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

2024-09-11 Thread Skyler Grey (via logerrit)
 sc/source/ui/view/tabvwshf.cxx |  100 +
 vcl/jsdialog/enabled.cxx   |1 
 2 files changed, 64 insertions(+), 37 deletions(-)

New commits:
commit 5044236b08e5390ba5a154966391e9a32441c6e7
Author: Skyler Grey 
AuthorDate: Wed Aug 14 09:50:28 2024 +
Commit: Caolán McNamara 
CommitDate: Wed Sep 11 14:56:30 2024 +0200

feat: Make move/copy sheet an async jsdialog

Generally pretty standard ... I asynced this one specifically because I
wanted to be able to put it into the mobile wizard as part of
https://github.com/CollaboraOnline/online/issues/9787

I used 'mutable' for the callback here, as we modify some variables
(e.g. bDoIt) inside the callback, and I preferred to do so rather than
either shadow the variables or have separately-named things inside the
callback.

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

diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx
index b5355e2d1c28..c8fed32c9dd3 100644
--- a/sc/source/ui/view/tabvwshf.cxx
+++ b/sc/source/ui/view/tabvwshf.cxx
@@ -633,6 +633,16 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
 if ( bDoIt && nTab >= nTableCount ) // if 
necessary append
 nTab = SC_TAB_APPEND;
 }
+
+if( bDoIt )
+{
+rReq.Done();// record, while doc is active
+if (bFromContextMenu)
+MoveTable(nDoc, nTab, bCpy, &aTabName, true,
+nContextMenuTab);
+else
+MoveTable( nDoc, nTab, bCpy, &aTabName );
+}
 }
 else
 {
@@ -641,7 +651,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
 
 ScAbstractDialogFactory* pFact = 
ScAbstractDialogFactory::Create();
 
-ScopedVclPtr 
pDlg(pFact->CreateScMoveTableDlg(GetFrameWeld(),
+VclPtr 
pDlg(pFact->CreateScMoveTableDlg(GetFrameWeld(),
 aDefaultName));
 
 SCTAB nTableCount = rDoc.GetTableCount();
@@ -657,51 +667,67 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
 // is selected.
 pDlg->EnableRenameTable(nTabSelCount == 1);
 
-if ( pDlg->Execute() == RET_OK )
-{
-nDoc = pDlg->GetSelectedDocument();
-nTab = pDlg->GetSelectedTable();
-bCpy = pDlg->GetCopyTable();
-bool bRna = pDlg->GetRenameTable();
-// Leave aTabName string empty, when Rename is FALSE.
-if( bRna )
-{
-   pDlg->GetTabNameString( aTabName );
-}
-bDoIt = true;
+std::shared_ptr pReq = 
std::make_shared(rReq);
 
-OUString aFoundDocName;
-if ( nDoc != SC_DOC_NEW )
+pDlg->StartExecuteAsync([
+this,
+bFromContextMenu,
+nContextMenuTab,
+pDlg,
+pReq
+](sal_Int32 nResult) {
+if ( nResult == RET_OK )
 {
-ScDocShell* pSh = ScDocShell::GetShellByNum( nDoc 
);
-if (pSh)
+sal_uInt16 nDoc = pDlg->GetSelectedDocument();
+SCTAB nSelectedTab = pDlg->GetSelectedTable();
+bool bCopy = pDlg->GetCopyTable();
+bool bRna = pDlg->GetRenameTable();
+OUString aNewTabName;
+
+// Leave aNewTabName string empty, when Rename is 
FALSE.
+if( bRna )
+{
+pDlg->GetTabNameString(aNewTabName);
+}
+bool bDoItAsync = true;
+
+OUString aFoundDocName;
+if ( nDoc != SC_DOC_NEW )
 {
-aFoundDocName = pSh->GetTitle();
-if ( !pSh->GetDocument().IsDocEditable() )
+ScDocShell* pSh = ScDocShell::GetShellByNum( 
nDoc );
+if (pSh)
 {
-ErrorM

core.git: sfx2/source svtools/source

2024-08-28 Thread Skyler Grey (via logerrit)
 sfx2/source/appl/appserv.cxx   |1 
 svtools/source/config/colorcfg.cxx |   51 ++---
 2 files changed, 42 insertions(+), 10 deletions(-)

New commits:
commit 4e04e96334a841865914c1629202912e343c4cb2
Author: Skyler Grey 
AuthorDate: Tue Jul 30 10:17:31 2024 +
Commit: Miklos Vajna 
CommitDate: Wed Aug 28 09:41:18 2024 +0200

fix(invert): Avoid spurious LOK invalidations

Using the same mechanism as with theme changes, we can avoid LOK getting
invalidations if we have an invert-background change that doesn't apply.

The trouble is that this method of inverting the background causes *lots
of* properties to change, so there's no single "If we inverted the
background" to check...

To get there, I've checked if all of the following are true
- We didn't change the color scheme
- We didn't have any new colors after this change
- All of the properties we were changing should have been within this
  color scheme

While they don't necessarily mean "there was a background inversion",
they do mean "something changed in your theme but no action is needed
from you" - which should only be a background inversion - and if we
added anything else that could fit in that category, it should also
avoid LOK invalidations

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

diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index 603b1b90648f..5d94b1d5786f 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -754,7 +754,6 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
 }
 
 svtools::ColorConfigValue aValue;
-aValue.bIsVisible = true;
 
 if(aNewTheme == "Dark")
 aValue.nColor = aDefDarkColor;
diff --git a/svtools/source/config/colorcfg.cxx 
b/svtools/source/config/colorcfg.cxx
index 46b796e5e226..699dfde0f3aa 100644
--- a/svtools/source/config/colorcfg.cxx
+++ b/svtools/source/config/colorcfg.cxx
@@ -255,25 +255,58 @@ void ColorConfig_Impl::Load(const OUString& rScheme)
 
 void ColorConfig_Impl::Notify(const uno::Sequence& rProperties)
 {
-const bool bOnlyChangingCurrentColorScheme = rProperties.getLength() == 1 
&& rProperties[0] == "CurrentColorScheme";
 const OUString sOldLoadedScheme = m_sLoadedScheme;
 
-//loading via notification always uses the default setting
+ColorConfigValue aOldConfigValues[ColorConfigEntryCount];
+std::copy( m_aConfigValues, m_aConfigValues + ColorConfigEntryCount, 
aOldConfigValues );
+
+// loading via notification always uses the default setting
 Load(OUString());
 
+const bool bNoColorSchemeChange = sOldLoadedScheme == m_sLoadedScheme;
+
 // If the name of the scheme hasn't changed, then there is no change to the
 // global color scheme name, but Kit deliberately only changed the then
 // current document when it last changed, so there are typically a mixture
 // of documents with the original 'light' color scheme and the last changed
 // color scheme 'dark'. Kit then tries to set the color scheme again to the
 // last changed color scheme 'dark' to try and update a 'light' document
-// that had opted out of the last change to 'dark'. So tag such an apparent
-// null change attempt with 'OnlyCurrentDocumentColorScheme' to allow it to
-// go through, but identify what that change is for, so the other color
-// config listeners for whom it doesn't matter, can ignore it as an
-// optimization.
-const bool bOnlyCurrentDocumentColorScheme = 
bOnlyChangingCurrentColorScheme && sOldLoadedScheme == m_sLoadedScheme &&
- 
comphelper::LibreOfficeKit::isActive();
+// that had opted out of the last change to 'dark'...
+const bool bEmptyColorSchemeNotify =
+rProperties.getLength() == 1
+&& rProperties[0] == "CurrentColorScheme"
+&& bNoColorSchemeChange;
+
+// ...We can get into a similar situation with inverted backgrounds, for
+// similar reasons, so even if we are only changing the current color 
scheme
+// we need to make sure that something actually changed...
+bool bNoConfigChange = true;
+for (int i = 0; i < ColorConfigEntryCount; ++i) {
+if (aOldConfigValues[i] != m_aConfigValues[i]) {
+bNoConfigChange = false;
+break;
+}
+}
+
+// ...and if something from a different color scheme changes, our config
+// values wouldn't change anyway, so we need to make sure that if something
+// changed it was this color scheme...
+const OUString sCurrentSchemePropertyPrefix = 
"ColorSchemes/org.openoffice.Office.UI:ColorScheme['" + m_sLoadedScheme + "']/";
+bool bOnlyCurrentSchemeChanges = true;
+for (in

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

2024-08-16 Thread Skyler Grey (via logerrit)
 sc/source/ui/unoobj/docuno.cxx|   11 +++
 sd/source/ui/unoidl/unomodel.cxx  |   11 +++
 sw/source/uibase/uno/unotxdoc.cxx |   11 +++
 3 files changed, 33 insertions(+)

New commits:
commit 8d9a96fca21118da6676f56b4abd48594fc1956e
Author: Skyler Grey 
AuthorDate: Mon Jul 29 09:52:18 2024 +
Commit: Miklos Vajna 
CommitDate: Fri Aug 16 21:56:41 2024 +0200

feat(invert): Allow inverted background on init

Previously for Online there was no way to save the background invert
state and reload it. Worse, when someone changed the state it would
become the default for new document loads.

This patch allows Online to specify whether it wants the background to
be inverted, which should allow smooth tab refreshes while also avoiding
mingling state from different people.

There is a change to online to support this here:
https://github.com/CollaboraOnline/online/pull/9652

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

diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 8fdbec2ba040..dce8f566f733 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1317,6 +1317,7 @@ void ScModelObj::initializeForTiledRendering(const 
css::uno::SequenceSetAppOptions(aAppOptions);
 
 OUString sThemeName;
+OUString sBackgroundThemeName;
 
 for (const beans::PropertyValue& rValue : rArguments)
 {
@@ -1328,6 +1329,8 @@ void ScModelObj::initializeForTiledRendering(const 
css::uno::Sequence())
 sThemeName = rValue.Value.get();
+else if (rValue.Name == ".uno:InvertBackground" && 
rValue.Value.has())
+sBackgroundThemeName = rValue.Value.get();
 }
 
 // show us the text exactly
@@ -1354,6 +1357,14 @@ void ScModelObj::initializeForTiledRendering(const 
css::uno::Sequence 
aPropertyValues(comphelper::InitPropertySequence(
+{
+{ "NewTheme", uno::Any(sBackgroundThemeName) }
+}));
+comphelper::dispatchCommand(".uno:InvertBackground", aPropertyValues);
+}
 }
 
 uno::Any SAL_CALL ScModelObj::queryInterface( const uno::Type& rType )
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index f8f9359d7988..247c4810b9e8 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2730,6 +2730,7 @@ void 
SdXImpressDocument::initializeForTiledRendering(const css::uno::SequenceSetOnlineSpell(rValue.Value.get());
 else if (rValue.Name == ".uno:ChangeTheme" && 
rValue.Value.has())
 sThemeName = rValue.Value.get();
+else if (rValue.Name == ".uno:InvertBackground" && 
rValue.Value.has())
+sBackgroundThemeName = rValue.Value.get();
 }
 
 // Disable comments if requested
@@ -2795,6 +2798,14 @@ void 
SdXImpressDocument::initializeForTiledRendering(const css::uno::Sequence 
aPropertyValues(comphelper::InitPropertySequence(
+{
+{ "NewTheme", uno::Any(sBackgroundThemeName) }
+}));
+comphelper::dispatchCommand(".uno:InvertBackground", aPropertyValues);
+}
 }
 
 void SdXImpressDocument::postKeyEvent(int nType, int nCharCode, int nKeyCode)
diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index e963b890bbfd..6262416a480f 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3763,6 +3763,7 @@ void SwXTextDocument::initializeForTiledRendering(const 
css::uno::SequenceGetRedlineAuthor(SW_MOD()->GetRedlineAuthor());
 OUString sAuthor;
 
@@ -3786,6 +3787,8 @@ void SwXTextDocument::initializeForTiledRendering(const 
css::uno::Sequence());
 else if (rValue.Name == ".uno:ChangeTheme" && 
rValue.Value.has())
 sThemeName = rValue.Value.get();
+else if (rValue.Name == ".uno:InvertBackground" && 
rValue.Value.has())
+sBackgroundThemeName = rValue.Value.get();
 }
 
 if (!sAuthor.isEmpty() && sAuthor != sOrigAuthor)
@@ -3844,6 +3847,14 @@ void SwXTextDocument::initializeForTiledRendering(const 
css::uno::Sequence 
aPropertyValues(comphelper::InitPropertySequence(
+{
+{ "NewTheme", uno::Any(sBackgroundThemeName) }
+}));
+comphelper::dispatchCommand(".uno:InvertBackground", aPropertyValues);
+}
 }
 
 void SwXTextDocument::postKeyEvent(int nType, int nCharCode, int nKeyCode)


core.git: sw/qa

2024-08-16 Thread Skyler Grey (via logerrit)
 sw/qa/extras/tiledrendering/tiledrendering.cxx |  100 +
 1 file changed, 100 insertions(+)

New commits:
commit 3a597235ea95621d386bf85d747f763bda275837
Author: Skyler Grey 
AuthorDate: Thu Jul 25 12:34:34 2024 +
Commit: Miklos Vajna 
CommitDate: Fri Aug 16 15:14:56 2024 +0200

test(invert): ensure background-invert separation

I0aed702185e642f631854b1f8234355c9e69ff6e made inverted backgrounds
separated by view. This change adds a test to make sure that it really
works, based on the work in I05486860c5f562c3cfa59b4a7fc492d48913a181 to
allow a specific theme to be stated on a per-view basis

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

diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx 
b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index cba5c265c864..6c0ddb77be62 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -1860,6 +1860,106 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testThemeViewSeparation)
 CPPUNIT_ASSERT_EQUAL(COL_WHITE, getTilePixelColor(pXTextDocument, 255, 
255));
 }
 
+// Test that changing the theme in one view doesn't change it in the other view
+CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testInvertBackgroundViewSeparation)
+{
+Color aDarkColor(0x1c, 0x1c, 0x1c);
+addDarkLightThemes(aDarkColor, COL_WHITE);
+SwXTextDocument* pXTextDocument = createDoc();
+int nFirstViewId = SfxLokHelper::getView();
+ViewCallback aView1;
+// Set view to dark scheme
+{
+SwDoc* pDoc = pXTextDocument->GetDocShell()->GetDoc();
+SwView* pView = pDoc->GetDocShell()->GetView();
+uno::Reference xFrame = 
pView->GetViewFrame().GetFrame().GetFrameInterface();
+uno::Sequence aPropertyValues = 
comphelper::InitPropertySequence(
+{
+{ "NewTheme", uno::Any(OUString("Dark")) },
+}
+);
+comphelper::dispatchCommand(".uno:ChangeTheme", xFrame, 
aPropertyValues);
+}
+// First view is in dark scheme
+CPPUNIT_ASSERT_EQUAL(aDarkColor, getTilePixelColor(pXTextDocument, 255, 
255));
+// Create second view
+SfxLokHelper::createView();
+int nSecondViewId = SfxLokHelper::getView();
+ViewCallback aView2;
+// Set second view to dark scheme
+{
+SwDoc* pDoc = pXTextDocument->GetDocShell()->GetDoc();
+SwView* pView = pDoc->GetDocShell()->GetView();
+uno::Reference xFrame = 
pView->GetViewFrame().GetFrame().GetFrameInterface();
+uno::Sequence aPropertyValues = 
comphelper::InitPropertySequence(
+{
+{ "NewTheme", uno::Any(OUString("Dark")) },
+}
+);
+comphelper::dispatchCommand(".uno:ChangeTheme", xFrame, 
aPropertyValues);
+}
+CPPUNIT_ASSERT_EQUAL(aDarkColor, getTilePixelColor(pXTextDocument, 255, 
255));
+
+// Set view 1 to invert document background
+SfxLokHelper::setView(nFirstViewId);
+{
+SwDoc* pDoc = pXTextDocument->GetDocShell()->GetDoc();
+SwView* pView = pDoc->GetDocShell()->GetView();
+uno::Reference xFrame = 
pView->GetViewFrame().GetFrame().GetFrameInterface();
+uno::Sequence aPropertyValues = 
comphelper::InitPropertySequence(
+{
+{ "NewTheme", uno::Any(OUString("Light")) },
+}
+);
+comphelper::dispatchCommand(".uno:InvertBackground", xFrame, 
aPropertyValues);
+}
+// First view has inverted background
+CPPUNIT_ASSERT_EQUAL(COL_WHITE, getTilePixelColor(pXTextDocument, 255, 
255));
+
+SfxLokHelper::setView(nSecondViewId);
+// Second view still has regular background
+CPPUNIT_ASSERT_EQUAL(aDarkColor, getTilePixelColor(pXTextDocument, 255, 
255));
+
+// Set view 2 to invert document background
+{
+SwDoc* pDoc = pXTextDocument->GetDocShell()->GetDoc();
+SwView* pView = pDoc->GetDocShell()->GetView();
+uno::Reference xFrame = 
pView->GetViewFrame().GetFrame().GetFrameInterface();
+uno::Sequence aPropertyValues = 
comphelper::InitPropertySequence(
+{
+{ "NewTheme", uno::Any(OUString("Light")) },
+}
+);
+comphelper::dispatchCommand(".uno:InvertBackground", xFrame, 
aPropertyValues);
+}
+// Second view has inverted background
+CPPUNIT_ASSERT_EQUAL(COL_WHITE, getTilePixelColor(pXTextDocument, 255, 
255));
+
+SfxLokHelper::setView(nFirstViewId);
+// First view still has inverted background
+CPPUNIT_ASSERT_EQUAL(COL_WHITE, getTilePixelColor(pXTextDocument, 255, 
255));
+
+SfxLokHelper::setView(nSecondViewId);
+// Set view 2 to regular document background
+{
+SwDoc* pDoc = pXTextDocument->GetDocShell()->GetDoc();
+SwView* pView = pDoc->GetDocShell()->GetV

core.git: sfx2/sdi sfx2/source

2024-08-15 Thread Skyler Grey (via logerrit)
 sfx2/sdi/sfx.sdi |2 +-
 sfx2/source/appl/appserv.cxx |   18 --
 2 files changed, 17 insertions(+), 3 deletions(-)

New commits:
commit 9f47fe2bfd791bdce28c0b9e7226d329a2b9537e
Author: Skyler Grey 
AuthorDate: Thu Jul 25 12:34:34 2024 +
Commit: Miklos Vajna 
CommitDate: Thu Aug 15 11:50:33 2024 +0200

feat(invert): Allow specifying a theme

In Online, we previously weren't able to specify what we wanted the
theme to be after an invert. This led to the theme being "whatever the
*last* person toggled it to" rather than "whatever isn't our current
theme"

This commit also lays the groundwork for loading the same invert theme
after a reload/rejoin/new doc in Online

There is a change to online to support this here:
https://github.com/CollaboraOnline/online/pull/9652

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

diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi
index 5aedc10c828f..6b45698d563b 100644
--- a/sfx2/sdi/sfx.sdi
+++ b/sfx2/sdi/sfx.sdi
@@ -5930,7 +5930,7 @@ SfxVoidItem ChangeTheme FN_CHANGE_THEME
 ]
 
 SfxVoidItem InvertBackground FN_INVERT_BACKGROUND
-()
+(SfxStringItem NewTheme FN_PARAM_NEW_THEME)
 [
 AutoUpdate = FALSE,
 FastCall = FALSE,
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index 23358e7f8cfe..603b1b90648f 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -734,15 +734,29 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
 }
 case FN_INVERT_BACKGROUND:
 {
+const SfxStringItem* pNewThemeArg = 
rReq.GetArg(FN_PARAM_NEW_THEME);
+
 svtools::EditableColorConfig aColorConfig;
-::Color aCurrentColor = 
aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor;
 ::Color aDefLightColor = 
svtools::ColorConfig::GetDefaultColor(svtools::DOCCOLOR, 0);
 ::Color aDefDarkColor = 
svtools::ColorConfig::GetDefaultColor(svtools::DOCCOLOR, 1);
 
+OUString aNewTheme;
+if (!pNewThemeArg) {
+::Color aCurrentColor = 
aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor;
+
+if (aCurrentColor == aDefLightColor) {
+aNewTheme = OUString("Dark");
+} else {
+aNewTheme = OUString("Light");
+}
+} else {
+aNewTheme = pNewThemeArg->GetValue();
+}
+
 svtools::ColorConfigValue aValue;
 aValue.bIsVisible = true;
 
-if(aCurrentColor == aDefLightColor)
+if(aNewTheme == "Dark")
 aValue.nColor = aDefDarkColor;
 else
 aValue.nColor = aDefLightColor;


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

2024-08-09 Thread Skyler Grey (via logerrit)
 sc/source/ui/unoobj/docuno.cxx|4 +++-
 sd/source/ui/unoidl/unomodel.cxx  |2 ++
 sw/source/uibase/uno/unotxdoc.cxx |3 +++
 3 files changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 71d98f04b94a34e8174942d594d2bbaa4f2c8455
Author: Skyler Grey 
AuthorDate: Thu Jul 25 12:34:34 2024 +
Commit: Miklos Vajna 
CommitDate: Fri Aug 9 13:34:22 2024 +0200

fix(invert): Use separate view IDs when inverted

Previously in Online the document background inversion was tied together
such that if someone inverted the background, everyone in dark theme
would end up with an inverted background.

By adding whether the document background is dark to the view render
state, we can create a new view when the background is inverted, and
avoid everyone getting an inverted view.

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

diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 24f9a5270361..15a8c4bfd223 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -506,13 +506,15 @@ void ScModelObj::RepaintRange( const ScRangeList& rRange )
 static OString getTabViewRenderState(ScTabViewShell& rTabViewShell)
 {
 OStringBuffer aState;
+const ScViewRenderingOptions& rViewRenderingOptions = 
rTabViewShell.GetViewRenderingData();
 
 if (rTabViewShell.IsAutoSpell())
 aState.append('S');
+if (rViewRenderingOptions.GetDocColor() == 
svtools::ColorConfig::GetDefaultColor(svtools::DOCCOLOR, 1))
+aState.append('D');
 
 aState.append(';');
 
-const ScViewRenderingOptions& rViewRenderingOptions = 
rTabViewShell.GetViewRenderingData();
 OString aThemeName = 
OUStringToOString(rViewRenderingOptions.GetColorSchemeName(), 
RTL_TEXTENCODING_UTF8);
 aState.append(aThemeName);
 
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index b05fc83a676d..f8f9359d7988 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2492,6 +2492,8 @@ OString 
SdXImpressDocument::getViewRenderState(SfxViewShell* pViewShell)
 const SdViewOptions& pVOpt = pView->GetViewOptions();
 if (mpDoc->GetOnlineSpell())
 aState.append('S');
+if (pVOpt.mnDocBackgroundColor == 
svtools::ColorConfig::GetDefaultColor(svtools::DOCCOLOR, 1))
+aState.append('D');
 aState.append(';');
 
 OString aThemeName = OUStringToOString(pVOpt.msColorSchemeName, 
RTL_TEXTENCODING_UTF8);
diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index 23d4d3974c79..f45ba9f073a2 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3545,6 +3545,9 @@ OString SwXTextDocument::getViewRenderState(SfxViewShell* 
pViewShell)
 aState.append('P');
 if (pVOpt->IsOnlineSpell())
 aState.append('S');
+if (pVOpt->GetDocColor() == 
svtools::ColorConfig::GetDefaultColor(svtools::DOCCOLOR, 1))
+aState.append('D');
+
 aState.append(';');
 
 OString aThemeName = OUStringToOString(pVOpt->GetThemeName(), 
RTL_TEXTENCODING_UTF8);


core.git: sw/qa

2024-08-07 Thread Skyler Grey (via logerrit)
 sw/qa/extras/tiledrendering/tiledrendering.cxx |   14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 784a1468354c3ed8a8bdee216771aa234ab38407
Author: Skyler Grey 
AuthorDate: Thu Jul 25 12:34:34 2024 +
Commit: Miklos Vajna 
CommitDate: Thu Aug 8 08:41:04 2024 +0200

test: Refactor pixel assertion

When a test fails, the line the assertion failed on is printed.
Unfortunately, in the case of this assertion, it was always inside the
same function.

If we instead change the function to only return the pixel color, and
perform the assertion inside the test, assertion failure error messages
are more helpful

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

diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx 
b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 163dd4751ace..e7e309f67e50 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -1769,12 +1769,12 @@ static Bitmap getTile(SwXTextDocument* pXTextDocument)
 }
 
 // Helper function to get a tile to a bitmap and check the pixel color
-static void assertTilePixelColor(SwXTextDocument* pXTextDocument, int nPixelX, 
int nPixelY, Color aColor)
+static Color getTilePixelColor(SwXTextDocument* pXTextDocument, int nPixelX, 
int nPixelY)
 {
 Bitmap aBitmap = getTile(pXTextDocument);
 BitmapScopedReadAccess pAccess(aBitmap);
 Color aActualColor(pAccess->GetPixel(nPixelX, nPixelY));
-CPPUNIT_ASSERT_EQUAL(aColor, aActualColor);
+return aActualColor;
 }
 
 static void addDarkLightThemes(const Color& rDarkColor, const Color& 
rLightColor)
@@ -1820,7 +1820,7 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testThemeViewSeparation)
 comphelper::dispatchCommand(u".uno:ChangeTheme"_ustr, xFrame, 
aPropertyValues);
 }
 // First view is in light scheme
-assertTilePixelColor(pXTextDocument, 255, 255, COL_WHITE);
+CPPUNIT_ASSERT_EQUAL(COL_WHITE, getTilePixelColor(pXTextDocument, 255, 
255));
 // Create second view
 SfxLokHelper::createView();
 int nSecondViewId = SfxLokHelper::getView();
@@ -1837,13 +1837,13 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testThemeViewSeparation)
 );
 comphelper::dispatchCommand(u".uno:ChangeTheme"_ustr, xFrame, 
aPropertyValues);
 }
-assertTilePixelColor(pXTextDocument, 255, 255, aDarkColor);
+CPPUNIT_ASSERT_EQUAL(aDarkColor, getTilePixelColor(pXTextDocument, 255, 
255));
 // First view still in light scheme
 SfxLokHelper::setView(nFirstViewId);
-assertTilePixelColor(pXTextDocument, 255, 255, COL_WHITE);
+CPPUNIT_ASSERT_EQUAL(COL_WHITE, getTilePixelColor(pXTextDocument, 255, 
255));
 // Second view still in dark scheme
 SfxLokHelper::setView(nSecondViewId);
-assertTilePixelColor(pXTextDocument, 255, 255, aDarkColor);
+CPPUNIT_ASSERT_EQUAL(aDarkColor, getTilePixelColor(pXTextDocument, 255, 
255));
 // Switch second view back to light scheme
 {
 SwDoc* pDoc = pXTextDocument->GetDocShell()->GetDoc();
@@ -1857,7 +1857,7 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testThemeViewSeparation)
 comphelper::dispatchCommand(u".uno:ChangeTheme"_ustr, xFrame, 
aPropertyValues);
 }
 // Now in light scheme
-assertTilePixelColor(pXTextDocument, 255, 255, COL_WHITE);
+CPPUNIT_ASSERT_EQUAL(COL_WHITE, getTilePixelColor(pXTextDocument, 255, 
255));
 }
 
 // Test that changing the theme sends the document background color as 
LOK_CALLBACK_DOCUMENT_BACKGROUND_COLOR


core.git: sw/source

2024-08-07 Thread Skyler Grey (via logerrit)
 sw/source/core/layout/paintfrm.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 3215fcdc58f0835857dedfc91573b9c891f3ae0a
Author: Skyler Grey 
AuthorDate: Mon Jul 29 08:00:47 2024 +
Commit: Miklos Vajna 
CommitDate: Wed Aug 7 13:10:05 2024 +0200

cool#9654 fix: Skip invalidation if it won't go through

On Android, we often hit this condition where we should get an
invalidation. Unfortunately, the invalidation is skipped due to being in
LOK Tiled Painting, leaving us to deal with whatever tile was rendered
on this go-around...

...Also because of this condition, the tile rendered here is broken.
pFrame->PaintSwFrame is never called, leading to a tile which renders
without things like its text. Normally, this wouldn't be a problem as
it's about to get invalidated, and is more of a nice performance
optimization...

...However given we don't invalidate it, we really see that tile without
any text. Similar workarounds were considered (such as skipping the
condition in another case that appears to be true on Android or
rendering the tile anyway, even if we're about to invalidate it) but
this seems to be the safest bet to avoid something like this happening
on other platforms...

...The true solution is still elusive. It probably includes figuring out
why this happens on Android without happening on other platforms, and
fixing that, as well as perhaps figuring out what to do about this
condition if we *do* genuinely trigger it on Android - as the previous
solution of invalidating everything nearby won't work

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

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index a9b8c1db17ff..f8c657d16784 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -3787,6 +3787,7 @@ void SwLayoutFrame::PaintSwFrame(vcl::RenderContext& 
rRenderContext, SwRect cons
 if ( rRect.Overlaps( aPaintRect ) )
 {
 if ( bCnt && pFrame->IsCompletePaint() &&
+ !(comphelper::LibreOfficeKit::isActive() && 
comphelper::LibreOfficeKit::isTiledPainting()) &&
  !rRect.Contains( aPaintRect ) && Application::AnyInput( 
VclInputFlags::KEYBOARD ) )
 {
 //fix(8104): It may happen, that the processing wasn't complete


core.git: sw/qa

2024-08-02 Thread Skyler Grey (via logerrit)
 sw/qa/extras/tiledrendering/tiledrendering.cxx |   39 +
 1 file changed, 39 insertions(+)

New commits:
commit 07dec064c2a05d13812cd85c1047743468843f7f
Author: Skyler Grey 
AuthorDate: Wed Jun 26 10:13:36 2024 +
Commit: Miklos Vajna 
CommitDate: Fri Aug 2 16:07:07 2024 +0200

test: send document bg color on new theme

In I27c8409a6fcb771d741b07d77c5598c87e178f3b we fixed this feature,
here's a test to make sure we're doing the right thing

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

diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx 
b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index d43170885c57..163dd4751ace 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -769,6 +769,7 @@ namespace {
 bool m_bGraphicViewSelection;
 bool m_bGraphicSelection;
 bool m_bViewLock;
+OString m_aDocColor;
 /// Set if any callback was invoked.
 bool m_bCalled;
 /// Redline table size changed payload
@@ -940,6 +941,11 @@ namespace {
 m_aComment = m_aComment.get_child("comment");
 }
 break;
+case LOK_CALLBACK_DOCUMENT_BACKGROUND_COLOR:
+{
+m_aDocColor = aPayload;
+break;
+}
 }
 }
 };
@@ -1854,6 +1860,39 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testThemeViewSeparation)
 assertTilePixelColor(pXTextDocument, 255, 255, COL_WHITE);
 }
 
+// Test that changing the theme sends the document background color as 
LOK_CALLBACK_DOCUMENT_BACKGROUND_COLOR
+CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testThemeChangeBackgroundCallback)
+{
+Color aDarkColor(0x1c, 0x1c, 0x1c);
+addDarkLightThemes(aDarkColor, COL_WHITE);
+SwXTextDocument* pXTextDocument = createDoc();
+ViewCallback aView;
+
+SwDoc* pDoc = pXTextDocument->GetDocShell()->GetDoc();
+SwView* pView = pDoc->GetDocShell()->GetView();
+uno::Reference xFrame = 
pView->GetViewFrame().GetFrame().GetFrameInterface();
+
+{
+uno::Sequence aPropertyValues = 
comphelper::InitPropertySequence(
+{
+{ "NewTheme", uno::Any(OUString("Dark")) },
+}
+);
+comphelper::dispatchCommand(".uno:ChangeTheme", xFrame, 
aPropertyValues);
+}
+CPPUNIT_ASSERT_EQUAL("1c1c1c"_ostr, aView.m_aDocColor);
+
+{
+uno::Sequence aPropertyValues = 
comphelper::InitPropertySequence(
+{
+{ "NewTheme", uno::Any(OUString("Light")) },
+}
+);
+comphelper::dispatchCommand(".uno:ChangeTheme", xFrame, 
aPropertyValues);
+}
+CPPUNIT_ASSERT_EQUAL("ff"_ostr, aView.m_aDocColor);
+}
+
 CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testSetViewGraphicSelection)
 {
 // Load a document.


core.git: sw/source

2024-08-01 Thread Skyler Grey (via logerrit)
 sw/source/uibase/app/apphdl.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 5292d8d52c2fd1f2556d0691738961f2e3ddda46
Author: Skyler Grey 
AuthorDate: Wed Jun 26 08:53:46 2024 +
Commit: Miklos Vajna 
CommitDate: Thu Aug 1 16:19:43 2024 +0200

fix(writer): send document bg color on new theme

In Ic025e542417da004c1c4a2bfd58a858deb4caa58, we intended to start
sending the document background color to kit after a configuration
change, which is useful when we change the document theme.

Unfortunately, we mistakenly sent the *application* background color
instead, which is normally darker/lighter than the document background
color, causing color flashes if you tried to use the document color as a
background before tiles were sent

Change-Id: I27c8409a6fcb771d741b07d77c5598c87e178f3b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171373
Tested-by: Jenkins
Reviewed-by: Skyler Grey 

diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index 9e5ada1b0101..35504f1c8f33 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -995,7 +995,7 @@ void 
SwModule::ConfigurationChanged(utl::ConfigurationBroadcaster* pBrdCst, Conf
 
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_APPLICATION_BACKGROUND_COLOR,
 
aViewColors.m_aAppBackgroundColor.AsRGBHexString().toUtf8());
 
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_BACKGROUND_COLOR,
-
aViewColors.m_aAppBackgroundColor.AsRGBHexString().toUtf8());
+aViewColors.m_aDocColor.AsRGBHexString().toUtf8());
 }
 
 // if nothing changed, and the hint was 
OnlyCurrentDocumentColorScheme we can skip invalidate


core.git: Branch 'distro/collabora/co-24.04' - 2 commits - sc/source sd/source sfx2/source svtools/source sw/source

2024-08-01 Thread Skyler Grey (via logerrit)
 sc/source/ui/unoobj/docuno.cxx |   11 +++
 sd/source/ui/unoidl/unomodel.cxx   |   11 +++
 sfx2/source/appl/appserv.cxx   |1 
 svtools/source/config/colorcfg.cxx |   51 ++---
 sw/source/uibase/uno/unotxdoc.cxx  |   11 +++
 5 files changed, 75 insertions(+), 10 deletions(-)

New commits:
commit f805a645b9d358938b73f0522dfcdfe8cc6036d1
Author: Skyler Grey 
AuthorDate: Tue Jul 30 10:17:31 2024 +
Commit: Skyler Grey 
CommitDate: Thu Aug 1 09:21:33 2024 +0200

fix(invert): Avoid spurious LOK invalidations

Using the same mechanism as with theme changes, we can avoid LOK getting
invalidations if we have an invert-background change that doesn't apply.

The trouble is that this method of inverting the background causes *lots
of* properties to change, so there's no single "If we inverted the
background" to check...

To get there, I've checked if all of the following are true
- We didn't change the color scheme
- We didn't have any new colors after this change
- All of the properties we were changing should have been within this
  color scheme

While they don't necessarily mean "there was a background inversion",
they do mean "something changed in your theme but no action is needed
from you" - which should only be a background inversion - and if we
added anything else that could fit in that category, it should also
avoid LOK invalidations

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

diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index 0db9fe31be24..f53570f78a8c 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -676,7 +676,6 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
 }
 
 svtools::ColorConfigValue aValue;
-aValue.bIsVisible = true;
 
 if(aNewTheme == "Dark")
 aValue.nColor = aDefDarkColor;
diff --git a/svtools/source/config/colorcfg.cxx 
b/svtools/source/config/colorcfg.cxx
index a2f8aeddf96d..3e7e84a273fd 100644
--- a/svtools/source/config/colorcfg.cxx
+++ b/svtools/source/config/colorcfg.cxx
@@ -244,25 +244,58 @@ void ColorConfig_Impl::Load(const OUString& rScheme)
 
 void ColorConfig_Impl::Notify(const uno::Sequence& rProperties)
 {
-const bool bOnlyChangingCurrentColorScheme = rProperties.getLength() == 1 
&& rProperties[0] == "CurrentColorScheme";
 const OUString sOldLoadedScheme = m_sLoadedScheme;
 
-//loading via notification always uses the default setting
+ColorConfigValue aOldConfigValues[ColorConfigEntryCount];
+std::copy( m_aConfigValues, m_aConfigValues + ColorConfigEntryCount, 
aOldConfigValues );
+
+// loading via notification always uses the default setting
 Load(OUString());
 
+const bool bNoColorSchemeChange = sOldLoadedScheme == m_sLoadedScheme;
+
 // If the name of the scheme hasn't changed, then there is no change to the
 // global color scheme name, but Kit deliberately only changed the then
 // current document when it last changed, so there are typically a mixture
 // of documents with the original 'light' color scheme and the last changed
 // color scheme 'dark'. Kit then tries to set the color scheme again to the
 // last changed color scheme 'dark' to try and update a 'light' document
-// that had opted out of the last change to 'dark'. So tag such an apparent
-// null change attempt with 'OnlyCurrentDocumentColorScheme' to allow it to
-// go through, but identify what that change is for, so the other color
-// config listeners for whom it doesn't matter, can ignore it as an
-// optimization.
-const bool bOnlyCurrentDocumentColorScheme = 
bOnlyChangingCurrentColorScheme && sOldLoadedScheme == m_sLoadedScheme &&
- 
comphelper::LibreOfficeKit::isActive();
+// that had opted out of the last change to 'dark'...
+const bool bEmptyColorSchemeNotify =
+rProperties.getLength() == 1
+&& rProperties[0] == "CurrentColorScheme"
+&& bNoColorSchemeChange;
+
+// ...We can get into a similar situation with inverted backgrounds, for
+// similar reasons, so even if we are only changing the current color 
scheme
+// we need to make sure that something actually changed...
+bool bNoConfigChange = true;
+for (int i = 0; i < ColorConfigEntryCount; ++i) {
+if (aOldConfigValues[i] != m_aConfigValues[i]) {
+bNoConfigChange = false;
+break;
+}
+}
+
+// ...and if something from a different color scheme changes, our config
+// values wouldn't change anyway, so we need to make sure that if something
+// changed it was this color scheme...
+const OUStrin

core.git: Branch 'distro/collabora/co-24.04' - 3 commits - sc/source sd/source sfx2/sdi sfx2/source sw/qa sw/source

2024-08-01 Thread Skyler Grey (via logerrit)
 sc/source/ui/unoobj/docuno.cxx |4 -
 sd/source/ui/unoidl/unomodel.cxx   |2 
 sfx2/sdi/sfx.sdi   |2 
 sfx2/source/appl/appserv.cxx   |   18 
 sw/qa/extras/tiledrendering/tiledrendering.cxx |  100 +
 sw/source/uibase/uno/unotxdoc.cxx  |3 
 6 files changed, 125 insertions(+), 4 deletions(-)

New commits:
commit ee467e85efbdd7b18ccecc76894b9a7613bb44e9
Author: Skyler Grey 
AuthorDate: Thu Jul 25 12:34:34 2024 +
Commit: Skyler Grey 
CommitDate: Thu Aug 1 09:21:21 2024 +0200

test(invert): ensure background-invert separation

I0aed702185e642f631854b1f8234355c9e69ff6e made inverted backgrounds
separated by view. This change adds a test to make sure that it really
works, based on the work in I05486860c5f562c3cfa59b4a7fc492d48913a181 to
allow a specific theme to be stated on a per-view basis

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

diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx 
b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index a01622eae018..29489e7835f1 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -1885,6 +1885,106 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testThemeViewSeparation)
 CPPUNIT_ASSERT_EQUAL(COL_WHITE, getTilePixelColor(pXTextDocument, 255, 
255));
 }
 
+// Test that changing the theme in one view doesn't change it in the other view
+CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testInvertBackgroundViewSeparation)
+{
+Color aDarkColor(0x1c, 0x1c, 0x1c);
+addDarkLightThemes(aDarkColor, COL_WHITE);
+SwXTextDocument* pXTextDocument = createDoc();
+int nFirstViewId = SfxLokHelper::getView();
+ViewCallback aView1;
+// Set view to dark scheme
+{
+SwDoc* pDoc = pXTextDocument->GetDocShell()->GetDoc();
+SwView* pView = pDoc->GetDocShell()->GetView();
+uno::Reference xFrame = 
pView->GetViewFrame().GetFrame().GetFrameInterface();
+uno::Sequence aPropertyValues = 
comphelper::InitPropertySequence(
+{
+{ "NewTheme", uno::Any(OUString("Dark")) },
+}
+);
+comphelper::dispatchCommand(".uno:ChangeTheme", xFrame, 
aPropertyValues);
+}
+// First view is in dark scheme
+CPPUNIT_ASSERT_EQUAL(aDarkColor, getTilePixelColor(pXTextDocument, 255, 
255));
+// Create second view
+SfxLokHelper::createView();
+int nSecondViewId = SfxLokHelper::getView();
+ViewCallback aView2;
+// Set second view to dark scheme
+{
+SwDoc* pDoc = pXTextDocument->GetDocShell()->GetDoc();
+SwView* pView = pDoc->GetDocShell()->GetView();
+uno::Reference xFrame = 
pView->GetViewFrame().GetFrame().GetFrameInterface();
+uno::Sequence aPropertyValues = 
comphelper::InitPropertySequence(
+{
+{ "NewTheme", uno::Any(OUString("Dark")) },
+}
+);
+comphelper::dispatchCommand(".uno:ChangeTheme", xFrame, 
aPropertyValues);
+}
+CPPUNIT_ASSERT_EQUAL(aDarkColor, getTilePixelColor(pXTextDocument, 255, 
255));
+
+// Set view 1 to invert document background
+SfxLokHelper::setView(nFirstViewId);
+{
+SwDoc* pDoc = pXTextDocument->GetDocShell()->GetDoc();
+SwView* pView = pDoc->GetDocShell()->GetView();
+uno::Reference xFrame = 
pView->GetViewFrame().GetFrame().GetFrameInterface();
+uno::Sequence aPropertyValues = 
comphelper::InitPropertySequence(
+{
+{ "NewTheme", uno::Any(OUString("Light")) },
+}
+);
+comphelper::dispatchCommand(".uno:InvertBackground", xFrame, 
aPropertyValues);
+}
+// First view has inverted background
+CPPUNIT_ASSERT_EQUAL(COL_WHITE, getTilePixelColor(pXTextDocument, 255, 
255));
+
+SfxLokHelper::setView(nSecondViewId);
+// Second view still has regular background
+CPPUNIT_ASSERT_EQUAL(aDarkColor, getTilePixelColor(pXTextDocument, 255, 
255));
+
+// Set view 2 to invert document background
+{
+SwDoc* pDoc = pXTextDocument->GetDocShell()->GetDoc();
+SwView* pView = pDoc->GetDocShell()->GetView();
+uno::Reference xFrame = 
pView->GetViewFrame().GetFrame().GetFrameInterface();
+uno::Sequence aPropertyValues = 
comphelper::InitPropertySequence(
+{
+{ "NewTheme", uno::Any(OUString("Light")) },
+}
+);
+comphelper::dispatchCommand(".uno:InvertBackground", xFrame, 
aPropertyValues);
+}
+// Second view has inverted background
+CPPUNIT_ASSERT_EQUAL(COL_WHITE, getTilePixelColor(pXTextDocument, 255, 
255));
+
+SfxLokHelper::setView(nFirstViewId);
+// First view still has 

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

2024-07-31 Thread Skyler Grey (via logerrit)
 sw/qa/extras/tiledrendering/tiledrendering.cxx |   14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

New commits:
commit b96920054754bf14eb6acb5086dd517f0986e213
Author: Skyler Grey 
AuthorDate: Thu Jul 25 12:34:34 2024 +
Commit: Caolán McNamara 
CommitDate: Wed Jul 31 12:51:20 2024 +0200

test: Refactor pixel assertion

When a test fails, the line the assertion failed on is printed.
Unfortunately, in the case of this assertion, it was always inside the
same function.

If we instead change the function to only return the pixel color, and
perform the assertion inside the test, assertion failure error messages
are more helpful

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

diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx 
b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 471f4183388b..a01622eae018 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -1794,12 +1794,12 @@ static Bitmap getTile(SwXTextDocument* pXTextDocument)
 }
 
 // Helper function to get a tile to a bitmap and check the pixel color
-static void assertTilePixelColor(SwXTextDocument* pXTextDocument, int nPixelX, 
int nPixelY, Color aColor)
+static Color getTilePixelColor(SwXTextDocument* pXTextDocument, int nPixelX, 
int nPixelY)
 {
 Bitmap aBitmap = getTile(pXTextDocument);
 BitmapScopedReadAccess pAccess(aBitmap);
 Color aActualColor(pAccess->GetPixel(nPixelX, nPixelY));
-CPPUNIT_ASSERT_EQUAL(aColor, aActualColor);
+return aActualColor;
 }
 
 static void addDarkLightThemes(const Color& rDarkColor, const Color& 
rLightColor)
@@ -1845,7 +1845,7 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testThemeViewSeparation)
 comphelper::dispatchCommand(".uno:ChangeTheme", xFrame, 
aPropertyValues);
 }
 // First view is in light scheme
-assertTilePixelColor(pXTextDocument, 255, 255, COL_WHITE);
+CPPUNIT_ASSERT_EQUAL(COL_WHITE, getTilePixelColor(pXTextDocument, 255, 
255));
 // Create second view
 SfxLokHelper::createView();
 int nSecondViewId = SfxLokHelper::getView();
@@ -1862,13 +1862,13 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testThemeViewSeparation)
 );
 comphelper::dispatchCommand(".uno:ChangeTheme", xFrame, 
aPropertyValues);
 }
-assertTilePixelColor(pXTextDocument, 255, 255, aDarkColor);
+CPPUNIT_ASSERT_EQUAL(aDarkColor, getTilePixelColor(pXTextDocument, 255, 
255));
 // First view still in light scheme
 SfxLokHelper::setView(nFirstViewId);
-assertTilePixelColor(pXTextDocument, 255, 255, COL_WHITE);
+CPPUNIT_ASSERT_EQUAL(COL_WHITE, getTilePixelColor(pXTextDocument, 255, 
255));
 // Second view still in dark scheme
 SfxLokHelper::setView(nSecondViewId);
-assertTilePixelColor(pXTextDocument, 255, 255, aDarkColor);
+CPPUNIT_ASSERT_EQUAL(aDarkColor, getTilePixelColor(pXTextDocument, 255, 
255));
 // Switch second view back to light scheme
 {
 SwDoc* pDoc = pXTextDocument->GetDocShell()->GetDoc();
@@ -1882,7 +1882,7 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testThemeViewSeparation)
 comphelper::dispatchCommand(".uno:ChangeTheme", xFrame, 
aPropertyValues);
 }
 // Now in light scheme
-assertTilePixelColor(pXTextDocument, 255, 255, COL_WHITE);
+CPPUNIT_ASSERT_EQUAL(COL_WHITE, getTilePixelColor(pXTextDocument, 255, 
255));
 }
 
 // Test that changing the theme sends the document background color as 
LOK_CALLBACK_DOCUMENT_BACKGROUND_COLOR


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

2024-07-30 Thread Skyler Grey (via logerrit)
 sw/source/core/layout/paintfrm.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit facdda16ad14d321c5675874f838a3cd5f6cdd6f
Author: Skyler Grey 
AuthorDate: Mon Jul 29 08:00:47 2024 +
Commit: Skyler Grey 
CommitDate: Tue Jul 30 09:24:09 2024 +0200

fix: Skip invalidation if it won't go through

On Android, we often hit this condition where we should get an
invalidation. Unfortunately, the invalidation is skipped due to being in
LOK Tiled Painting, leaving us to deal with whatever tile was rendered
on this go-around...

...Also because of this condition, the tile rendered here is broken.
pFrame->PaintSwFrame is never called, leading to a tile which renders
without things like its text. Normally, this wouldn't be a problem as
it's about to get invalidated, and is more of a nice performance
optimization...

...However given we don't invalidate it, we really see that tile without
any text. Similar workarounds were considered (such as skipping the
condition in another case that appears to be true on Android or
rendering the tile anyway, even if we're about to invalidate it) but
this seems to be the safest bet to avoid something like this happening
on other platforms...

...The true solution is still elusive. It probably includes figuring out
why this happens on Android without happening on other platforms, and
fixing that, as well as perhaps figuring out what to do about this
condition if we *do* genuinely trigger it on Android - as the previous
solution of invalidating everything nearby won't work

Change-Id: Id58f5bae8ae357d116c5f2345e88ec3364cb2172
Fixes: https://github.com/CollaboraOnline/online/issues/9654
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170853
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index b96c378185c7..60edc56aafb5 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -3765,6 +3765,7 @@ void SwLayoutFrame::PaintSwFrame(vcl::RenderContext& 
rRenderContext, SwRect cons
 if ( rRect.Overlaps( aPaintRect ) )
 {
 if ( bCnt && pFrame->IsCompletePaint() &&
+ !(comphelper::LibreOfficeKit::isActive() && 
comphelper::LibreOfficeKit::isTiledPainting()) &&
  !rRect.Contains( aPaintRect ) && Application::AnyInput( 
VclInputFlags::KEYBOARD ) )
 {
 //fix(8104): It may happen, that the processing wasn't complete


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

2024-06-27 Thread Skyler Grey (via logerrit)
 sw/qa/extras/tiledrendering/tiledrendering.cxx |   39 +
 1 file changed, 39 insertions(+)

New commits:
commit a76ac5400e60d8b8019b598491e5e3900f7b2f56
Author: Skyler Grey 
AuthorDate: Wed Jun 26 10:13:36 2024 +
Commit: Miklos Vajna 
CommitDate: Thu Jun 27 15:14:47 2024 +0200

test: send document bg color on new theme

In I27c8409a6fcb771d741b07d77c5598c87e178f3b we fixed this feature,
here's a test to make sure we're doing the right thing

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

diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx 
b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index dddf4f9503b5..b8c46fe404b4 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -772,6 +772,7 @@ namespace {
 bool m_bGraphicViewSelection;
 bool m_bGraphicSelection;
 bool m_bViewLock;
+OString m_aDocColor;
 /// Set if any callback was invoked.
 bool m_bCalled;
 /// Redline table size changed payload
@@ -949,6 +950,11 @@ namespace {
 m_aStateChanges.push_back(pPayload);
 break;
 }
+case LOK_CALLBACK_DOCUMENT_BACKGROUND_COLOR:
+{
+m_aDocColor = aPayload;
+break;
+}
 }
 }
 };
@@ -1863,6 +1869,39 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testThemeViewSeparation)
 assertTilePixelColor(pXTextDocument, 255, 255, COL_WHITE);
 }
 
+// Test that changing the theme sends the document background color as 
LOK_CALLBACK_DOCUMENT_BACKGROUND_COLOR
+CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testThemeChangeBackgroundCallback)
+{
+Color aDarkColor(0x1c, 0x1c, 0x1c);
+addDarkLightThemes(aDarkColor, COL_WHITE);
+SwXTextDocument* pXTextDocument = createDoc();
+ViewCallback aView;
+
+SwDoc* pDoc = pXTextDocument->GetDocShell()->GetDoc();
+SwView* pView = pDoc->GetDocShell()->GetView();
+uno::Reference xFrame = 
pView->GetViewFrame().GetFrame().GetFrameInterface();
+
+{
+uno::Sequence aPropertyValues = 
comphelper::InitPropertySequence(
+{
+{ "NewTheme", uno::Any(OUString("Dark")) },
+}
+);
+comphelper::dispatchCommand(".uno:ChangeTheme", xFrame, 
aPropertyValues);
+}
+CPPUNIT_ASSERT_EQUAL("1c1c1c"_ostr, aView.m_aDocColor);
+
+{
+uno::Sequence aPropertyValues = 
comphelper::InitPropertySequence(
+{
+{ "NewTheme", uno::Any(OUString("Light")) },
+}
+);
+comphelper::dispatchCommand(".uno:ChangeTheme", xFrame, 
aPropertyValues);
+}
+CPPUNIT_ASSERT_EQUAL("ff"_ostr, aView.m_aDocColor);
+}
+
 CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testSetViewGraphicSelection)
 {
 // Load a document.


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

2024-06-26 Thread Skyler Grey (via logerrit)
 sw/source/uibase/app/apphdl.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 174dd0d8565b2e8e26bc1ea4ddfba4c4e343c0aa
Author: Skyler Grey 
AuthorDate: Wed Jun 26 08:53:46 2024 +
Commit: Szymon Kłos 
CommitDate: Wed Jun 26 19:02:53 2024 +0200

fix(writer): send document bg color on new theme

In Ic025e542417da004c1c4a2bfd58a858deb4caa58, we intended to start
sending the document background color to kit after a configuration
change, which is useful when we change the document theme.

Unfortunately, we mistakenly sent the *application* background color
instead, which is normally darker/lighter than the document background
color, causing color flashes if you tried to use the document color as a
background before tiles were sent

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

diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index bca9d20dbd59..253117c5bf9b 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -1000,7 +1000,7 @@ void 
SwModule::ConfigurationChanged(utl::ConfigurationBroadcaster* pBrdCst, Conf
 
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_APPLICATION_BACKGROUND_COLOR,
 
aViewColors.m_aAppBackgroundColor.AsRGBHexString().toUtf8());
 
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_BACKGROUND_COLOR,
-
aViewColors.m_aAppBackgroundColor.AsRGBHexString().toUtf8());
+aViewColors.m_aDocColor.AsRGBHexString().toUtf8());
 }
 
 // if nothing changed, and the hint was 
OnlyCurrentDocumentColorScheme we can skip invalidate


core.git: Branch 'libreoffice-24-2' - filter/source

2024-03-19 Thread Skyler Grey (via logerrit)
 filter/source/svg/presentation_engine.js |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit edacf30340058707e02c3348a255435f4f4481b3
Author: Skyler Grey 
AuthorDate: Mon Mar 11 14:38:53 2024 +
Commit: Skyler Grey 
CommitDate: Tue Mar 19 11:56:46 2024 +0100

exported SVGs: Stop bullets skipping animation

Previously, we used the incorrect format for bullet point IDs, leading
to them not being noticed by animation code, leading to them being
skipped during animation.

This meant that if you exported an SVG of an impress presentation, and
you had a bullet list animating to appear later, you would see the
bullets without the text from the start.

Change-Id: Ibce764c0843778dd09b108fb251ce606255afb90
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164661
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Gökay ŞATIR 
(cherry picked from commit 5ee89034692eb21f9a71c9a36cc205b09f24e856)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164871
Tested-by: Jenkins
(cherry picked from commit c3327640208fb5117ca88878afd7e716981372c7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164887
Reviewed-by: Skyler Grey 

diff --git a/filter/source/svg/presentation_engine.js 
b/filter/source/svg/presentation_engine.js
index 839bd1676ffd..fa42b89b2f8e 100644
--- a/filter/source/svg/presentation_engine.js
+++ b/filter/source/svg/presentation_engine.js
@@ -15110,7 +15110,7 @@ function AnimatedTextElement( aElement, 
aEventMultiplexer )
 if( aBulletPlaceholderElem )
 {
 var sId = aBulletPlaceholderElem.getAttribute( 'id' );
-sId = 'bullet-char(' + sId + ')';
+sId = 'bullet-char-' + sId;
 aBulletCharElem = theDocument.getElementById( sId );
 if( aBulletCharElem )
 {


core.git: filter/source

2024-03-15 Thread Skyler Grey (via logerrit)
 filter/source/svg/presentation_engine.js |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c3327640208fb5117ca88878afd7e716981372c7
Author: Skyler Grey 
AuthorDate: Mon Mar 11 14:38:53 2024 +
Commit: Skyler Grey 
CommitDate: Fri Mar 15 17:29:10 2024 +0100

exported SVGs: Stop bullets skipping animation

Previously, we used the incorrect format for bullet point IDs, leading
to them not being noticed by animation code, leading to them being
skipped during animation.

This meant that if you exported an SVG of an impress presentation, and
you had a bullet list animating to appear later, you would see the
bullets without the text from the start.

Change-Id: Ibce764c0843778dd09b108fb251ce606255afb90
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164661
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Gökay ŞATIR 
(cherry picked from commit 5ee89034692eb21f9a71c9a36cc205b09f24e856)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164871
Tested-by: Jenkins

diff --git a/filter/source/svg/presentation_engine.js 
b/filter/source/svg/presentation_engine.js
index 839bd1676ffd..fa42b89b2f8e 100644
--- a/filter/source/svg/presentation_engine.js
+++ b/filter/source/svg/presentation_engine.js
@@ -15110,7 +15110,7 @@ function AnimatedTextElement( aElement, 
aEventMultiplexer )
 if( aBulletPlaceholderElem )
 {
 var sId = aBulletPlaceholderElem.getAttribute( 'id' );
-sId = 'bullet-char(' + sId + ')';
+sId = 'bullet-char-' + sId;
 aBulletCharElem = theDocument.getElementById( sId );
 if( aBulletCharElem )
 {


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

2024-03-15 Thread Skyler Grey (via logerrit)
 filter/source/svg/presentation_engine.js |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 7fb108a29cff3ad157898350571aa068719761cc
Author: Skyler Grey 
AuthorDate: Mon Mar 11 14:38:53 2024 +
Commit: Skyler Grey 
CommitDate: Fri Mar 15 17:29:04 2024 +0100

exported SVGs: Stop bullets skipping animation

Previously, we used the incorrect format for bullet point IDs, leading
to them not being noticed by animation code, leading to them being
skipped during animation.

This meant that if you exported an SVG of an impress presentation, and
you had a bullet list animating to appear later, you would see the
bullets without the text from the start.

Change-Id: Ibce764c0843778dd09b108fb251ce606255afb90
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164661
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Gökay ŞATIR 
(cherry picked from commit f418738f9881ec183d02e9f3216d192951df52c1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164870

diff --git a/filter/source/svg/presentation_engine.js 
b/filter/source/svg/presentation_engine.js
index 2f653ea486f0..93753988b565 100644
--- a/filter/source/svg/presentation_engine.js
+++ b/filter/source/svg/presentation_engine.js
@@ -15110,7 +15110,7 @@ function AnimatedTextElement( aElement, 
aEventMultiplexer )
 if( aBulletPlaceholderElem )
 {
 var sId = aBulletPlaceholderElem.getAttribute( 'id' );
-sId = 'bullet-char(' + sId + ')';
+sId = 'bullet-char-' + sId;
 aBulletCharElem = theDocument.getElementById( sId );
 if( aBulletCharElem )
 {


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

2024-03-15 Thread Skyler Grey (via logerrit)
 filter/source/svg/presentation_engine.js |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 5ee89034692eb21f9a71c9a36cc205b09f24e856
Author: Skyler Grey 
AuthorDate: Mon Mar 11 14:38:53 2024 +
Commit: Skyler Grey 
CommitDate: Fri Mar 15 14:12:19 2024 +0100

exported SVGs: Stop bullets skipping animation

Previously, we used the incorrect format for bullet point IDs, leading
to them not being noticed by animation code, leading to them being
skipped during animation.

This meant that if you exported an SVG of an impress presentation, and
you had a bullet list animating to appear later, you would see the
bullets without the text from the start.

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

diff --git a/filter/source/svg/presentation_engine.js 
b/filter/source/svg/presentation_engine.js
index 839bd1676ffd..fa42b89b2f8e 100644
--- a/filter/source/svg/presentation_engine.js
+++ b/filter/source/svg/presentation_engine.js
@@ -15110,7 +15110,7 @@ function AnimatedTextElement( aElement, 
aEventMultiplexer )
 if( aBulletPlaceholderElem )
 {
 var sId = aBulletPlaceholderElem.getAttribute( 'id' );
-sId = 'bullet-char(' + sId + ')';
+sId = 'bullet-char-' + sId;
 aBulletCharElem = theDocument.getElementById( sId );
 if( aBulletCharElem )
 {


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

2023-12-18 Thread Skyler Grey (via logerrit)
 desktop/source/lib/init.cxx   |3 ++-
 sc/inc/inputopt.hxx   |3 +++
 sc/inc/sc.hrc |1 +
 sc/sdi/cellsh.sdi |2 ++
 sc/sdi/scalc.sdi  |   15 +++
 sc/source/ui/app/inputhdl.cxx |   14 ++
 sc/source/ui/inc/tabvwsh.hxx  |5 +
 sc/source/ui/view/cellsh3.cxx |   20 
 8 files changed, 62 insertions(+), 1 deletion(-)

New commits:
commit 284f2759dedbc2375abdbaab5258efda4a52b8f5
Author: Skyler Grey 
AuthorDate: Mon Dec 4 14:08:09 2023 +
Commit: Szymon Kłos 
CommitDate: Mon Dec 18 16:33:43 2023 +0100

calc: Add option to keep edit mode on enter/tab

This change makes it so that, rather than leaving edit mode, enter and
tab keep editing the new cell when they have moved. This is important on
devices with an onscreen keyboard (e.g. iPads, Android tablets,
Convertible Laptops, etc.), particularly in Collabora Online, as exiting
edit mode hides the onscreen keyboard.

It is not desirable to enable this by default, as arrow keys cannot move
around the document when we are in edit mode (they move within the
cell). Therefore, this commit also adds an .uno command so that we can
activate or deactivate the option.

In LibreOfficeKit we want to make sure not to share this setting among
different users, so we also add this option in the view shell and switch
which one we care about based on whether Kit is active.

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

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 13fcfad60f1f..8855e9a60ed2 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3852,7 +3852,8 @@ static void doc_iniUnoCommands ()
 OUString(".uno:InsertPlainTextContentControl"),
 OUString(".uno:InsertPictureContentControl"),
 OUString(".uno:DataFilterAutoFilter"),
-OUString(".uno:CellProtection")
+OUString(".uno:CellProtection"),
+OUString(".uno:MoveKeepInsertMode")
 };
 
 util::URL aCommandURL;
diff --git a/sc/inc/inputopt.hxx b/sc/inc/inputopt.hxx
index 05e59aad5716..aa4b4078e5df 100644
--- a/sc/inc/inputopt.hxx
+++ b/sc/inc/inputopt.hxx
@@ -26,6 +26,7 @@ class ScInputOptions
 private:
 sal_uInt16  nMoveDir;   // enum ScDirection
 boolbMoveSelection;
+boolbMoveKeepEdit;
 boolbEnterEdit;
 boolbExtendFormat;
 boolbRangeFinder;
@@ -47,6 +48,8 @@ public:
 boolGetMoveSelection() const{ return bMoveSelection; }
 voidSetEnterEdit(bool bSet) { bEnterEdit = bSet; }
 boolGetEnterEdit() const{ return bEnterEdit; }
+voidSetMoveKeepEdit(bool bSet)  { bMoveKeepEdit = bSet;  }
+boolGetMoveKeepEdit() const { return bMoveKeepEdit;  }
 voidSetExtendFormat(bool bSet)  { bExtendFormat = bSet;  }
 boolGetExtendFormat() const { return bExtendFormat;  }
 voidSetRangeFinder(bool bSet)   { bRangeFinder = bSet;   }
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index 7d8e02aeed0d..89fa9058070c 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -247,6 +247,7 @@ class SvxZoomSliderItem;
 
 #define SID_OPEN_CALC   (SC_FUNCTION_START + 4)
 #define SID_CONVERT_FORMULA_TO_VALUE(SC_FUNCTION_START + 5)
+#define FID_MOVE_KEEP_INSERT_MODE   (SC_FUNCTION_START + 6)
 #ifndef FILE_MENU_END // duplicated in sfx2/sfxsids.hrc
 #define FILE_MENU_END   (SC_FUNCTION_START + 20)
 #endif
diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi
index 84217c63c949..7370d142607e 100644
--- a/sc/sdi/cellsh.sdi
+++ b/sc/sdi/cellsh.sdi
@@ -446,6 +446,8 @@ interface CellMovement
 ]
 SID_DATA_SELECT [ ExecMethod = Execute; StateMethod = GetState; ]
 SID_DETECTIVE_FILLMODE  [ ExecMethod = Execute; StateMethod = GetState; ] 
// api:
+
+FID_MOVE_KEEP_INSERT_MODE [ ExecMethod = Execute; ]
 }
 
 
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index 614293cc90bb..c62c8c549d10 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -6667,3 +6667,18 @@ SfxVoidItem AutoSum SID_AUTO_SUM
 ToolBoxConfig = TRUE,
 GroupId = SfxGroupId::Intern;
 ]
+
+
+SfxVoidItem MoveKeepInsertMode FID_MOVE_KEEP_INSERT_MODE
+(SfxBoolItem Enable FID_MOVE_KEEP_INSERT_MODE)
+[
+AutoUpdate = FALSE,
+FastCall = FALSE,
+ReadOnlyDoc = FALSE,
+Toggle = FALSE,
+Container = FALSE,
+RecordAbsolute = FALSE,
+RecordPerSet;
+
+GroupId = SfxGroupId::Application;
+]
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 1153a7dc03d4..0f7a2afc858f 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/so

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

2023-11-09 Thread Skyler Grey (via logerrit)
 sw/source/filter/ww8/ww8atr.cxx |3 +++
 xmloff/source/text/txtfldi.cxx  |3 +++
 2 files changed, 6 insertions(+)

New commits:
commit 7471de2849e076304b6e59f4d78b83a272f46607
Author: Skyler Grey 
AuthorDate: Thu Nov 9 16:57:50 2023 +
Commit: Miklos Vajna 
CommitDate: Fri Nov 10 08:13:11 2023 +0100

Fix STYLEREF crashes and forwards-compatibility

This commit fixes a crash in STYLEREF caused by a dereferenced nullptr
when serializing chapter fields for .doc export. Along with the STYLEREF
changes, I also changed the chapter export logic to allow exporting
chapter fields when they were in document text, and to use the style of
the thing they pointed to. Unfortunately, in some cases that would be
null. This commit makes us fall back to previous behavior in those
cases.

This commit also adds import logic for styleref on the TEXT namespace in
addition to LO_EXT. This is important as if/when the STYLEREF field is
no longer LO_EXT we want to be able to open new documents in old
versions of libreoffice. This was erroneously missed when we changed
TEXT references to LO_EXT in our export logic.

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

diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 62ae243168ec..6e73e9255495 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -3430,6 +3430,9 @@ void AttributeOutputBase::TextField( const SwFormatField& 
rField )
 // Otherwise, get the style of the text and use it as the 
style name
 const SwTextNode* pOutlineNd = 
pTextNd->FindOutlineNodeOfLevel(aCopy.GetLevel());
 
+if (!pOutlineNd) break;
+// Sometimes we can't find the outline node, in that case 
let's just fallback to exporting the text
+
 sStr = FieldString(ww::eSTYLEREF)
  + 
GetExport().GetStyleRefName(pOutlineNd->GetFormatColl()->GetName());
 }
diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx
index 4b43240878af..07496cb74c05 100644
--- a/xmloff/source/text/txtfldi.cxx
+++ b/xmloff/source/text/txtfldi.cxx
@@ -408,6 +408,7 @@ XMLTextFieldImportContext::CreateTextFieldImportContext(
 case XML_ELEMENT(TEXT, XML_BOOKMARK_REF):
 case XML_ELEMENT(TEXT, XML_NOTE_REF):
 case XML_ELEMENT(TEXT, XML_SEQUENCE_REF):
+case XML_ELEMENT(TEXT, XML_STYLE_REF):
 case XML_ELEMENT(LO_EXT, XML_STYLE_REF):
 pContext = new XMLReferenceFieldImportContext( rImport, rHlp, 
nToken );
 break;
@@ -2512,6 +2513,7 @@ void XMLReferenceFieldImportContext::startFastElement(
 case XML_ELEMENT(TEXT, XML_SEQUENCE_REF):
 nSource = ReferenceFieldSource::SEQUENCE_FIELD;
 break;
+case XML_ELEMENT(TEXT, XML_STYLE_REF):
 case XML_ELEMENT(LO_EXT, XML_STYLE_REF):
 nSource = ReferenceFieldSource::STYLE;
 break;
@@ -2593,6 +2595,7 @@ void XMLReferenceFieldImportContext::PrepareField(
 {
 case XML_ELEMENT(TEXT, XML_REFERENCE_REF):
 case XML_ELEMENT(TEXT, XML_BOOKMARK_REF):
+case XML_ELEMENT(TEXT, XML_STYLE_REF):
 case XML_ELEMENT(LO_EXT, XML_STYLE_REF):
 xPropertySet->setPropertyValue("SourceName", Any(sName));
 xPropertySet->setPropertyValue("ReferenceFieldFlags", Any(nFlags));


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

2023-11-09 Thread Skyler Grey (via logerrit)
 sw/source/filter/ww8/ww8atr.cxx |3 +++
 xmloff/source/text/txtfldi.cxx  |3 +++
 2 files changed, 6 insertions(+)

New commits:
commit 7924d8fc274bb611c829443e0eb1a53d883cc9a3
Author: Skyler Grey 
AuthorDate: Thu Nov 9 16:57:50 2023 +
Commit: Miklos Vajna 
CommitDate: Fri Nov 10 08:12:28 2023 +0100

Fix STYLEREF crashes and forwards-compatibility

This commit fixes a crash in STYLEREF caused by a dereferenced nullptr
when serializing chapter fields for .doc export. Along with the STYLEREF
changes, I also changed the chapter export logic to allow exporting
chapter fields when they were in document text, and to use the style of
the thing they pointed to. Unfortunately, in some cases that would be
null. This commit makes us fall back to previous behavior in those
cases.

This commit also adds import logic for styleref on the TEXT namespace in
addition to LO_EXT. This is important as if/when the STYLEREF field is
no longer LO_EXT we want to be able to open new documents in old
versions of libreoffice. This was erroneously missed when we changed
TEXT references to LO_EXT in our export logic.

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

diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 79446939957e..4949c7ffe6fd 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -3456,6 +3456,9 @@ void AttributeOutputBase::TextField( const SwFormatField& 
rField )
 // Otherwise, get the style of the text and use it as the 
style name
 const SwTextNode* pOutlineNd = 
pTextNd->FindOutlineNodeOfLevel(aCopy.GetLevel());
 
+if (!pOutlineNd) break;
+// Sometimes we can't find the outline node, in that case 
let's just fallback to exporting the text
+
 sStr = FieldString(ww::eSTYLEREF)
  + 
GetExport().GetStyleRefName(pOutlineNd->GetFormatColl()->GetName());
 }
diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx
index e0f6a01ecca6..1228e232d328 100644
--- a/xmloff/source/text/txtfldi.cxx
+++ b/xmloff/source/text/txtfldi.cxx
@@ -408,6 +408,7 @@ XMLTextFieldImportContext::CreateTextFieldImportContext(
 case XML_ELEMENT(TEXT, XML_BOOKMARK_REF):
 case XML_ELEMENT(TEXT, XML_NOTE_REF):
 case XML_ELEMENT(TEXT, XML_SEQUENCE_REF):
+case XML_ELEMENT(TEXT, XML_STYLE_REF):
 case XML_ELEMENT(LO_EXT, XML_STYLE_REF):
 pContext = new XMLReferenceFieldImportContext( rImport, rHlp, 
nToken );
 break;
@@ -2512,6 +2513,7 @@ void XMLReferenceFieldImportContext::startFastElement(
 case XML_ELEMENT(TEXT, XML_SEQUENCE_REF):
 nSource = ReferenceFieldSource::SEQUENCE_FIELD;
 break;
+case XML_ELEMENT(TEXT, XML_STYLE_REF):
 case XML_ELEMENT(LO_EXT, XML_STYLE_REF):
 nSource = ReferenceFieldSource::STYLE;
 break;
@@ -2593,6 +2595,7 @@ void XMLReferenceFieldImportContext::PrepareField(
 {
 case XML_ELEMENT(TEXT, XML_REFERENCE_REF):
 case XML_ELEMENT(TEXT, XML_BOOKMARK_REF):
+case XML_ELEMENT(TEXT, XML_STYLE_REF):
 case XML_ELEMENT(LO_EXT, XML_STYLE_REF):
 xPropertySet->setPropertyValue("SourceName", Any(sName));
 xPropertySet->setPropertyValue("ReferenceFieldFlags", Any(nFlags));


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

2023-11-02 Thread Skyler Grey (via logerrit)
 sw/qa/core/fields/data/styleref-flags.docx |binary
 sw/qa/core/fields/data/styleref.odt|binary
 sw/qa/core/fields/data/suppress-non-numerical.docx |binary
 sw/qa/core/fields/fields.cxx   |  215 -
 4 files changed, 169 insertions(+), 46 deletions(-)

New commits:
commit fd5c75750f5c5448eec840033bce16375774a707
Author: Skyler Grey 
AuthorDate: Mon Oct 23 09:17:23 2023 +
Commit: Caolán McNamara 
CommitDate: Thu Nov 2 10:27:52 2023 +0100

Improve and extend STYLEREF tests

- I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19,
  Ib664fec059aa1f7f130acc76c253d5d298fa59f7 and
  Iad8e8001807f5ceeaedc9665838672695174a936 added STYLEREF flags. This
  commit adds tests for them
- The tests in I35dc36197b62fa53def4745da1d4755ece79ed22 were partly
  broken due to the fields occasionally being inserted in the wrong
  place (i.e. at the end of the document), this commit makes sure to
  move the cursor before inserting a field
- The tests in I35dc36197b62fa53def4745da1d4755ece79ed22 were not
  separated into sections which made it difficult to tell what was being
  tested. All STYLEREF tests that create documents are now clearly split
  into arrange/act/assert steps with comments denoting the sections
- The tests in I35dc36197b62fa53def4745da1d4755ece79ed22 had a lot of
  repetition, particularly in creating the document, adding headings,
  etc. This has been refactored into some helper functions
- I35dc36197b62fa53def4745da1d4755ece79ed22 was missing an ODF import
  test. This commit adds one

Follow-Up-To: I25dd7a6940abee5651a784b9059fe23b32547d6c
Follow-Up-To: I35dc36197b62fa53def4745da1d4755ece79ed22
Follow-Up-To: I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19
Follow-Up-To: Ib664fec059aa1f7f130acc76c253d5d298fa59f7
Follow-Up-To: Iad8e8001807f5ceeaedc9665838672695174a936
Follow-Up-To: Iecd3e83a6bd3f8c2c6adba5c7eba9ee55b773510
Follow-Up-To: Ifaa67fbc2d53b0d4fb85e7305b2dbdf78cf0a1ad
Follow-Up-To: Id991c92b9aeaa054b136f7a3d9c7c8ea0026e514
Change-Id: I941b477c8e860270a400869cb9ea15e5561e402a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158352
Tested-by: Jenkins
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/sw/qa/core/fields/data/styleref-flags.docx 
b/sw/qa/core/fields/data/styleref-flags.docx
new file mode 100644
index ..443624a575e0
Binary files /dev/null and b/sw/qa/core/fields/data/styleref-flags.docx differ
diff --git a/sw/qa/core/fields/data/styleref.odt 
b/sw/qa/core/fields/data/styleref.odt
new file mode 100644
index ..27af5aae1f06
Binary files /dev/null and b/sw/qa/core/fields/data/styleref.odt differ
diff --git a/sw/qa/core/fields/data/suppress-non-numerical.docx 
b/sw/qa/core/fields/data/suppress-non-numerical.docx
new file mode 100644
index ..439e048b9f93
Binary files /dev/null and b/sw/qa/core/fields/data/suppress-non-numerical.docx 
differ
diff --git a/sw/qa/core/fields/fields.cxx b/sw/qa/core/fields/fields.cxx
index 9fae9cafef13..8e6a1488fa3a 100644
--- a/sw/qa/core/fields/fields.cxx
+++ b/sw/qa/core/fields/fields.cxx
@@ -7,8 +7,9 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include 
+#include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -36,7 +37,6 @@
 
 #include 
 #include 
-
 #include 
 
 #include 
@@ -182,27 +182,49 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf86790)
 CPPUNIT_ASSERT_EQUAL(sValue.first, xField->getPresentation(true));
 CPPUNIT_ASSERT_EQUAL(sValue.second, xField->getPresentation(false));
 }
+CPPUNIT_ASSERT(!xFields->hasMoreElements());
+}
+
+void InsertParagraphBreak(const uno::Reference& xCursor)
+{
+uno::Reference xText = xCursor->getText();
+xText->insertControlCharacter(xCursor, 
text::ControlCharacter::PARAGRAPH_BREAK, false);
+}
+void InsertHeading(const uno::Reference& xCursor, const 
OUString& content)
+{
+uno::Reference xCursorPropertySet(xCursor, 
uno::UNO_QUERY);
+uno::Reference xText = xCursor->getText();
+
+xCursorPropertySet->setPropertyValue("ParaStyleName", 
uno::Any(OUString("Heading 1")));
+xText->insertString(xCursor, content, false);
+InsertParagraphBreak(xCursor);
 }
 
 /// If there is referenced text both above and below, STYLEREF searches up
 CPPUNIT_TEST_FIXTURE(Test, testStyleRefSearchUp)
 {
+// Arrange
+// Create a document with headings both above and below a cursor
 createSwDoc();
 
 uno::Reference xTextDocument(mxComponent, 
uno::UNO_QUERY);
 uno::Reference xText = xTextDocument->getText();
 
 uno::Reference xCursor = xText->createTextCursor();
-uno::Reference xCursorPropertySet(xCursor, 
uno::UNO_QUERY);
 
-xCursorPropertySet->setPropertyValue("ParaStyleName", 
uno::Any(OUString("Heading 1")));
-xText->insertString(xCursor, "Heading far above field", false);
-xText->insertCont

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

2023-10-30 Thread Skyler Grey (via logerrit)
 sw/source/core/fields/reffld.cxx |   21 +
 sw/uiconfig/swriter/ui/fldrefpage.ui |2 +-
 2 files changed, 6 insertions(+), 17 deletions(-)

New commits:
commit 3e6d4a563f390638b285254d2128466b56ce03ba
Author: Skyler Grey 
AuthorDate: Tue Oct 24 10:19:52 2023 +
Commit: Caolán McNamara 
CommitDate: Mon Oct 30 20:11:31 2023 +0100

Improve STYLE_FROM_BOTTOM compatability with Word

From my testing in Word, it doesn't honor the "search from bottom" flag
when it is in the body, only in marginals. Additionally, it doesn't
continue searching in the opposite order if the referenced content is
not found on the current page, instead it searches in the same order as
it would normally (i.e. pages above then pages below). This commit
changes the behavior and UI of our from bottom flag to match.

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

diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index c92d4b6d37bb..f034b1b52b5b 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -1384,8 +1384,6 @@ SwTextNode* SwGetRefFieldType::FindAnchor(SwDoc* pDoc, 
const OUString& rRefMark,
 case REF_STYLE:
 if (!pSelf) break;
 
-bool bFlagFromBottom = (nFlags & REFFLDFLAG_STYLE_FROM_BOTTOM) == 
REFFLDFLAG_STYLE_FROM_BOTTOM;
-
 const SwNodes& nodes = pDoc->GetNodes();
 
 StyleRefElementType elementType = StyleRefElementType::Default;
@@ -1434,6 +1432,8 @@ SwTextNode* SwGetRefFieldType::FindAnchor(SwDoc* pDoc, 
const OUString& rRefMark,
 // For marginals, styleref tries to act on the current 
page first
 // 1. Get the page we're on, search it from top to bottom
 
+bool bFlagFromBottom = (nFlags & 
REFFLDFLAG_STYLE_FROM_BOTTOM) == REFFLDFLAG_STYLE_FROM_BOTTOM;
+
 Point aPt;
 std::pair const tmp(aPt, false);
 
@@ -1499,10 +1499,7 @@ SwTextNode* SwGetRefFieldType::FindAnchor(SwDoc* pDoc, 
const OUString& rRefMark,
 
 if (beforeStart)
 {
-if (bFlagFromBottom)
-pSearchThird.push_front(nodes[n]);
-else
-pSearchSecond.push_front(nodes[n]);
+pSearchSecond.push_front(nodes[n]);
 }
 else if (beforeEnd)
 {
@@ -1516,8 +1513,6 @@ SwTextNode* SwGetRefFieldType::FindAnchor(SwDoc* pDoc, 
const OUString& rRefMark,
 beforeEnd = false;
 }
 }
-else if (bFlagFromBottom)
-pSearchSecond.push_back(nodes[n]);
 else
 pSearchThird.push_back(nodes[n]);
 }
@@ -1579,20 +1574,14 @@ SwTextNode* SwGetRefFieldType::FindAnchor(SwDoc* pDoc, 
const OUString& rRefMark,
 {
 if (beforeElement)
 {
-if (bFlagFromBottom)
-pSearchSecond.push_front(nodes[n]);
-else
-pSearchFirst.push_front(nodes[n]);
+pSearchFirst.push_front(nodes[n]);
 
 if (*pReference == *nodes[n])
 {
 beforeElement = false;
 }
 }
-else if (bFlagFromBottom)
-pSearchFirst.push_back(nodes[n]);
-else
-pSearchSecond.push_back(nodes[n]);
+pSearchSecond.push_back(nodes[n]);
 }
 
 // 1. Search up until we hit the top of the document
diff --git a/sw/uiconfig/swriter/ui/fldrefpage.ui 
b/sw/uiconfig/swriter/ui/fldrefpage.ui
index 549a7a6e6f9a..8398e0a2ccf8 100644
--- a/sw/uiconfig/swriter/ui/fldrefpage.ui
+++ b/sw/uiconfig/swriter/ui/fldrefpage.ui
@@ -202,7 +202,7 @@
 top
 
   
-Search from bottom to top
+Search this page from bottom to 
top
 True
 True
 False


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

2023-10-30 Thread Skyler Grey (via logerrit)
 sw/inc/numrule.hxx   |4 -
 sw/inc/reffld.hxx|5 -
 sw/source/core/doc/number.cxx|  121 ++-
 sw/source/core/fields/reffld.cxx |   44 +++---
 sw/source/core/txtnode/ndtxt.cxx |1 
 sw/source/ui/fldui/fldref.cxx|   48 +--
 sw/source/ui/fldui/fldref.hxx|1 
 7 files changed, 152 insertions(+), 72 deletions(-)

New commits:
commit 2ddd1378fc232fbc1d5162f2c44ecf71c6725732
Author: Skyler Grey 
AuthorDate: Tue Oct 24 16:22:30 2023 +
Commit: Caolán McNamara 
CommitDate: Mon Oct 30 20:10:27 2023 +0100

Improve HIDE_NON_NUMERICAL compatibility with Word

The previous implementation of REFFLDFLAG_STYLE_HIDE_NON_NUMERICAL had
some major incompatibilites with Word. In particular, it stripped
letters even if they were included in the "numbering" system.

This commit fixes a lot of the flaws in the previous implementation, so
it's now a lot closer to Word.

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

diff --git a/sw/inc/numrule.hxx b/sw/inc/numrule.hxx
index f642e21e746c..b21cc5259656 100644
--- a/sw/inc/numrule.hxx
+++ b/sw/inc/numrule.hxx
@@ -169,11 +169,13 @@ public:
 OUString MakeNumString( const SwNumberTree::tNumberVector & rNumVector,
   const bool bInclStrings = true,
   const unsigned int _nRestrictToThisLevel = MAXLEVEL,
+  const bool bHideNonNumerical = false,
   Extremities* pExtremities = nullptr,
   LanguageType nLang = LANGUAGE_SYSTEM) const;
 OUString MakeRefNumString( const SwNodeNum& rNodeNum,
  const bool bInclSuperiorNumLabels,
- const int nRestrictInclToThisLevel ) const;
+ const int nRestrictInclToThisLevel,
+ const bool bHideNonNumerical ) const;
 OUString MakeParagraphStyleListString() const;
 
 /** @return list of associated text nodes */
diff --git a/sw/inc/reffld.hxx b/sw/inc/reffld.hxx
index 3c1e3c63b5e6..b65e8c209633 100644
--- a/sw/inc/reffld.hxx
+++ b/sw/inc/reffld.hxx
@@ -117,11 +117,6 @@ private:
 
 virtual OUStringExpandImpl(SwRootFrame const* pLayout) const override;
 virtual std::unique_ptr Copy() const override;
-
-/// Strip out text that is not either a number or a delimiter. Used in 
STYLEREF for when you
-/// have chapters labelled "Chapter X.Y" and want to just keep the "X.Y". 
Distinct from
-/// GetExpandedTextOfReferencedTextNode so you can run it after any other 
processing
-void StylerefStripNonnumerical(OUString& rText) const;
 public:
 SwGetRefField( SwGetRefFieldType*, OUString aSetRef, OUString 
aReferenceLanguage,
 sal_uInt16 nSubType, sal_uInt16 nSeqNo, sal_uInt16 nFlags, 
sal_uLong nFormat );
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index 3ab36c63c160..d2cb98924e0f 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -648,9 +648,51 @@ OUString SwNumRule::MakeNumString( const SwNodeNum& rNum, 
bool bInclStrings ) co
 return OUString();
 }
 
+namespace {
+/// Strip out text that is not a delimiter. Used in STYLEREF for when you
+/// have chapters labelled "Chapter X.Y" and want to just keep the "X.Y"
+/// Only used on the prefix/infix/suffix, so the numbers are not modified
+void StripNonDelimiter(OUString& rText)
+{
+std::vector charactersToKeep;
+
+for (int i = 0; i < rText.getLength(); i++) {
+auto character = rText[i];
+
+ // tdf#86790# for Word compatibility: I haven't found any better way 
to determine whether a
+ // character is a delimiter than testing in Word and listing them 
out. Furthermore, I haven't
+ // found a list so I can't be certain this is the complete set- if 
there's a compatibility issue
+ // with this in the future, here's the first place to look...
+if (
+character == '.'
+|| character == ','
+|| character == ':'
+|| character == ';'
+|| character == '-'
+|| character == '('
+|| character == ')'
+|| character == '['
+|| character == ']'
+|| character == '{'
+|| character == '}'
+|| character == '/'
+|| character == '\\'
+|| character == '|'
+)
+charactersToKeep.push_back(character);
+}
+
+if (charactersToKeep.size())
+rText = OUString(charactersToKeep.data(), charactersToKeep.size());
+else
+rText = OUString();
+}
+}
+
 OUString SwNumRule::MakeNumString( const SwNumberTree::tNumberVector & 
rNumVector,
   

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

2023-10-30 Thread Skyler Grey (via logerrit)
 sw/inc/reffld.hxx|1 
 sw/source/core/doc/DocumentFieldsManager.cxx |5 
 sw/source/core/fields/reffld.cxx |   29 ++-
 3 files changed, 34 insertions(+), 1 deletion(-)

New commits:
commit 15972993ff6e106a02954125269612179e1f33aa
Author: Skyler Grey 
AuthorDate: Mon Oct 23 16:17:17 2023 +
Commit: Caolán McNamara 
CommitDate: Mon Oct 30 20:08:56 2023 +0100

Fix incorrect marginal STYLEREF content in docx

STYLEREF fields were previously not importing with the correct content
when loading a docx document. This is because they were not updating
when the document had finished loading- only partway through, and where
a STYLEREF field is in relation to everything else in the document can
change its content.

This commit fixes that issue by adding STYLEREF fields to be refreshed
whenever other fields that can change based on pages (e.g. page number)
fields are updated. I suspect this could lead to double updates in some
cases where both reference and page fields are being updated. I consider
this a relatively minor issue in comparison to incorrect field content
when specific documents are loaded, but a followup could be made
improving this.

This commit also fixes a minor typo in reffld.cxx where m_sText is
always the filtered text when updating fields, even if we are updating
m_sTextRLHidden instead.

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

diff --git a/sw/inc/reffld.hxx b/sw/inc/reffld.hxx
index 293b913c406b..3c1e3c63b5e6 100644
--- a/sw/inc/reffld.hxx
+++ b/sw/inc/reffld.hxx
@@ -100,6 +100,7 @@ public:
 SwRootFrame const* pLayout = nullptr,
 SwTextNode* pSelf = nullptr, SwFrame* 
pFrame = nullptr);
 void UpdateGetReferences();
+void UpdateStyleReferences();
 };
 
 class SW_DLLPUBLIC SwGetRefField final : public SwField
diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx 
b/sw/source/core/doc/DocumentFieldsManager.cxx
index c8703e7f06ef..a7be3bb96394 100644
--- a/sw/source/core/doc/DocumentFieldsManager.cxx
+++ b/sw/source/core/doc/DocumentFieldsManager.cxx
@@ -1292,6 +1292,11 @@ void DocumentFieldsManager::UpdatePageFields(const 
SwTwips nDocPos)
 case SwFieldIds::DocStat:
 pFieldType->CallSwClientNotify(sw::LegacyModifyHint(nullptr, 
nullptr));
 break;
+case SwFieldIds::GetRef:
+
static_cast(pFieldType)->UpdateStyleReferences();
+// Style references can vary across different pages (e.g. in 
header/footer)
+// so they must be updated when page fields are
+break;
 default: break;
 }
 }
diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index 638baf0a5474..ee7791a68753 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -706,7 +706,7 @@ void SwGetRefField::UpdateField(const SwTextField* 
pFieldTextAttr, SwFrame* pFra
 rText = pTextNd->GetExpandText(pLayout, nStart, nEnd - 
nStart, false, false,
false, ExpandMode(0));
 }
-FilterText(m_sText, GetLanguage(), m_sSetReferenceLanguage);
+FilterText(rText, GetLanguage(), m_sSetReferenceLanguage);
 }
 }
 break;
@@ -1167,6 +1167,33 @@ void SwGetRefFieldType::UpdateGetReferences()
 CallSwClientNotify(sw::LegacyModifyHint(nullptr, nullptr));
 }
 
+void SwGetRefFieldType::UpdateStyleReferences()
+{
+std::vector vFields;
+GatherFields(vFields, false);
+bool bModified = false;
+for(auto pFormatField: vFields)
+{
+// update only the GetRef fields which are also STYLEREF fields
+SwGetRefField* pGRef = 
static_cast(pFormatField->GetField());
+
+if (pGRef->GetSubType() != REF_STYLE) continue;
+
+const SwTextField* pTField;
+if(!pGRef->GetLanguage() &&
+nullptr != (pTField = pFormatField->GetTextField()) &&
+pTField->GetpTextNode())
+{
+
pGRef->SetLanguage(pTField->GetpTextNode()->GetLang(pTField->GetStart()));
+}
+
+pGRef->UpdateField(pFormatField->GetTextField(), nullptr);
+bModified = true;
+}
+if (bModified)
+CallSwClientNotify(sw::LegacyModifyHint(nullptr, nullptr));
+}
+
 void SwGetRefFieldType::SwClientNotify(const SwModify&, const SfxHint& rHint)
 {
 if (rHint.GetId() != SfxHintId::SwLegacyModify)


[Libreoffice-commits] core.git: include/xmloff schema/libreoffice xmloff/inc xmloff/source

2023-10-30 Thread Skyler Grey (via logerrit)
 include/xmloff/xmltoken.hxx |2 
 schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng |   10 
 xmloff/inc/txtfld.hxx   |   28 
 xmloff/inc/txtflde.hxx  |9 +++
 xmloff/inc/txtfldi.hxx  |2 
 xmloff/source/core/xmltoken.cxx |2 
 xmloff/source/text/txtflde.cxx  |   22 -
 xmloff/source/text/txtfldi.cxx  |   13 +
 xmloff/source/token/tokens.txt  |2 
 9 files changed, 87 insertions(+), 3 deletions(-)

New commits:
commit 6412a74b35a3e6089b65b4ad04549262e4bf93c8
Author: Skyler Grey 
AuthorDate: Fri Oct 20 14:30:31 2023 +
Commit: Caolán McNamara 
CommitDate: Mon Oct 30 20:07:01 2023 +0100

Enable STYLEREF flag export/import with ODF

This commit enables exporting the following STYLEREF flags with ODF
- Search from bottom to top
- Hide non numerical

After this commit, the following steps have been implemented
- The document model (I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19)
- The layout (I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19)
- The UI (I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19)
- UNO (Ib664fec059aa1f7f130acc76c253d5d298fa59f7)
- DOCX/ODF filters (here and Ib664fec059aa1f7f130acc76c253d5d298fa59f7)

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

diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index d3c1b93ea6e4..066a55960e0b 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -1607,6 +1607,8 @@ namespace xmloff::token {
 XML_REFERENCE,
 XML_REFERENCE_END,
 XML_REFERENCE_FORMAT,
+XML_REFERENCE_FROM_BOTTOM,
+XML_REFERENCE_HIDE_NON_NUMERICAL,
 XML_REFERENCE_MARK,
 XML_REFERENCE_MARK_END,
 XML_REFERENCE_MARK_START,
diff --git a/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng 
b/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
index bf57af9b0be6..b9fbcfc7ce4b 100644
--- a/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
+++ b/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
@@ -2195,6 +2195,16 @@ 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.
 
   
 
+
+  
+
+  
+
+
+  
+
+  
+
   
 
   
diff --git a/xmloff/inc/txtfld.hxx b/xmloff/inc/txtfld.hxx
new file mode 100644
index ..c562644a5f18
--- /dev/null
+++ b/xmloff/inc/txtfld.hxx
@@ -0,0 +1,28 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/** @#file
+ *  Constants, helpers etc. that need to be shared between text field import
+ *  and export
+ */
+
+#pragma once
+
+#define REFFLDFLAG_STYLE_FROM_BOTTOM 0xc100
+#define REFFLDFLAG_STYLE_HIDE_NON_NUMERICAL 0xc200
diff --git a/xmloff/inc/txtflde.hxx b/xmloff/inc/txtflde.hxx
index 459dea29f550..f98fb7c5c421 100644
--- a/xmloff/inc/txtflde.hxx
+++ b/xmloff/inc/txtflde.hxx
@@ -34,6 +34,8 @@
 #include 
 #include 
 
+#include "txtfld.hxx"
+
 class SvXMLExport;
 struct XMLPropertyState;
 
@@ -239,6 +241,13 @@ private:
   bool i_bAutoStyles, bool i_bProgress,
   bool & rPrevCharIsSpace);
 
+
+void ProcessBoolean(
+enum ::xmloff::token::XMLTokenEnum eXmlName,/// attribute token
+bool bBool, /// attribute value
+bool bDefault,
+sal_uInt16 nPrefix); /// namespace
+
 /// export a boolean attribute
 void ProcessBoolean(
 enum ::xmloff::token::XMLTokenEnum eXmlName,/// attribute token 
(namespace text)
diff --git a/xmloff/inc/txtfldi.hxx b/xmloff/inc/txtfldi.hxx
index 0a15329c31ec..3d56c547811e 100644
--- a/xmloff/inc/txtfldi.hxx
+++ b/xmloff/inc/txtfld

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

2023-10-30 Thread Skyler Grey (via logerrit)
 offapi/com/sun/star/text/textfield/GetReference.idl |4 
 sw/inc/unoprnms.hxx |1 +
 sw/source/core/fields/reffld.cxx|   10 ++
 sw/source/core/inc/unofldmid.h  |2 ++
 sw/source/core/unocore/unofield.cxx |   12 +++-
 sw/source/core/unocore/unomap.cxx   |1 +
 sw/source/filter/ww8/ww8atr.cxx |   11 +++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx   |   18 ++
 writerfilter/source/dmapper/PropertyIds.cxx |1 +
 writerfilter/source/dmapper/PropertyIds.hxx |1 +
 10 files changed, 60 insertions(+), 1 deletion(-)

New commits:
commit e195c22533de44cd4f6afab7836c7eb6a613d202
Author: Skyler Grey 
AuthorDate: Fri Oct 20 13:07:12 2023 +
Commit: Caolán McNamara 
CommitDate: Mon Oct 30 20:04:01 2023 +0100

Enable STYLEREF flag export/import with OOXML

This commit enables exporting the following STYLEREF flags with OOXML
- Search from bottom to top
- Hide non numerical

After this commit, the following steps have been implemented
- The document model (I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19)
- The layout (I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19)
- The UI (I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19)
- UNO
- DOCX filter

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

diff --git a/offapi/com/sun/star/text/textfield/GetReference.idl 
b/offapi/com/sun/star/text/textfield/GetReference.idl
index 11bfc92b7705..c686b00b23cf 100644
--- a/offapi/com/sun/star/text/textfield/GetReference.idl
+++ b/offapi/com/sun/star/text/textfield/GetReference.idl
@@ -62,6 +62,10 @@ published service GetReference
 
  */
 [optional, property] string ReferenceFieldLanguage;
+/** contains extra flags which can modify the behaviour of the field
+@since LibreOffice 24.2
+ */
+[optional, property] short ReferenceFieldFlags;
 };
 
 
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index 1ab2395fa67d..e83b1b601ef4 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -307,6 +307,7 @@ inline constexpr OUString UNO_NAME_PAGE_NUMBER_OFFSET = 
u"PageNumberOffset"_ustr
 inline constexpr OUString UNO_NAME_PLACEHOLDER = u"PlaceHolder"_ustr;
 inline constexpr OUString UNO_NAME_PLACEHOLDER_TYPE = u"PlaceHolderType"_ustr;
 inline constexpr OUString UNO_NAME_PRINT = u"Print"_ustr;
+inline constexpr OUString UNO_NAME_REFERENCE_FIELD_FLAGS = 
u"ReferenceFieldFlags"_ustr;
 inline constexpr OUString UNO_NAME_REFERENCE_FIELD_PART = 
u"ReferenceFieldPart"_ustr;
 inline constexpr OUString UNO_NAME_REFERENCE_FIELD_SOURCE = 
u"ReferenceFieldSource"_ustr;
 inline constexpr OUString UNO_NAME_REFERENCE_FIELD_LANGUAGE = 
u"ReferenceFieldLanguage"_ustr;
diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index 96b9716f7eac..638baf0a5474 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -974,6 +974,9 @@ bool SwGetRefField::QueryValue( uno::Any& rAny, sal_uInt16 
nWhichId ) const
 rAny <<= nSource;
 }
 break;
+case FIELD_PROP_USHORT3:
+rAny <<= m_nFlags;
+break;
 case FIELD_PROP_PAR1:
 {
 OUString sTmp(GetPar1());
@@ -1076,6 +1079,13 @@ bool SwGetRefField::PutValue( const uno::Any& rAny, 
sal_uInt16 nWhichId )
 case FIELD_PROP_PAR4:
 rAny >>= m_sSetReferenceLanguage;
 break;
+case FIELD_PROP_USHORT3:
+{
+sal_uInt16 nSetFlags = 0;
+rAny >>= nSetFlags;
+m_nFlags = nSetFlags;
+}
+break;
 case FIELD_PROP_SHORT1:
 {
 sal_Int16 nSetSeq = 0;
diff --git a/sw/source/core/inc/unofldmid.h b/sw/source/core/inc/unofldmid.h
index 59f4583f3d6f..8c1838f45636 100644
--- a/sw/source/core/inc/unofldmid.h
+++ b/sw/source/core/inc/unofldmid.h
@@ -51,6 +51,8 @@
 #define FIELD_PROP_PAR6 36
 #define FIELD_PROP_PAR7 37
 
+#define FIELD_PROP_USHORT3  38
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/unocore/unofield.cxx 
b/sw/source/core/unocore/unofield.cxx
index b5d423e8fd42..74b530ed5a28 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -1043,6 +1043,7 @@ struct SwFieldProperties_Impl
 sal_Int32   nFormat;
 sal_uInt16  nUSHORT1;
 sal_uInt16  nUSHORT2;
+sal_uInt16  nUSHORT3;
 sal_Int16   nSHORT1;
 sal_Int8nByte1;
 boolbFormatIsDefault;
@@ -1058,6 +1059,7 @@ struct SwFieldProperties_Impl
 nFormat(0),
 nUSHORT1(0),
 nUSHORT2(0),
+nUSHORT3(0),
 nSHORT1(0),
 nByte1(0),
 bFormatIsDefa

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

2023-10-26 Thread Skyler Grey (via logerrit)
 sw/inc/crsrsh.hxx   |2 
 sw/inc/reffld.hxx   |   27 ++
 sw/qa/extras/uiwriter/uiwriter7.cxx |   15 -
 sw/source/core/crsr/crstrvl.cxx |4 
 sw/source/core/fields/reffld.cxx|   99 +++---
 sw/source/core/text/EnhancedPDFExportHelper.cxx |2 
 sw/source/core/unocore/unofield.cxx |1 
 sw/source/filter/ww8/ww8par5.cxx|8 
 sw/source/ui/fldui/fldref.cxx   |   37 ++-
 sw/source/ui/fldui/fldref.hxx   |4 
 sw/source/uibase/fldui/fldmgr.cxx   |   21 +-
 sw/source/uibase/inc/wrtsh.hxx  |2 
 sw/source/uibase/shells/textsh1.cxx |3 
 sw/source/uibase/wrtsh/move.cxx |4 
 sw/source/uibase/wrtsh/wrtsh2.cxx   |3 
 sw/uiconfig/swriter/ui/fldrefpage.ui|  231 ++--
 16 files changed, 303 insertions(+), 160 deletions(-)

New commits:
commit 4bb1a7836abb49a9b0513958239f3998305201fd
Author: Skyler Grey 
AuthorDate: Fri Oct 20 09:02:57 2023 +
Commit: Miklos Vajna 
CommitDate: Fri Oct 27 08:07:21 2023 +0200

Add flags to STYLEREF

This commit is part of an implementation for the following STYLEREF flags
- Search from bottom to top, which sets the STYLEREF field to search
  downwards first, or from the bottom of the page in marginals
- Hide non numerical, which hides all characters that are not either
  numbers or punctuation commonly used as delimiters. For example, if
  your STYLEREF said "Chapter 2.1", this setting would make it say "2.1"

This commit implements:
- The document model
- The layout
- The UI

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

diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 233edb71c240..fd28607c5e32 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -702,7 +702,7 @@ public:
 bool SelectNxtPrvHyperlink( bool bNext );
 
 bool GotoRefMark( const OUString& rRefMark, sal_uInt16 nSubType,
-sal_uInt16 nSeqNo );
+sal_uInt16 nSeqNo, sal_uInt16 nFlags );
 
 // get the nth character from the start or end of the  current selection
 sal_Unicode GetChar( bool bEnd = true, tools::Long nOffset = 0 );
diff --git a/sw/inc/reffld.hxx b/sw/inc/reffld.hxx
index bf9d563ab2ac..293b913c406b 100644
--- a/sw/inc/reffld.hxx
+++ b/sw/inc/reffld.hxx
@@ -34,6 +34,20 @@ class SwFrame;
 bool IsFrameBehind( const SwTextNode& rMyNd, sal_Int32 nMySttPos,
 const SwTextNode& rBehindNd, sal_Int32 nSttPos );
 
+#define REFFLDFLAG  0x4000
+#define REFFLDFLAG_BOOKMARK 0x4800
+#define REFFLDFLAG_FOOTNOTE 0x5000
+#define REFFLDFLAG_ENDNOTE  0x6000
+// #i83479#
+#define REFFLDFLAG_HEADING  0x7100
+#define REFFLDFLAG_NUMITEM  0x7200
+
+#define REFFLDFLAG_STYLE0xc000
+/* we skip past 0x8000, 0x9000, 0xa000 and 0xb000 as when we bitwise 'and'
+   with REFFLDFLAG they are false */
+#define REFFLDFLAG_STYLE_FROM_BOTTOM   0xc100
+#define REFFLDFLAG_STYLE_HIDE_NON_NUMERICAL0xc200
+
 enum REFERENCESUBTYPE
 {
 REF_SETREFATTR = 0,
@@ -81,7 +95,7 @@ public:
 void MergeWithOtherDoc( SwDoc& rDestDoc );
 
 static SwTextNode* FindAnchor( SwDoc* pDoc, const OUString& rRefMark,
-sal_uInt16 nSubType, sal_uInt16 nSeqNo,
+sal_uInt16 nSubType, sal_uInt16 
nSeqNo, sal_uInt16 nFlags,
 sal_Int32* pStt, sal_Int32* pEnd = 
nullptr,
 SwRootFrame const* pLayout = nullptr,
 SwTextNode* pSelf = nullptr, SwFrame* 
pFrame = nullptr);
@@ -98,13 +112,18 @@ private:
 sal_uInt16 m_nSubType;
 /// reference to either a SwTextFootnote::m_nSeqNo or a 
SwSetExpField::mnSeqNo
 sal_uInt16 m_nSeqNo;
+sal_uInt16 m_nFlags;
 
 virtual OUStringExpandImpl(SwRootFrame const* pLayout) const override;
 virtual std::unique_ptr Copy() const override;
 
+/// Strip out text that is not either a number or a delimiter. Used in 
STYLEREF for when you
+/// have chapters labelled "Chapter X.Y" and want to just keep the "X.Y". 
Distinct from
+/// GetExpandedTextOfReferencedTextNode so you can run it after any other 
processing
+void StylerefStripNonnumerical(OUString& rText) const;
 public:
 SwGetRefField( SwGetRefFieldType*, OUString aSetRef, OUString 
aReferenceLanguage,
-sal_uInt16 nSubType, sal_uInt16 nSeqNo, sal_uLong nFormat 
);
+sal_uInt16 nSubType, sal_uInt16 nSeqNo, sal_uInt16 nFlags, 
sal_uLong nFormat );
 
 virtual ~SwGetRefField() override;
 
@@ -140,6 +159,10 @@ public:

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

2023-10-25 Thread Skyler Grey (via logerrit)
 sw/qa/core/fields/data/styleref-flags.docx |binary
 sw/qa/core/fields/data/styleref.odt|binary
 sw/qa/core/fields/data/suppress-non-numerical.docx |binary
 sw/qa/core/fields/fields.cxx   |  224 -
 4 files changed, 172 insertions(+), 52 deletions(-)

New commits:
commit 5f4bbf5b8e9af5e98c34ce67d2a8b521ffcf50c6
Author: Skyler Grey 
AuthorDate: Mon Oct 23 09:17:23 2023 +
Commit: Miklos Vajna 
CommitDate: Wed Oct 25 17:52:20 2023 +0200

Improve and extend STYLEREF tests

- I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19,
  Ib664fec059aa1f7f130acc76c253d5d298fa59f7 and
  Iad8e8001807f5ceeaedc9665838672695174a936 added STYLEREF flags. This
  commit adds tests for them
- The tests in I35dc36197b62fa53def4745da1d4755ece79ed22 were partly
  broken due to the fields occasionally being inserted in the wrong
  place (i.e. at the end of the document), this commit makes sure to
  move the cursor before inserting a field
- The tests in I35dc36197b62fa53def4745da1d4755ece79ed22 were not
  separated into sections which made it difficult to tell what was being
  tested. All STYLEREF tests that create documents are now clearly split
  into arrange/act/assert steps with comments denoting the sections
- The tests in I35dc36197b62fa53def4745da1d4755ece79ed22 had a lot of
  repetition, particularly in creating the document, adding headings,
  etc. This has been refactored into some helper functions
- I35dc36197b62fa53def4745da1d4755ece79ed22 was missing an ODF import
  test. This commit adds one

Follow-Up-To: I25dd7a6940abee5651a784b9059fe23b32547d6c
Follow-Up-To: I35dc36197b62fa53def4745da1d4755ece79ed22
Follow-Up-To: I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19
Follow-Up-To: Ib664fec059aa1f7f130acc76c253d5d298fa59f7
Follow-Up-To: Iad8e8001807f5ceeaedc9665838672695174a936
Follow-Up-To: Iecd3e83a6bd3f8c2c6adba5c7eba9ee55b773510
Follow-Up-To: Ifaa67fbc2d53b0d4fb85e7305b2dbdf78cf0a1ad
Follow-Up-To: Id991c92b9aeaa054b136f7a3d9c7c8ea0026e514
Change-Id: I941b477c8e860270a400869cb9ea15e5561e402a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158342
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/core/fields/data/styleref-flags.docx 
b/sw/qa/core/fields/data/styleref-flags.docx
new file mode 100644
index ..443624a575e0
Binary files /dev/null and b/sw/qa/core/fields/data/styleref-flags.docx differ
diff --git a/sw/qa/core/fields/data/styleref.odt 
b/sw/qa/core/fields/data/styleref.odt
new file mode 100644
index ..27af5aae1f06
Binary files /dev/null and b/sw/qa/core/fields/data/styleref.odt differ
diff --git a/sw/qa/core/fields/data/suppress-non-numerical.docx 
b/sw/qa/core/fields/data/suppress-non-numerical.docx
new file mode 100644
index ..439e048b9f93
Binary files /dev/null and b/sw/qa/core/fields/data/suppress-non-numerical.docx 
differ
diff --git a/sw/qa/core/fields/fields.cxx b/sw/qa/core/fields/fields.cxx
index 4a3dd3af1593..934518d5b9f9 100644
--- a/sw/qa/core/fields/fields.cxx
+++ b/sw/qa/core/fields/fields.cxx
@@ -7,8 +7,9 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include 
+#include "reffld.hxx"
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -19,16 +20,11 @@
 #include 
 #include 
 #include 
-#include 
 #include 
-#include 
 #include 
 #include 
-#include 
 #include 
-#include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -40,9 +36,7 @@
 #include 
 
 #include 
-#include 
 #include 
-
 #include 
 
 #include 
@@ -191,27 +185,52 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf86790)
 CPPUNIT_ASSERT_EQUAL(sValue.first, xField->getPresentation(true));
 CPPUNIT_ASSERT_EQUAL(sValue.second, xField->getPresentation(false));
 }
+CPPUNIT_ASSERT(!xFields->hasMoreElements());
+}
+
+namespace
+{
+void InsertParagraphBreak(uno::Reference xCursor)
+{
+uno::Reference xText = xCursor->getText();
+xText->insertControlCharacter(xCursor, 
text::ControlCharacter::PARAGRAPH_BREAK, false);
+}
+void InsertHeading(uno::Reference xCursor, OUString content)
+{
+uno::Reference xCursorPropertySet(xCursor, 
uno::UNO_QUERY);
+uno::Reference xText = xCursor->getText();
+
+xCursorPropertySet->setPropertyValue("ParaStyleName", 
uno::Any(OUString("Heading 1")));
+xText->insertString(xCursor, content, false);
+InsertParagraphBreak(xCursor);
+}
 }
 
 /// If there is referenced text both above and below, STYLEREF searches up
 CPPUNIT_TEST_FIXTURE(Test, testStyleRefSearchUp)
 {
+// Arrange
+// Create a document with headings both above and below a cursor
 createSwDoc();
 
 uno::Reference xTextDocument(mxComponent, 
uno::UNO_QUERY);
 uno::Reference xText = xTextDocument->getText();
 
 uno::Reference xCursor = xText->createTextCursor();
-uno::Reference xCursorPropertySet(xCursor, 

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

2023-10-25 Thread Skyler Grey (via logerrit)
 sw/source/core/fields/reffld.cxx |   21 +
 sw/uiconfig/swriter/ui/fldrefpage.ui |2 +-
 2 files changed, 6 insertions(+), 17 deletions(-)

New commits:
commit 60c111838da81697a49b3011eebe8b1e05ad08bb
Author: Skyler Grey 
AuthorDate: Tue Oct 24 10:19:52 2023 +
Commit: Skyler Grey 
CommitDate: Wed Oct 25 16:36:51 2023 +0200

Improve STYLE_FROM_BOTTOM compatability with Word

From my testing in Word, it doesn't honor the "search from bottom" flag
when it is in the body, only in marginals. Additionally, it doesn't
continue searching in the opposite order if the referenced content is
not found on the current page, instead it searches in the same order as
it would normally (i.e. pages above then pages below). This commit
changes the behavior and UI of our from bottom flag to match.

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

diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index 3a7bc4ae4e70..1f8aae4e3506 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -1385,8 +1385,6 @@ SwTextNode* SwGetRefFieldType::FindAnchor(SwDoc* pDoc, 
const OUString& rRefMark,
 case REF_STYLE:
 if (!pSelf) break;
 
-bool bFlagFromBottom = (nFlags & REFFLDFLAG_STYLE_FROM_BOTTOM) == 
REFFLDFLAG_STYLE_FROM_BOTTOM;
-
 const SwNodes& nodes = pDoc->GetNodes();
 
 StyleRefElementType elementType = StyleRefElementType::Default;
@@ -1435,6 +1433,8 @@ SwTextNode* SwGetRefFieldType::FindAnchor(SwDoc* pDoc, 
const OUString& rRefMark,
 // For marginals, styleref tries to act on the current 
page first
 // 1. Get the page we're on, search it from top to bottom
 
+bool bFlagFromBottom = (nFlags & 
REFFLDFLAG_STYLE_FROM_BOTTOM) == REFFLDFLAG_STYLE_FROM_BOTTOM;
+
 Point aPt;
 std::pair const tmp(aPt, false);
 
@@ -1500,10 +1500,7 @@ SwTextNode* SwGetRefFieldType::FindAnchor(SwDoc* pDoc, 
const OUString& rRefMark,
 
 if (beforeStart)
 {
-if (bFlagFromBottom)
-pSearchThird.push_front(nodes[n]);
-else
-pSearchSecond.push_front(nodes[n]);
+pSearchSecond.push_front(nodes[n]);
 }
 else if (beforeEnd)
 {
@@ -1517,8 +1514,6 @@ SwTextNode* SwGetRefFieldType::FindAnchor(SwDoc* pDoc, 
const OUString& rRefMark,
 beforeEnd = false;
 }
 }
-else if (bFlagFromBottom)
-pSearchSecond.push_back(nodes[n]);
 else
 pSearchThird.push_back(nodes[n]);
 }
@@ -1580,20 +1575,14 @@ SwTextNode* SwGetRefFieldType::FindAnchor(SwDoc* pDoc, 
const OUString& rRefMark,
 {
 if (beforeElement)
 {
-if (bFlagFromBottom)
-pSearchSecond.push_front(nodes[n]);
-else
-pSearchFirst.push_front(nodes[n]);
+pSearchFirst.push_front(nodes[n]);
 
 if (*pReference == *nodes[n])
 {
 beforeElement = false;
 }
 }
-else if (bFlagFromBottom)
-pSearchFirst.push_back(nodes[n]);
-else
-pSearchSecond.push_back(nodes[n]);
+pSearchSecond.push_back(nodes[n]);
 }
 
 // 1. Search up until we hit the top of the document
diff --git a/sw/uiconfig/swriter/ui/fldrefpage.ui 
b/sw/uiconfig/swriter/ui/fldrefpage.ui
index 635cbb35fb41..8592211ef10e 100644
--- a/sw/uiconfig/swriter/ui/fldrefpage.ui
+++ b/sw/uiconfig/swriter/ui/fldrefpage.ui
@@ -201,7 +201,7 @@
 top
 
   
-Search from bottom to top
+Search this page from bottom to 
top
 True
 True
 False


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

2023-10-25 Thread Skyler Grey (via logerrit)
 sw/inc/numrule.hxx   |4 -
 sw/inc/reffld.hxx|5 -
 sw/source/core/doc/number.cxx|  121 ++-
 sw/source/core/fields/reffld.cxx |   44 +++---
 sw/source/core/txtnode/ndtxt.cxx |1 
 sw/source/ui/fldui/fldref.cxx|   48 +--
 sw/source/ui/fldui/fldref.hxx|1 
 7 files changed, 152 insertions(+), 72 deletions(-)

New commits:
commit 6d2871efaebc9c36ba1d225e2f149e35d32db1d6
Author: Skyler Grey 
AuthorDate: Tue Oct 24 16:22:30 2023 +
Commit: Miklos Vajna 
CommitDate: Wed Oct 25 16:16:39 2023 +0200

Improve HIDE_NON_NUMERICAL compatibility with Word

The previous implementation of REFFLDFLAG_STYLE_HIDE_NON_NUMERICAL had
some major incompatibilites with Word. In particular, it stripped
letters even if they were included in the "numbering" system.

This commit fixes a lot of the flaws in the previous implementation, so
it's now a lot closer to Word.

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

diff --git a/sw/inc/numrule.hxx b/sw/inc/numrule.hxx
index f642e21e746c..b21cc5259656 100644
--- a/sw/inc/numrule.hxx
+++ b/sw/inc/numrule.hxx
@@ -169,11 +169,13 @@ public:
 OUString MakeNumString( const SwNumberTree::tNumberVector & rNumVector,
   const bool bInclStrings = true,
   const unsigned int _nRestrictToThisLevel = MAXLEVEL,
+  const bool bHideNonNumerical = false,
   Extremities* pExtremities = nullptr,
   LanguageType nLang = LANGUAGE_SYSTEM) const;
 OUString MakeRefNumString( const SwNodeNum& rNodeNum,
  const bool bInclSuperiorNumLabels,
- const int nRestrictInclToThisLevel ) const;
+ const int nRestrictInclToThisLevel,
+ const bool bHideNonNumerical ) const;
 OUString MakeParagraphStyleListString() const;
 
 /** @return list of associated text nodes */
diff --git a/sw/inc/reffld.hxx b/sw/inc/reffld.hxx
index 3c1e3c63b5e6..b65e8c209633 100644
--- a/sw/inc/reffld.hxx
+++ b/sw/inc/reffld.hxx
@@ -117,11 +117,6 @@ private:
 
 virtual OUStringExpandImpl(SwRootFrame const* pLayout) const override;
 virtual std::unique_ptr Copy() const override;
-
-/// Strip out text that is not either a number or a delimiter. Used in 
STYLEREF for when you
-/// have chapters labelled "Chapter X.Y" and want to just keep the "X.Y". 
Distinct from
-/// GetExpandedTextOfReferencedTextNode so you can run it after any other 
processing
-void StylerefStripNonnumerical(OUString& rText) const;
 public:
 SwGetRefField( SwGetRefFieldType*, OUString aSetRef, OUString 
aReferenceLanguage,
 sal_uInt16 nSubType, sal_uInt16 nSeqNo, sal_uInt16 nFlags, 
sal_uLong nFormat );
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index 3ab36c63c160..fffa5ea2a92c 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -648,9 +648,51 @@ OUString SwNumRule::MakeNumString( const SwNodeNum& rNum, 
bool bInclStrings ) co
 return OUString();
 }
 
+namespace {
+/// Strip out text that is not a delimiter. Used in STYLEREF for when you
+/// have chapters labelled "Chapter X.Y" and want to just keep the "X.Y"
+/// Only used on the prefix/infix/suffix, so the numbers are not modified
+void StripNonDelimiter(OUString& rText)
+{
+std::vector charactersToKeep;
+
+for (int i = 0; i < rText.getLength(); i++) {
+auto character = rText[i];
+
+ // tdf#86790# for Word compatibility: I haven't found any better way 
to determine whether a
+ // character is a delimiter than testing in Word and listing them 
out. Furthermore, I haven't
+ // found a list so I can't be certain this is the complete set- if 
there's a compatibility issue
+ // with this in the future, here's the first place to look...
+ if (
+character == '.'
+|| character == ','
+|| character == ':'
+|| character == ';'
+|| character == '-'
+|| character == '('
+|| character == ')'
+|| character == '['
+|| character == ']'
+|| character == '{'
+|| character == '}'
+|| character == '/'
+|| character == '\\'
+|| character == '|'
+)
+charactersToKeep.push_back(character);
+}
+
+if (charactersToKeep.size())
+rText = OUString(&charactersToKeep[0], charactersToKeep.size());
+else
+rText = OUString();
+}
+}
+
 OUString SwNumRule::MakeNumString( const SwNumberTree::tNumberVector & 
rNumVector,
  

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

2023-10-25 Thread Skyler Grey (via logerrit)
 sw/inc/reffld.hxx|1 
 sw/source/core/doc/DocumentFieldsManager.cxx |5 
 sw/source/core/fields/reffld.cxx |   29 ++-
 3 files changed, 34 insertions(+), 1 deletion(-)

New commits:
commit 8c8682ddd62d7144ded88acde99aa7b0b0e1978b
Author: Skyler Grey 
AuthorDate: Mon Oct 23 16:17:17 2023 +
Commit: Miklos Vajna 
CommitDate: Wed Oct 25 12:23:24 2023 +0200

Fix incorrect marginal STYLEREF content in docx

STYLEREF fields were previously not importing with the correct content
when loading a docx document. This is because they were not updating
when the document had finished loading- only partway through, and where
a STYLEREF field is in relation to everything else in the document can
change its content.

This commit fixes that issue by adding STYLEREF fields to be refreshed
whenever other fields that can change based on pages (e.g. page number)
fields are updated. I suspect this could lead to double updates in some
cases where both reference and page fields are being updated. I consider
this a relatively minor issue in comparison to incorrect field content
when specific documents are loaded, but a followup could be made
improving this.

This commit also fixes a minor typo in reffld.cxx where m_sText is
always the filtered text when updating fields, even if we are updating
m_sTextRLHidden instead.

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

diff --git a/sw/inc/reffld.hxx b/sw/inc/reffld.hxx
index 293b913c406b..3c1e3c63b5e6 100644
--- a/sw/inc/reffld.hxx
+++ b/sw/inc/reffld.hxx
@@ -100,6 +100,7 @@ public:
 SwRootFrame const* pLayout = nullptr,
 SwTextNode* pSelf = nullptr, SwFrame* 
pFrame = nullptr);
 void UpdateGetReferences();
+void UpdateStyleReferences();
 };
 
 class SW_DLLPUBLIC SwGetRefField final : public SwField
diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx 
b/sw/source/core/doc/DocumentFieldsManager.cxx
index fc604900a139..204803ffb870 100644
--- a/sw/source/core/doc/DocumentFieldsManager.cxx
+++ b/sw/source/core/doc/DocumentFieldsManager.cxx
@@ -1351,6 +1351,11 @@ void DocumentFieldsManager::UpdatePageFields( 
SfxPoolItem* pMsgHint )
 case SwFieldIds::DocStat:
 pFieldType->CallSwClientNotify(sw::LegacyModifyHint(nullptr, 
nullptr));
 break;
+case SwFieldIds::GetRef:
+
static_cast(pFieldType)->UpdateStyleReferences();
+// Style references can vary across different pages (e.g. in 
header/footer)
+// so they must be updated when page fields are
+break;
 default: break;
 }
 }
diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index 2720550795ff..552bded828d4 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -707,7 +707,7 @@ void SwGetRefField::UpdateField(const SwTextField* 
pFieldTextAttr, SwFrame* pFra
 rText = pTextNd->GetExpandText(pLayout, nStart, nEnd - 
nStart, false, false,
false, ExpandMode(0));
 }
-FilterText(m_sText, GetLanguage(), m_sSetReferenceLanguage);
+FilterText(rText, GetLanguage(), m_sSetReferenceLanguage);
 }
 }
 break;
@@ -1168,6 +1168,33 @@ void SwGetRefFieldType::UpdateGetReferences()
 CallSwClientNotify(sw::LegacyModifyHint(nullptr, nullptr));
 }
 
+void SwGetRefFieldType::UpdateStyleReferences()
+{
+std::vector vFields;
+GatherFields(vFields, false);
+bool bModified = false;
+for(auto pFormatField: vFields)
+{
+// update only the GetRef fields which are also STYLEREF fields
+SwGetRefField* pGRef = 
static_cast(pFormatField->GetField());
+
+if (pGRef->GetSubType() != REF_STYLE) continue;
+
+const SwTextField* pTField;
+if(!pGRef->GetLanguage() &&
+nullptr != (pTField = pFormatField->GetTextField()) &&
+pTField->GetpTextNode())
+{
+
pGRef->SetLanguage(pTField->GetpTextNode()->GetLang(pTField->GetStart()));
+}
+
+pGRef->UpdateField(pFormatField->GetTextField(), nullptr);
+bModified = true;
+}
+if (bModified)
+CallSwClientNotify(sw::LegacyModifyHint(nullptr, nullptr));
+}
+
 void SwGetRefFieldType::SwClientNotify(const SwModify&, const SfxHint& rHint)
 {
 if (rHint.GetId() != SfxHintId::SwLegacyModify)


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - include/xmloff schema/libreoffice xmloff/inc xmloff/source

2023-10-24 Thread Skyler Grey (via logerrit)
 include/xmloff/xmltoken.hxx |2 
 schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng |   10 
 xmloff/inc/txtfld.hxx   |   28 
 xmloff/inc/txtflde.hxx  |8 +++
 xmloff/inc/txtfldi.hxx  |2 
 xmloff/source/core/xmltoken.cxx |2 
 xmloff/source/text/txtflde.cxx  |   22 -
 xmloff/source/text/txtfldi.cxx  |   13 +
 xmloff/source/token/tokens.txt  |2 
 9 files changed, 86 insertions(+), 3 deletions(-)

New commits:
commit 7c13e0337f3a784d6f81296f12ae5d3e6aa5370d
Author: Skyler Grey 
AuthorDate: Fri Oct 20 14:30:31 2023 +
Commit: Miklos Vajna 
CommitDate: Wed Oct 25 08:22:01 2023 +0200

Enable STYLEREF flag export/import with ODF

This commit enables exporting the following STYLEREF flags with ODF
- Search from bottom to top
- Hide non numerical

After this commit, the following steps have been implemented
- The document model (I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19)
- The layout (I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19)
- The UI (I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19)
- UNO (Ib664fec059aa1f7f130acc76c253d5d298fa59f7)
- DOCX/ODF filters (here and Ib664fec059aa1f7f130acc76c253d5d298fa59f7)

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

diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 5bb8528c81e6..1fb203e3469c 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -1604,6 +1604,8 @@ namespace xmloff::token {
 XML_REFERENCE,
 XML_REFERENCE_END,
 XML_REFERENCE_FORMAT,
+XML_REFERENCE_FROM_BOTTOM,
+XML_REFERENCE_HIDE_NON_NUMERICAL,
 XML_REFERENCE_MARK,
 XML_REFERENCE_MARK_END,
 XML_REFERENCE_MARK_START,
diff --git a/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng 
b/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
index 5f5040173bb8..c02dcf8925be 100644
--- a/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
+++ b/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
@@ -2078,6 +2078,16 @@ 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.
 
   
 
+
+  
+
+  
+
+
+  
+
+  
+
   
 
   
diff --git a/xmloff/inc/txtfld.hxx b/xmloff/inc/txtfld.hxx
new file mode 100644
index ..c562644a5f18
--- /dev/null
+++ b/xmloff/inc/txtfld.hxx
@@ -0,0 +1,28 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/** @#file
+ *  Constants, helpers etc. that need to be shared between text field import
+ *  and export
+ */
+
+#pragma once
+
+#define REFFLDFLAG_STYLE_FROM_BOTTOM 0xc100
+#define REFFLDFLAG_STYLE_HIDE_NON_NUMERICAL 0xc200
diff --git a/xmloff/inc/txtflde.hxx b/xmloff/inc/txtflde.hxx
index 459dea29f550..dd4f3c698c73 100644
--- a/xmloff/inc/txtflde.hxx
+++ b/xmloff/inc/txtflde.hxx
@@ -28,6 +28,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -239,6 +240,13 @@ private:
   bool i_bAutoStyles, bool i_bProgress,
   bool & rPrevCharIsSpace);
 
+
+void ProcessBoolean(
+enum ::xmloff::token::XMLTokenEnum eXmlName,/// attribute token
+bool bBool, /// attribute value
+bool bDefault,
+sal_uInt16 nPrefix); /// namespace
+
 /// export a boolean attribute
 void ProcessBoolean(
 enum ::xmloff::token::XMLTokenEnum eXmlName,/// attribute token 
(namespace text)
diff --git a/xmloff/inc/txtfldi.hxx b/xmloff/inc/txtfldi.hxx
index 0a15329c31ec..3f87010e022d 100644
--- a/xmloff/inc/txtfldi.hxx
+++ b/xmloff/inc/txtfldi.hxx
@@ -34,6 +34,7 @@
 #i

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

2023-10-23 Thread Skyler Grey (via logerrit)
 offapi/com/sun/star/text/textfield/GetReference.idl |4 
 sw/inc/unoprnms.hxx |1 +
 sw/source/core/fields/reffld.cxx|   10 ++
 sw/source/core/inc/unofldmid.h  |2 ++
 sw/source/core/unocore/unofield.cxx |   12 +++-
 sw/source/core/unocore/unomap.cxx   |1 +
 sw/source/filter/ww8/ww8atr.cxx |   11 +++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx   |   18 ++
 writerfilter/source/dmapper/PropertyIds.cxx |1 +
 writerfilter/source/dmapper/PropertyIds.hxx |1 +
 10 files changed, 60 insertions(+), 1 deletion(-)

New commits:
commit ce4c591f3bb9f0a7f97ce73d434991c061d1adb5
Author: Skyler Grey 
AuthorDate: Fri Oct 20 13:07:12 2023 +
Commit: Miklos Vajna 
CommitDate: Tue Oct 24 08:38:16 2023 +0200

Enable STYLEREF flag export/import with OOXML

This commit enables exporting the following STYLEREF flags with OOXML
- Search from bottom to top
- Hide non numerical

After this commit, the following steps have been implemented
- The document model (I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19)
- The layout (I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19)
- The UI (I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19)
- UNO
- DOCX filter

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

diff --git a/offapi/com/sun/star/text/textfield/GetReference.idl 
b/offapi/com/sun/star/text/textfield/GetReference.idl
index 11bfc92b7705..c686b00b23cf 100644
--- a/offapi/com/sun/star/text/textfield/GetReference.idl
+++ b/offapi/com/sun/star/text/textfield/GetReference.idl
@@ -62,6 +62,10 @@ published service GetReference
 
  */
 [optional, property] string ReferenceFieldLanguage;
+/** contains extra flags which can modify the behaviour of the field
+@since LibreOffice 24.2
+ */
+[optional, property] short ReferenceFieldFlags;
 };
 
 
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index 9d484371ed5f..31b032c1d59b 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -312,6 +312,7 @@ inline constexpr OUStringLiteral 
UNO_NAME_PAGE_NUMBER_OFFSET = u"PageNumberOffse
 inline constexpr OUStringLiteral UNO_NAME_PLACEHOLDER = u"PlaceHolder";
 inline constexpr OUStringLiteral UNO_NAME_PLACEHOLDER_TYPE = 
u"PlaceHolderType";
 inline constexpr OUStringLiteral UNO_NAME_PRINT = u"Print";
+inline constexpr OUStringLiteral UNO_NAME_REFERENCE_FIELD_FLAGS = 
u"ReferenceFieldFlags";
 inline constexpr OUStringLiteral UNO_NAME_REFERENCE_FIELD_PART = 
u"ReferenceFieldPart";
 inline constexpr OUStringLiteral UNO_NAME_REFERENCE_FIELD_SOURCE = 
u"ReferenceFieldSource";
 inline constexpr OUStringLiteral UNO_NAME_REFERENCE_FIELD_LANGUAGE = 
u"ReferenceFieldLanguage";
diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index d7e2e6ff75fd..2720550795ff 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -975,6 +975,9 @@ bool SwGetRefField::QueryValue( uno::Any& rAny, sal_uInt16 
nWhichId ) const
 rAny <<= nSource;
 }
 break;
+case FIELD_PROP_USHORT3:
+rAny <<= m_nFlags;
+break;
 case FIELD_PROP_PAR1:
 {
 OUString sTmp(GetPar1());
@@ -1077,6 +1080,13 @@ bool SwGetRefField::PutValue( const uno::Any& rAny, 
sal_uInt16 nWhichId )
 case FIELD_PROP_PAR4:
 rAny >>= m_sSetReferenceLanguage;
 break;
+case FIELD_PROP_USHORT3:
+{
+sal_uInt16 nSetFlags = 0;
+rAny >>= nSetFlags;
+m_nFlags = nSetFlags;
+}
+break;
 case FIELD_PROP_SHORT1:
 {
 sal_Int16 nSetSeq = 0;
diff --git a/sw/source/core/inc/unofldmid.h b/sw/source/core/inc/unofldmid.h
index 59f4583f3d6f..8c1838f45636 100644
--- a/sw/source/core/inc/unofldmid.h
+++ b/sw/source/core/inc/unofldmid.h
@@ -51,6 +51,8 @@
 #define FIELD_PROP_PAR6 36
 #define FIELD_PROP_PAR7 37
 
+#define FIELD_PROP_USHORT3  38
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/unocore/unofield.cxx 
b/sw/source/core/unocore/unofield.cxx
index 5e74c3434190..63f614a76216 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -1055,6 +1055,7 @@ struct SwFieldProperties_Impl
 sal_Int32   nFormat;
 sal_uInt16  nUSHORT1;
 sal_uInt16  nUSHORT2;
+sal_uInt16  nUSHORT3;
 sal_Int16   nSHORT1;
 sal_Int8nByte1;
 boolbFormatIsDefault;
@@ -1070,6 +1071,7 @@ struct SwFieldProperties_Impl
 nFormat(0),
 nUSHORT1(0),
 nUSHORT2(0),
+nUSHORT3(0),
 nSHORT1(0),
 nByte1(

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

2023-10-20 Thread Skyler Grey (via logerrit)
 sw/inc/crsrsh.hxx   |2 
 sw/inc/reffld.hxx   |   27 ++
 sw/qa/extras/uiwriter/uiwriter7.cxx |   15 -
 sw/source/core/crsr/crstrvl.cxx |4 
 sw/source/core/fields/reffld.cxx|   99 +++--
 sw/source/core/text/EnhancedPDFExportHelper.cxx |2 
 sw/source/core/unocore/unofield.cxx |1 
 sw/source/filter/ww8/ww8par5.cxx|8 
 sw/source/ui/fldui/fldref.cxx   |   37 ++-
 sw/source/ui/fldui/fldref.hxx   |4 
 sw/source/uibase/fldui/fldmgr.cxx   |   21 +-
 sw/source/uibase/inc/wrtsh.hxx  |2 
 sw/source/uibase/shells/textsh1.cxx |3 
 sw/source/uibase/wrtsh/move.cxx |4 
 sw/source/uibase/wrtsh/wrtsh2.cxx   |3 
 sw/uiconfig/swriter/ui/fldrefpage.ui|  239 ++--
 16 files changed, 307 insertions(+), 164 deletions(-)

New commits:
commit ff93cd6c71c5fdf7a89948bad79dc8d19a39f903
Author: Skyler Grey 
AuthorDate: Fri Oct 20 09:02:57 2023 +
Commit: Miklos Vajna 
CommitDate: Fri Oct 20 16:51:49 2023 +0200

Add flags to STYLEREF

This commit is part of an implementation for the following STYLEREF flags
- Search from bottom to top, which sets the STYLEREF field to search
  downwards first, or from the bottom of the page in marginals
- Hide non numerical, which hides all characters that are not either
  numbers or punctuation commonly used as delimiters. For example, if
  your STYLEREF said "Chapter 2.1", this setting would make it say "2.1"

This commit implements:
- The document model
- The layout
- The UI

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

diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 639b29f3ed98..4694ae9ca578 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -698,7 +698,7 @@ public:
 bool SelectNxtPrvHyperlink( bool bNext );
 
 bool GotoRefMark( const OUString& rRefMark, sal_uInt16 nSubType,
-sal_uInt16 nSeqNo );
+sal_uInt16 nSeqNo, sal_uInt16 nFlags );
 
 // get the nth character from the start or end of the  current selection
 sal_Unicode GetChar( bool bEnd = true, tools::Long nOffset = 0 );
diff --git a/sw/inc/reffld.hxx b/sw/inc/reffld.hxx
index bf9d563ab2ac..293b913c406b 100644
--- a/sw/inc/reffld.hxx
+++ b/sw/inc/reffld.hxx
@@ -34,6 +34,20 @@ class SwFrame;
 bool IsFrameBehind( const SwTextNode& rMyNd, sal_Int32 nMySttPos,
 const SwTextNode& rBehindNd, sal_Int32 nSttPos );
 
+#define REFFLDFLAG  0x4000
+#define REFFLDFLAG_BOOKMARK 0x4800
+#define REFFLDFLAG_FOOTNOTE 0x5000
+#define REFFLDFLAG_ENDNOTE  0x6000
+// #i83479#
+#define REFFLDFLAG_HEADING  0x7100
+#define REFFLDFLAG_NUMITEM  0x7200
+
+#define REFFLDFLAG_STYLE0xc000
+/* we skip past 0x8000, 0x9000, 0xa000 and 0xb000 as when we bitwise 'and'
+   with REFFLDFLAG they are false */
+#define REFFLDFLAG_STYLE_FROM_BOTTOM   0xc100
+#define REFFLDFLAG_STYLE_HIDE_NON_NUMERICAL0xc200
+
 enum REFERENCESUBTYPE
 {
 REF_SETREFATTR = 0,
@@ -81,7 +95,7 @@ public:
 void MergeWithOtherDoc( SwDoc& rDestDoc );
 
 static SwTextNode* FindAnchor( SwDoc* pDoc, const OUString& rRefMark,
-sal_uInt16 nSubType, sal_uInt16 nSeqNo,
+sal_uInt16 nSubType, sal_uInt16 
nSeqNo, sal_uInt16 nFlags,
 sal_Int32* pStt, sal_Int32* pEnd = 
nullptr,
 SwRootFrame const* pLayout = nullptr,
 SwTextNode* pSelf = nullptr, SwFrame* 
pFrame = nullptr);
@@ -98,13 +112,18 @@ private:
 sal_uInt16 m_nSubType;
 /// reference to either a SwTextFootnote::m_nSeqNo or a 
SwSetExpField::mnSeqNo
 sal_uInt16 m_nSeqNo;
+sal_uInt16 m_nFlags;
 
 virtual OUStringExpandImpl(SwRootFrame const* pLayout) const override;
 virtual std::unique_ptr Copy() const override;
 
+/// Strip out text that is not either a number or a delimiter. Used in 
STYLEREF for when you
+/// have chapters labelled "Chapter X.Y" and want to just keep the "X.Y". 
Distinct from
+/// GetExpandedTextOfReferencedTextNode so you can run it after any other 
processing
+void StylerefStripNonnumerical(OUString& rText) const;
 public:
 SwGetRefField( SwGetRefFieldType*, OUString aSetRef, OUString 
aReferenceLanguage,
-sal_uInt16 nSubType, sal_uInt16 nSeqNo, sal_uLong nFormat 
);
+sal_uInt16 nSubType, sal_uInt16 nSeqNo, sal_uInt16 nFlags, 
sal_uLong nFormat );
 
 virtual ~SwGetRefField() override;
 
@@ -140,6 +159,10

[Libreoffice-commits] core.git: include/xmloff offapi/com schema/libreoffice sw/inc sw/qa sw/source writerfilter/source xmloff/inc xmloff/source

2023-10-19 Thread Skyler Grey (via logerrit)
 include/xmloff/xmltoken.hxx |1 
 offapi/com/sun/star/text/ReferenceFieldSource.idl   |5 
 schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng |   23 
 sw/inc/fldref.hrc   |1 
 sw/inc/reffld.hxx   |   22 
 sw/qa/core/fields/data/tdf86790.docx|binary
 sw/qa/core/fields/fields.cxx|  228 +
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx|2 
 sw/qa/extras/uiwriter/uiwriter8.cxx |6 
 sw/source/core/access/accpara.cxx   |3 
 sw/source/core/crsr/crstrvl.cxx |   10 
 sw/source/core/fields/reffld.cxx|  484 +---
 sw/source/core/text/txtfld.cxx  |   10 
 sw/source/filter/ww8/wrtww8.hxx |3 
 sw/source/filter/ww8/ww8atr.cxx |   87 +-
 sw/source/filter/ww8/ww8par5.cxx|7 
 sw/source/ui/fldui/fldref.cxx   |   70 +
 sw/source/ui/fldui/fldref.hxx   |1 
 sw/source/uibase/docvw/edtwin2.cxx  |2 
 sw/source/uibase/fldui/fldmgr.cxx   |3 
 sw/source/uibase/utlui/content.cxx  |2 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx   |   55 +
 writerfilter/source/dmapper/FieldTypes.hxx  |5 
 xmloff/inc/txtflde.hxx  |1 
 xmloff/source/core/xmltoken.cxx |1 
 xmloff/source/text/txtflde.cxx  |   32 
 xmloff/source/text/txtfldi.cxx  |5 
 xmloff/source/token/tokens.txt  |1 
 28 files changed, 920 insertions(+), 150 deletions(-)

New commits:
commit 32c588dd1164aa2fc4c8120ddb74bd510cc082f9
Author: Skyler Grey 
AuthorDate: Thu Sep 14 08:48:16 2023 +
Commit: Miklos Vajna 
CommitDate: Fri Oct 20 08:53:34 2023 +0200

tdf#86790: Add support for a word-style styleref

STYLEREF is a field type in Word which changes its content based on
nearby paragraphs. For example, upon creating a styleref referencing
"Heading 1" you will see the text of the nearest "Heading 1"-styled
paragraph that is above the field.

This patch implements STYLEREF in Writer as a cross-reference. By using
"insert>cross-reference>styles" you'll be presented with a list of
styles. Selecting one and clicking "insert" will create a field which
has text from the "most relevant" instance of the style. To find the
most relevant instance we first search up for paragraphs with the style,
and if there are any we take the closest. If there weren't any, we
search down for paragraphs with the style.

This patch also updates our use of STYLEREF for chapters exported to
docx by using it for all chapters not only those in headers and footers.
This allows us to approximate more chapter field functionality even when
moving between Writer and Word.

Finally, this patch adds some tests for STYLEREF:
- testTdf86790 tests that the "sample file with STYLEREF" document from
  tdf#86790 has the correct fields
- testStyleRefSearchUp tests that the STYLEREF searches up when there
  are bits of text both above and below it
- testStyleRefSearchDown tests that the STYLEREF searches down when
  there are bits of text below it only
- testMarginalStyleRef tests that the STYLEREF searches from the page
  top when it is placed in a footer
- testFootnotetyleRef tests that the STYLEREF searches from the
  reference mark when it is placed in a footnote

Still TODO:
- [  ] Update documentation
- [  ] Implement reverse-searching (\l) and nondelimiter
   suppression (\t)
   - Probably these 2 will be in a followup patch

Change-Id: I25dd7a6940abee5651a784b9059fe23b32547d6c
Signed-off-by: Skyler Grey 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157456
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 773d54f79318..00d0d5f349e1 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -1902,6 +1902,7 @@ namespace xmloff::token {
 XML_STRUCTURE_PROTECTED,
 XML_STYLE,
 XML_STYLE_NAME,
+XML_STYLE_REF,
 XML_STYLES,
 XML_STYLESHEET,
 XML_SUB_TABLE,
diff --git a/offapi/com/sun/star/text/ReferenceFieldSource.idl 
b/offapi/com/sun/star/text/ReferenceFieldSource.idl
index 1892fdc04cd8..91295fef2844 100644
--- a/offapi/com/sun/star/text/ReferenceFieldSource.idl
+++ b/offapi/com/sun/star/text/ReferenceField

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

2023-10-18 Thread Skyler Grey (via logerrit)
 sw/inc/reffld.hxx |   20 -
 sw/qa/core/fields/data/tdf86790.docx  |binary
 sw/qa/core/fields/fields.cxx  |  228 ++
 sw/qa/extras/uiwriter/uiwriter7.cxx   |   15 -
 sw/qa/extras/uiwriter/uiwriter8.cxx   |6 
 sw/source/core/fields/reffld.cxx  |   73 ++-
 sw/source/core/text/txtfld.cxx|7 
 sw/source/core/txtnode/atrfld.cxx |2 
 sw/source/core/unocore/unofield.cxx   |2 
 sw/source/filter/ww8/ww8par5.cxx  |8 
 sw/source/ui/fldui/fldref.cxx |6 
 sw/source/uibase/docvw/edtwin2.cxx|2 
 sw/source/uibase/fldui/fldmgr.cxx |   13 -
 sw/source/uibase/utlui/content.cxx|2 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |2 
 xmloff/source/text/txtfldi.cxx|4 
 16 files changed, 287 insertions(+), 103 deletions(-)

New commits:
commit 613249e2b208716aa71580ff0373bb201d9c2697
Author: Skyler Grey 
AuthorDate: Fri Oct 13 09:36:51 2023 +
Commit: Miklos Vajna 
CommitDate: Thu Oct 19 08:18:14 2023 +0200

Add tests for STYLEREF and fix STYLEREF bugs

- testTdf86790 tests that the "sample file with STYLEREF" document from
  tdf#86790 has the correct fields
- testStyleRefSearchUp tests that the STYLEREF searches up when there
  are bits of text both above and below it
- testStyleRefSearchDown tests that the STYLEREF searches down when
  there are bits of text below it only
- testMarginalStyleRef tests that the STYLEREF searches from the page
  top when it is placed in a footer
- testFootnotetyleRef tests that the STYLEREF searches from the
  reference mark when it is placed in a footnote

- As an artifact of changing the STYLEREF namespace from TEXT to LO_EXT
  partway through, some references to STYLEREF being in TEXT still
  remained. This caused STYLEREFs saved to ODF to vanish on import. This
  has been fixed

- Previously STYLEREF kept a pointer to the frame and text node
  containing it. Unfortunately, sometimes these could be destructed and
  the STYLEREF later asked to update which led to a crash due to
  use-after-free. STYLEREF no longer keeps a pointer to these values,
  instead preferring to not update when it is not given them

- As part of the review process for
  I25dd7a6940abee5651a784b9059fe23b32547d6c we added
  SearchForStyleAnchor, a function used only in reffld.cxx, to an
  anonymous namespace. Unfortunately we neglected to do the same for
  StyleRefElementType just above it. This has been fixed

Follow-Up-To: I25dd7a6940abee5651a784b9059fe23b32547d6c
Change-Id: I35dc36197b62fa53def4745da1d4755ece79ed22
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157911
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sw/inc/reffld.hxx b/sw/inc/reffld.hxx
index 28ced8dcc2cb..bf9d563ab2ac 100644
--- a/sw/inc/reffld.hxx
+++ b/sw/inc/reffld.hxx
@@ -99,22 +99,15 @@ private:
 /// reference to either a SwTextFootnote::m_nSeqNo or a 
SwSetExpField::mnSeqNo
 sal_uInt16 m_nSeqNo;
 
-SwTextNode* m_pTextNode; ///< a pointer to the text node which contains 
the field
-SwFrame* m_pFrame; ///< a pointer to the frame which contains the field
-/* m_pTextNode and m_pFrame are used for STYLEREF, for other subtypes 
these will often be nullptr */
-
 virtual OUStringExpandImpl(SwRootFrame const* pLayout) const override;
 virtual std::unique_ptr Copy() const override;
 
 public:
 SwGetRefField( SwGetRefFieldType*, OUString aSetRef, OUString 
aReferenceLanguage,
-sal_uInt16 nSubType, sal_uInt16 nSeqNo, sal_uLong nFormat,
-SwTextNode* pTextNode, SwFrame* pFrame );
+sal_uInt16 nSubType, sal_uInt16 nSeqNo, sal_uLong nFormat 
);
 
 virtual ~SwGetRefField() override;
 
-void ChangeExpansion(SwFrame* pFrame, const SwTextField* pField);
-
 virtual OUString GetFieldName() const override;
 
 const OUString& GetSetRefName() const { return m_sSetRefName; }
@@ -126,9 +119,9 @@ public:
and REF_STYLE.
Note: This instance may be NULL (field in Undo/Redo). This will cause
no update for these reference format types. */
-voidUpdateField( const SwTextField* pFieldTextAttr );
-voidUpdateField( const SwTextField* pFieldTextAttr, const 
SwRootFrame* const pLayout,
- OUString& rText );
+voidUpdateField( const SwTextField* pFieldTextAttr, 
SwFrame* pFrame );
+voidUpdateField( const SwTextField* pFieldTextAttr, 
SwFrame* pFrame,
+ const SwRootFrame* const pLayout, 
OUString& rText );
 
  

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

2023-10-14 Thread Skyler Grey (via logerrit)
 cui/source/tabpages/numpages.cxx |6 +-
 sw/source/ui/misc/num.cxx|   11 +--
 vcl/inc/jsdialog/jsdialogbuilder.hxx |1 +
 vcl/jsdialog/enabled.cxx |1 +
 vcl/jsdialog/jsdialogbuilder.cxx |6 ++
 5 files changed, 14 insertions(+), 11 deletions(-)

New commits:
commit 328d6aae9e2b7a73f6672800629230f5b46d15b1
Author: Skyler Grey 
AuthorDate: Wed Aug 2 08:31:56 2023 +
Commit: Caolán McNamara 
CommitDate: Sat Oct 14 14:30:17 2023 +0200

Re-enable Bullets and Numbering → Customize

- Revert change If0f7b953a40ca1d5f469087cb8f362a949c39b37
- Enable jsdialog for the customize page
- Fix numbering not being selected when switching level
- Fix start at field not having a default when changing level type to one 
that can use it
- Disable types that rely on supporting graphics in LOK as we cannot
  provide them

Change-Id: I2517289b553b8a3e9ed62c64b6514c6aab3702b6
Signed-off-by: Skyler Grey 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153806
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Szymon Kłos 
(cherry picked from commit 6b9415005fee130e9d9b4b005a56975794a47934)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157957
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 45ee580f1667..d1cb79341281 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -52,6 +52,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -1089,7 +1090,9 @@ 
SvxNumOptionsTabPage::SvxNumOptionsTabPage(weld::Container* pPage, weld::DialogC
 sal_uInt32 nCount = SvxNumberingTypeTable::Count();
 for (sal_uInt32 i = 0; i < nCount; ++i)
 {
-m_xFmtLB->append(OUString::number(SvxNumberingTypeTable::GetValue(i)), 
SvxNumberingTypeTable::GetString(i));
+int nValue = SvxNumberingTypeTable::GetValue(i);
+if (comphelper::LibreOfficeKit::isActive() && (nValue & 
SVX_NUM_BITMAP)) continue;
+m_xFmtLB->append(OUString::number(nValue), 
SvxNumberingTypeTable::GetString(i));
 }
 
 // Get advanced numbering types from the component.
@@ -1464,6 +1467,7 @@ void SvxNumOptionsTabPage::InitControls()
 else
 m_xBulColLB->SetNoSelection();
 }
+m_xStartED->set_value(1); // If this isn't set then changing the bullet 
type to a numbered type doesn't reset the start level
 switch(nBullet)
 {
 case SHOW_NUMBERING:
diff --git a/sw/source/ui/misc/num.cxx b/sw/source/ui/misc/num.cxx
index 0764a61be710..91e075d26124 100644
--- a/sw/source/ui/misc/num.cxx
+++ b/sw/source/ui/misc/num.cxx
@@ -873,16 +873,7 @@ 
SwSvxNumBulletTabDialog::SwSvxNumBulletTabDialog(weld::Window* pParent,
 AddTabPage("bullets", RID_SVXPAGE_PICK_BULLET );
 AddTabPage("outlinenum", RID_SVXPAGE_PICK_NUM );
 AddTabPage("graphics", RID_SVXPAGE_PICK_BMP );
-
-if (comphelper::LibreOfficeKit::isActive())
-{
-RemoveTabPage("customize");
-}
-else
-{
-AddTabPage("customize", RID_SVXPAGE_NUM_OPTIONS );
-}
-
+AddTabPage("customize", RID_SVXPAGE_NUM_OPTIONS );
 AddTabPage("position", RID_SVXPAGE_NUM_POSITION );
 }
 
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx 
b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index 33f5bdcbe881..030638e06e75 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -619,6 +619,7 @@ public:
 virtual void set_entry_text_without_notify(const OUString& rText);
 virtual void set_entry_text(const OUString& rText) override;
 virtual void set_active(int pos) override;
+virtual void set_active_id(const OUString& rText) override;
 virtual bool changed_by_direct_pick() const override;
 
 void render_entry(int pos, int dpix, int dpiy);
diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index 78aa703a8b6e..c61be13c2b7c 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -53,6 +53,7 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool 
bMobile)
 || rUIFile == u"cui/ui/linetabpage.ui"
 || rUIFile == u"cui/ui/macroselectordialog.ui"
 || rUIFile == u"cui/ui/numberingformatpage.ui"
+|| rUIFile == u"cui/ui/numberingoptionspage.ui"
 || rUIFile == u"cui/ui/numberingpositionpage.ui"
 || rUIFile == u"cui/ui/optlingupage.ui"
 || rUIFile == u"cui/ui/pageformatpage.ui"
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index ec0c4fec1573..91e09663bef1 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -1665,6 +1665,12 @@ void JSComboBox::set_active(int pos)
 sendUpdate();
 }
 
+void JSComboBox::set_active_id(const OUString& rStr)
+{
+sal_uInt16 nPos = find_id(rStr);
+set_active(nPos);
+}
+
 bool JSComboBox::changed_by_direct_pick() co

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - configure.ac desktop/qa desktop/source download.lst external/java_websocket external/Module_external.mk include/LibreOfficeKit incl

2023-09-01 Thread Skyler Grey (via logerrit)
 Makefile.fetch   |
1 
 RepositoryExternal.mk|   
12 
 configure.ac |   
11 
 desktop/qa/desktop_lib/test_desktop_lib.cxx  |
4 
 desktop/source/lib/init.cxx  |  
227 +++
 download.lst |
5 
 external/Module_external.mk  |
1 
 external/java_websocket/ExternalPackage_java_websocket.mk|   
16 
 external/java_websocket/ExternalProject_java_websocket.mk|   
31 
 external/java_websocket/Makefile |
7 
 external/java_websocket/Module_java_websocket.mk |   
18 
 external/java_websocket/README   |
3 
 external/java_websocket/UnpackedTarball_java_websocket.mk|   
21 
 external/java_websocket/patches/ant-build.patch  |   
26 
 external/java_websocket/patches/no-slf4j.patch   |  
748 ++
 include/LibreOfficeKit/LibreOfficeKit.h  |
9 
 include/LibreOfficeKit/LibreOfficeKit.hxx|   
26 
 include/sal/log-areas.dox|
1 
 readlicense_oo/license/license.xml   |   
18 
 ridljar/Jar_libreoffice.mk   |
8 
 ridljar/com/sun/star/comp/helper/Bootstrap.java  |   
63 
 ridljar/com/sun/star/lib/connections/websocket/ConnectionDescriptor.java |   
60 
 ridljar/com/sun/star/lib/connections/websocket/WebsocketConnection.java  |  
335 
 ridljar/com/sun/star/lib/connections/websocket/websocketConnector.java   |  
137 +
 ridljar/source/libreoffice/module-info.java  |
1 
 ridljar/util/manifest|
3 
 ure/source/README|
2 
 27 files changed, 1792 insertions(+), 2 deletions(-)

New commits:
commit fe2a3980b4749ca6b60f17eed53afb14ef9f8ce9
Author: Skyler Grey 
AuthorDate: Fri Aug 18 13:30:35 2023 +
Commit: Caolán McNamara 
CommitDate: Fri Sep 1 21:34:10 2023 +0200

Add a FunctionBasedURPConnection and a websocket URP connector

- FunctionBasedURPConnection is used to enable a client to open a URP
  connection to a fresh Kit instance in COOL.
- This URP connector can be used with that and
  https://github.com/CollaboraOnline/online/pull/6992 to use a Java Uno
  Remote Protocol client over websockets
- For interoperability with existing Collabora Online websockets a
  prefix (urp ) is added to each message sent and a similar prefix
  (urp: ) is expected on each message recieved. This allows sending over
  the same websocket as other data is being transmitted through. If you
  are writing a bridge to work with this, you will need to add/strip the
  prefixes accordingly
- This commit uses Java WebSocket
  (https://github.com/TooTallNate/Java-WebSocket) to send data over
  websockets.

Change-Id: I2bda3d0b988bef7883f9b6829eeb5b7ae8075f27
Signed-off-by: Skyler Grey 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155100
Reviewed-by: Michael Meeks 
Tested-by: Jenkins CollaboraOffice 

diff --git a/Makefile.fetch b/Makefile.fetch
index 8295de2ab366..eb9acb0bd5a7 100644
--- a/Makefile.fetch
+++ b/Makefile.fetch
@@ -135,6 +135,7 @@ $(WORKDIR)/download: $(BUILDDIR)/config_$(gb_Side).mk 
$(SRCDIR)/download.lst $(S
$(call fetch_Optional,HYPHEN,HYPHEN_TARBALL) \
$(call fetch_Optional,ICU,ICU_TARBALL) \
$(call fetch_Optional,ICU,ICU_DATA_TARBALL) \
+   $(call fetch_Optional,JAVA_WEBSOCKET,JAVA_WEBSOCKET_TARBALL) \
$(call 
fetch_Optional,JFREEREPORT,JFREEREPORT_FLOW_ENGINE_TARBALL) \
$(call fetch_Optional,JFREEREPORT,JFREEREPORT_FLUTE_TARBALL) \
$(call fetch_Optional,JFREEREPORT,JFREEREPORT_LIBBASE_TARBALL) \
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index c4e9f4dac874..3cfff4ecea58 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -3728,7 +3728,6 @@ endef
 
 endif # SYSTEM_HSQLDB
 
-
 ifeq ($(ENABLE_SCRIPTING_BEANSHELL),TRUE)
 
 ifneq ($(SYSTEM_BSH),)
@@ -3887,6 +3886,17 @@ endef
 
 endif # SYSTEM_JFREEREPORT
 
+# no known distro packaged java-websocket
+
+ifeq ($(ENABLE_JAVA),TRUE)
+$(eval $(call gb_Helper_register_jars_for_install,URE,ure, \
+   java_websocket \
+))
+endif
+
+define gb_Jar__use_java_websocket
+$(call gb_Jar_use_jar,$(1),java_websocket)
+endef
 
 # Executables
 
di

[Libreoffice-commits] core.git: configure.ac desktop/qa desktop/source download.lst external/java_websocket external/Module_external.mk include/LibreOfficeKit include/sal Makefile.fetch readlicense_oo

2023-09-01 Thread Skyler Grey (via logerrit)
 Makefile.fetch   |
1 
 RepositoryExternal.mk|   
11 
 configure.ac |   
11 
 desktop/qa/desktop_lib/test_desktop_lib.cxx  |
4 
 desktop/source/lib/init.cxx  |  
227 +++
 download.lst |
5 
 external/Module_external.mk  |
1 
 external/java_websocket/ExternalPackage_java_websocket.mk|   
16 
 external/java_websocket/ExternalProject_java_websocket.mk|   
31 
 external/java_websocket/Makefile |
7 
 external/java_websocket/Module_java_websocket.mk |   
18 
 external/java_websocket/README   |
3 
 external/java_websocket/UnpackedTarball_java_websocket.mk|   
21 
 external/java_websocket/patches/ant-build.patch  |   
26 
 external/java_websocket/patches/no-slf4j.patch   |  
748 ++
 include/LibreOfficeKit/LibreOfficeKit.h  |
9 
 include/LibreOfficeKit/LibreOfficeKit.hxx|   
26 
 include/sal/log-areas.dox|
1 
 readlicense_oo/license/license.xml   |   
18 
 ridljar/Jar_libreoffice.mk   |
8 
 ridljar/com/sun/star/comp/helper/Bootstrap.java  |   
63 
 ridljar/com/sun/star/lib/connections/websocket/ConnectionDescriptor.java |   
60 
 ridljar/com/sun/star/lib/connections/websocket/WebsocketConnection.java  |  
335 
 ridljar/com/sun/star/lib/connections/websocket/websocketConnector.java   |  
137 +
 ridljar/source/libreoffice/module-info.java  |
1 
 ridljar/util/manifest|
3 
 ure/source/README|
2 
 27 files changed, 1792 insertions(+), 1 deletion(-)

New commits:
commit 8e246331f6f71320cfcc8defdd04e756a75f71cf
Author: Skyler Grey 
AuthorDate: Fri Aug 18 13:30:35 2023 +
Commit: Caolán McNamara 
CommitDate: Fri Sep 1 16:55:37 2023 +0200

Add a FunctionBasedURPConnection and a websocket URP connector

- FunctionBasedURPConnection is used to enable a client to open a URP
  connection to a fresh Kit instance in COOL.
- This URP connector can be used with that and
  https://github.com/CollaboraOnline/online/pull/6992 to use a Java Uno
  Remote Protocol client over websockets
- For interoperability with existing Collabora Online websockets a
  prefix (urp ) is added to each message sent and a similar prefix
  (urp: ) is expected on each message recieved. This allows sending over
  the same websocket as other data is being transmitted through. If you
  are writing a bridge to work with this, you will need to add/strip the
  prefixes accordingly
- This commit uses Java WebSocket
  (https://github.com/TooTallNate/Java-WebSocket) to send data over
  websockets.

Change-Id: I2bda3d0b988bef7883f9b6829eeb5b7ae8075f27
Signed-off-by: Skyler Grey 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151171
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/Makefile.fetch b/Makefile.fetch
index 625e781dc36a..6640b0ade985 100644
--- a/Makefile.fetch
+++ b/Makefile.fetch
@@ -136,6 +136,7 @@ $(WORKDIR)/download: $(BUILDDIR)/config_$(gb_Side).mk 
$(SRCDIR)/download.lst $(S
$(call fetch_Optional,HYPHEN,HYPHEN_TARBALL) \
$(call fetch_Optional,ICU,ICU_TARBALL) \
$(call fetch_Optional,ICU,ICU_DATA_TARBALL) \
+   $(call fetch_Optional,JAVA_WEBSOCKET,JAVA_WEBSOCKET_TARBALL) \
$(call 
fetch_Optional,JFREEREPORT,JFREEREPORT_FLOW_ENGINE_TARBALL) \
$(call fetch_Optional,JFREEREPORT,JFREEREPORT_FLUTE_TARBALL) \
$(call fetch_Optional,JFREEREPORT,JFREEREPORT_LIBBASE_TARBALL) \
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 0d70c7e966fb..a7f6dc3897ec 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -3915,6 +3915,17 @@ endef
 
 endif # SYSTEM_JFREEREPORT
 
+# no known distro packaged Java-Websocket at present
+
+ifeq ($(ENABLE_JAVA),TRUE)
+$(eval $(call gb_Helper_register_jars_for_install,URE,ure, \
+   java_websocket \
+))
+endif
+
+define gb_Jar__use_java_websocket
+$(call gb_Jar_use_jar,$(1),java_websocket)
+endef
 
 # Executables
 
diff --git a/configure.ac b/configure.ac
index 5ce8454546c4..5a682dde4d61 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12690,6 +1

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

2023-08-09 Thread Skyler Grey (via logerrit)
 cui/source/tabpages/numpages.cxx |6 +-
 sw/source/ui/misc/num.cxx|   11 +--
 vcl/inc/jsdialog/jsdialogbuilder.hxx |1 +
 vcl/jsdialog/enabled.cxx |1 +
 vcl/jsdialog/jsdialogbuilder.cxx |6 ++
 5 files changed, 14 insertions(+), 11 deletions(-)

New commits:
commit 6b9415005fee130e9d9b4b005a56975794a47934
Author: Skyler Grey 
AuthorDate: Wed Aug 2 08:31:56 2023 +
Commit: Szymon Kłos 
CommitDate: Wed Aug 9 13:18:43 2023 +0200

Re-enable Bullets and Numbering → Customize

- Revert change If0f7b953a40ca1d5f469087cb8f362a949c39b37
- Enable jsdialog for the customize page
- Fix numbering not being selected when switching level
- Fix start at field not having a default when changing level type to one 
that can use it
- Disable types that rely on supporting graphics in LOK as we cannot
  provide them

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

diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 9b97d19460b5..1f5de3dc387b 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -52,6 +52,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -1089,7 +1090,9 @@ 
SvxNumOptionsTabPage::SvxNumOptionsTabPage(weld::Container* pPage, weld::DialogC
 sal_uInt32 nCount = SvxNumberingTypeTable::Count();
 for (sal_uInt32 i = 0; i < nCount; ++i)
 {
-m_xFmtLB->append(OUString::number(SvxNumberingTypeTable::GetValue(i)), 
SvxNumberingTypeTable::GetString(i));
+int nValue = SvxNumberingTypeTable::GetValue(i);
+if (comphelper::LibreOfficeKit::isActive() && (nValue & 
SVX_NUM_BITMAP)) continue;
+m_xFmtLB->append(OUString::number(nValue), 
SvxNumberingTypeTable::GetString(i));
 }
 
 // Get advanced numbering types from the component.
@@ -1464,6 +1467,7 @@ void SvxNumOptionsTabPage::InitControls()
 else
 m_xBulColLB->SetNoSelection();
 }
+m_xStartED->set_value(1); // If this isn't set then changing the bullet 
type to a numbered type doesn't reset the start level
 switch(nBullet)
 {
 case SHOW_NUMBERING:
diff --git a/sw/source/ui/misc/num.cxx b/sw/source/ui/misc/num.cxx
index 137b6db9f015..a5caff53a0c8 100644
--- a/sw/source/ui/misc/num.cxx
+++ b/sw/source/ui/misc/num.cxx
@@ -873,16 +873,7 @@ 
SwSvxNumBulletTabDialog::SwSvxNumBulletTabDialog(weld::Window* pParent,
 AddTabPage("bullets", RID_SVXPAGE_PICK_BULLET );
 AddTabPage("outlinenum", RID_SVXPAGE_PICK_NUM );
 AddTabPage("graphics", RID_SVXPAGE_PICK_BMP );
-
-if (comphelper::LibreOfficeKit::isActive())
-{
-RemoveTabPage("customize");
-}
-else
-{
-AddTabPage("customize", RID_SVXPAGE_NUM_OPTIONS );
-}
-
+AddTabPage("customize", RID_SVXPAGE_NUM_OPTIONS );
 AddTabPage("position", RID_SVXPAGE_NUM_POSITION );
 }
 
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx 
b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index 060a3e1bb72a..8ed7743c96dd 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -623,6 +623,7 @@ public:
 virtual void set_entry_text_without_notify(const OUString& rText);
 virtual void set_entry_text(const OUString& rText) override;
 virtual void set_active(int pos) override;
+virtual void set_active_id(const OUString& rText) override;
 virtual bool changed_by_direct_pick() const override;
 };
 
diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index 647cec05602b..4db6b0da9113 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -53,6 +53,7 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool 
bMobile)
 || rUIFile == u"cui/ui/linetabpage.ui"
 || rUIFile == u"cui/ui/macroselectordialog.ui"
 || rUIFile == u"cui/ui/numberingformatpage.ui"
+|| rUIFile == u"cui/ui/numberingoptionspage.ui"
 || rUIFile == u"cui/ui/numberingpositionpage.ui"
 || rUIFile == u"cui/ui/optlingupage.ui"
 || rUIFile == u"cui/ui/pageformatpage.ui"
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 5740e300ae9a..9d1bc1774165 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -1665,6 +1665,12 @@ void JSComboBox::set_active(int pos)
 sendUpdate();
 }
 
+void JSComboBox::set_active_id(const OUString& rStr)
+{
+sal_uInt16 nPos = find_id(rStr);
+set_active(nPos);
+}
+
 bool JSComboBox::changed_by_direct_pick() const { return true; }
 
 JSNotebook::JSNotebook(JSDialogSender* pSender, ::TabControl* pControl,


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

2023-07-06 Thread Skyler Grey (via logerrit)
 sw/source/ui/dialog/uiregionsw.cxx |  102 ++---
 vcl/jsdialog/enabled.cxx   |1 
 2 files changed, 53 insertions(+), 50 deletions(-)

New commits:
commit 6aff11f36ecd02613c0613c9e89883c81656d9f6
Author: Skyler Grey 
AuthorDate: Sun Feb 19 13:13:05 2023 +
Commit: Szymon Kłos 
CommitDate: Thu Jul 6 11:48:41 2023 +0200

Make the format > sections > options dialog a jsdialog

- This dialog was not properly tunneled so did not show on collabora
  online
- Running asynchronously as a jsdialog both fixes this issue and is a
  general improvement (in that jsdialog conversion improves
  accessability, looks more consistent with the rest of COOL, etc.)

Note- This commit was previously given the Change-Id
  Ie9a70da70bbb30de039ded82f738285b1b734421 however I have replaced
  it due to accidentally creating it against the wrong base branch.
  To see the old change go to
  https://gerrit.libreoffice.org/c/core/+/147295

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

diff --git a/sw/source/ui/dialog/uiregionsw.cxx 
b/sw/source/ui/dialog/uiregionsw.cxx
index f3560e8f2b67..89248e7eed8d 100644
--- a/sw/source/ui/dialog/uiregionsw.cxx
+++ b/sw/source/ui/dialog/uiregionsw.cxx
@@ -1048,57 +1048,59 @@ IMPL_LINK_NOARG(SwEditRegionDlg, OptionsHdl, 
weld::Button&, void)
 aSet.Put(SwFormatFrameSize(SwFrameSize::Variable, nWidth));
 aSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(nWidth, nWidth)));
 
-SwSectionPropertyTabDialog aTabDlg(m_xDialog.get(), aSet, m_rSh);
-if (RET_OK != aTabDlg.run())
-return;
-
-const SfxItemSet* pOutSet = aTabDlg.GetOutputItemSet();
-if( !(pOutSet && pOutSet->Count()) )
-return;
-
-const SwFormatCol* pColItem = pOutSet->GetItemIfSet(
-RES_COL, false );
-const SvxBrushItem* pBrushItem = pOutSet->GetItemIfSet(
-RES_BACKGROUND, false );
-const SwFormatFootnoteAtTextEnd* pFootnoteItem = pOutSet->GetItemIfSet(
-RES_FTN_AT_TXTEND, false );
-const SwFormatEndAtTextEnd* pEndItem = pOutSet->GetItemIfSet(
-RES_END_AT_TXTEND, false );
-const SwFormatNoBalancedColumns* pBalanceItem = pOutSet->GetItemIfSet(
-RES_COLUMNBALANCE, false );
-const SvxFrameDirectionItem* pFrameDirItem = pOutSet->GetItemIfSet(
-RES_FRAMEDIR, false );
-const SvxLRSpaceItem* pLRSpaceItem = pOutSet->GetItemIfSet(
-RES_LR_SPACE, false );
-
-if( !(pColItem ||
-  pBrushItem ||
-  pFootnoteItem ||
-  pEndItem ||
-  pBalanceItem ||
-  pFrameDirItem ||
-  pLRSpaceItem) )
-return;
-
-m_xTree->selected_foreach([&](weld::TreeIter& rEntry)
-{
-SectRepr* pRepr = weld::fromId(m_xTree->get_id(rEntry));
-if (pColItem)
-pRepr->GetCol() = *pColItem;
-if (pBrushItem)
-pRepr->GetBackground().reset(pBrushItem->Clone());
-if (pFootnoteItem)
-pRepr->GetFootnoteNtAtEnd() = *pFootnoteItem;
-if (pEndItem)
-pRepr->GetEndNtAtEnd() = *pEndItem;
-if (pBalanceItem)
-pRepr->GetBalance().SetValue(pBalanceItem->GetValue());
-if (pFrameDirItem)
-pRepr->GetFrameDir()->SetValue(pFrameDirItem->GetValue());
-if (pLRSpaceItem)
-pRepr->GetLRSpace().reset(pLRSpaceItem->Clone());
-return false;
+auto pDlg = std::make_shared(m_xDialog.get(), 
aSet, m_rSh);
+SfxTabDialogController::runAsync(pDlg, [pDlg, this](sal_Int32 nResult){
+if (nResult == RET_OK) {
+const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
+if( !(pOutSet && pOutSet->Count()) )
+return;
+
+const SwFormatCol* pColItem = pOutSet->GetItemIfSet(
+RES_COL, false );
+const SvxBrushItem* pBrushItem = pOutSet->GetItemIfSet(
+RES_BACKGROUND, false );
+const SwFormatFootnoteAtTextEnd* pFootnoteItem = 
pOutSet->GetItemIfSet(
+RES_FTN_AT_TXTEND, false );
+const SwFormatEndAtTextEnd* pEndItem = pOutSet->GetItemIfSet(
+RES_END_AT_TXTEND, false );
+const SwFormatNoBalancedColumns* pBalanceItem = 
pOutSet->GetItemIfSet(
+RES_COLUMNBALANCE, false );
+const SvxFrameDirectionItem* pFrameDirItem = pOutSet->GetItemIfSet(
+RES_FRAMEDIR, false );
+const SvxLRSpaceItem* pLRSpaceItem = pOutSet->GetItemIfSet(
+  

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

2022-11-21 Thread Skyler Grey (via logerrit)
 sw/source/ui/dialog/swdlgfact.cxx |   22 +
 sw/source/ui/dialog/swdlgfact.hxx |   14 
 sw/source/ui/frmdlg/cption.cxx|   34 -
 sw/source/uibase/shells/tabsh.cxx |   60 --
 vcl/jsdialog/enabled.cxx  |5 ++-
 5 files changed, 90 insertions(+), 45 deletions(-)

New commits:
commit 19d02a1267cfa1e7a950af31a77d4a7888594630
Author: Skyler Grey 
AuthorDate: Fri Aug 12 10:31:42 2022 +0100
Commit: Szymon Kłos 
CommitDate: Mon Nov 21 11:17:21 2022 +0100

Make the number format dialog an async jsdialog

- The dialog needs to be async in order for multiple people to be able
  to use it at once
- If we don't make the item set a shared pointer, we will crash out with
  an error when we try to copy it after the OK button is pressed
- As the dialog is tabbed, we need to enable the dialog for all UI files
  that the dialog uses rather than just the main dialog UI file

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

diff --git a/sw/source/ui/dialog/swdlgfact.cxx 
b/sw/source/ui/dialog/swdlgfact.cxx
index 68135716fcb9..56bce661390d 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -110,6 +110,16 @@ short SwAbstractSfxController_Impl::Execute()
 return m_xDlg->run();
 }
 
+short AbstractNumFormatDlg_Impl::Execute()
+{
+return m_xDlg->run();
+}
+
+bool AbstractNumFormatDlg_Impl::StartExecuteAsync(AsyncContext &rCtx)
+{
+return SfxSingleTabDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
+}
+
 short AbstractSwAsciiFilterDlg_Impl::Execute()
 {
 return m_xDlg->run();
@@ -356,11 +366,21 @@ const SfxItemSet* 
SwAbstractSfxController_Impl::GetOutputItemSet() const
 return m_xDlg->GetOutputItemSet();
 }
 
+const SfxItemSet* AbstractNumFormatDlg_Impl::GetOutputItemSet() const
+{
+return m_xDlg->GetOutputItemSet();
+}
+
 void SwAbstractSfxController_Impl::SetText(const OUString& rStr)
 {
 m_xDlg->set_title(rStr);
 }
 
+void AbstractNumFormatDlg_Impl::SetText(const OUString& rStr)
+{
+m_xDlg->set_title(rStr);
+}
+
 void AbstractSwAsciiFilterDlg_Impl::FillOptions( SwAsciiOptions& rOptions )
 {
 m_xDlg->FillOptions(rOptions);
@@ -833,7 +853,7 @@ VclPtr 
SwAbstractDialogFactory_Impl::CreateSwBackgroundDialog
 
 VclPtr 
SwAbstractDialogFactory_Impl::CreateNumFormatDialog(weld::Widget* pParent, 
const SfxItemSet& rSet)
 {
-return 
VclPtr::Create(std::make_unique(pParent,
 rSet));
+return 
VclPtr::Create(std::make_shared(pParent,
 rSet));
 }
 
 VclPtr 
SwAbstractDialogFactory_Impl::CreateSwAsciiFilterDlg(weld::Window* pParent,
diff --git a/sw/source/ui/dialog/swdlgfact.hxx 
b/sw/source/ui/dialog/swdlgfact.hxx
index c0326249a15b..5e110dfbdd59 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -126,6 +126,20 @@ public:
 virtual void SetText(const OUString& rStr) override;
 };
 
+class AbstractNumFormatDlg_Impl : public SfxAbstractDialog
+{
+std::shared_ptr m_xDlg;
+public:
+explicit 
AbstractNumFormatDlg_Impl(std::shared_ptr p)
+: m_xDlg(std::move(p))
+{
+}
+virtual short Execute() override;
+virtual bool StartExecuteAsync(AsyncContext &rCtx) override;
+virtual const SfxItemSet* GetOutputItemSet() const override;
+virtual void SetText(const OUString& rStr) override;
+};
+
 class AbstractSwAsciiFilterDlg_Impl : public AbstractSwAsciiFilterDlg
 {
 std::unique_ptr m_xDlg;
diff --git a/sw/source/uibase/shells/tabsh.cxx 
b/sw/source/uibase/shells/tabsh.cxx
index ab93b027e69f..3082c5e36e98 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -695,58 +695,62 @@ void SwTableShell::Execute(SfxRequest &rReq)
 FieldUnit eMetric = ::GetDfltMetric(dynamic_cast( 
pView) !=  nullptr );
 SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< 
sal_uInt16 >(eMetric)));
 SvNumberFormatter* pFormatter = rSh.GetNumberFormatter();
-SfxItemSetFixed
-aCoreSet( GetPool() );
+auto pCoreSet = 
std::make_shared>( GetPool() );
 
 SfxItemSetFixed
- aBoxSet( *aCoreSet.GetPool() );
+ aBoxSet( *pCoreSet->GetPool() );
 rSh.GetTableBoxFormulaAttrs( aBoxSet );
 
 SfxItemState eState = aBoxSet.GetItemState(RES_BOXATR_FORMAT);
 if(eState == SfxItemState::DEFAULT)
 {
-aCoreSet.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE,
+pCoreSet->Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE,
 pFormatter->GetFormatIndex(NF_TEXT, LANGUAGE_

[Libreoffice-commits] core.git: 2 commits - include/sfx2 sfx2/source sw/source vcl/jsdialog

2022-11-20 Thread Skyler Grey (via logerrit)
 include/sfx2/dinfdlg.hxx |   19 +
 sfx2/source/dialog/dinfdlg.cxx   |  115 ---
 sw/source/ui/frmdlg/cption.cxx   |7 ++
 sw/source/uibase/inc/cption.hxx  |1 
 sw/source/uibase/uiview/viewdlg2.cxx |   11 ++-
 vcl/jsdialog/enabled.cxx |7 +-
 6 files changed, 106 insertions(+), 54 deletions(-)

New commits:
commit 9a0a7ae8f62cc8233b71057caa6bc88c69ee94a1
Author: Skyler Grey 
AuthorDate: Fri Aug 19 12:23:20 2022 +0100
Commit: Szymon Kłos 
CommitDate: Sun Nov 20 15:34:05 2022 +0100

Make the insert caption dialog an async jsdialog

- Using StartExecuteAsync instead of Execute to execute the dialog makes
  it run asyncly
- We need to add a handler for the OK button, otherwise the event won't
  be fired when it's clicked. There seem to be varying names for this
  throughout the codebase, I've chosen OKHdl as it's short, appears to
  be relatively common and fits well with the existing OptionHdl and
  CaptionHdl that the other buttons on the dialog use
- Lastly, we need to enable the JSDialog builder in
  vcl/jsdialog/enabled.cxx so that the dialog becomes a JSDialog

Still TODO:
- Convert the dialogs that open when you press "auto" or "options"
  buttons (will be in a followup review)

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

diff --git a/sw/source/ui/frmdlg/cption.cxx b/sw/source/ui/frmdlg/cption.cxx
index 01ebc9d685c4..8b3c14afe0a6 100644
--- a/sw/source/ui/frmdlg/cption.cxx
+++ b/sw/source/ui/frmdlg/cption.cxx
@@ -138,6 +138,7 @@ SwCaptionDialog::SwCaptionDialog(weld::Window *pParent, 
SwView &rV)
 m_xSepEdit->connect_changed(aLk);
 
 m_xFormatBox->connect_changed(LINK(this, SwCaptionDialog, 
SelectListBoxHdl));
+m_xOKButton->connect_clicked(LINK(this, SwCaptionDialog, OKHdl));
 m_xOptionButton->connect_clicked(LINK(this, SwCaptionDialog, OptionHdl));
 m_xAutoCaptionButton->connect_clicked(LINK(this, SwCaptionDialog, 
CaptionHdl));
 
m_xAutoCaptionButton->set_accessible_description(SwResId(STR_A11Y_DESC_AUTO));
@@ -267,6 +268,12 @@ SwCaptionDialog::SwCaptionDialog(weld::Window *pParent, 
SwView &rV)
 DrawSample();
 }
 
+IMPL_LINK_NOARG(SwCaptionDialog, OKHdl, weld::Button&, void)
+{
+Apply();
+m_xDialog->response(RET_OK);
+}
+
 void SwCaptionDialog::Apply()
 {
 InsCaptionOpt aOpt;
diff --git a/sw/source/uibase/inc/cption.hxx b/sw/source/uibase/inc/cption.hxx
index 0a7bc9ef64c7..5ff685a8cedf 100644
--- a/sw/source/uibase/inc/cption.hxx
+++ b/sw/source/uibase/inc/cption.hxx
@@ -64,6 +64,7 @@ class SwCaptionDialog final : public SfxDialogController
 DECL_LINK(ModifyComboHdl, weld::ComboBox&, void);
 DECL_LINK(OptionHdl, weld::Button&, void);
 DECL_LINK(CaptionHdl, weld::Button&, void);
+DECL_LINK(OKHdl, weld::Button&, void);
 
 void Apply();
 
diff --git a/sw/source/uibase/uiview/viewdlg2.cxx 
b/sw/source/uibase/uiview/viewdlg2.cxx
index eed4eddcc064..19678d38fdcb 100644
--- a/sw/source/uibase/uiview/viewdlg2.cxx
+++ b/sw/source/uibase/uiview/viewdlg2.cxx
@@ -46,15 +46,18 @@
 
 using namespace css;
 
-void SwView::ExecDlgExt(SfxRequest const &rReq)
+void SwView::ExecDlgExt(SfxRequest const& rReq)
 {
-switch ( rReq.GetSlot() )
+switch (rReq.GetSlot())
 {
 case FN_INSERT_CAPTION:
 {
 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
-ScopedVclPtr 
pDialog(pFact->CreateSwCaptionDialog(GetFrameWeld(), *this ));
-pDialog->Execute();
+VclPtr pDialog(
+pFact->CreateSwCaptionDialog(GetFrameWeld(), *this));
+pDialog->StartExecuteAsync([pDialog](sal_Int32) {
+pDialog->disposeOnce();
+});
 break;
 }
 case SID_INSERT_SIGNATURELINE:
diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index 6923056183af..89b50c96fab1 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -69,7 +69,8 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool 
bMobile)
 || rUIFile == u"sfx/ui/documentpropertiesdialog.ui"
 || rUIFile == u"sfx/ui/custominfopage.ui" || rUIFile == 
u"sfx/ui/cmisinfopage.ui"
 || rUIFile == u"sfx/ui/descriptioninfopage.ui" || rUIFile == 
u"sfx/ui/documentinfopage.ui"
-|| rUIFile == u"sfx/ui/linefragment.ui" || rUIFile == 
u"sfx/ui/editdurationdialog.ui")
+|| rUIFile == u"sfx/ui/linefragment.ui" || rUIFile == 
u"sfx/ui/editdurationdialog.ui"
+|| rUIFile == u"modules/swriter/ui/insertcaption.ui")
 {
 return true;
 }
commit 930b96dee6250eb8d51f25e2e1020bd1e028db03
Author: NickWingate 
AuthorDate: Tue Aug 

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

2022-11-20 Thread Skyler Grey (via logerrit)
 cui/uiconfig/ui/widgettestdialog.ui |1 +
 vcl/jsdialog/enabled.cxx|3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 6179026d162a4281ae158ccca7897f6059f1338c
Author: Skyler Grey 
AuthorDate: Wed Jul 27 16:46:24 2022 +
Commit: Szymon Kłos 
CommitDate: Sun Nov 20 10:42:36 2022 +0100

Add a title to the widget test dialog

- Previously the widget test dialog didn't have a title, however most of
  the other dialogs do. This commit adds a title to the dialog

Signed-off-by: Skyler Grey 
Change-Id: I8b61e00e93cd71a6a7bf068537d9cbcdc735753d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137534
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Rashesh Padia 
Reviewed-by: Pedro Silva 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142975
Tested-by: Jenkins
Reviewed-by: Szymon Kłos 

diff --git a/cui/uiconfig/ui/widgettestdialog.ui 
b/cui/uiconfig/ui/widgettestdialog.ui
index ce8e52879fec..787deda37171 100644
--- a/cui/uiconfig/ui/widgettestdialog.ui
+++ b/cui/uiconfig/ui/widgettestdialog.ui
@@ -4,6 +4,7 @@
   
   
 False
+Test Widgets
 dialog
 
   
commit 318d6175f2cf4328bbd6e88f4f64adfe314d759b
Author: Skyler Grey 
AuthorDate: Thu Aug 4 11:24:19 2022 +0100
Commit: Szymon Kłos 
CommitDate: Sun Nov 20 10:42:24 2022 +0100

Enable JSDialogs on the split cells dialog

- This dialog works properly when JSDialog rendering is enabled for it
- This dialog is already async, so there aren't multi-user issues like
  there are on some other dialogs

Signed-off-by: Skyler Grey 
Change-Id: I036ca7ab15e0ab472ff961ef643053f8f6771c0f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137791
Reviewed-by: Szymon Kłos 
Tested-by: Jenkins CollaboraOffice 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142973
Tested-by: Jenkins

diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index 3d830d07cf56..6cad5ecad14e 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -64,7 +64,8 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool 
bMobile)
 || rUIFile == u"cui/ui/widgettestdialog.ui"
 || rUIFile == u"modules/swriter/ui/contentcontroldlg.ui"
 || rUIFile == u"modules/swriter/ui/contentcontrollistitemdlg.ui"
-|| rUIFile == u"modules/swriter/ui/splittable.ui")
+|| rUIFile == u"modules/swriter/ui/splittable.ui"
+|| rUIFile == u"cui/ui/splitcellsdialog.ui")
 {
 return true;
 }


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

2022-11-20 Thread Skyler Grey (via logerrit)
 sw/source/ui/dialog/swdlgfact.cxx |7 ++-
 sw/source/ui/dialog/swdlgfact.hxx |5 +++--
 sw/source/uibase/inc/splittbl.hxx |   12 +++-
 sw/source/uibase/shells/tabsh.cxx |   18 ++
 vcl/jsdialog/enabled.cxx  |3 ++-
 5 files changed, 36 insertions(+), 9 deletions(-)

New commits:
commit b5d3a3ac031d055e433eb2b79b48f6d00fb0e0d6
Author: Skyler Grey 
AuthorDate: Wed Aug 3 09:54:45 2022 +0100
Commit: Szymon Kłos 
CommitDate: Sun Nov 20 10:40:49 2022 +0100

Turn the split table dialog into an async JSDialog

- Previously the split table dialog was not an async dialog, and it
  wasn't a JSDialog either
- A non-async dialog has issues when multiple people try to change
  something using the dialog at the same time. Generally the changes
  from one person will not be applied until all people who opened the
  dialog later than them have submitted
- This PR makes the dialog async, fixing multi-user issues with it
- This PR makes the dialog into a JSDialog, rendering it on the client
  with native HTML elements

Signed-off-by: Skyler Grey 
Change-Id: I9254bc1b635531c8b38d1ade76f99ffdda145b35
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137741
Reviewed-by: Szymon Kłos 
Tested-by: Jenkins CollaboraOffice 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142972
Tested-by: Jenkins

diff --git a/sw/source/ui/dialog/swdlgfact.cxx 
b/sw/source/ui/dialog/swdlgfact.cxx
index 6e9ebc873ab7..68135716fcb9 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -120,6 +120,11 @@ short AbstractSplitTableDialog_Impl::Execute()
 return m_xDlg->run();
 }
 
+bool AbstractSplitTableDialog_Impl::StartExecuteAsync(AsyncContext &rCtx)
+{
+return weld::GenericDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
+}
+
 short AbstractSwTableWidthDlg_Impl::Execute()
 {
 return m_xDlg->run();
@@ -978,7 +983,7 @@ VclPtr 
SwAbstractDialogFactory_Impl::CreateSwSortingDialog(we
 
 VclPtr 
SwAbstractDialogFactory_Impl::CreateSplitTableDialog(weld::Window *pParent, 
SwWrtShell &rSh)
 {
-return 
VclPtr::Create(std::make_unique(pParent,
 rSh));
+return 
VclPtr::Create(std::make_shared(pParent,
 rSh));
 }
 
 VclPtr 
SwAbstractDialogFactory_Impl::CreateSwSelGlossaryDlg(weld::Window *pParent, 
const OUString &rShortName)
diff --git a/sw/source/ui/dialog/swdlgfact.hxx 
b/sw/source/ui/dialog/swdlgfact.hxx
index f97ff430c294..c0326249a15b 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -236,13 +236,14 @@ public:
 
 class AbstractSplitTableDialog_Impl : public AbstractSplitTableDialog // add 
for
 {
-std::unique_ptr m_xDlg;
+std::shared_ptr m_xDlg;
 public:
-explicit AbstractSplitTableDialog_Impl(std::unique_ptr p)
+explicit AbstractSplitTableDialog_Impl(std::shared_ptr p)
 : m_xDlg(std::move(p))
 {
 }
 virtual short Execute() override;
+virtual bool  StartExecuteAsync(AsyncContext &rCtx) override;
 virtual SplitTable_HeadlineOption GetSplitMode() override;
 };
 
diff --git a/sw/source/uibase/inc/splittbl.hxx 
b/sw/source/uibase/inc/splittbl.hxx
index 8c8891c1df1b..0311f08d4043 100644
--- a/sw/source/uibase/inc/splittbl.hxx
+++ b/sw/source/uibase/inc/splittbl.hxx
@@ -49,7 +49,17 @@ public:
 return nRet;
 }
 
-SplitTable_HeadlineOption GetSplitMode() const { return m_nSplit; }
+SplitTable_HeadlineOption GetSplitMode() const
+{
+auto nSplit = SplitTable_HeadlineOption::ContentCopy;
+if (m_xBoxAttrCopyWithParaRB->get_active())
+nSplit = SplitTable_HeadlineOption::BoxAttrAllCopy;
+else if (m_xBoxAttrCopyNoParaRB->get_active())
+nSplit = SplitTable_HeadlineOption::BoxAttrCopy;
+else if (m_xBorderCopyRB->get_active())
+nSplit = SplitTable_HeadlineOption::BorderCopy;
+return nSplit;
+}
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/shells/tabsh.cxx 
b/sw/source/uibase/shells/tabsh.cxx
index 01bd9389c152..ab93b027e69f 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -1082,10 +1082,20 @@ void SwTableShell::Execute(SfxRequest &rReq)
 else
 {
 SwAbstractDialogFactory* pFact = 
SwAbstractDialogFactory::Create();
-ScopedVclPtr 
pDlg(pFact->CreateSplitTableDialog(GetView().GetFrameWeld(), rSh));
-pDlg->Execute();
-rReq.AppendItem( SfxUInt16Item( FN_PARAM_1, 
static_cast(pDlg->GetSplitMode()) ) );
-bCallDone = true;
+VclPtr 
pDlg(pFact->CreateSplitTableDialog(GetView().GetFrameWeld(), rSh));
+
+SwWrtShell* pSh = &rSh;
+
+pDlg->StartExecuteAsync([pDlg, pSh](int nResult) {
+if (nResult == RET_OK)
+{
+con

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

2022-08-22 Thread Skyler Grey (via logerrit)
 sw/source/ui/dialog/swdlgfact.cxx |   22 +-
 sw/source/ui/dialog/swdlgfact.hxx |   14 +
 sw/source/uibase/shells/tabsh.cxx |   58 --
 vcl/jsdialog/enabled.cxx  |4 +-
 4 files changed, 69 insertions(+), 29 deletions(-)

New commits:
commit e6bfcb1e5d64d3cd76ede9019b4ddaac00159144
Author: Skyler Grey 
AuthorDate: Fri Aug 12 10:31:42 2022 +0100
Commit: Szymon Kłos 
CommitDate: Mon Aug 22 14:46:14 2022 +0200

Make the number format dialog an async jsdialog

- The dialog needs to be async in order for multiple people to be able
  to use it at once
- If we don't make the item set a shared pointer, we will crash out with
  an error when we try to copy it after the OK button is pressed
- As the dialog is tabbed, we need to enable the dialog for all UI files
  that the dialog uses rather than just the main dialog UI file

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

diff --git a/sw/source/ui/dialog/swdlgfact.cxx 
b/sw/source/ui/dialog/swdlgfact.cxx
index ba883398486a..4c9eac2c2834 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -110,6 +110,16 @@ short SwAbstractSfxController_Impl::Execute()
 return m_xDlg->run();
 }
 
+short AbstractNumFormatDlg_Impl::Execute()
+{
+return m_xDlg->run();
+}
+
+bool AbstractNumFormatDlg_Impl::StartExecuteAsync(AsyncContext &rCtx)
+{
+return SfxSingleTabDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
+}
+
 short AbstractSwAsciiFilterDlg_Impl::Execute()
 {
 return m_xDlg->run();
@@ -356,11 +366,21 @@ const SfxItemSet* 
SwAbstractSfxController_Impl::GetOutputItemSet() const
 return m_xDlg->GetOutputItemSet();
 }
 
+const SfxItemSet* AbstractNumFormatDlg_Impl::GetOutputItemSet() const
+{
+return m_xDlg->GetOutputItemSet();
+}
+
 void SwAbstractSfxController_Impl::SetText(const OUString& rStr)
 {
 m_xDlg->set_title(rStr);
 }
 
+void AbstractNumFormatDlg_Impl::SetText(const OUString& rStr)
+{
+m_xDlg->set_title(rStr);
+}
+
 void AbstractSwAsciiFilterDlg_Impl::FillOptions( SwAsciiOptions& rOptions )
 {
 m_xDlg->FillOptions(rOptions);
@@ -832,7 +852,7 @@ VclPtr 
SwAbstractDialogFactory_Impl::CreateSwBackgroundDialog
 
 VclPtr 
SwAbstractDialogFactory_Impl::CreateNumFormatDialog(weld::Widget* pParent, 
const SfxItemSet& rSet)
 {
-return 
VclPtr::Create(std::make_unique(pParent,
 rSet));
+return 
VclPtr::Create(std::make_shared(pParent,
 rSet));
 }
 
 VclPtr 
SwAbstractDialogFactory_Impl::CreateSwAsciiFilterDlg(weld::Window* pParent,
diff --git a/sw/source/ui/dialog/swdlgfact.hxx 
b/sw/source/ui/dialog/swdlgfact.hxx
index b756a4de614e..ce809d3eaaa4 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -125,6 +125,20 @@ public:
 virtual void SetText(const OUString& rStr) override;
 };
 
+class AbstractNumFormatDlg_Impl : public SfxAbstractDialog
+{
+std::shared_ptr m_xDlg;
+public:
+explicit 
AbstractNumFormatDlg_Impl(std::shared_ptr p)
+: m_xDlg(std::move(p))
+{
+}
+virtual short Execute() override;
+virtual bool StartExecuteAsync(AsyncContext &rCtx) override;
+virtual const SfxItemSet* GetOutputItemSet() const override;
+virtual void SetText(const OUString& rStr) override;
+};
+
 class AbstractSwAsciiFilterDlg_Impl : public AbstractSwAsciiFilterDlg
 {
 std::unique_ptr m_xDlg;
diff --git a/sw/source/uibase/shells/tabsh.cxx 
b/sw/source/uibase/shells/tabsh.cxx
index 4d83dd1ec756..9fbd241f3f20 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -695,57 +695,61 @@ void SwTableShell::Execute(SfxRequest &rReq)
 FieldUnit eMetric = ::GetDfltMetric(dynamic_cast( 
pView) !=  nullptr );
 SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< 
sal_uInt16 >(eMetric)));
 SvNumberFormatter* pFormatter = rSh.GetNumberFormatter();
-SfxItemSetFixed
-aCoreSet( GetPool() );
+auto pCoreSet = 
std::make_shared>( GetPool() );
 
 SfxItemSetFixed
- aBoxSet( *aCoreSet.GetPool() );
+ aBoxSet( *pCoreSet->GetPool() );
 rSh.GetTableBoxFormulaAttrs( aBoxSet );
 
 SfxItemState eState = aBoxSet.GetItemState(RES_BOXATR_FORMAT);
 if(eState == SfxItemState::DEFAULT)
 {
-aCoreSet.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE,
+pCoreSet->Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE,
 pFormatter->GetFormatIndex(NF_TEXT, LANGUAGE_SYSTEM)));
 }
 else
-aCoreSet.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE,
+  

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

2022-08-21 Thread Skyler Grey (via logerrit)
 sw/source/ui/frmdlg/cption.cxx |   34 +++---
 vcl/jsdialog/enabled.cxx   |3 ++-
 2 files changed, 21 insertions(+), 16 deletions(-)

New commits:
commit 62a2c025eb9704dde8c78e86eef1231c2a6cdffc
Author: Skyler Grey 
AuthorDate: Wed Aug 17 13:17:25 2022 +0100
Commit: Szymon Kłos 
CommitDate: Mon Aug 22 07:40:50 2022 +0200

Make the insert caption options an async jsdialog

- In https://gerrit.libreoffice.org/c/core/+/138313, the insert caption
  dialog was converted to an async jsdialog. It has 2 subdialogs which
  it opens when you press the 'options' and 'auto' buttons
- This review converts the first of these (the options dialog) to an
  async jsdialog as well, bringing it up to parity with the parent
  dialog

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

diff --git a/sw/source/ui/frmdlg/cption.cxx b/sw/source/ui/frmdlg/cption.cxx
index 8d8752fb7783..f22e881a0210 100644
--- a/sw/source/ui/frmdlg/cption.cxx
+++ b/sw/source/ui/frmdlg/cption.cxx
@@ -311,21 +311,25 @@ IMPL_LINK_NOARG(SwCaptionDialog, OptionHdl, 
weld::Button&, void)
 OUString sFieldTypeName = m_xCategoryBox->get_active_text();
 if(sFieldTypeName == m_sNone)
 sFieldTypeName.clear();
-SwSequenceOptionDialog aDlg(m_xDialog.get(), rView, sFieldTypeName);
-aDlg.SetApplyBorderAndShadow(bCopyAttributes);
-aDlg.SetCharacterStyle( sCharacterStyle );
-aDlg.SetOrderNumberingFirst( bOrderNumberingFirst );
-aDlg.run();
-bCopyAttributes = aDlg.IsApplyBorderAndShadow();
-sCharacterStyle = aDlg.GetCharacterStyle();
-//#i61007# order of captions
-if( bOrderNumberingFirst != aDlg.IsOrderNumberingFirst() )
-{
-bOrderNumberingFirst = aDlg.IsOrderNumberingFirst();
-
SW_MOD()->GetModuleConfig()->SetCaptionOrderNumberingFirst(bOrderNumberingFirst);
-ApplyCaptionOrder();
-}
-DrawSample();
+auto pDlg = std::make_shared(m_xDialog.get(), 
rView, sFieldTypeName);
+pDlg->SetApplyBorderAndShadow(bCopyAttributes);
+pDlg->SetCharacterStyle( sCharacterStyle );
+pDlg->SetOrderNumberingFirst( bOrderNumberingFirst );
+
+GenericDialogController::runAsync(pDlg, [pDlg, this](sal_Int32 nResult){
+if (nResult == RET_OK) {
+bCopyAttributes = pDlg->IsApplyBorderAndShadow();
+sCharacterStyle = pDlg->GetCharacterStyle();
+//#i61007# order of captions
+if( bOrderNumberingFirst != pDlg->IsOrderNumberingFirst() )
+{
+bOrderNumberingFirst = pDlg->IsOrderNumberingFirst();
+
SW_MOD()->GetModuleConfig()->SetCaptionOrderNumberingFirst(bOrderNumberingFirst);
+ApplyCaptionOrder();
+}
+DrawSample();
+}
+});
 }
 
 IMPL_LINK_NOARG(SwCaptionDialog, SelectListBoxHdl, weld::ComboBox&, void)
diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index f608dad9f3e8..2b4e2fcf3957 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -67,7 +67,8 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool 
bMobile)
 || rUIFile == u"sfx/ui/custominfopage.ui" || rUIFile == 
u"sfx/ui/cmisinfopage.ui"
 || rUIFile == u"sfx/ui/descriptioninfopage.ui" || rUIFile == 
u"sfx/ui/documentinfopage.ui"
 || rUIFile == u"sfx/ui/linefragment.ui" || rUIFile == 
u"sfx/ui/editdurationdialog.ui"
-|| rUIFile == u"modules/swriter/ui/insertcaption.ui")
+|| rUIFile == u"modules/swriter/ui/insertcaption.ui"
+|| rUIFile == u"modules/swriter/ui/captionoptions.ui")
 {
 return true;
 }


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

2022-08-21 Thread Skyler Grey (via logerrit)
 sw/source/ui/frmdlg/cption.cxx   |7 +++
 sw/source/uibase/inc/cption.hxx  |1 +
 sw/source/uibase/uiview/viewdlg2.cxx |   11 +++
 vcl/jsdialog/enabled.cxx |   10 --
 4 files changed, 19 insertions(+), 10 deletions(-)

New commits:
commit 6b36c22cd3197e79ac3420bdca98eb5574b64f81
Author: Skyler Grey 
AuthorDate: Fri Aug 19 12:23:20 2022 +0100
Commit: Szymon Kłos 
CommitDate: Mon Aug 22 07:40:24 2022 +0200

Make the insert caption dialog an async jsdialog

- Using StartExecuteAsync instead of Execute to execute the dialog makes
  it run asyncly
- We need to add a handler for the OK button, otherwise the event won't
  be fired when it's clicked. There seem to be varying names for this
  throughout the codebase, I've chosen OKHdl as it's short, appears to
  be relatively common and fits well with the existing OptionHdl and
  CaptionHdl that the other buttons on the dialog use
- Lastly, we need to enable the JSDialog builder in
  vcl/jsdialog/enabled.cxx so that the dialog becomes a JSDialog

Still TODO:
- Convert the dialogs that open when you press "auto" or "options"
  buttons (will be in a followup review)

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

diff --git a/sw/source/ui/frmdlg/cption.cxx b/sw/source/ui/frmdlg/cption.cxx
index 867e16fa56dc..8d8752fb7783 100644
--- a/sw/source/ui/frmdlg/cption.cxx
+++ b/sw/source/ui/frmdlg/cption.cxx
@@ -137,6 +137,7 @@ SwCaptionDialog::SwCaptionDialog(weld::Window *pParent, 
SwView &rV)
 m_xSepEdit->connect_changed(aLk);
 
 m_xFormatBox->connect_changed(LINK(this, SwCaptionDialog, 
SelectListBoxHdl));
+m_xOKButton->connect_clicked(LINK(this, SwCaptionDialog, OKHdl));
 m_xOptionButton->connect_clicked(LINK(this, SwCaptionDialog, OptionHdl));
 m_xAutoCaptionButton->connect_clicked(LINK(this, SwCaptionDialog, 
CaptionHdl));
 
@@ -265,6 +266,12 @@ SwCaptionDialog::SwCaptionDialog(weld::Window *pParent, 
SwView &rV)
 DrawSample();
 }
 
+IMPL_LINK_NOARG(SwCaptionDialog, OKHdl, weld::Button&, void)
+{
+Apply();
+m_xDialog->response(RET_OK);
+}
+
 void SwCaptionDialog::Apply()
 {
 InsCaptionOpt aOpt;
diff --git a/sw/source/uibase/inc/cption.hxx b/sw/source/uibase/inc/cption.hxx
index b442857a44b8..f5640d2b877b 100644
--- a/sw/source/uibase/inc/cption.hxx
+++ b/sw/source/uibase/inc/cption.hxx
@@ -64,6 +64,7 @@ class SwCaptionDialog final : public SfxDialogController
 DECL_LINK(ModifyComboHdl, weld::ComboBox&, void);
 DECL_LINK(OptionHdl, weld::Button&, void);
 DECL_LINK(CaptionHdl, weld::Button&, void);
+DECL_LINK(OKHdl, weld::Button&, void);
 
 void Apply();
 
diff --git a/sw/source/uibase/uiview/viewdlg2.cxx 
b/sw/source/uibase/uiview/viewdlg2.cxx
index dd0da7acef95..c1131f1f590b 100644
--- a/sw/source/uibase/uiview/viewdlg2.cxx
+++ b/sw/source/uibase/uiview/viewdlg2.cxx
@@ -46,15 +46,18 @@
 
 using namespace css;
 
-void SwView::ExecDlgExt(SfxRequest const &rReq)
+void SwView::ExecDlgExt(SfxRequest const& rReq)
 {
-switch ( rReq.GetSlot() )
+switch (rReq.GetSlot())
 {
 case FN_INSERT_CAPTION:
 {
 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
-ScopedVclPtr 
pDialog(pFact->CreateSwCaptionDialog(GetFrameWeld(), *this ));
-pDialog->Execute();
+VclPtr pDialog(
+pFact->CreateSwCaptionDialog(GetFrameWeld(), *this));
+pDialog->StartExecuteAsync([pDialog](sal_Int32) {
+pDialog->disposeOnce();
+});
 break;
 }
 case SID_INSERT_SIGNATURELINE:
diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index 7c1fe9b6f6b2..f608dad9f3e8 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -64,12 +64,10 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool 
bMobile)
 || rUIFile == u"modules/swriter/ui/splittable.ui"
 || rUIFile == u"cui/ui/splitcellsdialog.ui"
 || rUIFile == u"sfx/ui/documentpropertiesdialog.ui"
-|| rUIFile == u"sfx/ui/custominfopage.ui"
-|| rUIFile == u"sfx/ui/cmisinfopage.ui"
-|| rUIFile == u"sfx/ui/descriptioninfopage.ui"
-|| rUIFile == u"sfx/ui/documentinfopage.ui"
-|| rUIFile == u"sfx/ui/linefragment.ui"
-|| rUIFile == u"sfx/ui/editdurationdialog.ui")
+|| rUIFile == u"sfx/ui/custominfopage.ui" || rUIFile == 
u"sfx/ui/cmisinfopage.ui"
+|| rUIFile == u"sfx/ui/descriptioninfopage.ui" || rUIFile == 
u"sfx/ui/documentinfopage.ui"
+|| rUIFile == u"sfx/ui/linefragment.ui" || rUIFile == 
u"sfx/ui/editdurationdialog.ui"
+|| rUIFile == u"modules/swriter/ui/insertcaption.ui")
 {
 return true;
 }


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

2022-08-05 Thread Skyler Grey (via logerrit)
 vcl/jsdialog/enabled.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit c55f174445db16252957a78a31ca911593f81dc0
Author: Skyler Grey 
AuthorDate: Thu Aug 4 11:24:19 2022 +0100
Commit: Szymon Kłos 
CommitDate: Fri Aug 5 08:56:17 2022 +0200

Enable JSDialogs on the split cells dialog

- This dialog works properly when JSDialog rendering is enabled for it
- This dialog is already async, so there aren't multi-user issues like
  there are on some other dialogs

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

diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index f0d8ed530dcf..e17c93e574f3 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -61,7 +61,8 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool 
bMobile)
 || rUIFile == u"cui/ui/widgettestdialog.ui"
 || rUIFile == u"modules/swriter/ui/contentcontroldlg.ui"
 || rUIFile == u"modules/swriter/ui/contentcontrollistitemdlg.ui"
-|| rUIFile == u"modules/swriter/ui/splittable.ui")
+|| rUIFile == u"modules/swriter/ui/splittable.ui"
+|| rUIFile == u"cui/ui/splitcellsdialog.ui")
 {
 return true;
 }


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

2022-08-04 Thread Skyler Grey (via logerrit)
 sw/source/ui/dialog/swdlgfact.cxx |7 ++-
 sw/source/ui/dialog/swdlgfact.hxx |5 +++--
 sw/source/ui/table/splittbl.cxx   |   11 +--
 sw/source/uibase/inc/splittbl.hxx |   12 ++--
 sw/source/uibase/shells/tabsh.cxx |   18 ++
 vcl/jsdialog/enabled.cxx  |3 ++-
 6 files changed, 36 insertions(+), 20 deletions(-)

New commits:
commit bcabb3d1891fc67fb4e4b35642c2d55340994ecc
Author: Skyler Grey 
AuthorDate: Wed Aug 3 09:54:45 2022 +0100
Commit: Pedro Silva 
CommitDate: Thu Aug 4 10:24:55 2022 +0200

Turn the split table dialog into an async JSDialog

- Previously the split table dialog was not an async dialog, and it
  wasn't a JSDialog either
- A non-async dialog has issues when multiple people try to change
  something using the dialog at the same time. Generally the changes
  from one person will not be applied until all people who opened the
  dialog later than them have submitted
- This PR makes the dialog async, fixing multi-user issues with it
- This PR makes the dialog into a JSDialog, rendering it on the client
  with native HTML elements

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

diff --git a/sw/source/ui/dialog/swdlgfact.cxx 
b/sw/source/ui/dialog/swdlgfact.cxx
index 17f0ed1d3a03..ba883398486a 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -120,6 +120,11 @@ short AbstractSplitTableDialog_Impl::Execute()
 return m_xDlg->run();
 }
 
+bool AbstractSplitTableDialog_Impl::StartExecuteAsync(AsyncContext &rCtx)
+{
+return weld::GenericDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
+}
+
 short AbstractSwTableWidthDlg_Impl::Execute()
 {
 return m_xDlg->run();
@@ -972,7 +977,7 @@ VclPtr 
SwAbstractDialogFactory_Impl::CreateSwSortingDialog(we
 
 VclPtr 
SwAbstractDialogFactory_Impl::CreateSplitTableDialog(weld::Window *pParent, 
SwWrtShell &rSh)
 {
-return 
VclPtr::Create(std::make_unique(pParent,
 rSh));
+return 
VclPtr::Create(std::make_shared(pParent,
 rSh));
 }
 
 VclPtr 
SwAbstractDialogFactory_Impl::CreateSwSelGlossaryDlg(weld::Window *pParent, 
const OUString &rShortName)
diff --git a/sw/source/ui/dialog/swdlgfact.hxx 
b/sw/source/ui/dialog/swdlgfact.hxx
index 8690d9db8129..b756a4de614e 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -222,13 +222,14 @@ public:
 
 class AbstractSplitTableDialog_Impl : public AbstractSplitTableDialog // add 
for
 {
-std::unique_ptr m_xDlg;
+std::shared_ptr m_xDlg;
 public:
-explicit AbstractSplitTableDialog_Impl(std::unique_ptr p)
+explicit AbstractSplitTableDialog_Impl(std::shared_ptr p)
 : m_xDlg(std::move(p))
 {
 }
 virtual short Execute() override;
+virtual bool  StartExecuteAsync(AsyncContext &rCtx) override;
 virtual SplitTable_HeadlineOption GetSplitMode() override;
 };
 
diff --git a/sw/source/ui/table/splittbl.cxx b/sw/source/ui/table/splittbl.cxx
index 0deb5d03093c..0af89a160121 100644
--- a/sw/source/ui/table/splittbl.cxx
+++ b/sw/source/ui/table/splittbl.cxx
@@ -28,21 +28,12 @@ SwSplitTableDlg::SwSplitTableDlg(weld::Window* pParent, 
SwWrtShell& rSh)
 , m_xBoxAttrCopyNoParaRB(m_xBuilder->weld_radio_button("customheading"))
 , m_xBorderCopyRB(m_xBuilder->weld_radio_button("noheading"))
 , rShell(rSh)
-, m_nSplit(SplitTable_HeadlineOption::ContentCopy)
 {
 }
 
 void SwSplitTableDlg::Apply()
 {
-m_nSplit = SplitTable_HeadlineOption::ContentCopy;
-if (m_xBoxAttrCopyWithParaRB->get_active())
-m_nSplit = SplitTable_HeadlineOption::BoxAttrAllCopy;
-else if (m_xBoxAttrCopyNoParaRB->get_active())
-m_nSplit = SplitTable_HeadlineOption::BoxAttrCopy;
-else if (m_xBorderCopyRB->get_active())
-m_nSplit = SplitTable_HeadlineOption::BorderCopy;
-
-rShell.SplitTable(m_nSplit);
+rShell.SplitTable(GetSplitMode());
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/inc/splittbl.hxx 
b/sw/source/uibase/inc/splittbl.hxx
index 99e61f7d4075..b826914e4720 100644
--- a/sw/source/uibase/inc/splittbl.hxx
+++ b/sw/source/uibase/inc/splittbl.hxx
@@ -34,7 +34,6 @@ private:
 std::unique_ptr m_xBorderCopyRB;
 
 SwWrtShell& rShell;
-SplitTable_HeadlineOption m_nSplit;
 
 void Apply();
 
@@ -49,7 +48,16 @@ public:
 return nRet;
 }
 
-SplitTable_HeadlineOption GetSplitMode() const { return m_nSplit; }
+SplitTable_HeadlineOption GetSplitMode() const {
+auto nSplit = SplitTable_HeadlineOption::ContentCopy;
+if (m_xBoxAttrCopyWithParaRB->get_active())
+nSplit = SplitTable_HeadlineOption::BoxAttrAllCopy;
+else if (m_xBoxAttrCopyNoParaRB->get_active())
+nSplit = SplitTable_Head

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

2022-07-27 Thread Skyler Grey (via logerrit)
 cui/uiconfig/ui/widgettestdialog.ui |1 +
 1 file changed, 1 insertion(+)

New commits:
commit e57f9d1651c5abdce1228f070b5c1f3bd0830d1d
Author: Skyler Grey 
AuthorDate: Wed Jul 27 16:46:24 2022 +
Commit: Pedro Silva 
CommitDate: Thu Jul 28 08:56:36 2022 +0200

Add a title to the widget test dialog

- Previously the widget test dialog didn't have a title, however most of
  the other dialogs do. This commit adds a title to the dialog

Signed-off-by: Skyler Grey 
Change-Id: I8b61e00e93cd71a6a7bf068537d9cbcdc735753d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137534
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Rashesh Padia 
Reviewed-by: Pedro Silva 

diff --git a/cui/uiconfig/ui/widgettestdialog.ui 
b/cui/uiconfig/ui/widgettestdialog.ui
index ce8e52879fec..787deda37171 100644
--- a/cui/uiconfig/ui/widgettestdialog.ui
+++ b/cui/uiconfig/ui/widgettestdialog.ui
@@ -4,6 +4,7 @@
   
   
 False
+Test Widgets
 dialog