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

2023-07-07 Thread Ashod Nakashian (via logerrit)
 sfx2/source/dialog/dinfdlg.cxx |   10 ++
 1 file changed, 10 insertions(+)

New commits:
commit 8017dc98b9037fff3df24ef7cc5a575dc40d2bb8
Author: Ashod Nakashian 
AuthorDate: Tue Jul 4 02:13:28 2023 -0400
Commit: Ashod Nakashian 
CommitDate: Fri Jul 7 21:37:04 2023 +0200

sfx2: disable setting password on text documents

Since we can't preserve the password in a plain-text
file, we should disable the ability to set/change
it. Otherwise, it's misleading to users.

Signed-off-by: Ashod Nakashian 
Change-Id: I3176243ddd2826eb07def1ff5ab251e33cb7125e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153918
Reviewed-by: Jaume Pujantell 
Tested-by: Jenkins CollaboraOffice 

diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 71eeafc6ff6f..c8f68fdaa9ba 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -1025,6 +1025,16 @@ void SfxDocumentPage::Reset( const SfxItemSet* rSet )
 {
 m_xFileValEd->set_label(aName);
 m_xFileValEd->set_uri(aName);
+
+// Disable setting/changing password on text files.
+// Perhaps this needs to be done for both Online and Desktop.
+OUString sExtension(INetURLObject(rMainURL).getExtension());
+if (!sExtension.isEmpty())
+{
+sExtension = sExtension.toAsciiLowerCase();
+if (sExtension.equalsAscii("txt") || sExtension.equalsAscii("csv"))
+m_xChangePassBtn->set_sensitive(false);
+}
 }
 else
 {


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

2023-06-02 Thread Henry Castro (via logerrit)
 sfx2/source/control/unoctitm.cxx |   10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit fc8270f06eca5ba2ba25673a424b36d9e352f62a
Author: Henry Castro 
AuthorDate: Thu Jun 1 11:04:13 2023 -0400
Commit: Caolán McNamara 
CommitDate: Fri Jun 2 10:54:24 2023 +0200

lok: sfx2: fix change state "SheetRightToLeft"

The UNO command "SheetRightToLeft" can be disabled

Signed-off-by: Henry Castro 
Change-Id: I54742c9d52eb52e36154e0aac2cdf440771eb177
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152502
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index ab63e7697c91..17d60686e0b5 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -959,8 +959,14 @@ static void InterceptLOKStateChangeEvent(sal_uInt16 nSID, 
SfxViewFrame* pViewFra
 aEvent.FeatureURL.Path == "SpacePara2")
 {
 bool bTemp = false;
-aEvent.State >>= bTemp;
-aBuffer.append(bTemp);
+
+if (aEvent.IsEnabled)
+{
+aEvent.State >>= bTemp;
+aBuffer.append(bTemp);
+}
+else
+aBuffer.append("disabled");
 }
 else if (aEvent.FeatureURL.Path == "CharFontName")
 {


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

2023-05-23 Thread Caolán McNamara (via logerrit)
 sfx2/source/doc/iframe.cxx |   12 
 1 file changed, 4 insertions(+), 8 deletions(-)

New commits:
commit 17b405871d480a2c4319532035aa08ddc1ed7d06
Author: Caolán McNamara 
AuthorDate: Thu Apr 20 20:58:21 2023 +0100
Commit: Caolán McNamara 
CommitDate: Tue May 23 15:32:38 2023 +0200

assume IFrame script/macro support isn't needed

seems undocumented at least

Change-Id: I316e4f4f25ddb7cf6b7bac4d856a721b987207a3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151020
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152148
Tested-by: Jenkins CollaboraOffice 
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/sfx2/source/doc/iframe.cxx b/sfx2/source/doc/iframe.cxx
index e80f4d3cebf9..08dfee998c6d 100644
--- a/sfx2/source/doc/iframe.cxx
+++ b/sfx2/source/doc/iframe.cxx
@@ -166,20 +166,16 @@ sal_Bool SAL_CALL IFrameObject::load(
 uno::Reference < util::XURLTransformer > xTrans( 
util::URLTransformer::create( mxContext ) );
 xTrans->parseStrict( aTargetURL );
 
+INetURLObject aURLObject(aTargetURL.Complete);
+if (aURLObject.GetProtocol() == INetProtocol::Macro || 
aURLObject.isSchemeEqualTo(u"vnd.sun.star.script"))
+return false;
+
 uno::Reference xParentFrame = 
xFrame->getCreator();
 SfxObjectShell* pDoc = SfxMacroLoader::GetObjectShell(xParentFrame);
 
-if (INetURLObject(aTargetURL.Complete).GetProtocol() == 
INetProtocol::Macro)
-{
-if (pDoc && !pDoc->AdjustMacroMode())
-return false;
-}
-
 bool bUpdateAllowed(true);
 if (pDoc)
 {
-// perhaps should only check for file targets, but lets default to 
making it strong
-// unless there is a known need to distinguish
 comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer = 
pDoc->getEmbeddedObjectContainer();
 bUpdateAllowed = 
rEmbeddedObjectContainer.getUserAllowsLinkUpdate();
 }


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

2023-05-22 Thread Caolán McNamara (via logerrit)
 sfx2/source/doc/iframe.cxx |   13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

New commits:
commit 43ed66f2c964e2a1de1c6f8e61318cb11abac6e8
Author: Caolán McNamara 
AuthorDate: Tue Apr 11 10:13:37 2023 +0100
Commit: Andras Timar 
CommitDate: Mon May 22 21:43:45 2023 +0200

set Referer on loading IFrames

so tools, options, security, options,
"block any links from document not..."
applies to their contents.

Change-Id: I04839aea6b07a4a76ac147a85045939ccd9c3c79
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150221
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150751
Reviewed-by: Stephan Bergmann 
(cherry picked from commit acff9ca0579333b45d10ae5f8cd48172f563)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152088
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 

diff --git a/sfx2/source/doc/iframe.cxx b/sfx2/source/doc/iframe.cxx
index 80e0c4e68457..050d5c3f9e0f 100644
--- a/sfx2/source/doc/iframe.cxx
+++ b/sfx2/source/doc/iframe.cxx
@@ -38,6 +38,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -165,14 +166,19 @@ sal_Bool SAL_CALL IFrameObject::load(
 uno::Reference < util::XURLTransformer > xTrans( 
util::URLTransformer::create( mxContext ) );
 xTrans->parseStrict( aTargetURL );
 
+uno::Reference xParentFrame = 
xFrame->getCreator();
+SfxObjectShell* pDoc = SfxMacroLoader::GetObjectShell(xParentFrame);
+
 if (INetURLObject(aTargetURL.Complete).GetProtocol() == 
INetProtocol::Macro)
 {
-uno::Reference xParentFrame = 
xFrame->getCreator();
-SfxObjectShell* pDoc = 
SfxMacroLoader::GetObjectShell(xParentFrame);
 if (pDoc && !pDoc->AdjustMacroMode())
 return false;
 }
 
+OUString sReferer;
+if (pDoc && pDoc->HasName())
+sReferer = pDoc->GetMedium()->GetName();
+
 DBG_ASSERT( !mxFrame.is(), "Frame already existing!" );
 VclPtr pParent = VCLUnoHelper::GetWindow( 
xFrame->getContainerWindow() );
 VclPtr pWin = VclPtr::Create( 
pParent, maFrmDescr.IsFrameBorderOn() );
@@ -197,7 +203,8 @@ sal_Bool SAL_CALL IFrameObject::load(
 
 uno::Sequence < beans::PropertyValue > aProps{
 comphelper::makePropertyValue("PluginMode", sal_Int16(2)),
-comphelper::makePropertyValue("ReadOnly", true)
+comphelper::makePropertyValue("ReadOnly", true),
+comphelper::makePropertyValue("Referer", sReferer)
 };
 uno::Reference < frame::XDispatch > xDisp = mxFrame->queryDispatch( 
aTargetURL, "_self", 0 );
 if ( xDisp.is() )


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

2023-02-13 Thread Szymon Kłos (via logerrit)
 sfx2/source/view/lokhelper.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit ba2d21197affa5678143dd3cb3a2003d57bb6e22
Author: Szymon Kłos 
AuthorDate: Mon Feb 13 13:05:26 2023 +0100
Commit: Henry Castro 
CommitDate: Mon Feb 13 13:01:13 2023 +

lok: escape notifyWindow message

File properties dialog contains problematic characters.
In lok case and nl language it was constructing incorrect
message so boost JSON parser was throwing an exception
and dialog was not created correctly.

Change-Id: I7e81c9407fcbf57355c0890c9540ce1f828904e5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146900
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Henry Castro 

diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index 9f34d31c5766..e61263acc8c6 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -578,8 +578,10 @@ void SfxLokHelper::notifyWindow(const SfxViewShell* 
pThisView,
 {
 if (!rItem.first.isEmpty() && !rItem.second.isEmpty())
 {
-aPayload.append(", \"" + rItem.first + "\": \"" +
-rItem.second).append('"');
+auto aFirst = rItem.first.replaceAll("\"", "\\\"");
+auto aSecond = rItem.second.replaceAll("\"", "\\\"");
+aPayload.append(", \"" + aFirst + "\": \"" +
+aSecond).append('"');
 }
 }
 aPayload.append('}');


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

2023-01-26 Thread Aron Budea (via logerrit)
 sfx2/source/view/lokhelper.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit dc17158c99c8a15fbca57a9a0b0ea7178dcc5a34
Author: Aron Budea 
AuthorDate: Thu Jan 26 03:31:24 2023 +0100
Commit: Aron Budea 
CommitDate: Thu Jan 26 13:31:29 2023 +

sfx2: fix crash in SfxLokHelper::notifyAllViews(...)

Crashreport signature:

program/libmergedlo.so
SfxLokHelper::notifyAllViews(int, rtl::OString const&)
sfx2/source/view/lokhelper.cxx:682
program/libmergedlo.so
SfxClipboardChangeListener::ChangedContents()
include/rtl/string.hxx:413
program/libmergedlo.so
SfxClipboardChangeListener::LinkStubAsyncExecuteHdl_Impl(void*, 
void*)
include/rtl/ref.hxx:128
program/libmergedlo.so
ImplWindowFrameProc(vcl::Window*, SalEvent, void const*)
include/rtl/ref.hxx:128
program/libmergedlo.so
SvpSalInstance::ProcessEvent(SalUserEventList::SalUserEvent)

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

diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index 6bcae009bc1e..9f34d31c5766 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -676,6 +676,8 @@ void SfxLokHelper::notifyAllViews(int nType, const OString& 
rPayload)
 
 const auto payload = rPayload.getStr();
 const SfxViewShell* const pCurrentViewShell = SfxViewShell::Current();
+if (!pCurrentViewShell)
+return;
 SfxViewShell* pViewShell = SfxViewShell::GetFirst();
 while (pViewShell)
 {


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

2023-01-26 Thread Szymon Kłos (via logerrit)
 sfx2/source/doc/guisaveas.cxx|7 +++
 sfx2/source/doc/sfxbasemodel.cxx |6 ++
 2 files changed, 13 insertions(+)

New commits:
commit a92f9760e1e7b8b92687ba705c42791f50df6794
Author: Szymon Kłos 
AuthorDate: Mon Jan 23 14:32:15 2023 +0100
Commit: Szymon Kłos 
CommitDate: Thu Jan 26 13:07:26 2023 +

lok: send status for file export dialogs

Change-Id: I21530abc89808beb4c794f912e9453d8552c3b01
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146006
Reviewed-by: Ashod Nakashian 
Tested-by: Jenkins CollaboraOffice 

diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index 7a831f07a857..ab9ccd6494a0 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -675,12 +675,19 @@ IMPL_LINK( ModelData_Impl, OptionsDialogClosedHdl, 
css::ui::dialogs::DialogClose
 {
 if (pEvt->DialogResult == RET_OK && m_xFilterProperties)
 {
+if ( comphelper::LibreOfficeKit::isActive() && SfxViewShell::Current() 
)
+SfxViewShell::Current()->libreOfficeKitViewCallback( 
LOK_CALLBACK_EXPORT_FILE, "PENDING" );
+
 const uno::Sequence< beans::PropertyValue > aPropsFromDialog = 
m_xFilterProperties->getPropertyValues();
 for ( const auto& rProp : aPropsFromDialog )
 GetMediaDescr()[rProp.Name] = rProp.Value;
 
 m_pOwner->CallFinishGUIStoreModel();
 }
+else if ( comphelper::LibreOfficeKit::isActive() && 
SfxViewShell::Current() )
+{
+SfxViewShell::Current()->libreOfficeKitViewCallback( 
LOK_CALLBACK_EXPORT_FILE, "ABORT" );
+}
 }
 
 sal_Int8 ModelData_Impl::CheckSaveAcceptable( sal_Int8 nCurStatus )
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 44cd4216bece..6554ed1f317e 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -62,6 +62,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -130,6 +131,8 @@
 #include 
 #include 
 
+#include 
+
 //  namespaces
 
 
@@ -3195,6 +3198,9 @@ void SfxBaseModel::impl_store(  const   OUString& 
  sURL
 SfxGetpApp()->NotifyEvent( SfxEventHint( bSaveTo ? 
SfxEventHintId::SaveToDocFailed : SfxEventHintId::SaveAsDocFailed, 
GlobalEventConfig::GetEventName( bSaveTo ? GlobalEventId::SAVETODOCFAILED : 
GlobalEventId::SAVEASDOCFAILED),
 m_pData->m_pObjectShell.get() 
) );
 
+if ( comphelper::LibreOfficeKit::isActive() && SfxViewShell::Current() 
)
+SfxViewShell::Current()->libreOfficeKitViewCallback( 
LOK_CALLBACK_EXPORT_FILE, "ERROR" );
+
 std::stringstream aErrCode;
 aErrCode << nErrCode;
 throw task::ErrorCodeIOException(


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

2022-12-06 Thread Henry Castro (via logerrit)
 sfx2/source/doc/objstor.cxx |   15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

New commits:
commit 4114f8e21a6b6a7733764ab23e02e3f30f846902
Author: Henry Castro 
AuthorDate: Thu Nov 3 10:52:16 2022 -0400
Commit: Henry Castro 
CommitDate: Tue Dec 6 18:11:50 2022 +

sfx2: add log information to catch the exception

Add log information for data analysis if the ExportTo
fails due to an exception.

Signed-off-by: Henry Castro 
Change-Id: I888545da14f413a970faf50b3ce60d12966f3f9e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142201
Tested-by: Jenkins CollaboraOffice 

diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 9ec5d7980296..c56efca7cf8f 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -2492,8 +2492,19 @@ bool SfxObjectShell::ExportTo( SfxMedium& rMedium )
 }
 
 return xFilter->filter( aArgs );
-}catch(...)
-{}
+}
+catch (const css::uno::RuntimeException & e)
+{
+SAL_INFO("sfx.doc", "ExportTo: " << e);
+}
+catch (const std::exception & e)
+{
+SAL_INFO("sfx.doc", "ExportTo: " << e.what());
+}
+catch(...)
+{
+SAL_INFO("sfx.doc", "ExportTo: Unknown exception!");
+}
 }
 
 return false;


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

2022-11-29 Thread Miklos Vajna (via logerrit)
 sfx2/source/view/frame.cxx  |5 +-
 sw/inc/cmdid.h  |2 
 sw/qa/uibase/shells/shells.cxx  |   61 ++
 sw/sdi/_textsh.sdi  |6 ++
 sw/sdi/swriter.sdi  |   18 
 sw/source/uibase/shells/textfld.cxx |   73 
 6 files changed, 164 insertions(+), 1 deletion(-)

New commits:
commit fcee75c95b61e9f0491e9e0691d8b6ad96721edb
Author: Miklos Vajna 
AuthorDate: Mon Nov 28 09:06:23 2022 +0100
Commit: Miklos Vajna 
CommitDate: Tue Nov 29 12:27:31 2022 +0100

sw: add a new .uno:TextFormFields UNO command

Currently .uno:TextFormField can be used to insert a new fieldmark, but
then there is no way to update it. Also, there is no way to update
several fieldmarks at the same time.

Given that the "ADDON" field type in a field mark can be used by
extensions like Zotero, it's useful in case these fieldmarks can be not
only inserted, but they can be also updated. This works by (in the LOK
case) calling getCommandValues() with .uno:TextFormFields, and then once
the client generates the new expanded values, there is no way to insert
these updated expanded values into the document currently.

Fix this by adding a new .uno:TextFormFields UNO command that can update
all fieldmarks matching a certain prefix (looking at their field
command).  This allows e.g. updating all Zotero citations or the
bibliography, but the API is generic to support any kind of ADDON
fields. Similar to insertion, the content can be multi-paragraph,
formatted HTML.

This required adjusting SfxUnoAnyItem::CreateDefault(), this way an UNO
command parameter can be an array of beans::PropertyValues, which is how
the client can provide details of multiple fieldmarks.

(cherry picked from commit 7765b442e13048f857fd7ee49ced1731caee297e)

Conflicts:
sw/qa/uibase/shells/shells.cxx

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

diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx
index 91bea023858e..f0bb649f0e1d 100644
--- a/sfx2/source/view/frame.cxx
+++ b/sfx2/source/view/frame.cxx
@@ -58,7 +58,10 @@ using namespace ::com::sun::star::util;
 using namespace ::com::sun::star::frame;
 using namespace ::com::sun::star::container;
 
-SfxPoolItem* SfxUnoAnyItem::CreateDefault() { SAL_WARN( "sfx", "No 
SfxUnoAnyItem factory available"); return nullptr; }
+SfxPoolItem* SfxUnoAnyItem::CreateDefault()
+{
+return new SfxUnoAnyItem(0, uno::Any());
+}
 
 SfxPoolItem* SfxUnoFrameItem::CreateDefault()
 {
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 56b05c4aacd1..3ca95a5a4453 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -302,6 +302,8 @@
 #define FN_PROTECT_FIELDS   (FN_INSERT2 + 26)
 #define FN_PROTECT_BOOKMARKS(FN_INSERT2 + 27)
 
+#define FN_UPDATE_TEXT_FORMFIELDS   (FN_INSERT2 + 28)
+
 // clipboard table content
 #define FN_PASTE_NESTED_TABLE   (FN_INSERT2 + 30)  /* instead of the 
cell-by-cell copy between source and target tables */
 #define FN_TABLE_PASTE_ROW_BEFORE   (FN_INSERT2 + 31)  /* paste table as new 
table rows */
diff --git a/sw/qa/uibase/shells/shells.cxx b/sw/qa/uibase/shells/shells.cxx
index 5a7b2ca8d42c..e287ab6d23e6 100644
--- a/sw/qa/uibase/shells/shells.cxx
+++ b/sw/qa/uibase/shells/shells.cxx
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -284,6 +285,66 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, 
testInsertTextFormField)
 CPPUNIT_ASSERT_EQUAL(OUString("aaa\nbbb"), aActualResult);
 }
 
+CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateFieldmarks)
+{
+// Given a document with 2 fieldmarks:
+SwDoc* pDoc = createSwDoc();
+{
+uno::Sequence aArgs = {
+comphelper::makePropertyValue("FieldType", 
uno::Any(OUString(ODF_UNHANDLED))),
+comphelper::makePropertyValue("FieldCommand",
+  uno::Any(OUString("ADDIN ZOTERO_ITEM 
old command 1"))),
+comphelper::makePropertyValue("FieldResult", 
uno::Any(OUString("old result 1"))),
+};
+dispatchCommand(mxComponent, ".uno:TextFormField", aArgs);
+}
+{
+uno::Sequence aArgs = {
+comphelper::makePropertyValue("FieldType", 
uno::Any(OUString(ODF_UNHANDLED))),
+comphelper::makePropertyValue("FieldCommand",
+  uno::Any(OUString("ADDIN ZOTERO_ITEM 
old command 2"))),
+comphelper::makePropertyValue("FieldResult", 
uno::Any(OUString("old result 2"))),
+};
+dispatchCommand(mxComponent, ".uno:TextFormField", aArgs);
+}
+
+// When updating those fieldmarks:
+uno::Sequence aField1{
+  

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

2022-11-17 Thread Mike Kaganski (via logerrit)
 sfx2/source/view/lokstarmathhelper.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 69f781b0adbc74255f3409be973e20c780f2430f
Author: Mike Kaganski 
AuthorDate: Thu Nov 17 09:54:28 2022 +0300
Commit: Mike Kaganski 
CommitDate: Thu Nov 17 15:08:40 2022 +0100

Take in-place widget scaling into account

This is relevant when the Math OLE object is scaled in parent document
(e.g., using Position and Size dialog, disabling its size protection);
then the in-place editing widget uses own map mode reverting the OLE
scaling; without taking that into account, mouse clicks get misplaced.

Change-Id: I961fa8f3993c1b7992857c9f18d79650d078a684
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142822
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
(cherry picked from commit b062c2f3e61fc0b449c07c5ca2f1f6a956dfc41f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142799
Tested-by: Jenkins CollaboraOffice 

diff --git a/sfx2/source/view/lokstarmathhelper.cxx 
b/sfx2/source/view/lokstarmathhelper.cxx
index d9c559746ba2..5586068d88b7 100644
--- a/sfx2/source/view/lokstarmathhelper.cxx
+++ b/sfx2/source/view/lokstarmathhelper.cxx
@@ -170,6 +170,10 @@ bool LokStarMathHelper::postMouseEvent(int nType, int nX, 
int nY, int nCount, in
 // 2. Adjust the position according to the scales
 aMousePos
 = Point(std::round(aMousePos.X() * fScaleX), 
std::round(aMousePos.Y() * fScaleY));
+// 3. Take window own scaling into account (reverses the 
conversion done in
+// SmGraphicWidget::MouseButtonDown, albeit incompletely - it does 
not handle
+// GetFormulaDrawPos; hopefully, in lok/in-place case, it's always 
[ 0, 0 ]?)
+aMousePos = pWindow->LogicToPixel(aMousePos);
 
 LokMouseEventData aMouseEventData(
 nType, aMousePos, nCount, MouseEventModifiers::SIMPLECLICK, 
nButtons, nModifier);


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

2022-09-26 Thread Mike Kaganski (via logerrit)
 sfx2/source/view/lokstarmathhelper.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 5e0a3293ecfba225e144241e750359b7d3998666
Author: Mike Kaganski 
AuthorDate: Wed Apr 20 12:17:28 2022 +0300
Commit: Mike Kaganski 
CommitDate: Mon Sep 26 16:04:35 2022 +0200

lok: use correct window for the MapMode

... otherwise, using a zoomed document, the returned bounding box
does not account for that zoom.

Change-Id: Id7834bbc2bebaa923414cf029c37a8e22f9c1078
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133205
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
(cherry picked from commit 89948bd544516604af057588676b0f979f21c163)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140602
Tested-by: Jenkins CollaboraOffice 

diff --git a/sfx2/source/view/lokstarmathhelper.cxx 
b/sfx2/source/view/lokstarmathhelper.cxx
index 62c2fd56b102..9a704683aaec 100644
--- a/sfx2/source/view/lokstarmathhelper.cxx
+++ b/sfx2/source/view/lokstarmathhelper.cxx
@@ -131,7 +131,9 @@ tools::Rectangle LokStarMathHelper::GetBoundingBox()
 {
 // In all cases, the following code fragment
 // returns the bounding box in twips.
-const MapMode& aMapMode = pWindow->GetMapMode();
+// Note: the correct mapmode (representing document zoom) 
is provided by
+// GraphicWindow, not WidgetWindow
+const MapMode& aMapMode = GetGraphicWindow()->GetMapMode();
 const auto & [ m, d ]
 = o3tl::getConversionMulDiv(o3tl::Length::px, 
o3tl::Length::twip);
 const Fraction& scaleX = aMapMode.GetScaleX();


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

2022-08-26 Thread Mike Kaganski (via logerrit)
 sfx2/source/sidebar/SidebarController.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 909bc4b1388a1d59f1b12ce8955e626b0192e4e1
Author: Mike Kaganski 
AuthorDate: Fri Aug 26 18:31:34 2022 +0300
Commit: Mike Kaganski 
CommitDate: Sat Aug 27 07:16:52 2022 +0200

lok: use ".uno:SidebarDeck.DeckName" for the rest of the decks

Allows to avoid introducing a dedicated UNO command for each and every deck.

Change-Id: Icc9b2fa9ec3ac495f022970d412d9b19ec000a76
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138883
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
(cherry picked from commit 2a3e8d220a244dd15c28d52895848546a915feda)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138829
Tested-by: Jenkins CollaboraOffice 

diff --git a/sfx2/source/sidebar/SidebarController.cxx 
b/sfx2/source/sidebar/SidebarController.cxx
index 56cf5b6b6b26..3c1208d0da00 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -94,7 +94,8 @@ namespace
 if (rsDeckId == u"GalleryDeck")
 return ".uno:Gallery";
 
-return "";
+OString sUno = ".uno:SidebarDeck." + OUStringToOString(rsDeckId, 
RTL_TEXTENCODING_ASCII_US);
+return std::string(sUno);
 }
 }
 


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sfx2/source starmath/inc starmath/qa starmath/source starmath/uiconfig starmath/UIConfig_smath.mk uitest/math_tests

2022-08-26 Thread Mike Kaganski (via logerrit)
 sfx2/source/sidebar/SidebarChildWindow.cxx  |2 
 starmath/UIConfig_smath.mk  |1 
 starmath/inc/ElementsDockingWindow.hxx  |   37 ---
 starmath/inc/view.hxx   |3 
 starmath/qa/unit/data/starmath-dialogs-test.txt |1 
 starmath/source/ElementsDockingWindow.cxx   |  117 
 starmath/source/document.cxx|9 -
 starmath/source/smdll.cxx   |5 -
 starmath/source/view.cxx|   24 +---
 starmath/uiconfig/smath/ui/dockingelements.ui   |   60 
 uitest/math_tests/start.py  |2 
 11 files changed, 11 insertions(+), 250 deletions(-)

New commits:
commit 6068a5044a154d10a33d6550489b08806227b671
Author: Mike Kaganski 
AuthorDate: Wed Aug 17 23:37:08 2022 +0300
Commit: Mike Kaganski 
CommitDate: Fri Aug 26 15:14:28 2022 +0200

tdf#150489: Drop Elements docking window

and make uno:ElementsDockingWindow open the respective sidebar panel.

Change-Id: I9736d6804c579b83404636d5e327c49c2fdeb914
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138458
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
(cherry picked from commit dbe125fce5d226641bf84ac3be12ea88c41f6d91)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138826
Tested-by: Jenkins CollaboraOffice 

diff --git a/sfx2/source/sidebar/SidebarChildWindow.cxx 
b/sfx2/source/sidebar/SidebarChildWindow.cxx
index 04d1f1037f4b..272c280488c8 100644
--- a/sfx2/source/sidebar/SidebarChildWindow.cxx
+++ b/sfx2/source/sidebar/SidebarChildWindow.cxx
@@ -43,7 +43,7 @@ SidebarChildWindow::SidebarChildWindow(vcl::Window* 
pParentWindow, sal_uInt16 nI
 pDockWin->SetOutputSizePixel(Size(GetDefaultWidth(pDockWin), 450));
 
 if (pInfo && pInfo->aExtraString.isEmpty() && pInfo->aModule != "sdraw"
-&& pInfo->aModule != "simpress")
+&& pInfo->aModule != "simpress" && pInfo->aModule != "smath")
 {
 // When this is the first start (never had the sidebar open yet),
 // default to non-expanded sidebars in Writer and Calc.
diff --git a/starmath/UIConfig_smath.mk b/starmath/UIConfig_smath.mk
index a54f2e4553c4..d79d791a92df 100644
--- a/starmath/UIConfig_smath.mk
+++ b/starmath/UIConfig_smath.mk
@@ -31,7 +31,6 @@ $(eval $(call gb_UIConfig_add_toolbarfiles,modules/smath,\
 $(eval $(call gb_UIConfig_add_uifiles,modules/smath,\
starmath/uiconfig/smath/ui/alignmentdialog \
starmath/uiconfig/smath/ui/catalogdialog \
-   starmath/uiconfig/smath/ui/dockingelements \
starmath/uiconfig/smath/ui/editwindow \
starmath/uiconfig/smath/ui/fontdialog \
starmath/uiconfig/smath/ui/fontsizedialog \
diff --git a/starmath/inc/ElementsDockingWindow.hxx 
b/starmath/inc/ElementsDockingWindow.hxx
index e2c19aa8c6c3..1aa2d84e4bbb 100644
--- a/starmath/inc/ElementsDockingWindow.hxx
+++ b/starmath/inc/ElementsDockingWindow.hxx
@@ -77,41 +77,4 @@ public:
 static Color GetControlBackground();
 };
 
-class SmElementsDockingWindow final : public SfxDockingWindow
-{
-std::unique_ptr mxElementsControl;
-std::unique_ptr mxElementListBox;
-
-virtual void Resize() override;
-SmViewShell* GetView();
-
-DECL_LINK(SelectClickHandler, OUString, void);
-DECL_LINK(ElementSelectedHandle, weld::ComboBox&, void);
-
-public:
-
-SmElementsDockingWindow( SfxBindings* pBindings,
- SfxChildWindow* pChildWindow,
- vcl::Window* pParent );
-virtual ~SmElementsDockingWindow() override;
-virtual void dispose() override;
-
-virtual void EndDocking( const tools::Rectangle& rReactangle, bool 
bFloatMode) override;
-virtual void ToggleFloatingMode() override;
-virtual void GetFocus() override;
-
-void setSmSyntaxVersion(sal_uInt16 nSmSyntaxVersion);
-};
-
-class SmElementsDockingWindowWrapper final : public SfxChildWindow
-{
-SFX_DECL_CHILDWINDOW_WITHID(SmElementsDockingWindowWrapper);
-
-SmElementsDockingWindowWrapper( vcl::Window* pParentWindow,
-sal_uInt16 nId,
-SfxBindings* pBindings,
-SfxChildWinInfo* pInfo );
-virtual ~SmElementsDockingWindowWrapper() override;
-};
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx
index f3dab0d58850..4ab877358f94 100644
--- a/starmath/inc/view.hxx
+++ b/starmath/inc/view.hxx
@@ -36,7 +36,6 @@ class SmViewShell;
 class SmPrintUIOptions;
 class SmGraphicAccessible;
 class SmGraphicWidget;
-class SmElementsDockingWindow;
 
 namespace svtools { class ColorConfig; }
 
@@ -319,8 +318,6 @@ public:
 return *mxGraphicWindow;
 }
 
-SmElementsDockingWindow* GetDockingWindow();
-
 voidSetStatusText(const OUString& rText);
 
 voidShowError( const SmErrorDesc 

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

2022-08-17 Thread Mike Kaganski (via logerrit)
 sfx2/source/sidebar/SidebarController.cxx |   14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 6f1c9906513bdd0a2b4c6d1bc3d8b841ea1971ee
Author: Mike Kaganski 
AuthorDate: Wed Aug 17 12:52:55 2022 +0300
Commit: Mike Kaganski 
CommitDate: Wed Aug 17 16:04:51 2022 +0200

Move application check to the point where it matters

This simplifies and deduplicates call sites, and also makes sure that
we don't lookup strings until we need that. Also helps adding a check
for Math in a follow-up.

Change-Id: I6b073253f19afbb9a95f29806ab306c6a9f63f18
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138413
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
(cherry picked from commit 28914ddeb64d3c7a67093b75f399264e12a66a1d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138415
Tested-by: Jenkins CollaboraOffice 

diff --git a/sfx2/source/sidebar/SidebarController.cxx 
b/sfx2/source/sidebar/SidebarController.cxx
index 22d48cc90bf0..2709639cb7de 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -71,13 +71,13 @@ namespace
 const sal_Int32 gnWidthCloseThreshold (70);
 const sal_Int32 gnWidthOpenThreshold (40);
 
-std::string UnoNameFromDeckId(std::u16string_view rsDeckId, bool isImpress 
= false)
+std::string UnoNameFromDeckId(std::u16string_view rsDeckId, const 
sfx2::sidebar::Context& context)
 {
 if (rsDeckId == u"SdCustomAnimationDeck")
 return ".uno:CustomAnimation";
 
 if (rsDeckId == u"PropertyDeck")
-return isImpress ? ".uno:ModifyPage" : ".uno:Sidebar";
+return vcl::EnumContext::Application::Impress == 
vcl::EnumContext::GetApplicationEnum(context.msApplication) ? ".uno:ModifyPage" 
: ".uno:Sidebar";
 
 if (rsDeckId == u"SdLayoutsDeck")
 return ".uno:ModifyPage";
@@ -225,7 +225,7 @@ void SidebarController::disposeDecks()
 {
 if (const SfxViewShell* pViewShell = mpViewFrame->GetViewShell())
 {
-const std::string hide = UnoNameFromDeckId(msCurrentDeckId, 
vcl::EnumContext::Application::Impress == 
vcl::EnumContext::GetApplicationEnum(GetCurrentContext().msApplication));
+const std::string hide = UnoNameFromDeckId(msCurrentDeckId, 
GetCurrentContext());
 if (!hide.empty())
 
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
(hide + 
"=false").c_str());
@@ -801,13 +801,13 @@ void SidebarController::SwitchToDeck (
 {
 if (msCurrentDeckId != rDeckDescriptor.msId)
 {
-const std::string hide = UnoNameFromDeckId(msCurrentDeckId, 
vcl::EnumContext::Application::Impress == 
vcl::EnumContext::GetApplicationEnum(GetCurrentContext().msApplication));
+const std::string hide = UnoNameFromDeckId(msCurrentDeckId, 
GetCurrentContext());
 if (!hide.empty())
 
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
(hide + 
"=false").c_str());
 }
 
-const std::string show = UnoNameFromDeckId(rDeckDescriptor.msId, 
vcl::EnumContext::Application::Impress == 
vcl::EnumContext::GetApplicationEnum(GetCurrentContext().msApplication));
+const std::string show = UnoNameFromDeckId(rDeckDescriptor.msId, 
GetCurrentContext());
 if (!show.empty())
 
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
(show + 
"=true").c_str());
@@ -1325,7 +1325,7 @@ void SidebarController::UpdateDeckOpenState()
 
 if (const SfxViewShell* pViewShell = 
mpViewFrame->GetViewShell())
 {
-const std::string uno = UnoNameFromDeckId(msCurrentDeckId, 
vcl::EnumContext::Application::Impress == 
vcl::EnumContext::GetApplicationEnum(GetCurrentContext().msApplication));
+const std::string uno = UnoNameFromDeckId(msCurrentDeckId, 
GetCurrentContext());
 if (!uno.empty())
 
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
 (uno + 
"=true").c_str());
@@ -1363,7 +1363,7 @@ void SidebarController::UpdateDeckOpenState()
 
 if (const SfxViewShell* pViewShell = 
mpViewFrame->GetViewShell())
 {
-const std::string uno = UnoNameFromDeckId(msCurrentDeckId, 
vcl::EnumContext::Application::Impress == 
vcl::EnumContext::GetApplicationEnum(GetCurrentContext().msApplication));
+const std::string uno = UnoNameFromDeckId(msCurrentDeckId, 
GetCurrentContext());
 if (!uno.empty())
 

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

2022-08-16 Thread NickWingate (via logerrit)
 sfx2/source/dialog/dinfdlg.cxx |   15 ++-
 1 file changed, 6 insertions(+), 9 deletions(-)

New commits:
commit 4666a1b52028ba60f80ad93a756f95bb174dbe7b
Author: NickWingate 
AuthorDate: Fri Aug 12 09:48:18 2022 +0100
Commit: Szymon Kłos 
CommitDate: Tue Aug 16 12:40:37 2022 +0200

Fix opening duration custom property shows text

Before saving a duration custom property and
then closing and opening file props wouldn't
show the duration type and value and instead
blank text

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

diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 2a32e9c03dc9..818948f99461 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -1799,17 +1799,14 @@ void CustomPropertiesWindow::ReloadLinesContent()
 pLine->m_xDurationField->SetDuration(aTmpDuration);
 }
 
-if (nType != Custom_Type_Duration)
+if (Custom_Type_Boolean == nType)
 {
-if (Custom_Type_Boolean == nType)
-{
-if (bTmpValue)
-pLine->m_xYesNoButton->CheckYes();
-else
-pLine->m_xYesNoButton->CheckNo();
-}
-pLine->m_xTypeBox->set_active_id(OUString::number(nType));
+if (bTmpValue)
+pLine->m_xYesNoButton->CheckYes();
+else
+pLine->m_xYesNoButton->CheckNo();
 }
+pLine->m_xTypeBox->set_active_id(OUString::number(nType));
 
 pLine->DoTypeHdl(*pLine->m_xTypeBox);
 }


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

2022-05-30 Thread Szymon Kłos (via logerrit)
 sfx2/source/appl/appserv.cxx |8 
 1 file changed, 8 insertions(+)

New commits:
commit 5423ee704c4b551a155d05f5ca308ed17936aed0
Author: Szymon Kłos 
AuthorDate: Fri May 20 19:18:11 2022 +0200
Commit: Szymon Kłos 
CommitDate: Mon May 30 10:15:00 2022 +0200

lok: sidebar: notebookbar: don't change view mode for other views

We should change view mode (notebookbar/toolbars) only for current view.
This prevents the closed sidebar from showing when other view joins the 
session.

Change-Id: Iaeec1bee0afab7552e223f17dd7afac27d288db9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134690
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Michael Meeks 
(cherry picked from commit 08891ae798b1e59719684d1b0343767c9d136a11)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135001
Reviewed-by: Szymon Kłos 

diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index 2b1da7ce96cc..65bc3b101dc5 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -800,6 +800,14 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
 pViewFrame = SfxViewFrame::GetFirst();
 while( pViewFrame )
 {
+// in LOK case we want to apply changes only to the current 
view
+if (comphelper::LibreOfficeKit::isActive() &&
+pViewFrame != SfxViewShell::Current()->GetViewFrame())
+{
+pViewFrame = SfxViewFrame::GetNext( *pViewFrame );
+continue;
+}
+
 Reference xFrame = 
pViewFrame->GetFrame().GetFrameInterface();
 
 // We want to change mode only for a current app module, 
ignore other apps


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

2022-05-18 Thread Andras Timar (via logerrit)
 sfx2/source/doc/objstor.cxx |   31 ---
 1 file changed, 31 deletions(-)

New commits:
commit 1c9d9bdeca9534f7267c9c2488f57a2e1d01c4e9
Author: Andras Timar 
AuthorDate: Mon May 16 15:55:35 2022 +0200
Commit: Andras Timar 
CommitDate: Wed May 18 10:41:23 2022 +0200

Revert "sw: restore UI language to en while saving"

This reverts commit f4ef1e3e580f7a590496d62aaa3dc7e092510a9c.
Reason: T35383 Writer: Page breaks saved in German UI/locale turn into line 
breaks

Change-Id: Iea7c41b361beb0bc6f455e72ab48cef3604305d6

diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 65a340221223..548ce34b1c21 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -91,7 +91,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
@@ -3176,11 +3175,6 @@ bool SfxObjectShell::LoadOwnFormat( SfxMedium& rMedium )
 return false;
 }
 
-namespace
-{
-static LanguageTag g_defaultLanguageTag("en-US", true);
-}
-
 bool SfxObjectShell::SaveAsOwnFormat( SfxMedium& rMedium )
 {
 uno::Reference< embed::XStorage > xStorage = rMedium.GetStorage();
@@ -3203,31 +3197,6 @@ bool SfxObjectShell::SaveAsOwnFormat( SfxMedium& rMedium 
)
 pImpl->aBasicManager.storeLibrariesToStorage( xStorage );
 }
 #endif
-
-// Because XMLTextFieldExport::ExportFieldDeclarations (called from 
SwXMLExport)
-// calls SwXTextFieldMasters::getByName, which in turn maps property 
names by
-// calling SwStyleNameMapper::GetTextUINameArray, which uses
-// SvtSysLocale().GetUILanguageTag() to do the mapping, saving 
indirectly depends
-// on the UI language. This is an unfortunate depenency.
-// Here we restore to English
-const auto viewLanguage = comphelper::LibreOfficeKit::getLanguageTag();
-
-// Use the default language for saving and restore later if necessary.
-bool restoreLanguage = false;
-if (comphelper::LibreOfficeKit::isActive() && viewLanguage != 
g_defaultLanguageTag)
-{
-restoreLanguage = true;
-comphelper::LibreOfficeKit::setLanguageTag(g_defaultLanguageTag);
-}
-
-// Restore the view's original language automatically and as necessary.
-const ::comphelper::ScopeGuard aGuard(
-[, restoreLanguage]()
-{
-if (restoreLanguage && viewLanguage != 
comphelper::LibreOfficeKit::getLanguageTag())
-comphelper::LibreOfficeKit::setLanguageTag(viewLanguage);
-});
-
 return SaveAs( rMedium );
 }
 else return false;


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

2022-05-02 Thread Ashod Nakashian (via logerrit)
 sfx2/source/doc/objstor.cxx |   31 +++
 1 file changed, 31 insertions(+)

New commits:
commit 7e088fe43ae7c2647e634faa57e5905f39c4a522
Author: Ashod Nakashian 
AuthorDate: Sun May 1 16:52:30 2022 -0400
Commit: Michael Meeks 
CommitDate: Mon May 2 20:02:19 2022 +0200

sw: restore UI language to en while saving

Because the XML writer used in sw invokes the
translation logic, which uses the UI language,
saving can fail in case there are multiple
views with different langauges. This restores
the default language before saving to avoid
such issues and to make sure the document
xml is generated in the default language.

Signed-off-by: Ashod Nakashian 
Change-Id: Ibc0813de33cf7cf3528b0ff1d95560e799903fb0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133676
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Michael Meeks 
(cherry picked from commit f4ef1e3e580f7a590496d62aaa3dc7e092510a9c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133610

diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 548ce34b1c21..65a340221223 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -91,6 +91,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -3175,6 +3176,11 @@ bool SfxObjectShell::LoadOwnFormat( SfxMedium& rMedium )
 return false;
 }
 
+namespace
+{
+static LanguageTag g_defaultLanguageTag("en-US", true);
+}
+
 bool SfxObjectShell::SaveAsOwnFormat( SfxMedium& rMedium )
 {
 uno::Reference< embed::XStorage > xStorage = rMedium.GetStorage();
@@ -3197,6 +3203,31 @@ bool SfxObjectShell::SaveAsOwnFormat( SfxMedium& rMedium 
)
 pImpl->aBasicManager.storeLibrariesToStorage( xStorage );
 }
 #endif
+
+// Because XMLTextFieldExport::ExportFieldDeclarations (called from 
SwXMLExport)
+// calls SwXTextFieldMasters::getByName, which in turn maps property 
names by
+// calling SwStyleNameMapper::GetTextUINameArray, which uses
+// SvtSysLocale().GetUILanguageTag() to do the mapping, saving 
indirectly depends
+// on the UI language. This is an unfortunate depenency.
+// Here we restore to English
+const auto viewLanguage = comphelper::LibreOfficeKit::getLanguageTag();
+
+// Use the default language for saving and restore later if necessary.
+bool restoreLanguage = false;
+if (comphelper::LibreOfficeKit::isActive() && viewLanguage != 
g_defaultLanguageTag)
+{
+restoreLanguage = true;
+comphelper::LibreOfficeKit::setLanguageTag(g_defaultLanguageTag);
+}
+
+// Restore the view's original language automatically and as necessary.
+const ::comphelper::ScopeGuard aGuard(
+[, restoreLanguage]()
+{
+if (restoreLanguage && viewLanguage != 
comphelper::LibreOfficeKit::getLanguageTag())
+comphelper::LibreOfficeKit::setLanguageTag(viewLanguage);
+});
+
 return SaveAs( rMedium );
 }
 else return false;