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

2023-11-23 Thread Caolán McNamara (via logerrit)
 sd/source/ui/app/sdmod1.cxx |   29 ++---
 1 file changed, 18 insertions(+), 11 deletions(-)

New commits:
commit 569fa7f755718a06f23d25b2132bf0400cec7a0f
Author: Caolán McNamara 
AuthorDate: Wed Nov 22 21:14:41 2023 +
Commit: Miklos Vajna 
CommitDate: Fri Nov 24 08:52:35 2023 +0100

reuse AllowedLinkProtocolFromDocument in impress/draw

Change-Id: I73ca4f087946a45dbf92d69a0dc1e769de9b5690
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159843
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit f0942eed2eb328b04856f20613f5226d66b66a20)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159759
Reviewed-by: Michael Stahl 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159884
Reviewed-by: Miklos Vajna 

diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx
index 573ee853069b..b22feb2d1f21 100644
--- a/sd/source/ui/app/sdmod1.cxx
+++ b/sd/source/ui/app/sdmod1.cxx
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -192,26 +193,32 @@ void SdModule::Execute(SfxRequest& rReq)
 {
 bool bIntercept = false;
 ::sd::DrawDocShell* pDocShell = dynamic_cast< ::sd::DrawDocShell 
*>( SfxObjectShell::Current() );
-if (pDocShell)
+::sd::ViewShell* pViewShell = pDocShell ? 
pDocShell->GetViewShell() : nullptr;
+if (pViewShell)
 {
-::sd::ViewShell* pViewShell = pDocShell->GetViewShell();
-if (pViewShell)
+if( sd::SlideShow::IsRunning( pViewShell->GetViewShellBase() ) 
)
 {
-if( sd::SlideShow::IsRunning( 
pViewShell->GetViewShellBase() ) )
+// Prevent documents from opening while the slide
+// show is running, except when this request comes
+// from a shape interaction.
+if (rReq.GetArgs() == nullptr)
 {
-// Prevent documents from opening while the slide
-// show is running, except when this request comes
-// from a shape interaction.
-if (rReq.GetArgs() == nullptr)
-{
-bIntercept = true;
-}
+bIntercept = true;
 }
 }
 }
 
 if (!bIntercept)
 {
+if (const SfxStringItem* pURLItem = 
rReq.GetArg(SID_FILE_NAME))
+{
+if (!pViewShell || 
!SfxObjectShell::AllowedLinkProtocolFromDocument(pURLItem->GetValue(),
+   
 pViewShell->GetObjectShell(),
+   
 pViewShell->GetFrameWeld()))
+{
+return;
+}
+}
 SfxGetpApp()->ExecuteSlot(rReq, SfxGetpApp()->GetInterface());
 }
 else


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

2023-10-02 Thread Caolán McNamara (via logerrit)
 sd/source/ui/dlg/prltempl.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit d42f178418a255ebba902b9bdea63effe2fd2b70
Author: Caolán McNamara 
AuthorDate: Sun Oct 1 15:49:27 2023 +0100
Commit: Michael Stahl 
CommitDate: Mon Oct 2 13:38:46 2023 +0200

Resolves: tdf#157515 only remove RID_SVXPAGE_PARA_ASIAN once

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

diff --git a/sd/source/ui/dlg/prltempl.cxx b/sd/source/ui/dlg/prltempl.cxx
index 869f13c837d4..e7b77a46608b 100644
--- a/sd/source/ui/dlg/prltempl.cxx
+++ b/sd/source/ui/dlg/prltempl.cxx
@@ -141,7 +141,7 @@ 
SdPresLayoutTemplateDlg::SdPresLayoutTemplateDlg(SfxObjectShell const * pDocSh,
 AddTabPage( "RID_SVXPAGE_ALIGN_PARAGRAPH", pFact->GetTabPageCreatorFunc( 
RID_SVXPAGE_ALIGN_PARAGRAPH ), nullptr );
 AddTabPage( "RID_SVXPAGE_BKG", pFact->GetTabPageCreatorFunc( 
RID_SVXPAGE_BKG ), nullptr);
 
-if( !SvtCJKOptions::IsAsianTypographyEnabled() )
+if (!SvtCJKOptions::IsAsianTypographyEnabled() || bBackground)
 RemoveTabPage( "RID_SVXPAGE_PARA_ASIAN" );
 
 if (bBackground)
@@ -160,7 +160,6 @@ 
SdPresLayoutTemplateDlg::SdPresLayoutTemplateDlg(SfxObjectShell const * pDocSh,
 RemoveTabPage( "RID_SVXPAGE_NUM_OPTIONS");
 RemoveTabPage( "RID_SVXPAGE_TABULATOR");
 RemoveTabPage( "RID_SVXPAGE_ALIGN_PARAGRAPH");
-RemoveTabPage( "RID_SVXPAGE_PARA_ASIAN" );
 RemoveTabPage( "RID_SVXPAGE_BKG" );
 }
 


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

2023-06-02 Thread Jim Raykowski (via logerrit)
 sd/source/ui/dlg/navigatr.cxx |1 +
 sd/source/ui/dlg/sdtreelb.cxx |   35 ---
 2 files changed, 33 insertions(+), 3 deletions(-)

New commits:
commit b23077e1912c41905b44c15c914cb6db889cd22b
Author: Jim Raykowski 
AuthorDate: Sun May 21 15:39:11 2023 -0800
Commit: Xisco Fauli 
CommitDate: Fri Jun 2 12:39:34 2023 +0200

tdf#155393 SdNavigator: Enhancement to navigate in Notes view

Change-Id: Icea71217fa5ffadc637bd7d9b8cae2fa18ec93bc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152075
Tested-by: Jenkins
Reviewed-by: Stéphane Guillou 
Reviewed-by: Heiko Tietze 
Reviewed-by: Jim Raykowski 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152414

diff --git a/sd/source/ui/dlg/navigatr.cxx b/sd/source/ui/dlg/navigatr.cxx
index cdc2db1f5a81..a8e58022fba0 100644
--- a/sd/source/ui/dlg/navigatr.cxx
+++ b/sd/source/ui/dlg/navigatr.cxx
@@ -763,6 +763,7 @@ void 
SdNavigatorControllerItem::StateChangedAtToolBoxControl( sal_uInt16 nSId,
 static_cast<::sd::DrawViewShell 
*>(pDrawDocShell->GetViewShell());
 if (pDrawViewShell)
 {
+pNavigatorWin->FreshTree(pDrawDocShell->GetDoc());
 bool bEditModePage(pDrawViewShell->GetEditMode() == 
EditMode::Page);
 pNavigatorWin->mxToolbox->set_sensitive(bEditModePage);
 pNavigatorWin->mxLbDocs->set_sensitive(bEditModePage);
diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx
index da6a7182ef2a..600f5269f215 100644
--- a/sd/source/ui/dlg/sdtreelb.cxx
+++ b/sd/source/ui/dlg/sdtreelb.cxx
@@ -54,9 +54,21 @@
 #include 
 
 #include 
+#include 
 
 using namespace com::sun::star;
 
+namespace {
+
+sd::DrawViewShell* lcl_getDrawViewShell(const SdDrawDocument* pDoc)
+{
+if (!pDoc || !pDoc->GetDocSh())
+return nullptr;
+return static_cast(pDoc->GetDocSh()->GetViewShell());
+}
+
+}
+
 bool SdPageObjsTLV::bIsInDrag = false;
 
 bool SdPageObjsTLV::IsInDrag()
@@ -263,6 +275,13 @@ bool SdPageObjsTLV::IsEqualToDoc( const SdDrawDocument* 
pInDoc )
 if( !m_pDoc )
 return false;
 
+sd::DrawViewShell* pDrawViewShell = lcl_getDrawViewShell(m_pDoc);
+if (!pDrawViewShell)
+return false;
+PageKind eDrawViewShellPageKind = pDrawViewShell->GetPageKind();
+if (eDrawViewShellPageKind != PageKind::Standard && eDrawViewShellPageKind 
!= PageKind::Notes)
+return false;
+
 std::unique_ptr xEntry(m_xTreeView->make_iterator());
 if (!m_xTreeView->get_iter_first(*xEntry))
 xEntry.reset();
@@ -274,7 +293,7 @@ bool SdPageObjsTLV::IsEqualToDoc( const SdDrawDocument* 
pInDoc )
 while( nPage < nMaxPages )
 {
 const SdPage* pPage = static_cast( m_pDoc->GetPage( 
nPage ) );
-if( pPage->GetPageKind() == PageKind::Standard )
+if (pPage->GetPageKind() == eDrawViewShellPageKind)
 {
 bool bRet = IsEqualToShapeList(xEntry, *pPage, pPage->GetName());
 if (!bRet)
@@ -1254,11 +1273,21 @@ void SdPageObjsTLV::Fill(const SdDrawDocument* pInDoc, 
bool bAllPages, const OUS
 sal_uInt16 nPage = 0;
 const sal_uInt16 nMaxPages = m_pDoc->GetPageCount();
 
+sd::DrawViewShell* pDrawViewShell = lcl_getDrawViewShell(m_pDoc);
+if (!pDrawViewShell)
+return;
+PageKind eDrawViewShellPageKind = pDrawViewShell->GetPageKind();
+
 while( nPage < nMaxPages )
 {
 const SdPage* pPage = static_cast( m_pDoc->GetPage( 
nPage ) );
-if(  (m_bShowAllPages || pPage->GetPageKind() == PageKind::Standard)
- && (pPage->GetPageKind() != PageKind::Handout)   ) //#94954# 
never list the normal handout page ( handout-masterpage is used instead )
+PageKind ePagePageKind = pPage->GetPageKind();
+if ((m_bShowAllPages ||
+ (ePagePageKind == PageKind::Standard &&
+  eDrawViewShellPageKind == PageKind::Standard) ||
+ (ePagePageKind == PageKind::Notes &&
+  eDrawViewShellPageKind == PageKind::Notes)) &&
+ePagePageKind != PageKind::Handout) //#94954# never list the 
normal handout page ( handout-masterpage is used instead )
 {
 bool bPageExcluded = pPage->IsExcluded();
 


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

2023-05-08 Thread Maxim Monastirsky (via logerrit)
 sd/source/ui/view/sdview3.cxx |   18 --
 1 file changed, 8 insertions(+), 10 deletions(-)

New commits:
commit a614740c09d99daf1a68f4642fded2c0c7608916
Author: Maxim Monastirsky 
AuthorDate: Fri May 5 11:12:36 2023 +0300
Commit: Michael Stahl 
CommitDate: Mon May 8 13:42:29 2023 +0200

tdf#155144 sd: Don't reset table styles on RTF pasting

Regression of daab698b346e5e40b67f1e15c796c4e399ccaf8a
("sd: replace hardcoded table styles with xml file").

The problem is with the temp SdDrawDocument reusing the
document's DrawDocShell. Before the mentioned commit we used
to insert the default table styles directly into the style
sheets pool, and that didn't affect the dest document as each
SdDrawDocument maintains its own pool. However, after that
commit we go through ODF import which use the document model
which happens to be the dest document. This results with all
the default table styles being replaced, with all their
formatting being reset, and all existing tables being reset
to the default style following the disposal of the original
styles. At the same time, this leaves the temp SdDrawDocument
with no table styles in its pool, and so the newly inserted
table ends up with no style assigned.

Change-Id: I9bebae929ec3d54e0139dd212ad0ad1dfe815caa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151417
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky 
(cherry picked from commit 86b48c757906c3ef647f3d5e2579ac1fef1bf55b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151376
Reviewed-by: Michael Stahl 

diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
index f96cd774a92a..9b94d9cca8b5 100644
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -1571,19 +1571,17 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
 
 bool View::PasteRTFTable( const ::tools::SvRef& xStm, SdrPage* 
pPage, SdrInsertFlags nPasteOptions )
 {
-SdDrawDocument aModel( DocumentType::Impress, mpDocSh );
-aModel.NewOrLoadCompleted(DocCreationMode::New);
-aModel.GetItemPool().SetDefaultMetric(MapUnit::Map100thMM);
-aModel.InsertPage(aModel.AllocPage(false).get());
+DrawDocShellRef xShell = new DrawDocShell(SfxObjectCreateMode::INTERNAL, 
false, DocumentType::Impress);
+xShell->DoInitNew();
 
-Reference< XComponent > xComponent( new SdXImpressDocument( , true 
) );
-aModel.setUnoModel( Reference< XInterface >::query( xComponent ) );
+SdDrawDocument* pModel = xShell->GetDoc();
+pModel->GetItemPool().SetDefaultMetric(MapUnit::Map100thMM);
+pModel->InsertPage(pModel->AllocPage(false).get());
 
-CreateTableFromRTF( *xStm,  );
-bool bRet = Paste(aModel, maDropPos, pPage, nPasteOptions);
+CreateTableFromRTF(*xStm, pModel);
+bool bRet = Paste(*pModel, maDropPos, pPage, nPasteOptions);
 
-xComponent->dispose();
-xComponent.clear();
+xShell->DoClose();
 
 return bRet;
 }


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

2023-04-07 Thread Xisco Fauli (via logerrit)
 sd/source/ui/view/drviews3.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit f7a5856a4a627548594b3d003903945a41d47e51
Author: Xisco Fauli 
AuthorDate: Thu Apr 6 12:55:50 2023 +0200
Commit: Caolán McNamara 
CommitDate: Fri Apr 7 22:51:17 2023 +0200

sd: fix crash in DrawViewShell::ExecCtrl

See 
https://crashreport.libreoffice.org/stats/signature/sd::DrawViewShell::ExecCtrl(SfxRequest%20&)

I believe this crash is triggered with some basic code while
slideshow is running.
Anyway, if I delete the previous SlideShow::IsRunning(GetViewShellBase())
check, launch Impress and add a new slide, LibreOfice also crashes.

Change-Id: Iba40f37485a4a6815729a1a26c380b6c3fdedfd4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150097
Reviewed-by: Caolán McNamara 
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 
(cherry picked from commit 6a1425c4c9595ed82629d846c9b69ed9942b2c0b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150079

diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx
index e0c0db7b7e48..b75a5d61733f 100644
--- a/sd/source/ui/view/drviews3.cxx
+++ b/sd/source/ui/view/drviews3.cxx
@@ -140,8 +140,8 @@ void  DrawViewShell::ExecCtrl(SfxRequest& rReq)
 // switch page in running slide show
 if(SlideShow::IsRunning(GetViewShellBase()) && rReq.GetArgs())
 {
-const SfxUInt32Item* pWhatPage = 
rReq.GetArg(ID_VAL_WHATPAGE);
-
SlideShow::GetSlideShow(GetViewShellBase())->jumpToPageNumber(static_cast((pWhatPage->GetValue()-1)>>1));
+if (const SfxUInt32Item* pWhatPage = 
rReq.GetArg(ID_VAL_WHATPAGE))
+
SlideShow::GetSlideShow(GetViewShellBase())->jumpToPageNumber(static_cast((pWhatPage->GetValue()-1)>>1));
 }
 else
 {


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

2023-03-15 Thread Miklos Vajna (via logerrit)
 sd/source/ui/view/ViewTabBar.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 196f81bfc7feb5036959299827cf3f4535bdc5e7
Author: Miklos Vajna 
AuthorDate: Wed Mar 8 08:58:52 2023 +0100
Commit: Xisco Fauli 
CommitDate: Wed Mar 15 10:04:36 2023 +

sd: fix crash in ViewTabBar::dispose()

Crashreport signature:

program/libsdlo.so
sd::ViewTabBar::disposing()
sd/source/ui/view/ViewTabBar.cxx:113 (discriminator 1)
program/libuno_cppuhelpergcc3.so.3
cppu::WeakComponentImplHelperBase::dispose()
cppuhelper/source/implbase.cxx:104
program/libuno_cppuhelpergcc3.so.3
cppu::WeakComponentImplHelperBase::release()
cppuhelper/source/implbase.cxx:84
program/libsdlo.so

sd::ViewTabBar::ViewTabBar(com::sun::star::uno::Reference
 const&, com::sun::star::uno::Reference 
const&) [clone .cold]
include/cppuhelper/compbase.hxx:65
program/libsdlo.so

sd::framework::BasicToolBarFactory::createResource(com::sun::star::uno::Reference
 const&)
sd/source/ui/framework/factories/BasicToolBarFactory.cxx:129 
(discriminator 2)

I.e. the ViewTabBar got deleted by a smart pointer before its ctor
finished, guard against this.

Change-Id: I3d6ccc21167355047e3752316c8d0b9b02470f57
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148838
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins
(cherry picked from commit a224948ef44eadfb32aee002d5f0e9f10c9e47de)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148859
Reviewed-by: Xisco Fauli 

diff --git a/sd/source/ui/view/ViewTabBar.cxx b/sd/source/ui/view/ViewTabBar.cxx
index 588b55eaee8b..e30796d5b7b2 100644
--- a/sd/source/ui/view/ViewTabBar.cxx
+++ b/sd/source/ui/view/ViewTabBar.cxx
@@ -66,6 +66,9 @@ ViewTabBar::ViewTabBar (
   mpViewShellBase(nullptr),
   mnNoteBookWidthPadding(0)
 {
+// Do this manually instead of via uno::Reference, so we don't delete 
ourselves.
+osl_atomic_increment(_refCount);
+
 // Tunnel through the controller and use the ViewShellBase to obtain the
 // view frame.
 try
@@ -100,6 +103,8 @@ ViewTabBar::ViewTabBar (
 {
 mpViewShellBase->SetViewTabBar(this);
 }
+
+osl_atomic_decrement(_refCount);
 }
 
 ViewTabBar::~ViewTabBar()


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

2023-02-15 Thread Caolán McNamara (via logerrit)
 sd/source/ui/app/sdmod1.cxx |9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit acb9c4ff1b3cd6a4fca29bb0d7551776e6957c32
Author: Caolán McNamara 
AuthorDate: Wed Feb 15 09:26:16 2023 +
Commit: Caolán McNamara 
CommitDate: Wed Feb 15 11:31:48 2023 +

crashreporter: apparent null dereference

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

diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx
index 927b37ae830e..573ee853069b 100644
--- a/sd/source/ui/app/sdmod1.cxx
+++ b/sd/source/ui/app/sdmod1.cxx
@@ -493,9 +493,12 @@ SfxFrame* SdModule::ExecuteNewDocument( SfxRequest const & 
rReq )
 // was open
 if (pFrame && SfxApplication::IsTipOfTheDayDue() && 
!SfxApplication::IsHeadlessOrUITest())
 {
-// tdf#127946 pass in argument for dialog parent
-SfxUnoFrameItem aDocFrame(SID_FILLFRAME, 
pFrame->GetFrameInterface());
-GetDispatcher()->ExecuteList(SID_TIPOFTHEDAY, 
SfxCallMode::SLOT, {}, {  });
+if (SfxDispatcher* pDispatcher = GetDispatcher())
+{
+// tdf#127946 pass in argument for dialog parent
+SfxUnoFrameItem aDocFrame(SID_FILLFRAME, 
pFrame->GetFrameInterface());
+pDispatcher->ExecuteList(SID_TIPOFTHEDAY, 
SfxCallMode::SLOT, {}, {  });
+}
 }
 }
 }


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

2023-02-09 Thread Tünde Tóth (via logerrit)
 sd/source/ui/docshell/sdclient.cxx |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit e553620ceb3bdef3cfa6d1e9fc18ca30c74fe9f7
Author: Tünde Tóth 
AuthorDate: Fri Jan 13 09:54:00 2023 +0100
Commit: Christian Lohmaier 
CommitDate: Thu Feb 9 11:41:30 2023 +

tdf#152991 sd: fix oversized rectangle of edited embedded object

The embedded object became unusably oversized after editing,
because it was not possible to minimize it by the mouse. Now
the object keeps its original size to avoid of the UX problem.

Note: losing the original zoom of the OLE content is still a problem.

Change-Id: I8b7a2f2a84324bf4de2358ecb5fec5c1f7349155
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145454
Reviewed-by: László Németh 
Tested-by: László Németh 
(cherry picked from commit fdf95de18ef1891862bdce26669d1ce2c6f24764)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145583
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier 

diff --git a/sd/source/ui/docshell/sdclient.cxx 
b/sd/source/ui/docshell/sdclient.cxx
index 02521c2575ad..c7f79c3ea813 100644
--- a/sd/source/ui/docshell/sdclient.cxx
+++ b/sd/source/ui/docshell/sdclient.cxx
@@ -143,6 +143,13 @@ void Client::ViewChanged()
 if (!pView)
 return;
 
+// Do not recalculate the visareasize if the embedded object is opening in 
a new window.
+if (!IsObjectInPlaceActive())
+{
+pSdrOle2Obj->BroadcastObjectChange();
+return;
+}
+
 ::tools::Rectangle aLogicRect( pSdrOle2Obj->GetLogicRect() );
 Size aLogicSize( aLogicRect.GetWidth(), aLogicRect.GetHeight() );
 


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

2022-12-15 Thread Xisco Fauli (via logerrit)
 sd/source/ui/view/unmodpg.cxx |   16 
 1 file changed, 12 insertions(+), 4 deletions(-)

New commits:
commit 2f3cf8afa905a83cd3b24a6ae35b164ed10cba44
Author: Xisco Fauli 
AuthorDate: Thu Dec 15 17:20:20 2022 +0100
Commit: Xisco Fauli 
CommitDate: Fri Dec 16 07:53:18 2022 +

sd: fix null deref in ModifyPageUndoAction::Undo/Redo

See 
https://crashreport.libreoffice.org/stats/signature/SfxViewFrame::GetDispatcher()

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

diff --git a/sd/source/ui/view/unmodpg.cxx b/sd/source/ui/view/unmodpg.cxx
index 2fdfbd13a9bb..afd454a5f183 100644
--- a/sd/source/ui/view/unmodpg.cxx
+++ b/sd/source/ui/view/unmodpg.cxx
@@ -118,8 +118,12 @@ void ModifyPageUndoAction::Undo()
 }
 
 // Redisplay
-SfxViewFrame::Current()->GetDispatcher()->Execute(
-SID_SWITCHPAGE, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD );
+SfxViewFrame* pCurrent = SfxViewFrame::Current();
+if( pCurrent )
+{
+pCurrent->GetDispatcher()->Execute(
+SID_SWITCHPAGE, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD );
+}
 }
 
 void ModifyPageUndoAction::Redo()
@@ -161,8 +165,12 @@ void ModifyPageUndoAction::Redo()
 }
 
 // Redisplay
-SfxViewFrame::Current()->GetDispatcher()->Execute(
-SID_SWITCHPAGE, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD );
+SfxViewFrame* pCurrent = SfxViewFrame::Current();
+if( pCurrent )
+{
+pCurrent->GetDispatcher()->Execute(
+SID_SWITCHPAGE, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD );
+}
 }
 
 ModifyPageUndoAction::~ModifyPageUndoAction()


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

2022-12-15 Thread Caolán McNamara (via logerrit)
 sd/source/ui/sidebar/SlideBackground.cxx |   28 
 1 file changed, 20 insertions(+), 8 deletions(-)

New commits:
commit 17852f4b6964a65f778863c197dfa3a924929195
Author: Caolán McNamara 
AuthorDate: Thu Dec 15 21:21:44 2022 +
Commit: Xisco Fauli 
CommitDate: Fri Dec 16 07:51:53 2022 +

likely fix for frequent mpGradientItem->GetName() crash

crash report id: ec5a64d7-b354-457e-92a3-1bd51208e7c7

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

diff --git a/sd/source/ui/sidebar/SlideBackground.cxx 
b/sd/source/ui/sidebar/SlideBackground.cxx
index bcd564e7bbc1..11f49dff67eb 100644
--- a/sd/source/ui/sidebar/SlideBackground.cxx
+++ b/sd/source/ui/sidebar/SlideBackground.cxx
@@ -1023,30 +1023,42 @@ IMPL_LINK_NOARG(SlideBackground, FillStyleModifyHdl, 
weld::ComboBox&, void)
 
 case SOLID:
 {
-const XFillColorItem aItem( OUString(), 
mpColorItem->GetColorValue() );
-GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_COLOR, 
SfxCallMode::RECORD, {  });
+if (mpColorItem)
+{
+const XFillColorItem aItem( OUString(), 
mpColorItem->GetColorValue() );
+
GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_COLOR, 
SfxCallMode::RECORD, {  });
+}
 }
 break;
 
 case GRADIENT:
 {
-const XFillGradientItem aItem( mpGradientItem->GetName(), 
mpGradientItem->GetGradientValue() );
-
GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_GRADIENT, 
SfxCallMode::RECORD, {  });
+if (mpGradientItem)
+{
+const XFillGradientItem aItem( mpGradientItem->GetName(), 
mpGradientItem->GetGradientValue() );
+
GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_GRADIENT, 
SfxCallMode::RECORD, {  });
+}
 }
 break;
 
 case HATCH:
 {
-const XFillHatchItem aItem( mpHatchItem->GetName(), 
mpHatchItem->GetHatchValue() );
-GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_HATCH, 
SfxCallMode::RECORD, {  });
+if (mpHatchItem)
+{
+const XFillHatchItem aItem( mpHatchItem->GetName(), 
mpHatchItem->GetHatchValue() );
+
GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_HATCH, 
SfxCallMode::RECORD, {  });
+}
 }
 break;
 
 case BITMAP:
 case PATTERN:
 {
-const XFillBitmapItem aItem( mpBitmapItem->GetName(), 
mpBitmapItem->GetGraphicObject() );
-GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_BITMAP, 
SfxCallMode::RECORD, {  });
+if (mpBitmapItem)
+{
+const XFillBitmapItem aItem( mpBitmapItem->GetName(), 
mpBitmapItem->GetGraphicObject() );
+
GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_BITMAP, 
SfxCallMode::RECORD, {  });
+}
 }
 break;
 


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

2022-12-15 Thread Caolán McNamara (via logerrit)
 sd/source/core/drawdoc4.cxx   |   10 --
 sd/source/ui/func/undoheaderfooter.cxx|6 --
 sd/source/ui/view/Outliner.cxx|   10 ++
 sd/source/ui/view/ViewShellImplementation.cxx |   14 +-
 4 files changed, 27 insertions(+), 13 deletions(-)

New commits:
commit cdb03edf09a704e8f7b67e3982e9e7d83e97d358
Author: Caolán McNamara 
AuthorDate: Thu Dec 15 20:25:18 2022 +
Commit: Xisco Fauli 
CommitDate: Fri Dec 16 07:50:42 2022 +

sd: check SfxViewFrame::Current()

these ones look potentially worth backporting

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

diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx
index 907b4163e500..c487c041c75a 100644
--- a/sd/source/core/drawdoc4.cxx
+++ b/sd/source/core/drawdoc4.cxx
@@ -948,9 +948,15 @@ void 
SdDrawDocument::ImpOnlineSpellCallback(SpellCallbackInfo const * pInfo, Sdr
 StartOnlineSpelling();
 }
 else if (nCommand == SpellCallbackCommand::STARTSPELLDLG)
-SfxViewFrame::Current()->GetDispatcher()->Execute( SID_SPELL_DIALOG, 
SfxCallMode::ASYNCHRON );
+{
+if (SfxViewFrame* pViewFrame = SfxViewFrame::Current())
+pViewFrame->GetDispatcher()->Execute( SID_SPELL_DIALOG, 
SfxCallMode::ASYNCHRON );
+}
 else if (nCommand == SpellCallbackCommand::AUTOCORRECT_OPTIONS)
-SfxViewFrame::Current()->GetDispatcher()->Execute( 
SID_AUTO_CORRECT_DLG, SfxCallMode::ASYNCHRON );
+{
+if (SfxViewFrame* pViewFrame = SfxViewFrame::Current())
+pViewFrame->GetDispatcher()->Execute( SID_AUTO_CORRECT_DLG, 
SfxCallMode::ASYNCHRON );
+}
 }
 
 // Return formatted page number (1, I, i, a, etc.)
diff --git a/sd/source/ui/func/undoheaderfooter.cxx 
b/sd/source/ui/func/undoheaderfooter.cxx
index 18a89d4ca8f5..6f386a42fd11 100644
--- a/sd/source/ui/func/undoheaderfooter.cxx
+++ b/sd/source/ui/func/undoheaderfooter.cxx
@@ -40,13 +40,15 @@ SdHeaderFooterUndoAction::~SdHeaderFooterUndoAction()
 void SdHeaderFooterUndoAction::Undo()
 {
 mpPage->setHeaderFooterSettings( maOldSettings );
-SfxViewFrame::Current()->GetDispatcher()->Execute( SID_SWITCHPAGE, 
SfxCallMode::ASYNCHRON | SfxCallMode::RECORD );
+if (SfxViewFrame* pViewFrm = SfxViewFrame::Current())
+pViewFrm->GetDispatcher()->Execute( SID_SWITCHPAGE, 
SfxCallMode::ASYNCHRON | SfxCallMode::RECORD );
 }
 
 void SdHeaderFooterUndoAction::Redo()
 {
 mpPage->setHeaderFooterSettings( maNewSettings );
-SfxViewFrame::Current()->GetDispatcher()->Execute( SID_SWITCHPAGE, 
SfxCallMode::ASYNCHRON | SfxCallMode::RECORD );
+if (SfxViewFrame* pViewFrm = SfxViewFrame::Current())
+pViewFrm->GetDispatcher()->Execute( SID_SWITCHPAGE, 
SfxCallMode::ASYNCHRON | SfxCallMode::RECORD );
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index 4773b3badf4f..6384f1ee58d7 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -1925,13 +1925,15 @@ weld::Window* SdOutliner::GetMessageBoxParent()
 switch (meMode)
 {
 case SEARCH:
-pChildWindow = SfxViewFrame::Current()->GetChildWindow(
-SvxSearchDialogWrapper::GetChildWindowId());
+if (SfxViewFrame* pViewFrm = SfxViewFrame::Current())
+pChildWindow = pViewFrm->GetChildWindow(
+SvxSearchDialogWrapper::GetChildWindowId());
 break;
 
 case SPELL:
-pChildWindow = SfxViewFrame::Current()->GetChildWindow(
-sd::SpellDialogChildWindow::GetChildWindowId());
+if (SfxViewFrame* pViewFrm = SfxViewFrame::Current())
+pChildWindow = pViewFrm->GetChildWindow(
+sd::SpellDialogChildWindow::GetChildWindowId());
 break;
 
 case TEXT_CONVERSION:
diff --git a/sd/source/ui/view/ViewShellImplementation.cxx 
b/sd/source/ui/view/ViewShellImplementation.cxx
index 2f81d5be9b3e..fb4598e048c0 100644
--- a/sd/source/ui/view/ViewShellImplementation.cxx
+++ b/sd/source/ui/view/ViewShellImplementation.cxx
@@ -305,12 +305,16 @@ SfxInterfaceId ViewShell::Implementation::GetViewId() 
const
 
 SvxIMapDlg* ViewShell::Implementation::GetImageMapDialog()
 {
-SvxIMapDlg* pDialog = nullptr;
-SfxChildWindow* pChildWindow = SfxViewFrame::Current()->GetChildWindow(
+SfxViewFrame* pViewFrm = SfxViewFrame::Current();
+if (!pViewFrm)
+return nullptr;
+
+SfxChildWindow* pChildWindow = pViewFrm->GetChildWindow(
 SvxIMapDlgChildWindow::GetChildWindowId());
-if (pChildWindow != nullptr)
-pDialog = 
dynamic_cast(pChildWindow->GetController().get());
-return pDialog;
+if (pChildWindow == nullptr)
+return nullptr;
+
+return 

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

2022-12-15 Thread Povilas Kanapickas (via logerrit)
 sd/source/ui/inc/ViewShell.hxx |1 +
 sd/source/ui/view/viewshel.cxx |7 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

New commits:
commit bfcca49e55eff2017287f88ad4747bb0f58308a1
Author: Povilas Kanapickas 
AuthorDate: Wed Dec 7 03:13:24 2022 +0200
Commit: Caolán McNamara 
CommitDate: Thu Dec 15 19:32:16 2022 +

sd: Improve reaction to slow zoom gestures in ViewShell

The current implementation will ignore slow zoom gestures because each
event may result in zoom change of less than 1% which will be truncated
to zero during floating-point -> integer conversion.

Storing accumulated amount and changing the zoom level once a whole
integer quantity is accumulated solves this problem.

Change-Id: If27a88d7695d0eed241dada5a09b25b2cb577841
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143751
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144225
Reviewed-by: Caolán McNamara 

diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx
index a7b24ef57759..d9fd8564edd0 100644
--- a/sd/source/ui/inc/ViewShell.hxx
+++ b/sd/source/ui/inc/ViewShell.hxx
@@ -456,6 +456,7 @@ protected:
 rtl::Reference   mxOldFunction;
 std::unique_ptr mpZoomList;
 double mfLastZoomScale;
+double mfAccumulatedZoom = 0;
 
 Point   maViewPos;
 SizemaViewSize;
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx
index 0cfc4b185b49..e12f65236dd9 100644
--- a/sd/source/ui/view/viewshel.cxx
+++ b/sd/source/ui/view/viewshel.cxx
@@ -776,7 +776,12 @@ bool ViewShell::HandleScrollCommand(const CommandEvent& 
rCEvt, ::sd::Window* pWi
 ::tools::Long nNewZoom;
 Point aOldMousePos = 
GetActiveWindow()->PixelToLogic(rCEvt.GetMousePosPixel());
 
-nNewZoom = nOldZoom + deltaBetweenEvents * 100;
+// Accumulate fractional zoom to avoid small zoom changes 
from being ignored
+mfAccumulatedZoom += deltaBetweenEvents;
+int nZoomChangePercent = mfAccumulatedZoom * 100;
+mfAccumulatedZoom -= nZoomChangePercent / 100.0;
+
+nNewZoom = nOldZoom + nZoomChangePercent;
 nNewZoom = std::max<::tools::Long>(pWin->GetMinZoom(), 
nNewZoom);
 nNewZoom = std::min<::tools::Long>(pWin->GetMaxZoom(), 
nNewZoom);