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

2023-04-28 Thread Caolán McNamara (via logerrit)
 sfx2/source/doc/iframe.cxx|   15 ---
 sfx2/source/inc/eventsupplier.hxx |1 +
 2 files changed, 5 insertions(+), 11 deletions(-)

New commits:
commit a10a5994bddf7646196ff45f6af598420d8663ad
Author: Caolán McNamara 
AuthorDate: Thu Apr 20 20:58:21 2023 +0100
Commit: Xisco Fauli 
CommitDate: Fri Apr 28 10:52:31 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 

diff --git a/sfx2/source/doc/iframe.cxx b/sfx2/source/doc/iframe.cxx
index 16750d8da0b3..52962c4be75d 100644
--- a/sfx2/source/doc/iframe.cxx
+++ b/sfx2/source/doc/iframe.cxx
@@ -167,23 +167,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;
-}
-
-if (!SfxEvents_Impl::isScriptURLAllowed(aTargetURL.Complete))
-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();
 }
diff --git a/sfx2/source/inc/eventsupplier.hxx 
b/sfx2/source/inc/eventsupplier.hxx
index 316b3b1836d7..56aa8f95e75f 100644
--- a/sfx2/source/inc/eventsupplier.hxx
+++ b/sfx2/source/inc/eventsupplier.hxx
@@ -81,6 +81,7 @@ public:
 SfxObjectShell* i_document );
 static void Execute( css::uno::Sequence < css::beans::PropertyValue > 
const & aEventData, const css::document::DocumentEvent& aTrigger, 
SfxObjectShell* pDoc );
 
+private:
 /// Check if script URL whitelist exists, and if so, if current script url 
is part of it
 static bool isScriptURLAllowed(const OUString& aScriptURL);
 };


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

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

New commits:
commit acff9ca0579333b45d10ae5f8cd48172f563
Author: Caolán McNamara 
AuthorDate: Tue Apr 11 10:13:37 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Tue Apr 25 11:25:31 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 

diff --git a/sfx2/source/doc/iframe.cxx b/sfx2/source/doc/iframe.cxx
index 15e0a7cf5c9c..6c92312b1fad 100644
--- a/sfx2/source/doc/iframe.cxx
+++ b/sfx2/source/doc/iframe.cxx
@@ -38,6 +38,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -166,10 +167,11 @@ 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;
 }
@@ -177,6 +179,10 @@ sal_Bool SAL_CALL IFrameObject::load(
 if (!SfxEvents_Impl::isScriptURLAllowed(aTargetURL.Complete))
 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() );
@@ -201,7 +207,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 'libreoffice-7-4' - sfx2/source

2023-04-19 Thread Xisco Fauli (via logerrit)
 sfx2/source/dialog/StyleList.cxx |   23 +--
 1 file changed, 13 insertions(+), 10 deletions(-)

New commits:
commit 751d34ee3a8b01f4c3912f586e4480680fd48222
Author: Xisco Fauli 
AuthorDate: Wed Apr 19 12:45:01 2023 +0200
Commit: Xisco Fauli 
CommitDate: Wed Apr 19 17:37:08 2023 +0200

sfx2: fix crash in StyleList::CustomRenderHdl

GetFamilyItem() might return nullptr
See 
https://crashreport.libreoffice.org/stats/signature/StyleList::CustomRenderHdl(std::tuple%3COutputDevice%20&,tools::Rectangle%20const%20&,bool,rtl::OUString%20const%20&%3E)

Change-Id: I099f045232aac710c4f26148de5e798d00ecc7ec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150602
Reviewed-by: Caolán McNamara 
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150617

diff --git a/sfx2/source/dialog/StyleList.cxx b/sfx2/source/dialog/StyleList.cxx
index a25050ead918..ded3822b1ebf 100644
--- a/sfx2/source/dialog/StyleList.cxx
+++ b/sfx2/source/dialog/StyleList.cxx
@@ -1557,17 +1557,20 @@ IMPL_LINK(StyleList, CustomRenderHdl, 
weld::TreeView::render_args, aPayload, voi
 
 if (pStyleManager)
 {
-const SfxStyleFamilyItem* pItem = GetFamilyItem();
-SfxStyleSheetBase* pStyleSheet = pStyleManager->Search(rId, 
pItem->GetFamily());
-
-if (pStyleSheet)
+if (const SfxStyleFamilyItem* pItem = GetFamilyItem())
 {
-rRenderContext.Push(vcl::PushFlags::ALL);
-sal_Int32 nSize = aRect.GetHeight();
-std::unique_ptr pStylePreviewRenderer(
-pStyleManager->CreateStylePreviewRenderer(rRenderContext, 
pStyleSheet, nSize));
-bSuccess = pStylePreviewRenderer->recalculate() && 
pStylePreviewRenderer->render(aRect);
-rRenderContext.Pop();
+SfxStyleSheetBase* pStyleSheet = pStyleManager->Search(rId, 
pItem->GetFamily());
+
+if (pStyleSheet)
+{
+rRenderContext.Push(vcl::PushFlags::ALL);
+sal_Int32 nSize = aRect.GetHeight();
+std::unique_ptr 
pStylePreviewRenderer(
+pStyleManager->CreateStylePreviewRenderer(rRenderContext, 
pStyleSheet, nSize));
+bSuccess
+= pStylePreviewRenderer->recalculate() && 
pStylePreviewRenderer->render(aRect);
+rRenderContext.Pop();
+}
 }
 }
 


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

2023-04-09 Thread Jaume Pujantell (via logerrit)
 sfx2/source/doc/docfile.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 4300ea07cfa664a1de9509cb9cd83c7ae46afe87
Author: Jaume Pujantell 
AuthorDate: Wed Mar 29 14:32:55 2023 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Sun Apr 9 22:58:40 2023 +0200

tdf#149064 ensure interaction handler is present when transfering with 
webDAV

Change-Id: I7a31f708e6fe01f07c7187aacd4657b5c6156c82
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149722
Tested-by: Jenkins
Reviewed-by: Andras Timar 
(cherry picked from commit 50848b06ea58a147f5b89f057880266518ce79e7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149697
Reviewed-by: Xisco Fauli 
(cherry picked from commit 439d8466c10473d1f3859ffa6c87fef6209e93eb)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150141
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 63966fb3c6ab..fafe05d150b4 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -2318,7 +2318,8 @@ void SfxMedium::Transfer_Impl()
 // a special case, an interaction handler should be used for
 // authentication in case it is available
 Reference< css::ucb::XCommandEnvironment > xComEnv;
-Reference< css::task::XInteractionHandler > xInteractionHandler = 
GetInteractionHandler();
+bool bForceInteractionHandler = GetURLObject().isAnyKnownWebDAVScheme();
+Reference< css::task::XInteractionHandler > xInteractionHandler = 
GetInteractionHandler(bForceInteractionHandler);
 if (xInteractionHandler.is())
 xComEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler,
   Reference< 
css::ucb::XProgressHandler >() );


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

2023-03-07 Thread Samuel Mehrbrodt (via logerrit)
 sfx2/source/doc/iframe.cxx|4 
 sfx2/source/inc/eventsupplier.hxx |1 -
 2 files changed, 4 insertions(+), 1 deletion(-)

New commits:
commit b19e0a6676b800b9d3c362c722913f1362113006
Author: Samuel Mehrbrodt 
AuthorDate: Mon Feb 27 15:27:24 2023 +0100
Commit: Caolán McNamara 
CommitDate: Tue Mar 7 09:01:46 2023 +

Check iframe target for allowed document URLs

Change-Id: I00e4192becbc160282a43ab89dcd269f3d1012d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147919
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 
(cherry picked from commit 288c0920a8475f9f2c537212e04aa7649192ad8c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148229
Reviewed-by: Caolán McNamara 

diff --git a/sfx2/source/doc/iframe.cxx b/sfx2/source/doc/iframe.cxx
index 80e0c4e68457..15e0a7cf5c9c 100644
--- a/sfx2/source/doc/iframe.cxx
+++ b/sfx2/source/doc/iframe.cxx
@@ -45,6 +45,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star;
 
@@ -173,6 +174,9 @@ sal_Bool SAL_CALL IFrameObject::load(
 return false;
 }
 
+if (!SfxEvents_Impl::isScriptURLAllowed(aTargetURL.Complete))
+return false;
+
 DBG_ASSERT( !mxFrame.is(), "Frame already existing!" );
 VclPtr pParent = VCLUnoHelper::GetWindow( 
xFrame->getContainerWindow() );
 VclPtr pWin = VclPtr::Create( 
pParent, maFrmDescr.IsFrameBorderOn() );
diff --git a/sfx2/source/inc/eventsupplier.hxx 
b/sfx2/source/inc/eventsupplier.hxx
index 56aa8f95e75f..316b3b1836d7 100644
--- a/sfx2/source/inc/eventsupplier.hxx
+++ b/sfx2/source/inc/eventsupplier.hxx
@@ -81,7 +81,6 @@ public:
 SfxObjectShell* i_document );
 static void Execute( css::uno::Sequence < css::beans::PropertyValue > 
const & aEventData, const css::document::DocumentEvent& aTrigger, 
SfxObjectShell* pDoc );
 
-private:
 /// Check if script URL whitelist exists, and if so, if current script url 
is part of it
 static bool isScriptURLAllowed(const OUString& aScriptURL);
 };


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

2022-12-16 Thread Caolán McNamara (via logerrit)
 sfx2/source/appl/app.cxx  |2 +-
 sfx2/source/commandpopup/CommandPopup.cxx |2 ++
 sfx2/source/control/charmapcontrol.cxx|7 +--
 sfx2/source/control/request.cxx   |8 +++-
 4 files changed, 15 insertions(+), 4 deletions(-)

New commits:
commit 59842f25ce457bdddc5cdddbe95dda76d09353cd
Author: Caolán McNamara 
AuthorDate: Thu Dec 15 20:00:26 2022 +
Commit: Xisco Fauli 
CommitDate: Fri Dec 16 08:29:39 2022 +

sfx2: check SfxViewFrame::Current()

these ones look potentially worth backporting

Change-Id: I9391f266b08e3842f9686db6113b61fa814f3fbb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144258
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx
index cd4acc552132..4a85e28f2d16 100644
--- a/sfx2/source/appl/app.cxx
+++ b/sfx2/source/appl/app.cxx
@@ -422,7 +422,7 @@ IMPL_STATIC_LINK( SfxApplication, GlobalBasicErrorHdl_Impl, 
StarBASIC*, pStarBas
 const SfxViewFrame* pViewFrame = SfxViewFrame::Current();
 std::shared_ptr xBox;
 xBox.reset(Application::CreateMessageDialog(
-   pViewFrame->GetFrameWeld(),
+   pViewFrame ? pViewFrame->GetFrameWeld() : nullptr,
VclMessageType::Error,
VclButtonsType::Ok,
aError,
diff --git a/sfx2/source/commandpopup/CommandPopup.cxx 
b/sfx2/source/commandpopup/CommandPopup.cxx
index 47df143a889b..f4cdf92436c7 100644
--- a/sfx2/source/commandpopup/CommandPopup.cxx
+++ b/sfx2/source/commandpopup/CommandPopup.cxx
@@ -152,6 +152,8 @@ void MenuContentHandler::addCommandIfPossible(
 return;
 
 auto* pViewFrame = SfxViewFrame::Current();
+if (!pViewFrame)
+return;
 
 SfxSlotPool& rSlotPool = SfxSlotPool::GetSlotPool(pViewFrame);
 const SfxSlot* pSlot = rSlotPool.GetUnoSlot(aCommandURL.Path);
diff --git a/sfx2/source/control/charmapcontrol.cxx 
b/sfx2/source/control/charmapcontrol.cxx
index 032306b8a85f..a79da745be26 100644
--- a/sfx2/source/control/charmapcontrol.cxx
+++ b/sfx2/source/control/charmapcontrol.cxx
@@ -207,8 +207,11 @@ IMPL_LINK_NOARG(SfxCharmapCtrl, OpenDlgHdl, weld::Button&, 
void)
 {
 m_xControl->EndPopupMode();
 
-uno::Reference xFrame = 
SfxViewFrame::Current()->GetFrame().GetFrameInterface();
-comphelper::dispatchCommand(".uno:InsertSymbol", xFrame, {});
+if (SfxViewFrame* pViewFrm = SfxViewFrame::Current())
+{
+uno::Reference xFrame = 
pViewFrm->GetFrame().GetFrameInterface();
+comphelper::dispatchCommand(".uno:InsertSymbol", xFrame, {});
+}
 }
 
 void SfxCharmapCtrl::GrabFocus()
diff --git a/sfx2/source/control/request.cxx b/sfx2/source/control/request.cxx
index 964a256b19a7..b43d1dd991bc 100644
--- a/sfx2/source/control/request.cxx
+++ b/sfx2/source/control/request.cxx
@@ -687,8 +687,14 @@ css::uno::Reference< css::frame::XDispatchRecorder > 
SfxRequest::GetMacroRecorde
 {
 css::uno::Reference< css::frame::XDispatchRecorder > xRecorder;
 
+if (!pView)
+pView = SfxViewFrame::Current();
+
+if (!pView)
+return xRecorder;
+
 css::uno::Reference< css::beans::XPropertySet > xSet(
-(pView ? pView : 
SfxViewFrame::Current())->GetFrame().GetFrameInterface(),
+pView->GetFrame().GetFrameInterface(),
 css::uno::UNO_QUERY);
 
 if(xSet.is())


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

2022-11-29 Thread Christian Lohmaier (via logerrit)
 sfx2/source/appl/sfxhelp.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 9988d022fffc24b1112ae066f6847b86e297667b
Author: Christian Lohmaier 
AuthorDate: Mon Nov 28 17:37:49 2022 +0100
Commit: Caolán McNamara 
CommitDate: Tue Nov 29 11:45:16 2022 +0100

f'up to the tdf#152172 fix re Safari as default browser on Ventura

Previous patch did only adjust the check in the rarely used version of
the function, not in the primarily used signature. D'oh!

Change-Id: I019a74651d3ee8bab43a8c3997b8cd05040b7ba4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143410
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier 
(cherry picked from commit c7b1fbff3673284d829606e5e07f9deb4258a5f5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143273
Reviewed-by: Caolán McNamara 

diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index bcea21952dc5..8295e03926ba 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -1291,7 +1291,7 @@ bool SfxHelp::Start_Impl(const OUString& rURL, 
weld::Widget* pWidget, const OUSt
 
static_cast(@"https://www.libreoffice.org";),
 nullptr),
 kLSRolesAll, nullptr);
-if([static_cast(CFURLGetString(pBrowser)) 
isEqualToString:@"file:///Applications/Safari.app/"]) {
+if([static_cast(CFURLGetString(pBrowser)) 
hasSuffix:@"/Applications/Safari.app/"]) {
 impl_showOnlineHelp(aHelpURL, pWidget);
 return true;
 }


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

2022-11-23 Thread Christian Lohmaier (via logerrit)
 sfx2/source/appl/sfxhelp.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 588c40b3a16008bfcfe6bb75e009faecaefccb7d
Author: Christian Lohmaier 
AuthorDate: Wed Nov 23 14:55:19 2022 +0100
Commit: Christian Lohmaier 
CommitDate: Wed Nov 23 20:20:14 2022 +0100

tdf#152172 fix help workaround re Safari as default browser on Ventura

the "Rapid Security Response" feature added with macOS 13 (Ventura)
makes Safari a stub in a different location. Instead of the traditional
/Application/Safari.app/ the call to query the default app will return
/System/Volumes/Preboot/Cryptexes/App/System/Applications/Safari.app/
So instead of a full match, just check for the suffix.

Change-Id: Ic4abfe33c118827bc0e089e9966e57a0fd8c0526
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143178
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier 
(cherry picked from commit e5d9db623882c7a9d88d40d5bf2bce0dbdb11365)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143158
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index d11c99b30b12..bcea21952dc5 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -1122,7 +1122,7 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const 
vcl::Window* pWindow)
 
static_cast(@"https://www.libreoffice.org";),
 nullptr),
 kLSRolesAll, nullptr);
-if([static_cast(CFURLGetString(pBrowser)) 
isEqualToString:@"file:///Applications/Safari.app/"]) {
+if([static_cast(CFURLGetString(pBrowser)) 
hasSuffix:@"/Applications/Safari.app/"]) {
 impl_showOnlineHelp(aHelpURL, pWeldWindow);
 return true;
 }


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

2022-10-07 Thread Caolán McNamara (via logerrit)
 sfx2/source/sidebar/Tools.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 3d8fd5c90b12d17cf6c3c51aada9321afdaa2e98
Author: Caolán McNamara 
AuthorDate: Thu Oct 6 15:27:30 2022 +0100
Commit: Michael Stahl 
CommitDate: Fri Oct 7 10:50:55 2022 +0200

tdf#150622 sidebar icons empty in High Contrast mode

Change-Id: Icfa78f0f655ee467c62cbc309b8e57ac310a73e7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140969
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sfx2/source/sidebar/Tools.cxx b/sfx2/source/sidebar/Tools.cxx
index 3c6886630439..727e85a4fac0 100644
--- a/sfx2/source/sidebar/Tools.cxx
+++ b/sfx2/source/sidebar/Tools.cxx
@@ -41,7 +41,7 @@ css::uno::Reference Tools::GetImage(
 const OUString& rsHighContrastImageURL,
 const Reference& rxFrame)
 {
-if (Theme::IsHighContrastMode())
+if (Theme::IsHighContrastMode() && !rsHighContrastImageURL.isEmpty())
 return GetImage(rsHighContrastImageURL, rxFrame);
 else
 return GetImage(rsImageURL, rxFrame);


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

2022-10-04 Thread Kevin Suo (via logerrit)
 sfx2/source/doc/doctempl.cxx |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit e2b9f3ea1ba70f07c3db56a331d6b926c8facb81
Author: Kevin Suo 
AuthorDate: Fri Sep 30 14:21:10 2022 +0800
Commit: Adolfo Jayme Barrientos 
CommitDate: Wed Oct 5 05:34:34 2022 +0200

Templates: Make localized names for "Simple" and "BPMN" show on the UI

Currently there are 32 localized template name strings defined in:
include/sfx2/strings.hrc. However, in sfx2/source/doc/doctempl.cxx
only 30 were used. This makes STR_TEMPLATE_NAME31 ("Simple") and
STR_TEMPLATE_NAME32 ("BPMN"), although already localized, not show up
on the Template Manager UI.

This patch adds these two strings in the sfx2/source/doc/doctempl.cxx,
so that they properly show as localized strings on the UI.

Change-Id: I64bb28cfe0a4d3b4b41c9114de7223014f6a3cfe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140785
Tested-by: Jenkins
Reviewed-by: Rafael Lima 
Reviewed-by: Laurent Balland 
(cherry picked from commit 244063d03117119d048376c84e22cf47c4abd250)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140956
Reviewed-by: Adolfo Jayme Barrientos 
Tested-by: Adolfo Jayme Barrientos 

diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx
index f464ab66f4a3..ebf2ddce4a1f 100644
--- a/sfx2/source/doc/doctempl.cxx
+++ b/sfx2/source/doc/doctempl.cxx
@@ -492,7 +492,9 @@ OUString SfxDocumentTemplates::ConvertResourceString(const 
OUString& rString)
 STR_TEMPLATE_NAME27_DEF,
 STR_TEMPLATE_NAME28_DEF,
 STR_TEMPLATE_NAME29_DEF,
-STR_TEMPLATE_NAME30_DEF
+STR_TEMPLATE_NAME30_DEF,
+STR_TEMPLATE_NAME31_DEF,
+STR_TEMPLATE_NAME32_DEF,
 };
 
 TranslateId STR_TEMPLATE_NAME[] =
@@ -526,7 +528,9 @@ OUString SfxDocumentTemplates::ConvertResourceString(const 
OUString& rString)
 STR_TEMPLATE_NAME27,
 STR_TEMPLATE_NAME28,
 STR_TEMPLATE_NAME29,
-STR_TEMPLATE_NAME30
+STR_TEMPLATE_NAME30,
+STR_TEMPLATE_NAME31,
+STR_TEMPLATE_NAME32,
 };
 
 static_assert(SAL_N_ELEMENTS(aTemplateNames) == 
SAL_N_ELEMENTS(STR_TEMPLATE_NAME));


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

2022-10-03 Thread Caolán McNamara (via logerrit)
 sfx2/source/dialog/backingwindow.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 18630ff2f994629d1e409b34e8486f2b59a4f109
Author: Caolán McNamara 
AuthorDate: Fri Sep 30 09:17:01 2022 +0100
Commit: Xisco Fauli 
CommitDate: Mon Oct 3 12:28:39 2022 +0200

tdf#143673 set an explicit drawing area bg

noticed in gtk darkmode on switching from initial application
to start center

Change-Id: I1cffab97ecd69ca6043531a6b2b5fc34b1ca84f1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140789
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit a091ae213eb8d64c21361969775b76e7911cc1af)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140755
Reviewed-by: Xisco Fauli 

diff --git a/sfx2/source/dialog/backingwindow.cxx 
b/sfx2/source/dialog/backingwindow.cxx
index cde9a7532d9f..6d8c2bbbc046 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -73,6 +73,11 @@ public:
 virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override
 {
 weld::CustomWidgetController::SetDrawingArea(pDrawingArea);
+
+const StyleSettings& rStyleSettings = 
Application::GetSettings().GetStyleSettings();
+OutputDevice& rDevice = pDrawingArea->get_ref_device();
+rDevice.SetBackground(Wallpaper(rStyleSettings.GetWindowColor()));
+
 SetPointer(PointerStyle::RefHand);
 }
 


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

2022-08-31 Thread Caolán McNamara (via logerrit)
 sfx2/source/appl/macroloader.cxx   |9 +++--
 sfx2/source/doc/iframe.cxx |   20 +++-
 sfx2/source/inc/macroloader.hxx|2 ++
 sw/source/filter/html/htmlplug.cxx |7 ++-
 sw/source/filter/xml/xmltexti.cxx  |9 +++--
 5 files changed, 37 insertions(+), 10 deletions(-)

New commits:
commit 3d9da8ce1e18feefc7ed2549bfe56b0dfb625da3
Author: Caolán McNamara 
AuthorDate: Tue Aug 30 17:01:08 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Wed Aug 31 18:04:40 2022 +0200

check IFrame "FrameURL" target

similiar to

commit b3edf85e0fe6ca03dc26e1bf531be82193bc9627
Date:   Wed Aug 7 17:37:11 2019 +0100

warn on load when a document binds an event to a macro

Change-Id: Iea888b1c083d2dc69ec322309ac9ae8c5e5eb315
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139059
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 
(cherry picked from commit c7450d0b9d02c64ae3da467d329040787039767e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138987

diff --git a/sfx2/source/appl/macroloader.cxx b/sfx2/source/appl/macroloader.cxx
index a6fe07000187..bf6dd7669b39 100644
--- a/sfx2/source/appl/macroloader.cxx
+++ b/sfx2/source/appl/macroloader.cxx
@@ -68,10 +68,10 @@ css::uno::Sequence SAL_CALL 
SfxMacroLoader::getSupportedServiceNames()
 return { "com.sun.star.frame.ProtocolHandler" };
 }
 
-SfxObjectShell* SfxMacroLoader::GetObjectShell_Impl()
+SfxObjectShell* SfxMacroLoader::GetObjectShell(const Reference & 
xFrame)
 {
 SfxObjectShell* pDocShell = nullptr;
-Reference < XFrame > xFrame( m_xFrame.get(), UNO_QUERY );
+
 if ( xFrame.is() )
 {
 SfxFrame* pFrame=nullptr;
@@ -88,6 +88,11 @@ SfxObjectShell* SfxMacroLoader::GetObjectShell_Impl()
 return pDocShell;
 }
 
+SfxObjectShell* SfxMacroLoader::GetObjectShell_Impl()
+{
+Reference < XFrame > xFrame( m_xFrame.get(), UNO_QUERY );
+return SfxMacroLoader::GetObjectShell(xFrame);
+}
 
 uno::Reference SAL_CALL SfxMacroLoader::queryDispatch(
 const util::URL&   aURL,
diff --git a/sfx2/source/doc/iframe.cxx b/sfx2/source/doc/iframe.cxx
index 58a387527e4a..80e0c4e68457 100644
--- a/sfx2/source/doc/iframe.cxx
+++ b/sfx2/source/doc/iframe.cxx
@@ -39,10 +39,12 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star;
 
@@ -158,6 +160,19 @@ sal_Bool SAL_CALL IFrameObject::load(
 {
 if ( officecfg::Office::Common::Misc::PluginsEnabled::get() )
 {
+util::URL aTargetURL;
+aTargetURL.Complete = maFrmDescr.GetURL().GetMainURL( 
INetURLObject::DecodeMechanism::NONE );
+uno::Reference < util::XURLTransformer > xTrans( 
util::URLTransformer::create( mxContext ) );
+xTrans->parseStrict( aTargetURL );
+
+if (INetURLObject(aTargetURL.Complete).GetProtocol() == 
INetProtocol::Macro)
+{
+uno::Reference xParentFrame = 
xFrame->getCreator();
+SfxObjectShell* pDoc = 
SfxMacroLoader::GetObjectShell(xParentFrame);
+if (pDoc && !pDoc->AdjustMacroMode())
+return false;
+}
+
 DBG_ASSERT( !mxFrame.is(), "Frame already existing!" );
 VclPtr pParent = VCLUnoHelper::GetWindow( 
xFrame->getContainerWindow() );
 VclPtr pWin = VclPtr::Create( 
pParent, maFrmDescr.IsFrameBorderOn() );
@@ -180,11 +195,6 @@ sal_Bool SAL_CALL IFrameObject::load(
 if ( xFramesSupplier.is() )
 mxFrame->setCreator( xFramesSupplier );
 
-util::URL aTargetURL;
-aTargetURL.Complete = maFrmDescr.GetURL().GetMainURL( 
INetURLObject::DecodeMechanism::NONE );
-uno::Reference < util::XURLTransformer > xTrans( 
util::URLTransformer::create( mxContext ) );
-xTrans->parseStrict( aTargetURL );
-
 uno::Sequence < beans::PropertyValue > aProps{
 comphelper::makePropertyValue("PluginMode", sal_Int16(2)),
 comphelper::makePropertyValue("ReadOnly", true)
diff --git a/sfx2/source/inc/macroloader.hxx b/sfx2/source/inc/macroloader.hxx
index b51cae3d93cf..250a07cd8ca1 100644
--- a/sfx2/source/inc/macroloader.hxx
+++ b/sfx2/source/inc/macroloader.hxx
@@ -79,6 +79,8 @@ public:
 virtual void SAL_CALL addStatusListener( const css::uno::Reference< 
css::frame::XStatusListener >& xControl, const css::util::URL& aURL ) override;
 
 virtual void SAL_CALL removeStatusListener( const css::uno::Reference< 
css::frame::XStatusListener >& xControl, const css::util::URL& aURL ) override;
+
+static SfxObjectShell* GetObjectShell(const 
css::uno::Reference& xFrame);
 };
 
 #endif
diff --git a/sw/source/filter/html/htmlplug.cxx 
b/sw/source/filter/html/htmlplug.cxx
index c6a939646f3a..ab9f75405a68 100644
--- a/sw/source/filter/html/htmlplug.cxx
+++ b/sw/source/filter/html/htmlplug.cxx
@@ -1105,7 +1105,12 @@ void SwHTMLParser::InsertFloatingFrame()
 bool bHasBorder = aFrame

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

2022-08-24 Thread Rafael Lima (via logerrit)
 sfx2/source/doc/templatedlg.cxx |3 +++
 sfx2/uiconfig/ui/templatedlg.ui |3 +--
 2 files changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 271711523e5f0d1191012009de311cc15b2096c2
Author: Rafael Lima 
AuthorDate: Sat Jul 9 00:43:13 2022 +0200
Commit: Christian Lohmaier 
CommitDate: Wed Aug 24 17:13:08 2022 +0200

tdf#149768 Do not fix Templates dialog width and height in pixels

This patch removes the fixed size of the Templates dialog in pixels so it 
works better in HiDPI displays.

This patch also makes the dialog a bit wider and non-resizable.

Change-Id: I256d8d5c8b76c8e32a4f008f3a235f80bf59634d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136922
Reviewed-by: Heiko Tietze 
Tested-by: Heiko Tietze 
(cherry picked from commit 410bff99a708371eed6a82677b44e2151a4a990a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138546
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier 

diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index ac3015ceb8c0..42e570e75dfb 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -203,6 +203,9 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg(weld::Window 
*pParent)
 
 mxLocalView->ShowTooltips(true);
 
+// Set width and height of the templates thumbnail viewer to acommodate 3 
rows and 4 columns of items
+mxLocalViewWeld->set_size_request(TEMPLATE_ITEM_MAX_WIDTH * 5, 
TEMPLATE_ITEM_MAX_HEIGHT_SUB * 3);
+
 mxOKButton->connect_clicked(LINK(this, SfxTemplateManagerDlg, OkClickHdl));
 // FIXME: rather than disabling make 
dispatchCommand(".uno:AdditionsDialog") work in start center
 if ( !SfxModule::GetActiveModule() )
diff --git a/sfx2/uiconfig/ui/templatedlg.ui b/sfx2/uiconfig/ui/templatedlg.ui
index 013eacb2a467..7f7fe31d6371 100644
--- a/sfx2/uiconfig/ui/templatedlg.ui
+++ b/sfx2/uiconfig/ui/templatedlg.ui
@@ -39,11 +39,10 @@
 
   
   
-740
-500
 False
 6
 Templates
+False
 True
 0
 0


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

2022-08-10 Thread Caolán McNamara (via logerrit)
 sfx2/source/appl/newhelp.cxx |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 08d1ff386546e0926b9fe0d186c565112010fc2b
Author: Caolán McNamara 
AuthorDate: Mon Aug 8 17:01:31 2022 +0200
Commit: Xisco Fauli 
CommitDate: Wed Aug 10 09:09:42 2022 +0200

sfx2: check saved last tab page name exists before restoring it

since GetPage might return nullptr on a nonexisting page

See 
https://crashreport.libreoffice.org/stats/signature/SfxHelpIndexWindow_Impl::ActivatePageHdl(rtl::OString%20const%20&)

Change-Id: I26e21f783645e8a87d56cbe76c0126de8947bf3e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138014
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx
index 701369f378c7..d9fdc9d0cb59 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -1308,7 +1308,11 @@ 
SfxHelpIndexWindow_Impl::SfxHelpIndexWindow_Impl(SfxHelpWindow_Impl* _pParent, w
 OString sPageId("index");
 SvtViewOptions aViewOpt( EViewType::TabDialog, CONFIGNAME_INDEXWIN );
 if ( aViewOpt.Exists() )
-sPageId = aViewOpt.GetPageID();
+{
+OString sSavedPageId = aViewOpt.GetPageID();
+if (m_xTabCtrl->get_page_index(sSavedPageId) != -1)
+sPageId = sSavedPageId;
+}
 m_xTabCtrl->set_current_page(sPageId);
 ActivatePageHdl(sPageId);
 m_xActiveLB->connect_changed(LINK(this, SfxHelpIndexWindow_Impl, 
SelectHdl));


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

2022-07-29 Thread Caolán McNamara (via logerrit)
 sfx2/source/dialog/recfloat.cxx |   15 ---
 sfx2/source/inc/recfloat.hxx|4 
 2 files changed, 16 insertions(+), 3 deletions(-)

New commits:
commit 2e602bab5d34fa9220da0885d07ff43537c27fcc
Author: Caolán McNamara 
AuthorDate: Thu Jul 28 15:49:32 2022 +0100
Commit: Caolán McNamara 
CommitDate: Fri Jul 29 21:36:48 2022 +0200

Resolves: tdf#147782 restore focus to launching frame asynchronously

Change-Id: I7ebde70e4e1aae861f6ac7d70a91741596cb2cc5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137525
Reviewed-by: Michael Stahl 
Tested-by: Jenkins

diff --git a/sfx2/source/dialog/recfloat.cxx b/sfx2/source/dialog/recfloat.cxx
index d835e7640bc5..1b674f602b71 100644
--- a/sfx2/source/dialog/recfloat.cxx
+++ b/sfx2/source/dialog/recfloat.cxx
@@ -101,6 +101,7 @@ SfxRecordingFloat_Impl::SfxRecordingFloat_Impl(SfxBindings* 
pBind, SfxChildWindo
   "FloatingRecord")
 , m_xToolbar(m_xBuilder->weld_toolbar("toolbar"))
 , m_xDispatcher(new ToolbarUnoDispatcher(*m_xToolbar, *m_xBuilder, 
pBind->GetActiveFrame()))
+, mnPostUserEventId(nullptr)
 , m_bFirstActivate(true)
 {
 // start recording
@@ -109,6 +110,14 @@ 
SfxRecordingFloat_Impl::SfxRecordingFloat_Impl(SfxBindings* pBind, SfxChildWindo
 SfxCallMode::SYNCHRON, { &aItem });
 }
 
+IMPL_LINK_NOARG(SfxRecordingFloat_Impl, PresentParentFrame, void*, void)
+{
+mnPostUserEventId = nullptr;
+css::uno::Reference 
xTopWindow(m_xDispatcher->GetFrame()->getContainerWindow(), 
css::uno::UNO_QUERY);
+if (xTopWindow.is())
+xTopWindow->toFront();
+}
+
 void SfxRecordingFloat_Impl::Activate()
 {
 SfxModelessDialogController::Activate();
@@ -116,13 +125,13 @@ void SfxRecordingFloat_Impl::Activate()
 return;
 // tdf#147782 retain focus in launching frame on the first activate on 
automatically gaining focus on getting launched
 m_bFirstActivate = false;
-css::uno::Reference 
xTopWindow(m_xDispatcher->GetFrame()->getContainerWindow(), 
css::uno::UNO_QUERY);
-if (xTopWindow.is())
-xTopWindow->toFront();
+mnPostUserEventId = Application::PostUserEvent(LINK(this, 
SfxRecordingFloat_Impl, PresentParentFrame));
 }
 
 SfxRecordingFloat_Impl::~SfxRecordingFloat_Impl()
 {
+if (mnPostUserEventId)
+Application::RemoveUserEvent(mnPostUserEventId);
 m_xDispatcher->dispose();
 }
 
diff --git a/sfx2/source/inc/recfloat.hxx b/sfx2/source/inc/recfloat.hxx
index b7a4882cd72e..e5720e155cd6 100644
--- a/sfx2/source/inc/recfloat.hxx
+++ b/sfx2/source/inc/recfloat.hxx
@@ -42,7 +42,11 @@ class SfxRecordingFloat_Impl final : public 
SfxModelessDialogController
 {
 std::unique_ptr m_xToolbar;
 std::unique_ptr m_xDispatcher;
+ImplSVEvent *mnPostUserEventId;
 bool m_bFirstActivate;
+
+DECL_LINK(PresentParentFrame, void*, void);
+
 public:
 SfxRecordingFloat_Impl(SfxBindings* pBindings,
SfxChildWindow* pChildWin,


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

2022-07-27 Thread Michael Stahl (via logerrit)
 sfx2/source/view/viewfrm.cxx |   26 --
 1 file changed, 26 deletions(-)

New commits:
commit b1d54e724ae360a22e08ef20e83a81804ebfae21
Author: Michael Stahl 
AuthorDate: Tue Jul 19 16:34:14 2022 +0200
Commit: Xisco Fauli 
CommitDate: Wed Jul 27 10:08:16 2022 +0200

tdf#149170 sfx2: fix regression about spurious dialog

Open a document that is locked, choose Read-Only, then click "Edit" on
infobar: it is still locked, so a dialog pops up. Click "Cancel".

Now a *second* dialog pops up that *again* asks if you want to open a
copy of the document - this appears pointless so let's remove it.

Change-Id: Id96a1211caea63e7559c67b08a6581d1a0ce9add
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137234
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit a1ca68e91868df51a269682f7c3dac62a88a85ef)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137421
Reviewed-by: Xisco Fauli 

diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 3e09372dd781..da5477928f51 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -765,9 +765,6 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
 // Do not cache the old Document! Is invalid when loading
 // another document.
 
-const SfxStringItem* pSavedOptions = 
SfxItemSet::GetItem(pMedium->GetItemSet(), 
SID_FILE_FILTEROPTIONS, false);
-const SfxStringItem* pSavedReferer = 
SfxItemSet::GetItem(pMedium->GetItemSet(), SID_REFERER, false);
-
 bool bHasStorage = pMedium->HasStorage_Impl();
 if( bHandsOff )
 {
@@ -812,29 +809,6 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
 
 xOldObj->DoSaveCompleted( pMedium );
 }
-
-// r/o-Doc couldn't be switched to writing mode
-if ( bForEdit && ( SID_EDITDOC == rReq.GetSlot() || 
SID_READONLYDOC == rReq.GetSlot() ) )
-{
-// ask user for opening as template
-std::unique_ptr 
xBox(Application::CreateMessageDialog(GetWindow().GetFrameWeld(),
-   
  VclMessageType::Question, VclButtonsType::YesNo,
-   
  SfxResId(STR_QUERY_OPENASTEMPLATE)));
-if (RET_YES == xBox->run())
-{
-SfxAllItemSet aSet( pApp->GetPool() );
-aSet.Put( SfxStringItem( SID_FILE_NAME, 
pMedium->GetName() ) );
-aSet.Put( SfxStringItem( SID_TARGETNAME, "_blank" 
) );
-if ( pSavedOptions )
-aSet.Put( *pSavedOptions );
-if ( pSavedReferer )
-aSet.Put( *pSavedReferer );
-aSet.Put( SfxBoolItem( SID_TEMPLATE, true ) );
-if( pFilter )
-aSet.Put( SfxStringItem( SID_FILTER_NAME, 
pFilter->GetFilterName() ) );
-GetDispatcher()->Execute( SID_OPENDOC, 
SfxCallMode::ASYNCHRON, aSet );
-}
-}
 }
 else
 {


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

2022-07-23 Thread Aron Budea (via logerrit)
 sfx2/source/sidebar/SidebarController.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 085579ecad6ca7892e9edd0b84e3c28f4a1b8330
Author: Aron Budea 
AuthorDate: Wed Jul 20 17:16:12 2022 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Sat Jul 23 14:09:30 2022 +0200

tdf#141294 Use DPI scale factor for sidebar width limit in config

And don't lock up if the calculated minimum exceeds the maximum
(sidebar remains unresizable in that case, however).

Change-Id: Ibe96a43ad5d6a3fe4132a9fb64fe244ab022668d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137267
Tested-by: Jenkins
Reviewed-by: Szymon Kłos 
Reviewed-by: Aron Budea 
(cherry picked from commit d2584db4e0f9295aee5b9e5f8218af382f007637)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137188
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sfx2/source/sidebar/SidebarController.cxx 
b/sfx2/source/sidebar/SidebarController.cxx
index 088384641efd..0bd71db0240d 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -121,7 +121,6 @@ SidebarController::SidebarController (
   this)),
   maCurrentContext(OUString(), OUString()),
   mnRequestedForceFlags(SwitchFlag_NoForce),
-  
mnMaximumSidebarWidth(officecfg::Office::UI::Sidebar::General::MaximumWidth::get()),
   
mbMinimumSidebarWidth(officecfg::Office::UI::Sidebar::General::MinimumWidth::get()),
   msCurrentDeckId(gsDefaultDeckId),
   maPropertyChangeForwarder([this](){ return 
this->BroadcastPropertyChange(); }),
@@ -133,6 +132,7 @@ SidebarController::SidebarController (
   mpSplitWindow(nullptr),
   mnWidthOnSplitterButtonDown(0)
 {
+mnMaximumSidebarWidth = 
officecfg::Office::UI::Sidebar::General::MaximumWidth::get() * 
mpTabBar->GetDPIScaleFactor();
 // Decks and panel collections for this sidebar
 mpResourceManager = std::make_unique();
 }
@@ -1433,7 +1433,7 @@ void SidebarController::RestrictWidth (sal_Int32 nWidth)
 
 pSplitWindow->SetItemSizeRange(
 nSetId,
-Range(nRequestedWidth, getMaximumWidth()));
+Range(nRequestedWidth, std::max(nRequestedWidth, 
getMaximumWidth(;
 }
 }
 


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

2022-07-19 Thread László Németh (via logerrit)
 sfx2/source/view/viewfrm.cxx |   44 ---
 1 file changed, 29 insertions(+), 15 deletions(-)

New commits:
commit 06229e4df02ddccb0408538271e0fbf683847355
Author: László Németh 
AuthorDate: Tue Jul 19 14:53:52 2022 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Tue Jul 19 20:01:22 2022 +0200

tdf#148913 sw: fix crash with pending infobars on Windows

Usage of VclPtr wasn't thread-safe
on Windows, resulting random crashing during loading big
documents.

Regression from commit d89786054715b44aa983d0752484216825c74ae2
"tdf#125909 tdf#141298 sw: show (Hidden) Track Changes infobar".

Change-Id: Ic6a6ad43a8cf7ea650ef6d1c0aa5c76c48763ea8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137230
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit a3745e55c9976cb5f7cfce341bc5dc2e7fc4fa6e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137183
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index f0f539ca675d..3e09372dd781 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -1537,27 +1537,41 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, 
const SfxHint& rHint )
 }
 }
 
-VclPtr pInfoBar =
-AppendInfoBar(aInfobarData.msId, 
aInfobarData.msPrimaryMessage,
+// Track Changes infobar: add a button to show/hide Track 
Changes functions
+// Hyphenation infobar: add a button to get more 
information
+// tdf#148913 limit VclPtr usage for these
+bool bTrackChanges = aInfobarData.msId == 
"hiddentrackchanges";
+if ( bTrackChanges || aInfobarData.msId == 
"hyphenationmissing" )
+{
+VclPtr pInfoBar =
+AppendInfoBar(aInfobarData.msId, 
aInfobarData.msPrimaryMessage,
   aInfobarData.msSecondaryMessage, 
aInfobarData.maInfobarType,
   aInfobarData.mbShowCloseButton);
 
-// Track Changes infobar: add a button to show/hide Track 
Changes functions
-if ( pInfoBar && aInfobarData.msId == "hiddentrackchanges" 
)
-{
-weld::Button& rTrackChangesButton = 
pInfoBar->addButton();
-
rTrackChangesButton.set_label(SfxResId(STR_TRACK_CHANGES_BUTTON));
-rTrackChangesButton.connect_clicked(LINK(this,
+// tdf#148913 don't extend this condition to keep it 
thread-safe
+if (pInfoBar)
+{
+weld::Button& rButton = pInfoBar->addButton();
+rButton.set_label(SfxResId(bTrackChanges
+? STR_TRACK_CHANGES_BUTTON
+: STR_HYPHENATION_BUTTON));
+if (bTrackChanges)
+{
+rButton.connect_clicked(LINK(this,
 SfxViewFrame, 
HiddenTrackChangesHandler));
+}
+else
+{
+rButton.connect_clicked(LINK(this,
+SfxViewFrame, 
HyphenationMissingHandler));
+}
+}
 }
-
-// Hyphenation infobar: add a button to get more 
information
-if ( pInfoBar && aInfobarData.msId == "hyphenationmissing" 
)
+else
 {
-weld::Button& rHyphenationButton = 
pInfoBar->addButton();
-
rHyphenationButton.set_label(SfxResId(STR_HYPHENATION_BUTTON));
-rHyphenationButton.connect_clicked(LINK(this,
-   SfxViewFrame, 
HyphenationMissingHandler));
+AppendInfoBar(aInfobarData.msId, 
aInfobarData.msPrimaryMessage,
+  aInfobarData.msSecondaryMessage, 
aInfobarData.maInfobarType,
+  aInfobarData.mbShowCloseButton);
 }
 
 aPendingInfobars.pop_back();


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

2022-07-08 Thread Stephan Bergmann (via logerrit)
 sfx2/source/view/viewfrm.cxx |   11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 7106ee81fe1b237217c199c649c847c6d31b5dd7
Author: Stephan Bergmann 
AuthorDate: Fri Jul 8 16:47:01 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Jul 8 20:16:36 2022 +0200

rhbz#2104545: Only call utl::IsYounger when its result is actually used

...as it may be expensive, or even throw (uncaught) exceptions (as 
apparently
happened at rhbz#2104545, throwing some css::uno::RuntimeException while 
aMedObj
was an sftp URL).

The two branches in the if statement's condition that will now potentially 
call
physObjIsOlder are disjoint (one for aMedObj being a file URL, the other for
aMedObj being any WebDAV-related URL), so there is no chance that this 
change
accidentally causes utl::IsYounger to be called more often than it used to 
be
called.

Change-Id: I29a5f18a12a8b83ec603366db26451175b5622c9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136904
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 
(cherry picked from commit 3467491f68f9c43f30c7b2b3c81f4110ec625900)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136919

diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 43c111216402..f0f539ca675d 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -269,6 +269,11 @@ bool AskPasswordToModify_Impl( const uno::Reference< 
task::XInteractionHandler >
 
 return bResult;
 }
+
+bool physObjIsOlder(INetURLObject const & aMedObj, INetURLObject const & 
aPhysObj) {
+return ::utl::UCBContentHelper::IsYounger(aMedObj.GetMainURL( 
INetURLObject::DecodeMechanism::NONE),
+   aPhysObj.GetMainURL( 
INetURLObject::DecodeMechanism::NONE ) );
+}
 }
 
 void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
@@ -437,8 +442,6 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
 // etag tells that the cache representation (e.g. in LO) is 
different from the one on the server,
 // but tells nothing about the age
 // Details at this link: 
http://tools.ietf.org/html/rfc4918#section-15, section 15.7
-bool const bPhysObjIsOlder = 
::utl::UCBContentHelper::IsYounger(aMedObj.GetMainURL( 
INetURLObject::DecodeMechanism::NONE),
- 
aPhysObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
 bool bIsWebDAV = aMedObj.isAnyKnownWebDAVScheme();
 
 // tdf#118938 Reload the document when the user enters the editing 
password,
@@ -446,8 +449,8 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
 if ( ( !bNeedsReload && ( ( aMedObj.GetProtocol() == 
INetProtocol::File &&
 ( aMedObj.getFSysPath( 
FSysStyle::Detect ) != aPhysObj.getFSysPath( FSysStyle::Detect )
   || bPasswordEntered ) &&
-!bPhysObjIsOlder)
-  || (bIsWebDAV && !bPhysObjIsOlder)
+!physObjIsOlder(aMedObj, aPhysObj))
+  || (bIsWebDAV && 
!physObjIsOlder(aMedObj, aPhysObj))
   || ( pMed->IsRemote() && !bIsWebDAV ) ) )
  || pVersionItem )
 // <- tdf#82744


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

2022-07-05 Thread Xisco Fauli (via logerrit)
 sfx2/source/appl/appserv.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 9e25ab14713a31746a9a8a62649b046606ae04b2
Author: Xisco Fauli 
AuthorDate: Tue Jul 5 15:51:21 2022 +0200
Commit: Xisco Fauli 
CommitDate: Tue Jul 5 21:17:18 2022 +0200

sfx2: fix null derefs of SfxViewFrame::Current()

See 
https://crashreport.libreoffice.org/stats/signature/%60anonymous%20namespace'::lcl_tryLoadBibliography

Change-Id: I80d764c4bbcf0c5affa3386fbb11f5a79e98b699
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136766
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index 66ac22ee133a..ee603ab5e097 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -186,8 +186,10 @@ namespace
 SfxStringItem aURL(SID_FILE_NAME, ".component:Bibliography/View1");
 SfxStringItem aRef(SID_REFERER, "private:user");
 SfxStringItem aTarget(SID_TARGETNAME, "_blank");
-SfxViewFrame::Current()->GetDispatcher()->ExecuteList(SID_OPENDOC,
-SfxCallMode::ASYNCHRON, { &aURL, &aRef, &aTarget });
+const SfxViewFrame* pViewFrame = SfxViewFrame::Current();
+if ( pViewFrame )
+pViewFrame->GetDispatcher()->ExecuteList(SID_OPENDOC,
+SfxCallMode::ASYNCHRON, { &aURL, &aRef, &aTarget });
 }
 catch (const Exception &)
 {


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

2022-07-04 Thread Christian Lohmaier (via logerrit)
 sfx2/source/appl/sfxhelp.cxx |   16 
 1 file changed, 16 insertions(+)

New commits:
commit 0db0e229fd2696ce9410576bdd2ba2e98cf4673d
Author: Christian Lohmaier 
AuthorDate: Thu Jun 30 22:23:30 2022 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Sun Jul 3 11:18:28 2022 +0200

tdf#149603 macOS: fix workaround to use web help if Safari is the default 
browser

Safari won't access the local helpfiles from LO's app folder unless you
enable Safari's webdeveloper menu. The workaround broke since
f31f0038f5fd9254584a06665066faf9715d1cd8 switched from window to widget
references and hence using a different codepath, skipping the workaround
added in 44893662d510c4173e55ba27af02d0258a697a5d

Change-Id: I0c59066fe1cef1514c6595e0439d31d3e60e02f3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136685
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier 
(cherry picked from commit 184a45c4176d96bf799a8f8a0fba290a8c851948)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136705
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index 4aa13c6f2c64..d11c99b30b12 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -1281,6 +1281,22 @@ bool SfxHelp::Start_Impl(const OUString& rURL, 
weld::Widget* pWidget, const OUSt
 impl_showOnlineHelp(aHelpURL, pWidget);
 return true;
 }
+#ifdef MACOSX
+if (@available(macOS 10.14, *)) {
+// Workaround: Safari sandboxing prevents it from accessing files in 
the LibreOffice.app folder
+// force online-help instead if Safari is default browser.
+CFURLRef pBrowser = LSCopyDefaultApplicationURLForURL(
+CFURLCreateWithString(
+kCFAllocatorDefault,
+
static_cast(@"https://www.libreoffice.org";),
+nullptr),
+kLSRolesAll, nullptr);
+if([static_cast(CFURLGetString(pBrowser)) 
isEqualToString:@"file:///Applications/Safari.app/"]) {
+impl_showOnlineHelp(aHelpURL, pWidget);
+return true;
+}
+}
+#endif
 
 // If the HTML or no help is installed, but aHelpURL nevertheless 
references valid help content,
 // that implies that help content belongs to an extension (and thus would 
not be available


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

2022-06-17 Thread xuenhua (via logerrit)
 sfx2/source/sidebar/SidebarController.cxx |9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 334b44affe24340f44216021a4699699dd5dde96
Author: xuenhua 
AuthorDate: Wed Jun 1 15:29:49 2022 +0800
Commit: Adolfo Jayme Barrientos 
CommitDate: Sat Jun 18 05:53:33 2022 +0200

tdf#149431 Fix the sidebar's width

When click the wider sidebar and then go back to the narrow one in Writer,
the narrow one becomes the same width as wider one, it's not suitable
and doesn't look good. Fix the width to smallest width unless you drag
the splitter. Take the maximum width from the smallest width and
mnWidthOnSplitterButtonDown.

Change-Id: I60aaab84593d59ac28b96c2d3c3bd62a4bbddbbe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135220
Tested-by: Jenkins
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 
(cherry picked from commit 0ec2b93c28093c80572c43f7be261630bd85f232)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136039
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sfx2/source/sidebar/SidebarController.cxx 
b/sfx2/source/sidebar/SidebarController.cxx
index cff76a95850b..088384641efd 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -506,6 +506,8 @@ void SidebarController::ProcessNewWidth (const sal_Int32 
nNewWidth)
 {
 // Deck became large enough to be shown.  Show it.
 mnSavedSidebarWidth = nNewWidth;
+// Store nNewWidth to mnWidthOnSplitterButtonDown when dragging 
sidebar Splitter
+mnWidthOnSplitterButtonDown = nNewWidth;
 if (!*mbIsDeckOpen)
 RequestOpenDeck();
 }
@@ -653,8 +655,12 @@ void SidebarController::OpenThenToggleDeck (
 if (mpCurrentDeck && mpTabBar)
 {
 sal_Int32 nRequestedWidth = mpCurrentDeck->GetMinimalWidth() + 
TabBar::GetDefaultWidth();
-if (mnSavedSidebarWidth < nRequestedWidth)
+// if sidebar was dragged
+if(mnWidthOnSplitterButtonDown > 0 && mnWidthOnSplitterButtonDown > 
nRequestedWidth){
+SetChildWindowWidth(mnWidthOnSplitterButtonDown);
+}else{
 SetChildWindowWidth(nRequestedWidth);
+}
 }
 }
 
@@ -1060,7 +1066,6 @@ IMPL_LINK(SidebarController, WindowEventHandler, 
VclWindowEvent&, rEvent, void)
 case VclEventId::WindowMouseButtonUp:
 {
 ProcessNewWidth(mpParentWindow->GetSizePixel().Width());
-mnWidthOnSplitterButtonDown = 0;
 break;
 }
 


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

2022-06-13 Thread Julien Nabet (via logerrit)
 sfx2/source/control/dispatch.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit f4bc77275485e3213c5592062d29905e624953ee
Author: Julien Nabet 
AuthorDate: Sun Jun 12 18:07:22 2022 +0200
Commit: Xisco Fauli 
CommitDate: Mon Jun 13 13:11:38 2022 +0200

Fix context menu on image which doesnt display

- Launch Writer
- Insert any image in it
- Right click on it
=> Nothing displays
+ console shows:
warn:legacy.osl:67182:67182:vcl/source/window/menu.cxx:2750: 
PopupMenu::Execute: need a non-NULL window!

Regression from f71606c920a3f78294da745cd9ef1eacde010224
new loplugin:moveit

Change-Id: I89f5bfe2a3cd6a935b419d55c2f3e884c7eed2c7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135681
Tested-by: Jenkins
Reviewed-by: Julien Nabet 
(cherry picked from commit 8ec56c5ab7ff81d271820ddfa66f27fbc950dbe6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135696
Reviewed-by: Xisco Fauli 

diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx
index f6082ad8f9a4..17edf97cc16d 100644
--- a/sfx2/source/control/dispatch.cxx
+++ b/sfx2/source/control/dispatch.cxx
@@ -1850,7 +1850,7 @@ void SfxDispatcher::ExecutePopup( const OUString& 
rResName, vcl::Window* pWin, c
 else
 {
 OUString aMenuURL = "private:resource/popupmenu/" + rResName;
-if (GetFrame()->GetViewShell()->TryContextMenuInterception(xPopupMenu, 
aMenuURL, std::move(aEvent)))
+if (GetFrame()->GetViewShell()->TryContextMenuInterception(xPopupMenu, 
aMenuURL, aEvent))
 {
 css::uno::Reference 
xParent(aEvent.SourceWindow, css::uno::UNO_QUERY);
 xPopupMenu->execute(xParent, css::awt::Rectangle(aPos.X(), 
aPos.Y(), 1, 1), css::awt::PopupMenuDirection::EXECUTE_DOWN);