core.git: sw/qa sw/source
sw/qa/core/objectpositioning/data/tdf154863-img-move-crash.docx |binary sw/qa/core/objectpositioning/objectpositioning.cxx | 14 ++ sw/source/core/layout/tabfrm.cxx|1 3 files changed, 15 insertions(+) New commits: commit 1b5010bfb745a3a7f0e596b237ab70694484fc33 Author: Matt K AuthorDate: Fri Feb 2 10:35:13 2024 -0600 Commit: Miklos Vajna CommitDate: Thu Mar 14 08:25:09 2024 +0100 tdf#154863 Add unit test to cover crash on image move This reverts commit 332faa63407305852f5044e4bbc41302ccfe46cd. This change adds a CppUnit test that changes the position of an image in an example document which causes a crash if the bug exists. This also adds a delete guard for a SwFrame used to prevent a use-after-free condition. Change-Id: I5cfec75681a5877c007df33c23d9a5e61e4292c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162940 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/sw/qa/core/objectpositioning/data/tdf154863-img-move-crash.docx b/sw/qa/core/objectpositioning/data/tdf154863-img-move-crash.docx new file mode 100644 index ..ca402edef74d Binary files /dev/null and b/sw/qa/core/objectpositioning/data/tdf154863-img-move-crash.docx differ diff --git a/sw/qa/core/objectpositioning/objectpositioning.cxx b/sw/qa/core/objectpositioning/objectpositioning.cxx index bf560cbdaf90..717d63ded052 100644 --- a/sw/qa/core/objectpositioning/objectpositioning.cxx +++ b/sw/qa/core/objectpositioning/objectpositioning.cxx @@ -25,6 +25,8 @@ #include #include +#include + namespace { /// Covers sw/source/core/objectpositioning/ fixes. @@ -56,6 +58,18 @@ CPPUNIT_TEST_FIXTURE(Test, testOverlapCrash) pWrtShell->SplitNode(); } +CPPUNIT_TEST_FIXTURE(Test, testImgMoveCrash) +{ +createSwDoc("tdf154863-img-move-crash.docx"); +uno::Reference xShape(getShapeByName(u"Image26"), uno::UNO_QUERY); +uno::Reference xShapeProps(xShape, uno::UNO_QUERY); +xShapeProps->setPropertyValue("VertOrient", uno::Any(static_cast(0))); +xShapeProps->setPropertyValue("VertOrientPosition", uno::Any(static_cast(3000))); +Scheduler::ProcessEventsToIdle(); +// Crash expected before assert if bug exists +CPPUNIT_ASSERT(true); +} + CPPUNIT_TEST_FIXTURE(Test, testVertPosFromBottom) { // Create a document, insert a shape and position it 1cm above the bottom of the body area. diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index edb10beb35c6..cd44758e574b 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -1754,6 +1754,7 @@ bool SwContentFrame::CalcLowers(SwLayoutFrame & rLay, SwLayoutFrame const& rDont { // #i23129#, #i36347# - pass correct page frame to // the object formatter +SwFrameDeleteGuard aDeleteGuard(pCnt); if ( !SwObjectFormatter::FormatObjsAtFrame( *pCnt, *(pCnt->FindPageFrame()) ) ) {
core.git: sw/inc sw/source
sw/inc/format.hxx|1 + sw/inc/ndtxt.hxx |4 ++-- sw/source/core/attr/format.cxx | 19 +-- sw/source/core/doc/fmtcol.cxx|1 + sw/source/core/txtnode/ndtxt.cxx | 28 +--- 5 files changed, 34 insertions(+), 19 deletions(-) New commits: commit 6a064b1967e06e40be40817deff99d00c1a8554f Author: Matt K AuthorDate: Sat Feb 3 17:04:19 2024 -0600 Commit: Matt K CommitDate: Wed Feb 28 22:08:38 2024 +0100 tdf#139004 Prevent crash when deleting footnote styles The problem was that a pointer was assumed valid, but was not, so now we check the value of the pointer before using it. Works now to delete footnote style. Also, change assert to variable check to ensure the proper method is only called when it is supposed to be, and to prevent a failing assert. We add a new Destr method on SwFormat so that it can be called from the SwTextFormatColl context and thus avoid the assert. Change-Id: Ia4b8029fb89e627cd685b3317606e2b9d60cf248 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162965 Tested-by: Jenkins Reviewed-by: Matt K diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx index 91043b1621de..62ef891bc545 100644 --- a/sw/inc/format.hxx +++ b/sw/inc/format.hxx @@ -72,6 +72,7 @@ protected: SwFormat *pDrvdFrame, sal_uInt16 nFormatWhich ); SwFormat( const SwFormat& rFormat ); virtual void SwClientNotify(const SwModify&, const SfxHint&) override; +void Destr(); public: diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx index 352dad71c247..eb046bc9151d 100644 --- a/sw/inc/ndtxt.hxx +++ b/sw/inc/ndtxt.hxx @@ -454,8 +454,8 @@ public: inline SwTextFormatColl *GetTextColl() const; virtual SwFormatColl *ChgFormatColl( SwFormatColl* ) override; -void ChgTextCollUpdateNum( const SwTextFormatColl* pOld, -const SwTextFormatColl* pNew ); +void ChgTextCollUpdateNum(const SwTextFormatColl* pOld, + const SwTextFormatColl* pNew ); /** Copy collection with all auto formats to dest-node. The latter might be in another document! diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx index 6f2f076881e9..fb03edef251b 100644 --- a/sw/source/core/attr/format.cxx +++ b/sw/source/core/attr/format.cxx @@ -200,27 +200,34 @@ void SwFormat::CopyAttrs( const SwFormat& rFormat ) delete pChgSet; } -SwFormat::~SwFormat() +void SwFormat::Destr() { // This happens at an ObjectDying message. Thus put all dependent // ones on DerivedFrom. -if(!HasWriterListeners()) +if (!HasWriterListeners()) return; m_bFormatInDTOR = true; -if(!DerivedFrom()) +if (!DerivedFrom()) { SwFormat::ResetFormatAttr(RES_PAGEDESC); -SAL_WARN("sw.core", "~SwFormat: format still has clients on death, but parent format is missing: " << GetName()); +SAL_WARN("sw.core", + "~SwFormat: format still has clients on death, but parent format is missing: " + << GetName()); return; } -SwIterator aIter(*this); -for(SwClient* pClient = aIter.First(); pClient; pClient = aIter.Next()) +SwIterator aIter(*this); +for (SwClient* pClient = aIter.First(); pClient; pClient = aIter.Next()) pClient->CheckRegistrationFormat(*this); assert(!HasWriterListeners()); } +SwFormat::~SwFormat() +{ +Destr(); +} + void SwFormat::SwClientNotify(const SwModify&, const SfxHint& rHint) { if (rHint.GetId() != SfxHintId::SwLegacyModify) diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx index 4d87241a03ba..02f2cb5bc2fd 100644 --- a/sw/source/core/doc/fmtcol.cxx +++ b/sw/source/core/doc/fmtcol.cxx @@ -124,6 +124,7 @@ SwTextFormatColl::~SwTextFormatColl() pCharFormat->SetLinkedParaFormat(nullptr); } } +Destr(); } void SwTextFormatColl::SwClientNotify(const SwModify& rModify, const SfxHint& rHint) { diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 0a54b140b68c..dc2625d33c54 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -1663,13 +1663,14 @@ void SwTextNode::Update( } } -void SwTextNode::ChgTextCollUpdateNum( const SwTextFormatColl *pOldColl, -const SwTextFormatColl *pNewColl) +void SwTextNode::ChgTextCollUpdateNum(const SwTextFormatColl* pOldColl, + const SwTextFormatColl* pNewColl) { SwDoc& rDoc = GetDoc(); // query the OutlineLevel and if it changed, notify the Nodes-Array! -const int nOldLevel = pOldColl && pOldColl->IsAssignedToListLevelOfOutlineStyle() ? - pOldColl->GetAssignedOutlineStyleLevel() : MAXLEVEL; +const int nOldLevel = pOldColl &&
core.git: sw/source
sw/source/core/inc/drawfont.hxx |2 - sw/source/core/layout/findfrm.cxx | 20 +++-- sw/source/core/layout/ftnfrm.cxx | 44 ++ sw/source/core/text/txtfrm.cxx|1 4 files changed, 49 insertions(+), 18 deletions(-) New commits: commit 05889c7fd814187aec3d88c056ece0cc33736868 Author: Matt K AuthorDate: Fri Jan 19 11:12:57 2024 -0600 Commit: Matt K CommitDate: Fri Feb 2 16:41:12 2024 +0100 tdf#149499 Prevent crash upon inserting page break and undoing The problem is the code uses objects that have been destructed or don't exist likely because of destruction, thus causing crashes. The fix is to check for the existence of these objects or whether they have been destructed prior to using them. Also removed some asserts that were firing that don't appear to be valid. A crash happens when executing an assert in an undo scenario because the SwFlowFrame on the SwFlowFrame::GetFollow call stack frame is an "Exception thrown: read access violation. this was 0xFFEF." > swlo.dll!SwFlowFrame::GetFollow() Line 169 C++ swlo.dll!SwFlowFrame::IsAnFollow(const SwFlowFrame * pAssumed) Line 757 C++ swlo.dll!SwFootnoteFrame::GetRef() Line 2947C++ swlo.dll!SwFootnoteBossFrame::FindFirstFootnote() Line 1114 C++ swlo.dll!SwFootnoteBossFrame::InsertFootnote(SwFootnoteFrame * pNew) Line 1271 C++ swlo.dll!SwFootnoteBossFrame::AppendFootnote(SwContentFrame * pRef, SwTextFootnote * pAttr) Line 1665 C++ swlo.dll!SwTextFrame::ConnectFootnote(SwTextFootnote * pFootnote, const __int64 nDeadLine) Line 692 C++ swlo.dll!SwTextFormatter::NewFootnotePortion(SwTextFormatInfo & rInf, SwTextAttr * pHint) Line 840 C++ swlo.dll!SwTextFormatter::NewExtraPortion(SwTextFormatInfo & rInf) Line 283 C++ swlo.dll!SwTextFormatter::NewPortion(SwTextFormatInfo & rInf, std::optional> oMovedFlyIndex) Line 1738C++ swlo.dll!SwTextFormatter::BuildPortions(SwTextFormatInfo & rInf) Line 773 C++ swlo.dll!SwTextFormatter::FormatLine(o3tl::strong_int nStartPos) Line 1955 C++ Another callstack observed for an assert (other version of SwFootnoteFrame::GetRef) in a undo/redo scenario was: ucrtbased.dll!issue_debug_notification(const wchar_t * const message) Line 28 C++ ucrtbased.dll!__acrt_report_runtime_error(const wchar_t * message) Line 154 C++ ucrtbased.dll!abort() Line 61 C++ ucrtbased.dll!common_assert_to_stderr(const wchar_t * const expression, const wchar_t * const file_name, const unsigned int line_number) Line 187 C++ ucrtbased.dll!common_assert(const wchar_t * const expression, const wchar_t * const file_name, const unsigned int line_number, void * const return_address) Line 420 C++ ucrtbased.dll!_wassert(const wchar_t * expression, const wchar_t * file_name, unsigned int line_number) Line 444C++ > swlo.dll!SwFootnoteFrame::GetRef() Line 2938C++ swlo.dll!SwTextFrameBreak::IsInside(const SwTextMargin & rLine) Line 172C++ swlo.dll!SwTextFrameBreak::IsBreakNow(SwTextMargin & rLine) Line 230C++ swlo.dll!SwTextFrame::FormatAdjust(SwTextFormatter & rLine, WidowsAndOrphans & rFrameBreak, o3tl::strong_int nStrLen, const bool bDummy) Line 1101 C++ swlo.dll!SwTextFrame::Format_(SwTextFormatter & rLine, SwTextFormatInfo & rInf, const bool bAdjust) Line 1757 C++ swlo.dll!SwTextFrame::FormatImpl(OutputDevice * pRenderContext, SwParaPortion * pPara, std::vector> & rIntersectingObjs) Line 1865C++ swlo.dll!SwTextFrame::Format(OutputDevice * pRenderContext, const SwBorderAttrs * __formal) Line 2068 C++ swlo.dll!SwContentFrame::MakeAll(OutputDevice * __formal) Line 1532 C++ swlo.dll!SwFrame::PrepareMake(OutputDevice * pRenderContext) Line 388 C++ swlo.dll!SwFrame::Calc(OutputDevice * pRenderContext) Line 1814 C++ swlo.dll!SwFootnoteBossFrame::AppendFootnote(SwContentFrame * pRef, SwTextFootnote * pAttr) Line 1687 C++ swlo.dll!SwTextFrame::ConnectFootnote(SwTextFootnote * pFootnote, const __int64 nDeadLine) Line 692 C++ swlo.dll!SwTextFormatter::NewFootnotePortion(SwTextFormatInfo & rInf, SwTextAttr * pHint) Line 840 C++ swlo.dll!SwTextFormatter::NewExtraPortion(SwTextFormatInfo & rInf) Line 283 C++ swlo.dll!SwTextFormatter::NewPortion(SwTextFormatInfo & rInf, std::optional> oMovedFlyIndex) Line 1738C++ swlo.dll!SwTextFormatter::BuildPortions(SwTextFormatInfo & rInf) Line 773 C++ swlo.dll!SwTextFormatter::FormatLine(o3tl::strong_int nStartPos)
core.git: sw/qa
sw/qa/core/objectpositioning/data/tdf154863-img-move-crash.docx |binary sw/qa/core/objectpositioning/objectpositioning.cxx | 14 ++ 2 files changed, 14 insertions(+) New commits: commit 16d46e25e03cd506576ac3dcb6be56270b47b4a6 Author: Matt K AuthorDate: Wed Jan 31 15:39:53 2024 -0600 Commit: Miklos Vajna CommitDate: Thu Feb 1 08:33:05 2024 +0100 tdf#154863 Add unit test to cover crash on image move This change adds a CppUnit test that changes the position of an image in an example document which causes a crash if the bug exists. Change-Id: I0f507ccf63c2c7f49f6ed71cd8df174b2b3136f1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162857 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/sw/qa/core/objectpositioning/data/tdf154863-img-move-crash.docx b/sw/qa/core/objectpositioning/data/tdf154863-img-move-crash.docx new file mode 100644 index ..ca402edef74d Binary files /dev/null and b/sw/qa/core/objectpositioning/data/tdf154863-img-move-crash.docx differ diff --git a/sw/qa/core/objectpositioning/objectpositioning.cxx b/sw/qa/core/objectpositioning/objectpositioning.cxx index bf560cbdaf90..717d63ded052 100644 --- a/sw/qa/core/objectpositioning/objectpositioning.cxx +++ b/sw/qa/core/objectpositioning/objectpositioning.cxx @@ -25,6 +25,8 @@ #include #include +#include + namespace { /// Covers sw/source/core/objectpositioning/ fixes. @@ -56,6 +58,18 @@ CPPUNIT_TEST_FIXTURE(Test, testOverlapCrash) pWrtShell->SplitNode(); } +CPPUNIT_TEST_FIXTURE(Test, testImgMoveCrash) +{ +createSwDoc("tdf154863-img-move-crash.docx"); +uno::Reference xShape(getShapeByName(u"Image26"), uno::UNO_QUERY); +uno::Reference xShapeProps(xShape, uno::UNO_QUERY); +xShapeProps->setPropertyValue("VertOrient", uno::Any(static_cast(0))); +xShapeProps->setPropertyValue("VertOrientPosition", uno::Any(static_cast(3000))); +Scheduler::ProcessEventsToIdle(); +// Crash expected before assert if bug exists +CPPUNIT_ASSERT(true); +} + CPPUNIT_TEST_FIXTURE(Test, testVertPosFromBottom) { // Create a document, insert a shape and position it 1cm above the bottom of the body area.
core.git: sfx2/source
sfx2/source/view/viewfrm.cxx | 25 ++--- 1 file changed, 22 insertions(+), 3 deletions(-) New commits: commit a2c09afebef70d2419823445ff92379fe3df9485 Author: Matt K AuthorDate: Fri Jan 19 17:05:35 2024 -0600 Commit: Caolán McNamara CommitDate: Tue Jan 30 12:49:42 2024 +0100 tdf#151352 Don't display tip-of-the-day in base form editor The problem is that there is some crash with tip-of-the-day on Linux with GTK3 when opening a base form for editing. The fix is to avoid showing the tip-of-the-day for base form editor, as suggested in the bug comments. Change-Id: Ic155e137c4314b7e014f09d83589519197bd0039 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162326 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 16b41843ba31..ab6e2ebdda0d 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -78,6 +78,7 @@ #include #include #include +#include #include #include @@ -1515,9 +1516,27 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) // open where SdModule::ExecuteNewDocument will launch it instead when that dialog is dismissed if (SfxApplication::IsTipOfTheDayDue() && !bIsHeadlessOrUITest && !IsInModalMode()) { -// tdf#127946 pass in argument for dialog parent -SfxUnoFrameItem aDocFrame(SID_FILLFRAME, GetFrame().GetFrameInterface()); -GetDispatcher()->ExecuteList(SID_TIPOFTHEDAY, SfxCallMode::SLOT, {}, { }); +bool bIsBaseFormOpen = false; + +const auto xCurrentFrame = GetFrame().GetFrameInterface(); +const auto xContext = comphelper::getProcessComponentContext(); +const auto xModuleManager = css::frame::ModuleManager::create(xContext); +switch (vcl::EnumContext::GetApplicationEnum( +xModuleManager->identify(xCurrentFrame))) +{ +case vcl::EnumContext::Application::WriterForm: +bIsBaseFormOpen = true; +break; +default: +break; +} +if (!bIsBaseFormOpen) +{ +// tdf#127946 pass in argument for dialog parent +SfxUnoFrameItem aDocFrame(SID_FILLFRAME, GetFrame().GetFrameInterface()); +GetDispatcher()->ExecuteList(SID_TIPOFTHEDAY, SfxCallMode::SLOT, {}, + { }); +} } // inform about the community involvement
core.git: sw/source
sw/source/core/layout/findfrm.cxx | 15 ++- sw/source/core/layout/flycnt.cxx|1 - sw/source/core/layout/objectformatter.cxx |2 +- sw/source/core/layout/objectformattertxtfrm.cxx | 17 ++--- 4 files changed, 21 insertions(+), 14 deletions(-) New commits: commit 4eaa50802d724b8744218c8993364fe7b6f03eaa Author: Matt K AuthorDate: Mon Jan 15 19:30:37 2024 -0600 Commit: Matt K CommitDate: Mon Jan 29 16:30:14 2024 +0100 tdf#154863 Fix crashes when moving images in a large document The problem is that when moving images around the code tries to do things with anchored text frames that have already gone through destruction. The fix is to check if those frames have the destruction bit set before using them, thus avoiding the crashes. Also, there is an assert that was firing and removing it seems to have no negative effect in interacting with the file. Change-Id: I899171ef3b5113f479725b0421f469c36e40e26c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162151 Reviewed-by: Matt K Tested-by: Matt K diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx index 5331baacd93e..4df108ccf170 100644 --- a/sw/source/core/layout/findfrm.cxx +++ b/sw/source/core/layout/findfrm.cxx @@ -235,12 +235,17 @@ bool SwLayoutFrame::IsAnLower( const SwFrame *pAssumed ) const const SwFrame *pUp = pAssumed; while ( pUp ) { -if ( pUp == this ) -return true; -if ( pUp->IsFlyFrame() ) -pUp = static_cast(pUp)->GetAnchorFrame(); +if (!pUp->IsInDtor()) +{ +if (pUp == this) +return true; +if (pUp->IsFlyFrame()) +pUp = static_cast(pUp)->GetAnchorFrame(); +else +pUp = pUp->GetUpper(); +} else -pUp = pUp->GetUpper(); +break; } return false; } diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx index 2ed6fbf08942..1913ef6c0f81 100644 --- a/sw/source/core/layout/flycnt.cxx +++ b/sw/source/core/layout/flycnt.cxx @@ -1474,7 +1474,6 @@ void SwFlyAtContentFrame::RegisterAtCorrectPage() void SwFlyAtContentFrame::RegisterAtPage(SwPageFrame & rPageFrame) { -assert(GetPageFrame() != ); if (GetPageFrame()) { GetPageFrame()->MoveFly( this, ); diff --git a/sw/source/core/layout/objectformatter.cxx b/sw/source/core/layout/objectformatter.cxx index 6395d2f9e3a8..547aa3c550d5 100644 --- a/sw/source/core/layout/objectformatter.cxx +++ b/sw/source/core/layout/objectformatter.cxx @@ -364,7 +364,7 @@ bool SwObjectFormatter::FormatObjsAtFrame_( SwTextFrame* _pMasterTextFrame ) { pAnchorFrame = (); } -if ( !pAnchorFrame->GetDrawObjs() ) +if ( !pAnchorFrame->GetDrawObjs() || pAnchorFrame->IsInDtor() ) { // nothing to do, if no floating screen object is registered at the anchor frame. return true; diff --git a/sw/source/core/layout/objectformattertxtfrm.cxx b/sw/source/core/layout/objectformattertxtfrm.cxx index 9a44b0df624b..1b71301e7adb 100644 --- a/sw/source/core/layout/objectformattertxtfrm.cxx +++ b/sw/source/core/layout/objectformattertxtfrm.cxx @@ -926,14 +926,17 @@ void SwObjectFormatterTextFrame::FormatAnchorFrameAndItsPrevs( SwTextFrame& _rAn // format anchor frame - format of its follow not needed // #i43255# - forbid follow format, only if anchor text // frame is in table -if ( _rAnchorTextFrame.IsInTab() ) +if (!_rAnchorTextFrame.IsInDtor()) { -SwForbidFollowFormat aForbidFollowFormat( _rAnchorTextFrame ); - _rAnchorTextFrame.Calc(_rAnchorTextFrame.getRootFrame()->GetCurrShell()->GetOut()); -} -else -{ - _rAnchorTextFrame.Calc(_rAnchorTextFrame.getRootFrame()->GetCurrShell()->GetOut()); +if (_rAnchorTextFrame.IsInTab()) +{ +SwForbidFollowFormat aForbidFollowFormat(_rAnchorTextFrame); + _rAnchorTextFrame.Calc(_rAnchorTextFrame.getRootFrame()->GetCurrShell()->GetOut()); +} +else +{ + _rAnchorTextFrame.Calc(_rAnchorTextFrame.getRootFrame()->GetCurrShell()->GetOut()); +} } }
core.git: Branch 'libreoffice-24-2-0' - sc/source
sc/source/core/data/document.cxx | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) New commits: commit 51233ec34207c8be256d8d75800fa3ca495c5ca4 Author: Matt K AuthorDate: Sat Jan 13 17:30:59 2024 -0600 Commit: Michael Weghorn CommitDate: Wed Jan 24 09:28:47 2024 +0100 tdf#151752 Fix crash when selecting unprotected cells and copy/pasting The problem is that the code attemps to index into maTabs when looping through clipboard ranges, but maTabs.size() can be 0 at that point thus resulting in a crash. The fix is to first check if maTabs.size() is greater than 0 before doing the looping. Change-Id: Ib2fc4c9f847f87f44a68ad6d73c2745d79b5caa5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162032 Tested-by: Jenkins Reviewed-by: Mike Kaganski (cherry picked from commit 59927dedc31eb5d51b417a02ae927eb578b90bd6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162090 Reviewed-by: Xisco Fauli (cherry picked from commit a381ac7b0fa95ce340bd1b384c946fbd19d87393) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162095 Reviewed-by: Matt K Reviewed-by: Ilmari Lauhakangas Tested-by: Michael Weghorn Reviewed-by: Michael Weghorn diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 060bd85eebbc..ff6d77b432f7 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -3254,12 +3254,16 @@ bool ScDocument::HasClipFilteredRows() if ( rClipRanges.empty() ) return false; -for ( size_t i = 0, n = rClipRanges.size(); i < n; ++i ) +if (maTabs.size() > 0) { -ScRange & rRange = rClipRanges[ i ]; -bool bAnswer = maTabs[nCountTab]->HasFilteredRows(rRange.aStart.Row(), rRange.aEnd.Row()); -if (bAnswer) -return true; +for (size_t i = 0, n = rClipRanges.size(); i < n; ++i) +{ +ScRange& rRange = rClipRanges[i]; +bool bAnswer += maTabs[nCountTab]->HasFilteredRows(rRange.aStart.Row(), rRange.aEnd.Row()); +if (bAnswer) +return true; +} } return false; }
core.git: Branch 'libreoffice-24-2' - sw/source
sw/source/core/layout/anchoreddrawobject.cxx | 10 ++ sw/source/core/layout/fly.cxx| 13 - 2 files changed, 14 insertions(+), 9 deletions(-) New commits: commit d6466f9b1ec73011145d429d12003b52718b Author: Matt K AuthorDate: Sun Jan 21 12:23:33 2024 -0600 Commit: Xisco Fauli CommitDate: Mon Jan 22 21:37:31 2024 +0100 tdf#132810 Prevent more crashes on gallery objects This change is a follow-up to https://gerrit.libreoffice.org/c/core/+/161950 where there is still a crash occurring on application close, and a general crash when using gallery objects. The fix is to check for object existence or if the object has the destructor bit set before using the objects. Here is the callstack for the assert that was removed: > swlo.dll!SwClient::GetRegisteredIn() Line 166 C++ swlo.dll!SwContact::GetFormat() Line 112C++ swlo.dll!SwAnchoredDrawObject::GetFrameFormat() Line 622C++ swlo.dll!SwAnchoredObject::FindAnchorCharFrame() Line 719 C++ swlo.dll!SwAnchoredObject::GetAnchorFrameContainingAnchPos() Line 132 C++ swlo.dll!SwAnchoredObject::FindPageFrameOfAnchor() Line 697 C++ swlo.dll!SwObjectFormatterLayFrame::AdditionalFormatObjsOnPage() Line 144 C++ swlo.dll!SwObjectFormatterLayFrame::DoFormatObjs() Line 94 C++ swlo.dll!SwObjectFormatter::FormatObjsAtFrame(SwFrame & _rAnchorFrame, const SwPageFrame & _rPageFrame, SwLayAction * _pLayAction) Line 160 C++ swlo.dll!SwLayAction::InternalAction(OutputDevice * pRenderContext) Line 565C++ swlo.dll!SwLayAction::Action(OutputDevice * pRenderContext) Line 390C++ swlo.dll!SwViewShell::ImplEndAction(const bool bIdleEnd) Line 308 C++ swlo.dll!SwViewShell::EndAction(const bool bIdleEnd) Line 628 C++ swlo.dll!SwCursorShell::EndAction(const bool bIdleEnd) Line 266 C++ swlo.dll!SwEditShell::EndAllAction() Line 102 C++ swlo.dll!SwWrtShell::Do(SwWrtShell::DoType eDoType, unsigned short nCnt, unsigned short nOffset) Line 60C++ swlo.dll!SwBaseShell::ExecUndo(SfxRequest & rReq) Line 655 C++ Change-Id: I90bd40f3ae864ec9655340c342ddc16b59d79aba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162349 Tested-by: Jenkins Reviewed-by: Mike Kaganski (cherry picked from commit 6840c242684986483624557a405a00e91ea048e9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162370 Reviewed-by: Matt K Reviewed-by: Xisco Fauli diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx index 77a19aa8295a..5a9e1245afd8 100644 --- a/sw/source/core/layout/anchoreddrawobject.cxx +++ b/sw/source/core/layout/anchoreddrawobject.cxx @@ -619,13 +619,15 @@ void SwAnchoredDrawObject::InvalidateObjPos() SwFrameFormat* SwAnchoredDrawObject::GetFrameFormat() { - assert(static_cast(GetUserCall(GetDrawObj()))->GetFormat()); -return static_cast(GetUserCall(GetDrawObj()))->GetFormat(); +if (SwDrawContact* pDC = static_cast(GetUserCall(GetDrawObj( +return pDC->GetFormat(); +return nullptr; } const SwFrameFormat* SwAnchoredDrawObject::GetFrameFormat() const { - assert(static_cast(GetUserCall(GetDrawObj()))->GetFormat()); -return static_cast(GetUserCall(GetDrawObj()))->GetFormat(); +if (SwDrawContact* pDC = static_cast(GetUserCall(GetDrawObj( +return pDC->GetFormat(); +return nullptr; } SwRect SwAnchoredDrawObject::GetObjRect() const diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index 6e7e6235dcb3..ba57cd6b4cdf 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -2594,12 +2594,15 @@ void SwFrame::RemoveDrawObj( SwAnchoredObject& _rToRemoveObj ) { // Notify accessible layout. #if !ENABLE_WASM_STRIP_ACCESSIBILITY -SwViewShell* pSh = getRootFrame()->GetCurrShell(); -if( pSh ) +if (!mbInDtor) { -SwRootFrame* pLayout = getRootFrame(); -if (pLayout && pLayout->IsAnyShellAccessible()) -pSh->Imp()->DisposeAccessibleObj(_rToRemoveObj.GetDrawObj(), false); +SwViewShell* pSh = getRootFrame()->GetCurrShell(); +if (pSh) +{ +SwRootFrame* pLayout = getRootFrame(); +if (pLayout && pLayout->IsAnyShellAccessible()) +pSh->Imp()->DisposeAccessibleObj(_rToRemoveObj.GetDrawObj(), false); +} } #endif
core.git: Branch 'libreoffice-7-6' - sw/source
sw/source/core/layout/anchoreddrawobject.cxx | 10 ++ sw/source/core/layout/fly.cxx| 13 - 2 files changed, 14 insertions(+), 9 deletions(-) New commits: commit b3d710ffd5f63d9c37a61fccc97213d22c4d721f Author: Matt K AuthorDate: Sun Jan 21 12:23:33 2024 -0600 Commit: Xisco Fauli CommitDate: Mon Jan 22 21:37:39 2024 +0100 tdf#132810 Prevent more crashes on gallery objects This change is a follow-up to https://gerrit.libreoffice.org/c/core/+/161950 where there is still a crash occurring on application close, and a general crash when using gallery objects. The fix is to check for object existence or if the object has the destructor bit set before using the objects. Here is the callstack for the assert that was removed: > swlo.dll!SwClient::GetRegisteredIn() Line 166 C++ swlo.dll!SwContact::GetFormat() Line 112C++ swlo.dll!SwAnchoredDrawObject::GetFrameFormat() Line 622C++ swlo.dll!SwAnchoredObject::FindAnchorCharFrame() Line 719 C++ swlo.dll!SwAnchoredObject::GetAnchorFrameContainingAnchPos() Line 132 C++ swlo.dll!SwAnchoredObject::FindPageFrameOfAnchor() Line 697 C++ swlo.dll!SwObjectFormatterLayFrame::AdditionalFormatObjsOnPage() Line 144 C++ swlo.dll!SwObjectFormatterLayFrame::DoFormatObjs() Line 94 C++ swlo.dll!SwObjectFormatter::FormatObjsAtFrame(SwFrame & _rAnchorFrame, const SwPageFrame & _rPageFrame, SwLayAction * _pLayAction) Line 160 C++ swlo.dll!SwLayAction::InternalAction(OutputDevice * pRenderContext) Line 565C++ swlo.dll!SwLayAction::Action(OutputDevice * pRenderContext) Line 390C++ swlo.dll!SwViewShell::ImplEndAction(const bool bIdleEnd) Line 308 C++ swlo.dll!SwViewShell::EndAction(const bool bIdleEnd) Line 628 C++ swlo.dll!SwCursorShell::EndAction(const bool bIdleEnd) Line 266 C++ swlo.dll!SwEditShell::EndAllAction() Line 102 C++ swlo.dll!SwWrtShell::Do(SwWrtShell::DoType eDoType, unsigned short nCnt, unsigned short nOffset) Line 60C++ swlo.dll!SwBaseShell::ExecUndo(SfxRequest & rReq) Line 655 C++ Change-Id: I90bd40f3ae864ec9655340c342ddc16b59d79aba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162349 Tested-by: Jenkins Reviewed-by: Mike Kaganski (cherry picked from commit 6840c242684986483624557a405a00e91ea048e9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162371 Reviewed-by: Matt K Reviewed-by: Xisco Fauli diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx index 77a19aa8295a..5a9e1245afd8 100644 --- a/sw/source/core/layout/anchoreddrawobject.cxx +++ b/sw/source/core/layout/anchoreddrawobject.cxx @@ -619,13 +619,15 @@ void SwAnchoredDrawObject::InvalidateObjPos() SwFrameFormat* SwAnchoredDrawObject::GetFrameFormat() { - assert(static_cast(GetUserCall(GetDrawObj()))->GetFormat()); -return static_cast(GetUserCall(GetDrawObj()))->GetFormat(); +if (SwDrawContact* pDC = static_cast(GetUserCall(GetDrawObj( +return pDC->GetFormat(); +return nullptr; } const SwFrameFormat* SwAnchoredDrawObject::GetFrameFormat() const { - assert(static_cast(GetUserCall(GetDrawObj()))->GetFormat()); -return static_cast(GetUserCall(GetDrawObj()))->GetFormat(); +if (SwDrawContact* pDC = static_cast(GetUserCall(GetDrawObj( +return pDC->GetFormat(); +return nullptr; } SwRect SwAnchoredDrawObject::GetObjRect() const diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index 8b3b316ec469..503dfedb35fa 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -2596,12 +2596,15 @@ void SwFrame::RemoveDrawObj( SwAnchoredObject& _rToRemoveObj ) { // Notify accessible layout. #if !ENABLE_WASM_STRIP_ACCESSIBILITY -SwViewShell* pSh = getRootFrame()->GetCurrShell(); -if( pSh ) +if (!mbInDtor) { -SwRootFrame* pLayout = getRootFrame(); -if (pLayout && pLayout->IsAnyShellAccessible()) -pSh->Imp()->DisposeAccessibleObj(_rToRemoveObj.GetDrawObj(), false); +SwViewShell* pSh = getRootFrame()->GetCurrShell(); +if (pSh) +{ +SwRootFrame* pLayout = getRootFrame(); +if (pLayout && pLayout->IsAnyShellAccessible()) +pSh->Imp()->DisposeAccessibleObj(_rToRemoveObj.GetDrawObj(), false); +} } #endif
core.git: sw/source
sw/source/core/layout/anchoreddrawobject.cxx | 10 ++ sw/source/core/layout/fly.cxx| 13 - 2 files changed, 14 insertions(+), 9 deletions(-) New commits: commit 6840c242684986483624557a405a00e91ea048e9 Author: Matt K AuthorDate: Sun Jan 21 12:23:33 2024 -0600 Commit: Mike Kaganski CommitDate: Mon Jan 22 05:52:00 2024 +0100 tdf#132810 Prevent more crashes on gallery objects This change is a follow-up to https://gerrit.libreoffice.org/c/core/+/161950 where there is still a crash occurring on application close, and a general crash when using gallery objects. The fix is to check for object existence or if the object has the destructor bit set before using the objects. Here is the callstack for the assert that was removed: > swlo.dll!SwClient::GetRegisteredIn() Line 166 C++ swlo.dll!SwContact::GetFormat() Line 112C++ swlo.dll!SwAnchoredDrawObject::GetFrameFormat() Line 622C++ swlo.dll!SwAnchoredObject::FindAnchorCharFrame() Line 719 C++ swlo.dll!SwAnchoredObject::GetAnchorFrameContainingAnchPos() Line 132 C++ swlo.dll!SwAnchoredObject::FindPageFrameOfAnchor() Line 697 C++ swlo.dll!SwObjectFormatterLayFrame::AdditionalFormatObjsOnPage() Line 144 C++ swlo.dll!SwObjectFormatterLayFrame::DoFormatObjs() Line 94 C++ swlo.dll!SwObjectFormatter::FormatObjsAtFrame(SwFrame & _rAnchorFrame, const SwPageFrame & _rPageFrame, SwLayAction * _pLayAction) Line 160 C++ swlo.dll!SwLayAction::InternalAction(OutputDevice * pRenderContext) Line 565C++ swlo.dll!SwLayAction::Action(OutputDevice * pRenderContext) Line 390C++ swlo.dll!SwViewShell::ImplEndAction(const bool bIdleEnd) Line 308 C++ swlo.dll!SwViewShell::EndAction(const bool bIdleEnd) Line 628 C++ swlo.dll!SwCursorShell::EndAction(const bool bIdleEnd) Line 266 C++ swlo.dll!SwEditShell::EndAllAction() Line 102 C++ swlo.dll!SwWrtShell::Do(SwWrtShell::DoType eDoType, unsigned short nCnt, unsigned short nOffset) Line 60C++ swlo.dll!SwBaseShell::ExecUndo(SfxRequest & rReq) Line 655 C++ Change-Id: I90bd40f3ae864ec9655340c342ddc16b59d79aba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162349 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx index 77a19aa8295a..5a9e1245afd8 100644 --- a/sw/source/core/layout/anchoreddrawobject.cxx +++ b/sw/source/core/layout/anchoreddrawobject.cxx @@ -619,13 +619,15 @@ void SwAnchoredDrawObject::InvalidateObjPos() SwFrameFormat* SwAnchoredDrawObject::GetFrameFormat() { - assert(static_cast(GetUserCall(GetDrawObj()))->GetFormat()); -return static_cast(GetUserCall(GetDrawObj()))->GetFormat(); +if (SwDrawContact* pDC = static_cast(GetUserCall(GetDrawObj( +return pDC->GetFormat(); +return nullptr; } const SwFrameFormat* SwAnchoredDrawObject::GetFrameFormat() const { - assert(static_cast(GetUserCall(GetDrawObj()))->GetFormat()); -return static_cast(GetUserCall(GetDrawObj()))->GetFormat(); +if (SwDrawContact* pDC = static_cast(GetUserCall(GetDrawObj( +return pDC->GetFormat(); +return nullptr; } SwRect SwAnchoredDrawObject::GetObjRect() const diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index 6e7e6235dcb3..ba57cd6b4cdf 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -2594,12 +2594,15 @@ void SwFrame::RemoveDrawObj( SwAnchoredObject& _rToRemoveObj ) { // Notify accessible layout. #if !ENABLE_WASM_STRIP_ACCESSIBILITY -SwViewShell* pSh = getRootFrame()->GetCurrShell(); -if( pSh ) +if (!mbInDtor) { -SwRootFrame* pLayout = getRootFrame(); -if (pLayout && pLayout->IsAnyShellAccessible()) -pSh->Imp()->DisposeAccessibleObj(_rToRemoveObj.GetDrawObj(), false); +SwViewShell* pSh = getRootFrame()->GetCurrShell(); +if (pSh) +{ +SwRootFrame* pLayout = getRootFrame(); +if (pLayout && pLayout->IsAnyShellAccessible()) +pSh->Imp()->DisposeAccessibleObj(_rToRemoveObj.GetDrawObj(), false); +} } #endif
core.git: Branch 'libreoffice-7-6' - sw/inc sw/source
sw/inc/anchoredobject.hxx|1 sw/source/core/doc/docdraw.cxx | 17 ++- sw/source/core/draw/dview.cxx| 19 ++-- sw/source/core/frmedt/feshview.cxx | 36 --- sw/source/core/layout/anchoredobject.cxx | 134 - sw/source/core/layout/flylay.cxx | 113 sw/source/core/layout/frmtool.cxx|6 - sw/source/core/layout/sortedobjs.cxx |4 sw/source/core/text/txtfly.cxx | 143 --- sw/source/uibase/docvw/edtwin.cxx| 28 +++--- sw/source/uibase/shells/drwbassh.cxx | 16 ++- 11 files changed, 288 insertions(+), 229 deletions(-) New commits: commit 75026d55a5ad58ac2bba790ec89caa38e7f44136 Author: Matt K AuthorDate: Thu Jan 11 20:37:01 2024 -0600 Commit: Xisco Fauli CommitDate: Mon Jan 15 15:28:44 2024 +0100 tdf#132810 Prevent crashes with gallery objects The problem is the formats for the gallery objects may be non-existent but the code attempts to use them anyway, causing crashes. The fix is to check for the existence of the proper format objects before using them, so as to prevent the crashes. I tested creating/deleting multiple objects with multiple rounds of undo/redo and believe this change to cover all the crashes that can occur (there were several). Change-Id: I9d5d704eaa381be861ac1758ad58269706437a27 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161950 Tested-by: Jenkins Reviewed-by: Mike Kaganski Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162078 Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162087 diff --git a/sw/inc/anchoredobject.hxx b/sw/inc/anchoredobject.hxx index 19cd2e75802b..9af198425714 100644 --- a/sw/inc/anchoredobject.hxx +++ b/sw/inc/anchoredobject.hxx @@ -318,6 +318,7 @@ class SW_DLLPUBLIC SwAnchoredObject void SetCurrRelPos( Point _aRelPos ); // accessors to the format +bool HasFrameFormat() const; virtual SwFrameFormat& GetFrameFormat() = 0; virtual const SwFrameFormat& GetFrameFormat() const = 0; diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx index cd1883ee346b..3e30a5d7709c 100644 --- a/sw/source/core/doc/docdraw.cxx +++ b/sw/source/core/doc/docdraw.cxx @@ -463,14 +463,17 @@ bool SwDoc::DeleteSelection( SwDrawView& rDrawView ) SdrObject *pObj = rMrkList.GetMark( i )->GetMarkedSdrObj(); if( dynamic_cast( pObj) == nullptr ) { -SwDrawContact *pC = static_cast(GetUserCall(pObj)); -SwDrawFrameFormat *pFrameFormat = static_cast(pC->GetFormat()); -if( pFrameFormat && -RndStdIds::FLY_AS_CHAR == pFrameFormat->GetAnchor().GetAnchorId() ) +if (SwDrawContact* pC = static_cast(GetUserCall(pObj))) { -rDrawView.MarkObj( pObj, rDrawView.Imp().GetPageView(), true ); ---i; -getIDocumentLayoutAccess().DelLayoutFormat( pFrameFormat ); +SwDrawFrameFormat* pFrameFormat += static_cast(pC->GetFormat()); +if (pFrameFormat +&& RndStdIds::FLY_AS_CHAR == pFrameFormat->GetAnchor().GetAnchorId()) +{ +rDrawView.MarkObj(pObj, rDrawView.Imp().GetPageView(), true); +--i; + getIDocumentLayoutAccess().DelLayoutFormat(pFrameFormat); +} } } } diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx index a658d20b4254..430e18ecfeaf 100644 --- a/sw/source/core/draw/dview.cxx +++ b/sw/source/core/draw/dview.cxx @@ -977,16 +977,19 @@ void SwDrawView::DeleteMarked() { SdrObject *pObject = rMarkList.GetMark(i)->GetMarkedSdrObj(); SwContact* pContact = GetUserCall(pObject); -SwFrameFormat* pFormat = pContact->GetFormat(); -if (pObject->getChildrenOfSdrObject()) +if (pContact) { -auto pChildTextBoxes = SwTextBoxHelper::CollectTextBoxes(pObject, pFormat); -for (auto& rChildTextBox : pChildTextBoxes) -aTextBoxesToDelete.push_back(rChildTextBox); -} -else -if (SwFrameFormat* pTextBox = SwTextBoxHelper::getOtherTextBoxFormat(pFormat, RES_DRAWFRMFMT)) +SwFrameFormat* pFormat = pContact->GetFormat(); +if (pObject->getChildrenOfSdrObject()) +{ +auto pChildTextBoxes = SwTextBoxHelper::CollectTextBoxes(pObject, pFormat); +for (auto& rChildTextBox : pChildTextBoxes) +aTextBoxesToDelete.push_back(rChildTextBox); +} +
core.git: Branch 'libreoffice-7-6' - sc/source
sc/source/ui/app/transobj.cxx | 46 +++--- 1 file changed, 26 insertions(+), 20 deletions(-) New commits: commit 87cf3f7fb877db5eca5aa7923586207920d19b79 Author: Matt K AuthorDate: Sat Jan 13 18:12:16 2024 -0600 Commit: Xisco Fauli CommitDate: Mon Jan 15 15:23:05 2024 +0100 tdf#159171 Prevent crash after selecting unprotected cells 2 times The problem is that the code tries to check for a table on a clip- board doc, but doesn't find any so it propagates nullptr back to the caller, which is then used without being checked thereby leading to a crash. The fix is to check the result of the table check of clipboard doc before doing any operations with it, thus preventing the crash. Change-Id: Ieb4a52d0c1cb713d5c14930e5e559e5bf520b330 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162033 Tested-by: Jenkins Reviewed-by: Mike Kaganski (cherry picked from commit 3b10bbacb8a12a00c35683eeaae4a75046a84aac) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162091 Reviewed-by: Xisco Fauli (cherry picked from commit f5a6c7d5252b9d201a9e00c8d9f45f66114d1462) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162098 diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index 6a1ef6a04650..5f0599c888b3 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -312,28 +312,34 @@ bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor, const OUSt ScAddress aPos(nCol, nRow, nTab); const ScPatternAttr* pPattern = m_pDoc->GetPattern( nCol, nRow, nTab ); -ScTabEditEngine aEngine( *pPattern, m_pDoc->GetEditPool(), m_pDoc.get() ); -ScRefCellValue aCell(*m_pDoc, aPos); -if (aCell.getType() == CELLTYPE_EDIT) +if (pPattern) { -const EditTextObject* pObj = aCell.getEditText(); -aEngine.SetTextCurrentDefaults(*pObj); -} -else -{ -SvNumberFormatter* pFormatter = m_pDoc->GetFormatTable(); -sal_uInt32 nNumFmt = pPattern->GetNumberFormat(pFormatter); -const Color* pColor; -OUString aText = ScCellFormat::GetString(aCell, nNumFmt, , *pFormatter, *m_pDoc); -if (!aText.isEmpty()) -aEngine.SetTextCurrentDefaults(aText); -} +ScTabEditEngine aEngine(*pPattern, m_pDoc->GetEditPool(), m_pDoc.get()); +ScRefCellValue aCell(*m_pDoc, aPos); +if (aCell.getType() == CELLTYPE_EDIT) +{ +const EditTextObject* pObj = aCell.getEditText(); +aEngine.SetTextCurrentDefaults(*pObj); +} +else +{ +SvNumberFormatter* pFormatter = m_pDoc->GetFormatTable(); +sal_uInt32 nNumFmt = pPattern->GetNumberFormat(pFormatter); +const Color* pColor; +OUString aText += ScCellFormat::GetString(aCell, nNumFmt, , *pFormatter, *m_pDoc); +if (!aText.isEmpty()) +aEngine.SetTextCurrentDefaults(aText); +} -bOK = SetObject( , -((nFormat == SotClipboardFormatId::RTF) ? SCTRANS_TYPE_EDIT_RTF : - ((nFormat == SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT) ? - SCTRANS_TYPE_EDIT_ODF_TEXT_FLAT : SCTRANS_TYPE_EDIT_BIN)), -rFlavor ); +bOK = SetObject(, +((nFormat == SotClipboardFormatId::RTF) + ? SCTRANS_TYPE_EDIT_RTF + : ((nFormat == SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT) +? SCTRANS_TYPE_EDIT_ODF_TEXT_FLAT +: SCTRANS_TYPE_EDIT_BIN)), +rFlavor); +} } else if ( ScImportExport::IsFormatSupported( nFormat ) || nFormat == SotClipboardFormatId::RTF || nFormat == SotClipboardFormatId::RICHTEXT )
core.git: Branch 'libreoffice-7-6' - sc/source
sc/source/core/data/document.cxx | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) New commits: commit ebf6a4ae1746002ede4b7920dad317015f802e32 Author: Matt K AuthorDate: Sat Jan 13 17:30:59 2024 -0600 Commit: Xisco Fauli CommitDate: Mon Jan 15 13:17:25 2024 +0100 tdf#151752 Fix crash when selecting unprotected cells and copy/pasting The problem is that the code attemps to index into maTabs when looping through clipboard ranges, but maTabs.size() can be 0 at that point thus resulting in a crash. The fix is to first check if maTabs.size() is greater than 0 before doing the looping. Change-Id: Ib2fc4c9f847f87f44a68ad6d73c2745d79b5caa5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162032 Tested-by: Jenkins Reviewed-by: Mike Kaganski (cherry picked from commit 59927dedc31eb5d51b417a02ae927eb578b90bd6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162090 Reviewed-by: Xisco Fauli (cherry picked from commit 051d4d2ade01bf1de8fd2e4d384463fa8e9f35d8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162094 diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 6ddae7a04057..2381bb3b2b97 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -3262,12 +3262,16 @@ bool ScDocument::HasClipFilteredRows() if ( rClipRanges.empty() ) return false; -for ( size_t i = 0, n = rClipRanges.size(); i < n; ++i ) +if (maTabs.size() > 0) { -ScRange & rRange = rClipRanges[ i ]; -bool bAnswer = maTabs[nCountTab]->HasFilteredRows(rRange.aStart.Row(), rRange.aEnd.Row()); -if (bAnswer) -return true; +for (size_t i = 0, n = rClipRanges.size(); i < n; ++i) +{ +ScRange& rRange = rClipRanges[i]; +bool bAnswer += maTabs[nCountTab]->HasFilteredRows(rRange.aStart.Row(), rRange.aEnd.Row()); +if (bAnswer) +return true; +} } return false; }
core.git: Branch 'libreoffice-24-2' - sw/inc sw/source
sw/inc/anchoredobject.hxx|1 sw/source/core/doc/docdraw.cxx | 17 ++- sw/source/core/draw/dview.cxx| 19 ++-- sw/source/core/frmedt/feshview.cxx | 36 --- sw/source/core/layout/anchoredobject.cxx | 134 - sw/source/core/layout/flylay.cxx | 113 sw/source/core/layout/frmtool.cxx|6 - sw/source/core/layout/sortedobjs.cxx |4 sw/source/core/text/txtfly.cxx | 143 --- sw/source/uibase/docvw/edtwin.cxx| 28 +++--- sw/source/uibase/shells/drwbassh.cxx | 16 ++- 11 files changed, 288 insertions(+), 229 deletions(-) New commits: commit a72dad4e4c0d41b61e453919401fcefc8e5e9b43 Author: Matt K AuthorDate: Thu Jan 11 20:37:01 2024 -0600 Commit: Xisco Fauli CommitDate: Mon Jan 15 13:01:00 2024 +0100 tdf#132810 Prevent crashes with gallery objects The problem is the formats for the gallery objects may be non-existent but the code attempts to use them anyway, causing crashes. The fix is to check for the existence of the proper format objects before using them, so as to prevent the crashes. I tested creating/deleting multiple objects with multiple rounds of undo/redo and believe this change to cover all the crashes that can occur (there were several). Change-Id: I9d5d704eaa381be861ac1758ad58269706437a27 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161950 Tested-by: Jenkins Reviewed-by: Mike Kaganski Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162078 diff --git a/sw/inc/anchoredobject.hxx b/sw/inc/anchoredobject.hxx index 19cd2e75802b..9af198425714 100644 --- a/sw/inc/anchoredobject.hxx +++ b/sw/inc/anchoredobject.hxx @@ -318,6 +318,7 @@ class SW_DLLPUBLIC SwAnchoredObject void SetCurrRelPos( Point _aRelPos ); // accessors to the format +bool HasFrameFormat() const; virtual SwFrameFormat& GetFrameFormat() = 0; virtual const SwFrameFormat& GetFrameFormat() const = 0; diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx index aecbe2ac824f..521ca2b0ba15 100644 --- a/sw/source/core/doc/docdraw.cxx +++ b/sw/source/core/doc/docdraw.cxx @@ -463,14 +463,17 @@ bool SwDoc::DeleteSelection( SwDrawView& rDrawView ) SdrObject *pObj = rMrkList.GetMark( i )->GetMarkedSdrObj(); if( dynamic_cast( pObj) == nullptr ) { -SwDrawContact *pC = static_cast(GetUserCall(pObj)); -SwDrawFrameFormat *pFrameFormat = static_cast(pC->GetFormat()); -if( pFrameFormat && -RndStdIds::FLY_AS_CHAR == pFrameFormat->GetAnchor().GetAnchorId() ) +if (SwDrawContact* pC = static_cast(GetUserCall(pObj))) { -rDrawView.MarkObj( pObj, rDrawView.Imp().GetPageView(), true ); ---i; -getIDocumentLayoutAccess().DelLayoutFormat( pFrameFormat ); +SwDrawFrameFormat* pFrameFormat += static_cast(pC->GetFormat()); +if (pFrameFormat +&& RndStdIds::FLY_AS_CHAR == pFrameFormat->GetAnchor().GetAnchorId()) +{ +rDrawView.MarkObj(pObj, rDrawView.Imp().GetPageView(), true); +--i; + getIDocumentLayoutAccess().DelLayoutFormat(pFrameFormat); +} } } } diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx index 9d704647c30e..2bd1acaf3db3 100644 --- a/sw/source/core/draw/dview.cxx +++ b/sw/source/core/draw/dview.cxx @@ -977,16 +977,19 @@ void SwDrawView::DeleteMarked() { SdrObject *pObject = rMarkList.GetMark(i)->GetMarkedSdrObj(); SwContact* pContact = GetUserCall(pObject); -SwFrameFormat* pFormat = pContact->GetFormat(); -if (pObject->getChildrenOfSdrObject()) +if (pContact) { -auto pChildTextBoxes = SwTextBoxHelper::CollectTextBoxes(pObject, pFormat); -for (auto& rChildTextBox : pChildTextBoxes) -aTextBoxesToDelete.push_back(rChildTextBox); -} -else -if (SwFrameFormat* pTextBox = SwTextBoxHelper::getOtherTextBoxFormat(pFormat, RES_DRAWFRMFMT)) +SwFrameFormat* pFormat = pContact->GetFormat(); +if (pObject->getChildrenOfSdrObject()) +{ +auto pChildTextBoxes = SwTextBoxHelper::CollectTextBoxes(pObject, pFormat); +for (auto& rChildTextBox : pChildTextBoxes) +aTextBoxesToDelete.push_back(rChildTextBox); +} +else if (SwFrameFormat* pTextBox + =
core.git: Branch 'libreoffice-24-2' - sc/source
sc/source/ui/app/transobj.cxx | 46 +++--- 1 file changed, 26 insertions(+), 20 deletions(-) New commits: commit fe1d56b3bc895d23f7e53fb7e2414862403099a0 Author: Matt K AuthorDate: Sat Jan 13 18:12:16 2024 -0600 Commit: Xisco Fauli CommitDate: Mon Jan 15 12:48:42 2024 +0100 tdf#159171 Prevent crash after selecting unprotected cells 2 times The problem is that the code tries to check for a table on a clip- board doc, but doesn't find any so it propagates nullptr back to the caller, which is then used without being checked thereby leading to a crash. The fix is to check the result of the table check of clipboard doc before doing any operations with it, thus preventing the crash. Change-Id: Ieb4a52d0c1cb713d5c14930e5e559e5bf520b330 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162033 Tested-by: Jenkins Reviewed-by: Mike Kaganski (cherry picked from commit 3b10bbacb8a12a00c35683eeaae4a75046a84aac) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162091 Reviewed-by: Xisco Fauli diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index 6a1ef6a04650..5f0599c888b3 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -312,28 +312,34 @@ bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor, const OUSt ScAddress aPos(nCol, nRow, nTab); const ScPatternAttr* pPattern = m_pDoc->GetPattern( nCol, nRow, nTab ); -ScTabEditEngine aEngine( *pPattern, m_pDoc->GetEditPool(), m_pDoc.get() ); -ScRefCellValue aCell(*m_pDoc, aPos); -if (aCell.getType() == CELLTYPE_EDIT) +if (pPattern) { -const EditTextObject* pObj = aCell.getEditText(); -aEngine.SetTextCurrentDefaults(*pObj); -} -else -{ -SvNumberFormatter* pFormatter = m_pDoc->GetFormatTable(); -sal_uInt32 nNumFmt = pPattern->GetNumberFormat(pFormatter); -const Color* pColor; -OUString aText = ScCellFormat::GetString(aCell, nNumFmt, , *pFormatter, *m_pDoc); -if (!aText.isEmpty()) -aEngine.SetTextCurrentDefaults(aText); -} +ScTabEditEngine aEngine(*pPattern, m_pDoc->GetEditPool(), m_pDoc.get()); +ScRefCellValue aCell(*m_pDoc, aPos); +if (aCell.getType() == CELLTYPE_EDIT) +{ +const EditTextObject* pObj = aCell.getEditText(); +aEngine.SetTextCurrentDefaults(*pObj); +} +else +{ +SvNumberFormatter* pFormatter = m_pDoc->GetFormatTable(); +sal_uInt32 nNumFmt = pPattern->GetNumberFormat(pFormatter); +const Color* pColor; +OUString aText += ScCellFormat::GetString(aCell, nNumFmt, , *pFormatter, *m_pDoc); +if (!aText.isEmpty()) +aEngine.SetTextCurrentDefaults(aText); +} -bOK = SetObject( , -((nFormat == SotClipboardFormatId::RTF) ? SCTRANS_TYPE_EDIT_RTF : - ((nFormat == SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT) ? - SCTRANS_TYPE_EDIT_ODF_TEXT_FLAT : SCTRANS_TYPE_EDIT_BIN)), -rFlavor ); +bOK = SetObject(, +((nFormat == SotClipboardFormatId::RTF) + ? SCTRANS_TYPE_EDIT_RTF + : ((nFormat == SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT) +? SCTRANS_TYPE_EDIT_ODF_TEXT_FLAT +: SCTRANS_TYPE_EDIT_BIN)), +rFlavor); +} } else if ( ScImportExport::IsFormatSupported( nFormat ) || nFormat == SotClipboardFormatId::RTF || nFormat == SotClipboardFormatId::RICHTEXT )
core.git: Branch 'libreoffice-24-2' - sc/source
sc/source/core/data/document.cxx | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) New commits: commit a381ac7b0fa95ce340bd1b384c946fbd19d87393 Author: Matt K AuthorDate: Sat Jan 13 17:30:59 2024 -0600 Commit: Xisco Fauli CommitDate: Mon Jan 15 11:45:59 2024 +0100 tdf#151752 Fix crash when selecting unprotected cells and copy/pasting The problem is that the code attemps to index into maTabs when looping through clipboard ranges, but maTabs.size() can be 0 at that point thus resulting in a crash. The fix is to first check if maTabs.size() is greater than 0 before doing the looping. Change-Id: Ib2fc4c9f847f87f44a68ad6d73c2745d79b5caa5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162032 Tested-by: Jenkins Reviewed-by: Mike Kaganski (cherry picked from commit 59927dedc31eb5d51b417a02ae927eb578b90bd6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162090 Reviewed-by: Xisco Fauli diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 060bd85eebbc..ff6d77b432f7 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -3254,12 +3254,16 @@ bool ScDocument::HasClipFilteredRows() if ( rClipRanges.empty() ) return false; -for ( size_t i = 0, n = rClipRanges.size(); i < n; ++i ) +if (maTabs.size() > 0) { -ScRange & rRange = rClipRanges[ i ]; -bool bAnswer = maTabs[nCountTab]->HasFilteredRows(rRange.aStart.Row(), rRange.aEnd.Row()); -if (bAnswer) -return true; +for (size_t i = 0, n = rClipRanges.size(); i < n; ++i) +{ +ScRange& rRange = rClipRanges[i]; +bool bAnswer += maTabs[nCountTab]->HasFilteredRows(rRange.aStart.Row(), rRange.aEnd.Row()); +if (bAnswer) +return true; +} } return false; }
core.git: sc/source
sc/source/ui/app/transobj.cxx | 46 +++--- 1 file changed, 26 insertions(+), 20 deletions(-) New commits: commit 3b10bbacb8a12a00c35683eeaae4a75046a84aac Author: Matt K AuthorDate: Sat Jan 13 18:12:16 2024 -0600 Commit: Mike Kaganski CommitDate: Sun Jan 14 05:43:00 2024 +0100 tdf#159171 Prevent crash after selecting unprotected cells 2 times The problem is that the code tries to check for a table on a clip- board doc, but doesn't find any so it propagates nullptr back to the caller, which is then used without being checked thereby leading to a crash. The fix is to check the result of the table check of clipboard doc before doing any operations with it, thus preventing the crash. Change-Id: Ieb4a52d0c1cb713d5c14930e5e559e5bf520b330 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162033 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index 6a1ef6a04650..5f0599c888b3 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -312,28 +312,34 @@ bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor, const OUSt ScAddress aPos(nCol, nRow, nTab); const ScPatternAttr* pPattern = m_pDoc->GetPattern( nCol, nRow, nTab ); -ScTabEditEngine aEngine( *pPattern, m_pDoc->GetEditPool(), m_pDoc.get() ); -ScRefCellValue aCell(*m_pDoc, aPos); -if (aCell.getType() == CELLTYPE_EDIT) +if (pPattern) { -const EditTextObject* pObj = aCell.getEditText(); -aEngine.SetTextCurrentDefaults(*pObj); -} -else -{ -SvNumberFormatter* pFormatter = m_pDoc->GetFormatTable(); -sal_uInt32 nNumFmt = pPattern->GetNumberFormat(pFormatter); -const Color* pColor; -OUString aText = ScCellFormat::GetString(aCell, nNumFmt, , *pFormatter, *m_pDoc); -if (!aText.isEmpty()) -aEngine.SetTextCurrentDefaults(aText); -} +ScTabEditEngine aEngine(*pPattern, m_pDoc->GetEditPool(), m_pDoc.get()); +ScRefCellValue aCell(*m_pDoc, aPos); +if (aCell.getType() == CELLTYPE_EDIT) +{ +const EditTextObject* pObj = aCell.getEditText(); +aEngine.SetTextCurrentDefaults(*pObj); +} +else +{ +SvNumberFormatter* pFormatter = m_pDoc->GetFormatTable(); +sal_uInt32 nNumFmt = pPattern->GetNumberFormat(pFormatter); +const Color* pColor; +OUString aText += ScCellFormat::GetString(aCell, nNumFmt, , *pFormatter, *m_pDoc); +if (!aText.isEmpty()) +aEngine.SetTextCurrentDefaults(aText); +} -bOK = SetObject( , -((nFormat == SotClipboardFormatId::RTF) ? SCTRANS_TYPE_EDIT_RTF : - ((nFormat == SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT) ? - SCTRANS_TYPE_EDIT_ODF_TEXT_FLAT : SCTRANS_TYPE_EDIT_BIN)), -rFlavor ); +bOK = SetObject(, +((nFormat == SotClipboardFormatId::RTF) + ? SCTRANS_TYPE_EDIT_RTF + : ((nFormat == SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT) +? SCTRANS_TYPE_EDIT_ODF_TEXT_FLAT +: SCTRANS_TYPE_EDIT_BIN)), +rFlavor); +} } else if ( ScImportExport::IsFormatSupported( nFormat ) || nFormat == SotClipboardFormatId::RTF || nFormat == SotClipboardFormatId::RICHTEXT )
core.git: sc/source
sc/source/core/data/document.cxx | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) New commits: commit 59927dedc31eb5d51b417a02ae927eb578b90bd6 Author: Matt K AuthorDate: Sat Jan 13 17:30:59 2024 -0600 Commit: Mike Kaganski CommitDate: Sun Jan 14 05:40:39 2024 +0100 tdf#151752 Fix crash when selecting unprotected cells and copy/pasting The problem is that the code attemps to index into maTabs when looping through clipboard ranges, but maTabs.size() can be 0 at that point thus resulting in a crash. The fix is to first check if maTabs.size() is greater than 0 before doing the looping. Change-Id: Ib2fc4c9f847f87f44a68ad6d73c2745d79b5caa5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162032 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index c44672048b39..71ea5bfc20a1 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -3259,12 +3259,16 @@ bool ScDocument::HasClipFilteredRows() if ( rClipRanges.empty() ) return false; -for ( size_t i = 0, n = rClipRanges.size(); i < n; ++i ) +if (maTabs.size() > 0) { -ScRange & rRange = rClipRanges[ i ]; -bool bAnswer = maTabs[nCountTab]->HasFilteredRows(rRange.aStart.Row(), rRange.aEnd.Row()); -if (bAnswer) -return true; +for (size_t i = 0, n = rClipRanges.size(); i < n; ++i) +{ +ScRange& rRange = rClipRanges[i]; +bool bAnswer += maTabs[nCountTab]->HasFilteredRows(rRange.aStart.Row(), rRange.aEnd.Row()); +if (bAnswer) +return true; +} } return false; }
core.git: sw/inc sw/source
sw/inc/anchoredobject.hxx|1 sw/source/core/doc/docdraw.cxx | 17 ++- sw/source/core/draw/dview.cxx| 19 ++-- sw/source/core/frmedt/feshview.cxx | 36 --- sw/source/core/layout/anchoredobject.cxx | 134 - sw/source/core/layout/flylay.cxx | 113 sw/source/core/layout/frmtool.cxx|6 - sw/source/core/layout/sortedobjs.cxx |4 sw/source/core/text/txtfly.cxx | 143 --- sw/source/uibase/docvw/edtwin.cxx| 28 +++--- sw/source/uibase/shells/drwbassh.cxx | 16 ++- 11 files changed, 288 insertions(+), 229 deletions(-) New commits: commit 19062c98da5b2e9edc7a99068fa06a83c7578826 Author: Matt K AuthorDate: Thu Jan 11 20:37:01 2024 -0600 Commit: Mike Kaganski CommitDate: Sat Jan 13 18:21:02 2024 +0100 tdf#132810 Prevent crashes with gallery objects The problem is the formats for the gallery objects may be non-existent but the code attempts to use them anyway, causing crashes. The fix is to check for the existence of the proper format objects before using them, so as to prevent the crashes. I tested creating/deleting multiple objects with multiple rounds of undo/redo and believe this change to cover all the crashes that can occur (there were several). Change-Id: I9d5d704eaa381be861ac1758ad58269706437a27 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161950 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sw/inc/anchoredobject.hxx b/sw/inc/anchoredobject.hxx index 19cd2e75802b..9af198425714 100644 --- a/sw/inc/anchoredobject.hxx +++ b/sw/inc/anchoredobject.hxx @@ -318,6 +318,7 @@ class SW_DLLPUBLIC SwAnchoredObject void SetCurrRelPos( Point _aRelPos ); // accessors to the format +bool HasFrameFormat() const; virtual SwFrameFormat& GetFrameFormat() = 0; virtual const SwFrameFormat& GetFrameFormat() const = 0; diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx index aecbe2ac824f..521ca2b0ba15 100644 --- a/sw/source/core/doc/docdraw.cxx +++ b/sw/source/core/doc/docdraw.cxx @@ -463,14 +463,17 @@ bool SwDoc::DeleteSelection( SwDrawView& rDrawView ) SdrObject *pObj = rMrkList.GetMark( i )->GetMarkedSdrObj(); if( dynamic_cast( pObj) == nullptr ) { -SwDrawContact *pC = static_cast(GetUserCall(pObj)); -SwDrawFrameFormat *pFrameFormat = static_cast(pC->GetFormat()); -if( pFrameFormat && -RndStdIds::FLY_AS_CHAR == pFrameFormat->GetAnchor().GetAnchorId() ) +if (SwDrawContact* pC = static_cast(GetUserCall(pObj))) { -rDrawView.MarkObj( pObj, rDrawView.Imp().GetPageView(), true ); ---i; -getIDocumentLayoutAccess().DelLayoutFormat( pFrameFormat ); +SwDrawFrameFormat* pFrameFormat += static_cast(pC->GetFormat()); +if (pFrameFormat +&& RndStdIds::FLY_AS_CHAR == pFrameFormat->GetAnchor().GetAnchorId()) +{ +rDrawView.MarkObj(pObj, rDrawView.Imp().GetPageView(), true); +--i; + getIDocumentLayoutAccess().DelLayoutFormat(pFrameFormat); +} } } } diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx index f7ab7cda9fbd..98c0014b1a17 100644 --- a/sw/source/core/draw/dview.cxx +++ b/sw/source/core/draw/dview.cxx @@ -979,16 +979,19 @@ void SwDrawView::DeleteMarked() { SdrObject *pObject = rMarkList.GetMark(i)->GetMarkedSdrObj(); SwContact* pContact = GetUserCall(pObject); -SwFrameFormat* pFormat = pContact->GetFormat(); -if (pObject->getChildrenOfSdrObject()) +if (pContact) { -auto pChildTextBoxes = SwTextBoxHelper::CollectTextBoxes(pObject, pFormat); -for (auto& rChildTextBox : pChildTextBoxes) -aTextBoxesToDelete.push_back(rChildTextBox); -} -else -if (SwFrameFormat* pTextBox = SwTextBoxHelper::getOtherTextBoxFormat(pFormat, RES_DRAWFRMFMT)) +SwFrameFormat* pFormat = pContact->GetFormat(); +if (pObject->getChildrenOfSdrObject()) +{ +auto pChildTextBoxes = SwTextBoxHelper::CollectTextBoxes(pObject, pFormat); +for (auto& rChildTextBox : pChildTextBoxes) +aTextBoxesToDelete.push_back(rChildTextBox); +} +else if (SwFrameFormat* pTextBox + = SwTextBoxHelper::getOtherTextBoxFormat(pFormat, RES_DRAWFRMFMT)) aTextBoxesToDelete.push_back(pTextBox); +}
core.git: sfx2/source
sfx2/source/doc/sfxbasemodel.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit e004c9dd2cc0da7f27503d14bfc13975889eea77 Author: Matt K AuthorDate: Tue Jan 9 17:23:34 2024 -0600 Commit: Mike Kaganski CommitDate: Thu Jan 11 05:19:28 2024 +0100 tdf#158937 Allow cancel of password dialog during recovery The problem is that when a user cancels the password dialog during recovery, the code tries to do something with the doc, but there is no doc yet because the file is password protected and not opened, so it crashes. The fix is just to check for the absence of errors before using the doc (canceling the password dialog is considered an abort/ general IO error). Change-Id: Ia76d8e4ff8212427d6b7b0a67ce1971b9ea8a48d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161844 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index a996259f3598..3da83626a5ea 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -2026,7 +2026,7 @@ void SAL_CALL SfxBaseModel::load( const Sequence< beans::PropertyValue >& seqA if( m_pData->m_pObjectShell->IsAbortingImport() ) nError = ERRCODE_ABORT; -if( bSalvage ) +if (bSalvage && nError == ERRCODE_NONE) { // file recovery: restore original filter const SfxStringItem* pFilterItem = pMedium->GetItemSet().GetItem(SID_FILTER_NAME, false);
core.git: Branch 'libreoffice-24-2' - sc/inc sc/source
sc/inc/refupdatecontext.hxx |2 ++ sc/source/core/data/conditio.cxx | 15 --- sc/source/core/tool/token.cxx|4 3 files changed, 18 insertions(+), 3 deletions(-) New commits: commit 5653238332deac00affa4fa913354b3c8384dab9 Author: Matt K AuthorDate: Mon Jan 1 11:44:35 2024 -0600 Commit: Xisco Fauli CommitDate: Tue Jan 9 09:54:44 2024 +0100 tdf#73678 Prevent conditional formatting from being lost in Calc The problem is that when a Calc tab sheet is moved from one position to another, the ScConditionEntry aSrcPos member variable isn't updated, and therefore when deleting a blank sheet in front of a data sheet the deletion still thinks it's looking at the correct sheet but it is now out-of-date and as such the conditional formatting references are invalidated such that all math operations are tested against 0.0 instead of the actual formula value for the condtional formatting, which has the side effect of updating cells colors that should be uncolored as per the conditional formats set on them. The fix is to update this aSrcPos member variable of ScConditionEntry via the call to ScTokenArray::AdjustReferenceOnMovedTab from ScConditionEntry::UpdateMoveTab, which is called on tab sheet move. This way, the aSrcPos variable is up to date when ScConditionEntry::UpdateDeleteTab is called, which is called on tab sheet delete. Change-Id: I3bbc8111bb1685d6f7f307a15c852c6657f37b3e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160234 Tested-by: Jenkins Reviewed-by: Mike Kaganski (cherry picked from commit 0ba4e0483bacd698a227d0d18422fc6a08055c28) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161754 Reviewed-by: Xisco Fauli diff --git a/sc/inc/refupdatecontext.hxx b/sc/inc/refupdatecontext.hxx index 1c50c7a2c0d1..50eb60c88d18 100644 --- a/sc/inc/refupdatecontext.hxx +++ b/sc/inc/refupdatecontext.hxx @@ -113,6 +113,8 @@ struct RefUpdateResult */ bool mbNameModified; +SCTAB nTab; + RefUpdateResult(); }; diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 93094e929bf4..04ee4e6fc239 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -595,20 +595,29 @@ void ScConditionEntry::UpdateDeleteTab( sc::RefUpdateDeleteTabContext& rCxt ) StartListening(); } -void ScConditionEntry::UpdateMoveTab( sc::RefUpdateMoveTabContext& rCxt ) +void ScConditionEntry::UpdateMoveTab(sc::RefUpdateMoveTabContext& rCxt) { +sc::RefUpdateResult aResFinal; +aResFinal.nTab = aSrcPos.Tab(); if (pFormula1) { -pFormula1->AdjustReferenceOnMovedTab(rCxt, aSrcPos); +sc::RefUpdateResult aRes = pFormula1->AdjustReferenceOnMovedTab(rCxt, aSrcPos); +if (aRes.mbValueChanged) +aResFinal.nTab = aRes.nTab; pFCell1.reset(); } if (pFormula2) { -pFormula2->AdjustReferenceOnMovedTab(rCxt, aSrcPos); +sc::RefUpdateResult aRes = pFormula2->AdjustReferenceOnMovedTab(rCxt, aSrcPos); +if (aRes.mbValueChanged) +aResFinal.nTab = aRes.nTab; pFCell2.reset(); } +if (aResFinal.nTab != aSrcPos.Tab()) +aSrcPos.SetTab(aResFinal.nTab); + StartListening(); } diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index 8abf686f2510..f927f2389450 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -4417,7 +4417,11 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceOnMovedTab( const sc::RefUpdate ScAddress aNewPos = rOldPos; if (adjustTabOnMove(aNewPos, rCxt)) +{ aRes.mbReferenceModified = true; +aRes.mbValueChanged = true; +aRes.nTab = aNewPos.Tab(); // this sets the new tab position used when deleting +} TokenPointers aPtrs( pCode.get(), nLen, pRPN, nRPN); for (size_t j=0; j<2; ++j)
core.git: sc/inc sc/source
sc/inc/refupdatecontext.hxx |2 ++ sc/source/core/data/conditio.cxx | 15 --- sc/source/core/tool/token.cxx|4 3 files changed, 18 insertions(+), 3 deletions(-) New commits: commit 0ba4e0483bacd698a227d0d18422fc6a08055c28 Author: Matt K AuthorDate: Mon Jan 1 11:44:35 2024 -0600 Commit: Mike Kaganski CommitDate: Sat Jan 6 18:20:29 2024 +0100 tdf#73678 Prevent conditional formatting from being lost in Calc The problem is that when a Calc tab sheet is moved from one position to another, the ScConditionEntry aSrcPos member variable isn't updated, and therefore when deleting a blank sheet in front of a data sheet the deletion still thinks it's looking at the correct sheet but it is now out-of-date and as such the conditional formatting references are invalidated such that all math operations are tested against 0.0 instead of the actual formula value for the condtional formatting, which has the side effect of updating cells colors that should be uncolored as per the conditional formats set on them. The fix is to update this aSrcPos member variable of ScConditionEntry via the call to ScTokenArray::AdjustReferenceOnMovedTab from ScConditionEntry::UpdateMoveTab, which is called on tab sheet move. This way, the aSrcPos variable is up to date when ScConditionEntry::UpdateDeleteTab is called, which is called on tab sheet delete. Change-Id: I3bbc8111bb1685d6f7f307a15c852c6657f37b3e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160234 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sc/inc/refupdatecontext.hxx b/sc/inc/refupdatecontext.hxx index 1c50c7a2c0d1..50eb60c88d18 100644 --- a/sc/inc/refupdatecontext.hxx +++ b/sc/inc/refupdatecontext.hxx @@ -113,6 +113,8 @@ struct RefUpdateResult */ bool mbNameModified; +SCTAB nTab; + RefUpdateResult(); }; diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 93094e929bf4..04ee4e6fc239 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -595,20 +595,29 @@ void ScConditionEntry::UpdateDeleteTab( sc::RefUpdateDeleteTabContext& rCxt ) StartListening(); } -void ScConditionEntry::UpdateMoveTab( sc::RefUpdateMoveTabContext& rCxt ) +void ScConditionEntry::UpdateMoveTab(sc::RefUpdateMoveTabContext& rCxt) { +sc::RefUpdateResult aResFinal; +aResFinal.nTab = aSrcPos.Tab(); if (pFormula1) { -pFormula1->AdjustReferenceOnMovedTab(rCxt, aSrcPos); +sc::RefUpdateResult aRes = pFormula1->AdjustReferenceOnMovedTab(rCxt, aSrcPos); +if (aRes.mbValueChanged) +aResFinal.nTab = aRes.nTab; pFCell1.reset(); } if (pFormula2) { -pFormula2->AdjustReferenceOnMovedTab(rCxt, aSrcPos); +sc::RefUpdateResult aRes = pFormula2->AdjustReferenceOnMovedTab(rCxt, aSrcPos); +if (aRes.mbValueChanged) +aResFinal.nTab = aRes.nTab; pFCell2.reset(); } +if (aResFinal.nTab != aSrcPos.Tab()) +aSrcPos.SetTab(aResFinal.nTab); + StartListening(); } diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index 8abf686f2510..f927f2389450 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -4417,7 +4417,11 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceOnMovedTab( const sc::RefUpdate ScAddress aNewPos = rOldPos; if (adjustTabOnMove(aNewPos, rCxt)) +{ aRes.mbReferenceModified = true; +aRes.mbValueChanged = true; +aRes.nTab = aNewPos.Tab(); // this sets the new tab position used when deleting +} TokenPointers aPtrs( pCode.get(), nLen, pRPN, nRPN); for (size_t j=0; j<2; ++j)
core.git: include/sfx2 sc/source sfx2/source
include/sfx2/childwin.hxx |2 +- sc/source/ui/inc/ChildWindowWrapper.hxx |2 +- sc/source/ui/inc/reffact.hxx|2 +- sc/source/ui/inc/tabvwsh.hxx|2 +- sc/source/ui/view/reffact.cxx |3 ++- sc/source/ui/view/tabvwshc.cxx |7 +-- sfx2/source/appl/childwin.cxx |3 ++- 7 files changed, 13 insertions(+), 8 deletions(-) New commits: commit e760dcf43052212952191ccdadbfb677fea3b5b8 Author: Matt K AuthorDate: Tue Dec 12 20:16:12 2023 -0600 Commit: Caolán McNamara CommitDate: Thu Dec 21 21:17:42 2023 +0100 tdf#153690 Prevent invisible dialogs in Calc Full Screen This change just adds the flag "SfxChildWindowFlags::NEVERHIDE" to the info passed around so that the dialogs are not treated as invisible when executing SfxWorkWindow::ShowChildren_Impl. Change-Id: I35f0be94132cee438b3be9f4b4217208617a1e77 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160660 Tested-by: Jenkins Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara diff --git a/include/sfx2/childwin.hxx b/include/sfx2/childwin.hxx index 568abf3f2e21..ff12fe30b3d0 100644 --- a/include/sfx2/childwin.hxx +++ b/include/sfx2/childwin.hxx @@ -136,7 +136,7 @@ public: static void RegisterChildWindow(SfxModule*, const SfxChildWinFactory&); -static std::unique_ptr CreateChildWindow( sal_uInt16, vcl::Window*, SfxBindings*, SfxChildWinInfo const &); +static std::unique_ptr CreateChildWindow( sal_uInt16, vcl::Window*, SfxBindings*, SfxChildWinInfo &); voidSetHideNotDelete( bool bOn ); boolIsHideNotDelete() const; boolIsVisible() const; diff --git a/sc/source/ui/inc/ChildWindowWrapper.hxx b/sc/source/ui/inc/ChildWindowWrapper.hxx index 5fb038df27dd..926e456c87ce 100644 --- a/sc/source/ui/inc/ChildWindowWrapper.hxx +++ b/sc/source/ui/inc/ChildWindowWrapper.hxx @@ -22,7 +22,7 @@ class ChildControllerWrapper : public SfxChildWindow { public: ChildControllerWrapper(vcl::Window* pParentP, sal_uInt16 nId, - SfxBindings* pBindings, const SfxChildWinInfo* pInfo) + SfxBindings* pBindings, SfxChildWinInfo* pInfo) : SfxChildWindow(pParentP, nId) { ScTabViewShell* pViewShell = getTabViewShell( pBindings ); diff --git a/sc/source/ui/inc/reffact.hxx b/sc/source/ui/inc/reffact.hxx index 4fbe965c15d9..de001354bda8 100644 --- a/sc/source/ui/inc/reffact.hxx +++ b/sc/source/ui/inc/reffact.hxx @@ -28,7 +28,7 @@ class Class : public SfxChildWindow \ { \ public: \ -Class( vcl::Window*, sal_uInt16, SfxBindings*, const SfxChildWinInfo* ); \ +Class( vcl::Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo* ); \ SFX_DECL_CHILDWINDOW_WITHID(Class); \ }; diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx index 1b80b0ab2f25..47c5c46e1bb0 100644 --- a/sc/source/ui/inc/tabvwsh.hxx +++ b/sc/source/ui/inc/tabvwsh.hxx @@ -356,7 +356,7 @@ public: static ScTabViewShell* GetActiveViewShell(); std::shared_ptr CreateRefDialogController(SfxBindings* pB, SfxChildWindow* pCW, -const SfxChildWinInfo* pInfo, +SfxChildWinInfo* pInfo, weld::Window* pParent, sal_uInt16 nSlotId); voidUpdateOleZoom(); diff --git a/sc/source/ui/view/reffact.cxx b/sc/source/ui/view/reffact.cxx index 3834e3b8c33f..999f0402d0a6 100644 --- a/sc/source/ui/view/reffact.cxx +++ b/sc/source/ui/view/reffact.cxx @@ -67,7 +67,7 @@ namespace Class::Class( vcl::Window* pParentP, \ sal_uInt16 nId,\ SfxBindings*p, \ -const SfxChildWinInfo* pInfo ) \ +SfxChildWinInfo* pInfo ) \ : SfxChildWindow(pParentP, nId) \ { \ //\ @@ -227,6 +227,7 @@ ScAcceptChgDlgWrapper::ScAcceptChgDlgWrapper(vcl::Window* pParentP, { auto xDlg = std::make_shared(pBindings, this, pParentP->GetFrameWeld(), >GetViewData()); SetController(xDlg); +pInfo->nFlags = SfxChildWindowFlags::NEVERHIDE; xDlg->Initialize( pInfo ); } else diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx
core.git: Branch 'libreoffice-24-2' - officecfg/registry
officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu | 6 + officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu | 31 -- 2 files changed, 32 insertions(+), 5 deletions(-) New commits: commit a82c7ed490446310dd099fed4bcaed6a432056c0 Author: Matt K AuthorDate: Sun Dec 10 15:38:12 2023 -0600 Commit: Xisco Fauli CommitDate: Wed Dec 20 17:11:52 2023 +0100 tdf#142695 Update tooltips for tools in Draw/Impress This change simply updates the tooltips for tool icons in Draw/Impress to inform the user that they can double-click the icon to continue using that specific action. Change-Id: I516cf9f110bd3c7dcb1545989b86155cc84617f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160555 Tested-by: Jenkins Reviewed-by: Mike Kaganski (cherry picked from commit 5b06b879916cd1682afd40201d6704711f909ff9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160645 Reviewed-by: Xisco Fauli diff --git a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu index de8d13e78222..6de8e0058a52 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu @@ -168,6 +168,9 @@ 3D Objects + + 3D Objects (double click for multi-selection) + 1 @@ -887,6 +890,9 @@ Connectors + + Connectors (double click for multi-selection) + 1 diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu index 83e6611922da..98332bbb434e 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu @@ -137,7 +137,7 @@ bit 3 (0x8): #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8 ~Basic Shapes - Basic Shapes + Basic Shapes (double click for multi-selection) 1 @@ -150,6 +150,9 @@ bit 3 (0x8): #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8 ~Symbol Shapes + + Symbol Shapes (double click for multi-selection) + 1 @@ -190,7 +193,7 @@ bit 3 (0x8): #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8 ~Block Arrows - Block Arrows + Block Arrows (double click for multi-selection) 1 @@ -203,6 +206,9 @@ bit 3 (0x8): #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8 ~Flowchart + + Flowchart (double click for multi-selection) + 1 @@ -214,6 +220,9 @@ bit 3 (0x8): #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8 ~Callout Shapes + + Callout Shapes (double click for multi-selection) + 1 @@ -226,7 +235,7 @@ bit 3 (0x8): #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8 S~tars and Banners - Stars and Banners + Stars and Banners (double click for multi-selection) 1 @@ -236,6 +245,9 @@ bit 3 (0x8): #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8 Rectangle + + Rectangle (double click for multi-selection) + 1 @@ -276,6 +288,9 @@ bit 3 (0x8): #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8 Ellipse + + Ellipse (double click for multi-selection) + 1 @@ -1446,7 +1461,7 @@ bit 3 (0x8): #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8 ~Text Box - Insert Text Box + Insert Text Box (double click for multi-selection) 1 @@ -2059,7 +2074,7 @@ bit 3 (0x8): #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8 Line - Insert Line + Insert Line (double click for multi-selection) 1 @@ -2069,6 +2084,9 @@ bit 3 (0x8): #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8 Lines and Arrows + + Lines and Arrows (double click for multi-selection) + 1 @@ -4884,6 +4902,9 @@ bit 3 (0x8): #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8 Curves and Polygons + + Curves and Polygons (double
core.git: officecfg/registry
officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu | 6 + officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu | 31 -- 2 files changed, 32 insertions(+), 5 deletions(-) New commits: commit 5b06b879916cd1682afd40201d6704711f909ff9 Author: Matt K AuthorDate: Sun Dec 10 15:38:12 2023 -0600 Commit: Mike Kaganski CommitDate: Wed Dec 13 08:31:59 2023 +0100 tdf#142695 Update tooltips for tools in Draw/Impress This change simply updates the tooltips for tool icons in Draw/Impress to inform the user that they can double-click the icon to continue using that specific action. Change-Id: I516cf9f110bd3c7dcb1545989b86155cc84617f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160555 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu index de8d13e78222..6de8e0058a52 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu @@ -168,6 +168,9 @@ 3D Objects + + 3D Objects (double click for multi-selection) + 1 @@ -887,6 +890,9 @@ Connectors + + Connectors (double click for multi-selection) + 1 diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu index 5235cfea8946..6ffdabf967a5 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu @@ -137,7 +137,7 @@ bit 3 (0x8): #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8 ~Basic Shapes - Basic Shapes + Basic Shapes (double click for multi-selection) 1 @@ -150,6 +150,9 @@ bit 3 (0x8): #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8 ~Symbol Shapes + + Symbol Shapes (double click for multi-selection) + 1 @@ -190,7 +193,7 @@ bit 3 (0x8): #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8 ~Block Arrows - Block Arrows + Block Arrows (double click for multi-selection) 1 @@ -203,6 +206,9 @@ bit 3 (0x8): #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8 ~Flowchart + + Flowchart (double click for multi-selection) + 1 @@ -214,6 +220,9 @@ bit 3 (0x8): #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8 ~Callout Shapes + + Callout Shapes (double click for multi-selection) + 1 @@ -226,7 +235,7 @@ bit 3 (0x8): #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8 S~tars and Banners - Stars and Banners + Stars and Banners (double click for multi-selection) 1 @@ -236,6 +245,9 @@ bit 3 (0x8): #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8 Rectangle + + Rectangle (double click for multi-selection) + 1 @@ -276,6 +288,9 @@ bit 3 (0x8): #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8 Ellipse + + Ellipse (double click for multi-selection) + 1 @@ -1446,7 +1461,7 @@ bit 3 (0x8): #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8 ~Text Box - Insert Text Box + Insert Text Box (double click for multi-selection) 1 @@ -2059,7 +2074,7 @@ bit 3 (0x8): #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8 Line - Insert Line + Insert Line (double click for multi-selection) 1 @@ -2069,6 +2084,9 @@ bit 3 (0x8): #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8 Lines and Arrows + + Lines and Arrows (double click for multi-selection) + 1 @@ -4884,6 +4902,9 @@ bit 3 (0x8): #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8 Curves and Polygons + + Curves and Polygons (double click for multi-selection) + 1
core.git: Branch 'libreoffice-24-2' - sw/source
sw/source/core/edit/autofmt.cxx |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) New commits: commit 8d3092eaea3fba2b96318d09722ca15b75a5b467 Author: Matt K AuthorDate: Sun Dec 10 12:20:32 2023 -0600 Commit: Xisco Fauli CommitDate: Mon Dec 11 14:14:44 2023 +0100 tdf#117651 Fix AutoCorrect support for italic, strike, bold, and underline The previous change for italic had a "break" for "/", but it turns out that code path is hit when trying to "Apply" with slashes around some text, so we just move the "break" inside the check for French language handling. Note that trying "Apply" with this change will crash on a debug build -- there is another fix for that problem in a subsequent change. Change-Id: I4bd76505b3fdfc9f5660eb6ae4a5c5c23e9672ef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160529 Tested-by: Jenkins Reviewed-by: Mike Kaganski Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160563 diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx index 65324e0eb296..fda00e5dfa4c 100644 --- a/sw/source/core/edit/autofmt.cxx +++ b/sw/source/core/edit/autofmt.cxx @@ -2110,8 +2110,10 @@ void SwAutoFormat::AutoCorrect(TextFrameIndex nPos) SetRedlineText( STR_AUTOFMTREDL_NON_BREAK_SPACE ); if (pATst->FnAddNonBrkSpace(aACorrDoc, *pText, sal_Int32(nPos), eLang, bNbspRunNext)) +{ --nPos; -break; +break; +} } [[fallthrough]]; case '-':
core.git: sw/source
sw/source/core/edit/autofmt.cxx | 16 +++- 1 file changed, 11 insertions(+), 5 deletions(-) New commits: commit 90d732a5311551ae79969ee24d98cf21ffbacac7 Author: Matt K AuthorDate: Sun Dec 10 12:32:51 2023 -0600 Commit: Mike Kaganski CommitDate: Mon Dec 11 05:38:43 2023 +0100 tdf#117651 Fix AutoCorrect crash for italic, strike, bold, and underline This change fixes correction of indices when autocorrecting for one of the categories of bold, italic, strike, or underline. Previously, the code would hit a debug assert when selecting "Apply" because of incorrect indices into the string being autocorrected. Change-Id: I5484c589ff43cd2fc78332cdc0d63e74cdc8e256 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160547 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx index fda00e5dfa4c..b569ca389ed8 100644 --- a/sw/source/core/edit/autofmt.cxx +++ b/sw/source/core/edit/autofmt.cxx @@ -2092,8 +2092,12 @@ void SwAutoFormat::AutoCorrect(TextFrameIndex nPos) aFInfo.SetFrame( nullptr ); } //#125102# in case of the mode RedlineFlags::ShowDelete the ** are still contained in pText - if(!(m_pDoc->getIDocumentRedlineAccess().GetRedlineFlags() & RedlineFlags::ShowDelete)) -nPos = m_pCurTextFrame->MapModelToViewPos(*m_aDelPam.GetPoint()) - TextFrameIndex(1); +if (m_pDoc->getIDocumentRedlineAccess().GetRedlineFlags() & RedlineFlags::ShowDelete) +{ +nPos = m_pCurTextFrame->MapModelToViewPos(*m_aDelPam.GetPoint()) + - TextFrameIndex(1); +bBreak++; +} // Was a character deleted before starting? if (cBlank && cBlank != (*pText)[sal_Int32(nSttPos) - 1]) --nSttPos; @@ -2141,11 +2145,13 @@ void SwAutoFormat::AutoCorrect(TextFrameIndex nPos) m_aDelPam.DeleteMark(); aFInfo.SetFrame(nullptr); } -//#125102# in case of the mode RedlineFlags::ShowDelete the ** are still contained in pText -if (!(m_pDoc->getIDocumentRedlineAccess().GetRedlineFlags() - & RedlineFlags::ShowDelete)) +//#125102# in case of the mode RedlineFlags::ShowDelete the // or -- are still contained in pText +if (m_pDoc->getIDocumentRedlineAccess().GetRedlineFlags() & RedlineFlags::ShowDelete) +{ nPos = m_pCurTextFrame->MapModelToViewPos(*m_aDelPam.GetPoint()) - TextFrameIndex(1); +bBreak++; +} // Was a character deleted before starting? if (cBlank && cBlank != (*pText)[sal_Int32(nSttPos) - 1]) --nSttPos;
core.git: sw/source
sw/source/core/edit/autofmt.cxx |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) New commits: commit dc8b69e3393d4f71900ea871db5598a5f7af567e Author: Matt K AuthorDate: Sun Dec 10 12:20:32 2023 -0600 Commit: Mike Kaganski CommitDate: Mon Dec 11 05:35:53 2023 +0100 tdf#117651 Fix AutoCorrect support for italic, strike, bold, and underline The previous change for italic had a "break" for "/", but it turns out that code path is hit when trying to "Apply" with slashes around some text, so we just move the "break" inside the check for French language handling. Note that trying "Apply" with this change will crash on a debug build -- there is another fix for that problem in a subsequent change. Change-Id: I4bd76505b3fdfc9f5660eb6ae4a5c5c23e9672ef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160529 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx index 65324e0eb296..fda00e5dfa4c 100644 --- a/sw/source/core/edit/autofmt.cxx +++ b/sw/source/core/edit/autofmt.cxx @@ -2110,8 +2110,10 @@ void SwAutoFormat::AutoCorrect(TextFrameIndex nPos) SetRedlineText( STR_AUTOFMTREDL_NON_BREAK_SPACE ); if (pATst->FnAddNonBrkSpace(aACorrDoc, *pText, sal_Int32(nPos), eLang, bNbspRunNext)) +{ --nPos; -break; +break; +} } [[fallthrough]]; case '-':
[Libreoffice-commits] core.git: comphelper/source
comphelper/source/container/interfacecontainer2.cxx |3 +++ 1 file changed, 3 insertions(+) New commits: commit 61308112435628177b7884ab833ece843d37cd28 Author: Matt K AuthorDate: Sun Nov 26 19:01:20 2023 -0600 Commit: Noel Grandin CommitDate: Tue Nov 28 06:16:54 2023 +0100 tdf#156648 Prevent LO from adding an empty event listener The problem is that an empty interface listener can be added in Basic, which then crashes when trying to fire an event on that listener. The fix is to check for the existence of the listener before adding to the list of listeners. Change-Id: I3205ec1e6cdad431f6297f2b7833295b9eb64b8e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159978 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/comphelper/source/container/interfacecontainer2.cxx b/comphelper/source/container/interfacecontainer2.cxx index 9acff0a7f761..df1c9e0e69e9 100644 --- a/comphelper/source/container/interfacecontainer2.cxx +++ b/comphelper/source/container/interfacecontainer2.cxx @@ -172,6 +172,9 @@ void OInterfaceContainerHelper2::copyAndResetInUse() sal_Int32 OInterfaceContainerHelper2::addInterface( const Reference & rListener ) { OSL_ASSERT( rListener.is() ); +if ( !rListener.is() ) +return 0; + MutexGuard aGuard( rMutex ); if( bInUse ) copyAndResetInUse();
[Libreoffice-commits] core.git: editeng/source solenv/gbuild sw/Module_sw.mk sw/qa sw/UITest_writer_tests8.mk
editeng/source/misc/svxacorr.cxx | 11 ++- solenv/gbuild/UITest.mk |2 sw/Module_sw.mk |1 sw/UITest_writer_tests8.mk| 20 +++ sw/qa/uitest/writer_tests8/tdf156243.py | 39 ++ sw/qa/uitest/writer_tests8_data/registrymodifications.xcu | 12 6 files changed, 79 insertions(+), 6 deletions(-) New commits: commit b6e273aaaf597b60f78c1dd3db8676eea958a9f5 Author: Matt K AuthorDate: Thu Nov 23 21:47:34 2023 -0600 Commit: Mike Kaganski CommitDate: Sat Nov 25 12:41:49 2023 +0100 tdf#156243 Fix off-by-one bug for autocorrect This change removes the "-1" from the code that applies the autocorrection so that the entire string to be autocorrected is replaced, instead of leaving off the last character. Also, the starting character of the string is preserved (i.e. non-bold if changing to bold) by adding 1 to the start position; this is for the case when the user cancels the autocorrect dialog. Change-Id: Ibe500a1ba0ca5b12ec9c918b51353074b8dd12ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154685 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 094ee2130f67..4c4b6883f247 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -833,37 +833,38 @@ bool SvxAutoCorrect::FnChgWeightUnderl( SvxAutoCorrDoc& rDoc, const OUString& rT // of an empty hint in SetAttr which would be removed by Delete // (fdo#62536, AUTOFMT in Writer) rDoc.Delete( nEndPos, nEndPos + 1 ); -rDoc.Delete( nFndPos, nFndPos + 1 ); + // Span the Attribute over the area // the end. if( '*' == cInsChar ) // Bold { SvxWeightItem aSvxWeightItem( WEIGHT_BOLD, SID_ATTR_CHAR_WEIGHT ); -rDoc.SetAttr( nFndPos, nEndPos - 1, +rDoc.SetAttr( nFndPos + 1, nEndPos, SID_ATTR_CHAR_WEIGHT, aSvxWeightItem); } else if( '/' == cInsChar ) // Italic { SvxPostureItem aSvxPostureItem( ITALIC_NORMAL, SID_ATTR_CHAR_POSTURE ); -rDoc.SetAttr( nFndPos, nEndPos - 1, +rDoc.SetAttr( nFndPos + 1, nEndPos, SID_ATTR_CHAR_POSTURE, aSvxPostureItem); } else if( '-' == cInsChar ) // Strikeout { SvxCrossedOutItem aSvxCrossedOutItem( STRIKEOUT_SINGLE, SID_ATTR_CHAR_STRIKEOUT ); -rDoc.SetAttr( nFndPos, nEndPos - 1, +rDoc.SetAttr( nFndPos + 1, nEndPos, SID_ATTR_CHAR_STRIKEOUT, aSvxCrossedOutItem); } else// Underline { SvxUnderlineItem aSvxUnderlineItem( LINESTYLE_SINGLE, SID_ATTR_CHAR_UNDERLINE ); -rDoc.SetAttr( nFndPos, nEndPos - 1, +rDoc.SetAttr( nFndPos + 1, nEndPos, SID_ATTR_CHAR_UNDERLINE, aSvxUnderlineItem); } +rDoc.Delete( nFndPos, nFndPos + 1 ); } return -1 != nFndPos; diff --git a/solenv/gbuild/UITest.mk b/solenv/gbuild/UITest.mk index 5859b9e56de4..65bc37c1d1bf 100644 --- a/solenv/gbuild/UITest.mk +++ b/solenv/gbuild/UITest.mk @@ -64,7 +64,7 @@ else $(if $(gb_UITest__interactive),, \ rm -fr $@.core && mkdir -p $(dir $(call gb_UITest_get_target,$*))user/ && mkdir $@.core && cd $@.core && ) \ $(if $(gb_UITest_use_config), \ - cp $(gb_UITest_use_config) $(dir $(call gb_UITest_get_target,$*))user/. && ) \ + cp $(gb_UITest_use_config) $(dir $(call gb_UITest_get_target,$*))user/user && ) \ $(call gb_CppunitTest_coredumpctl_setup,$@) \ ($(gb_UITest_PRECOMMAND) \ $(if $(G_SLICE),G_SLICE=$(G_SLICE)) \ diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk index 9ef1c80c84f7..22cea818178a 100644 --- a/sw/Module_sw.mk +++ b/sw/Module_sw.mk @@ -212,6 +212,7 @@ $(eval $(call gb_Module_add_uicheck_targets,sw,\ UITest_writer_tests5 \ UITest_writer_tests6 \ UITest_writer_tests7 \ + UITest_writer_tests8 \ UITest_sw_table \ UITest_sw_chart \ UITest_sw_fieldDialog \ diff --git a/sw/UITest_writer_tests8.mk b/sw/UITest_writer_tests8.mk new file mode 100644 index ..a33fdedbe255 --- /dev/null +++ b/sw/UITest_writer_tests8.mk @@ -0,0 +1,20 @@ +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +#
[Libreoffice-commits] core.git: sw/inc sw/source
sw/inc/comcore.hxx |4 +++- sw/inc/utlui.hrc|4 +++- sw/source/core/edit/autofmt.cxx | 40 3 files changed, 46 insertions(+), 2 deletions(-) New commits: commit 2fa88bfbfa4c9befe1be8a1953c018437a621254 Author: Matt K AuthorDate: Fri Jul 7 17:18:28 2023 -0500 Commit: Mike Kaganski CommitDate: Tue Nov 21 06:52:29 2023 +0100 tdf#117651 Add AutoCorrect support for italic and strikethrough The AutoCorrect "Apply" command calls SwAutoFormat::AutoCorrect in sw/source/core/edit/autofmt.cxx, as mentioned in the bug comments. This change just adds new cases for "/" (italic) and "-" (strikethrough), so that when "Tools" -> "AutoCorrect" -> "Apply" is invoked it changes any text between 2 "/"s or 2 "-"s (assuming your AutoCorrect options enable the setting for this). The new code is just mostly copied from the case statement above it (for bold and underline), and the only additional changes that were needed were to add the comment strings for the 2 new cases. Change-Id: I02238690a40fd0113e3e9acbecf93ef5c34e0785 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154207 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sw/inc/comcore.hxx b/sw/inc/comcore.hxx index 96a53fc84b2d..9da3d19e2aa0 100644 --- a/sw/inc/comcore.hxx +++ b/sw/inc/comcore.hxx @@ -45,8 +45,10 @@ #define STR_AUTOFMTREDL_NON_BREAK_SPACE 21 #define STR_AUTOFMTREDL_TRANSLITERATE_RTL 22 #define STR_AUTOFMTREDL_DETECT_DOI 23 +#define STR_AUTOFMTREDL_ITALIC 24 +#define STR_AUTOFMTREDL_STRIKETHROUGH 25 // !! always set the correct end -#define STR_AUTOFMTREDL_END 24 +#define STR_AUTOFMTREDL_END 26 #endif diff --git a/sw/inc/utlui.hrc b/sw/inc/utlui.hrc index db13af5b517c..417123331e46 100644 --- a/sw/inc/utlui.hrc +++ b/sw/inc/utlui.hrc @@ -50,7 +50,9 @@ const TranslateId RID_SHELLRES_AUTOFMTSTRS[] = NC_("RID_SHELLRES_AUTOFMTSTRS", "Combine paragraphs"), NC_("RID_SHELLRES_AUTOFMTSTRS", "Add non breaking space"), NC_("RID_SHELLRES_AUTOFMTSTRS", "Transliterates RTL Hungarian text to Old Hungarian script"), -NC_("RID_SHELLRES_AUTOFMTSTRS", "DOI citation recognition") +NC_("RID_SHELLRES_AUTOFMTSTRS", "DOI citation recognition"), +NC_("RID_SHELLRES_AUTOFMTSTRS", "Automatic /italic/"), +NC_("RID_SHELLRES_AUTOFMTSTRS", "Automatic -strikethrough-"), }; #endif diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx index 555eec327a5d..65324e0eb296 100644 --- a/sw/source/core/edit/autofmt.cxx +++ b/sw/source/core/edit/autofmt.cxx @@ -282,6 +282,8 @@ void SwAutoFormat::SetRedlineText_( sal_uInt16 nActionId ) case STR_AUTOFMTREDL_ORDINAL: case STR_AUTOFMTREDL_NON_BREAK_SPACE: case STR_AUTOFMTREDL_TRANSLITERATE_RTL: +case STR_AUTOFMTREDL_ITALIC: +case STR_AUTOFMTREDL_STRIKETHROUGH: nSeqNo = ++m_nRedlAutoFormatSeqId; break; } @@ -2109,6 +2111,44 @@ void SwAutoFormat::AutoCorrect(TextFrameIndex nPos) SetRedlineText( STR_AUTOFMTREDL_NON_BREAK_SPACE ); if (pATst->FnAddNonBrkSpace(aACorrDoc, *pText, sal_Int32(nPos), eLang, bNbspRunNext)) --nPos; +break; +} +[[fallthrough]]; +case '-': +if (m_aFlags.bChgWeightUnderl) +{ +// consider Symbolfonts! +if (!aFInfo.GetFrame()) +aFInfo.SetFrame(GetFrame(*m_pCurTextNd)); +if (!aFInfo.IsBullet(nPos)) +{ +SetRedlineText('/' == cChar ? STR_AUTOFMTREDL_ITALIC : STR_AUTOFMTREDL_STRIKETHROUGH); + +sal_Unicode cBlank = nSttPos ? (*pText)[sal_Int32(nSttPos) - 1] : 0; +*m_aDelPam.GetPoint() = m_pCurTextFrame->MapViewToModelPos(nPos); + +if (pATst->FnChgWeightUnderl(aACorrDoc, *pText, sal_Int32(nPos))) +{ +if (m_aFlags.bWithRedlining) +{ +m_aNdIdx = m_aDelPam.GetPoint()->GetNode(); +m_pCurTextNd = m_aNdIdx.GetNode().GetTextNode(); +m_pCurTextFrame = GetFrame(*m_pCurTextNd); +pText = _pCurTextFrame->GetText(); +m_aDelPam.SetMark(); +m_aDelPam.DeleteMark(); +aFInfo.SetFrame(nullptr); +} +//#125102# in case of the mode RedlineFlags::ShowDelete the ** are still contained in pText +
[Libreoffice-commits] core.git: sw/source
sw/source/core/txtnode/ndtxt.cxx | 28 ++-- 1 file changed, 18 insertions(+), 10 deletions(-) New commits: commit 0c3b89da7cde9866bf3174a6276736c76efb8356 Author: Matt K AuthorDate: Thu Aug 3 00:06:24 2023 -0500 Commit: Mike Kaganski CommitDate: Fri Nov 10 19:05:13 2023 +0100 tdf#62603 Fix find/replace to not extend font attributes This change modifies the logic of the core replace code to now not replace the 1st character and extend its attributes, but instead to actually replace characters to keep respective formatting. Additional checks are made for whether the replacement was shorter or longer than the found text, and to handle trimming or appending the final portions as needed. Change-Id: I03a5645898e55ad386bacc2766af9b244a97bd21 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155274 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index af9b5f72fc92..541e3fd5049f 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -3849,19 +3849,27 @@ void SwTextNode::ReplaceText( const SwContentIndex& rStart, const sal_Int32 nDel bool bOldExpFlg = IsIgnoreDontExpand(); SetIgnoreDontExpand( true ); -if (nLen && sInserted.getLength()) +const sal_Int32 nInsLen = sInserted.getLength(); +if (nLen && nInsLen) { -// Replace the 1st char, then delete the rest and insert. -// This way the attributes of the 1st char are expanded! -m_Text = m_Text.replaceAt(nStartPos, 1, sInserted.subView(0, 1)); +m_Text = m_Text.replaceAt(nStartPos, nLen, sInserted); -++const_cast(rStart); -m_Text = m_Text.replaceAt(rStart.GetIndex(), nLen - 1, u""); -Update(rStart, nLen - 1, UpdateMode::Negative); +if (nLen > nInsLen) // short insert +{ +// delete up to the point that the user specified +const SwContentIndex aNegIdx(rStart, nInsLen); +Update(aNegIdx, nLen - nInsLen, UpdateMode::Negative); +} +else if (nLen < nInsLen) // long insert +{ +const SwContentIndex aIdx(rStart, nLen); +Update(aIdx, nInsLen - nLen, UpdateMode::Replace); +} -std::u16string_view aTmpText( sInserted.subView(1) ); -m_Text = m_Text.replaceAt(rStart.GetIndex(), 0, aTmpText); -Update(rStart, aTmpText.size(), UpdateMode::Replace); +for (sal_Int32 i = 0; i < nInsLen; i++) +{ +++const_cast(rStart); +} } else {
[Libreoffice-commits] core.git: sc/source
sc/source/ui/app/inputwin.cxx | 37 +++-- 1 file changed, 3 insertions(+), 34 deletions(-) New commits: commit b0496a314b1acee28e22c1029b696cbbc1983853 Author: Matt K AuthorDate: Thu Jul 13 18:12:16 2023 -0500 Commit: Mike Kaganski CommitDate: Fri Oct 13 15:30:38 2023 +0200 tdf#150262 Split Autosum button: refactor to deduplicate This change refactors the recent checkin that split the autosum button into a default clickable button. We just use the existing function "AutoSum" in place of the copied code. Change-Id: I9a0e6fce047165c927746f0f87df4de905d2f8ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155058 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 2bb29146da07..ed3fe521d94b 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -368,40 +368,9 @@ void ScInputWindow::Select() } else if (curItemId == SID_INPUT_SUM) { -ScTabViewShell* pViewSh = dynamic_cast(SfxViewShell::Current()); -if (pViewSh) -{ -bool bSubTotal = false; -bool bRangeFinder = false; -const OUString aFormula = pViewSh->DoAutoSum(bRangeFinder, bSubTotal, ocSum); -if (!aFormula.isEmpty()) -{ -SetFuncString(aFormula); -if (bRangeFinder && pScMod->IsEditMode()) -{ -ScInputHandler* pHdl = pScMod->GetInputHdl(pViewSh); -if (pHdl) -{ -pHdl->InitRangeFinder(aFormula); - -//! SetSelection at the InputHandler? -//! Set bSelIsRef? -const sal_Int32 nOpen = aFormula.indexOf('('); -const sal_Int32 nLen = aFormula.getLength(); -if (nOpen != -1 && nLen > nOpen) -{ -ESelection aSel(0, nOpen + (bSubTotal ? 3 : 1), 0, nLen - 1); -EditView* pTableView = pHdl->GetTableView(); -if (pTableView) -pTableView->SetSelection(aSel); -EditView* pTopView = pHdl->GetTopView(); -if (pTopView) -pTopView->SetSelection(aSel); -} -} -} -} -} +bool bRangeFinder = false; +bool bSubTotal = false; +AutoSum(bRangeFinder, bSubTotal, ocSum); } else if (curItemId == SID_INPUT_EQUAL) {
[Libreoffice-commits] core.git: desktop/inc desktop/source
desktop/inc/app.hxx|3 ++- desktop/inc/strings.hrc|1 + desktop/source/app/app.cxx |9 + 3 files changed, 12 insertions(+), 1 deletion(-) New commits: commit efae7b4a1f7248b01e8cd95577c09d772cfe5709 Author: Matt K AuthorDate: Tue Jul 25 19:32:11 2023 -0500 Commit: Stephan Bergmann CommitDate: Wed Aug 2 08:25:37 2023 +0200 tdf#129713 Output message when using "--cat" with other LO instances running This change modifies the code that determines whether a 2nd LibreOffice instance is running during the startup of the new soffice.bin process. In that section of code, we simply write a new error message to console and pop-up a message box via FatalError. The message tells the user that they should close other LibreOffice processes if they want to use the "--cat" or "--script-cat" command line options. Change-Id: I2c2a00c07d733e2f0ed6c0632f0f0d115188b116 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154909 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx index 3372e751dbf1..9d6ac9864a52 100644 --- a/desktop/inc/app.hxx +++ b/desktop/inc/app.hxx @@ -58,7 +58,8 @@ class Desktop final : public Application BE_LANGUAGE_MISSING, BE_USERINSTALL_NOTENOUGHDISKSPACE, BE_USERINSTALL_NOWRITEACCESS, -BE_OFFICECONFIG_BROKEN +BE_OFFICECONFIG_BROKEN, +BE_2NDOFFICE_WITHCAT, }; enum BootstrapStatus { diff --git a/desktop/inc/strings.hrc b/desktop/inc/strings.hrc index b18117bb5a0d..f4af7ad24602 100644 --- a/desktop/inc/strings.hrc +++ b/desktop/inc/strings.hrc @@ -163,6 +163,7 @@ #define STR_BOOTSTRAP_ERR_LANGUAGE_MISSING NC_("STR_BOOTSTRAP_ERR_LANGUAGE_MISSING", "The user interface language cannot be determined.") #define STR_BOOTSTRAP_ERR_USERINSTALL_FAILED NC_("STR_BOOTSTRAP_ERR_USERINSTALL_FAILED", "User installation could not be completed. ") #define STR_BOOTSTRAP_ERR_NO_CFG_SERVICE NC_("STR_BOOTSTRAP_ERR_NO_CFG_SERVICE", "The configuration service is not available.") +#define STR_BOOTSTRAP_ERR_2NDOFFICE_WITHCAT NC_("STR_BOOTSTRAP_ERR_2NDOFFICE_WITHCAT", "There is already another %PRODUCTNAME instance running. Please close all %PRODUCTNAME processes before running with the '--cat' or '--script-cat' option.") #define STR_ASK_START_SETUP_MANUALLY NC_("STR_ASK_START_SETUP_MANUALLY", "Start the setup application to repair the installation from the CD or the folder containing the installation packages.") #define STR_CONFIG_ERR_ACCESS_GENERAL NC_("STR_CONFIG_ERR_ACCESS_GENERAL", "A general error occurred while accessing your central configuration. ") #define STR_LO_MUST_BE_RESTARTED NC_("STR_LO_MUST_BE_RESTARTED", "%PRODUCTNAME must unfortunately be manually restarted once after installation or update." ) diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index e4058bfe8932..cb3beaf0ae26 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -523,6 +523,10 @@ void Desktop::Init() else if ( aStatus == RequestHandler::IPC_STATUS_2ND_OFFICE ) { // 2nd office startup should terminate after sending cmdlineargs through pipe +if (rCmdLineArgs.IsTextCat() || rCmdLineArgs.IsScriptCat()) +{ +HandleBootstrapErrors( BE_2NDOFFICE_WITHCAT, OUString() ); +} SetBootstrapStatus(BS_TERMINATE); } else if ( !rCmdLineArgs.GetUnknown().isEmpty() @@ -880,6 +884,11 @@ void Desktop::HandleBootstrapErrors( FatalError(MakeStartupErrorMessage(aDiagnosticMessage)); } +else if ( aBootstrapError == BE_2NDOFFICE_WITHCAT ) +{ +OUString aDiagnosticMessage = DpResId(STR_BOOTSTRAP_ERR_2NDOFFICE_WITHCAT); +FatalError(MakeStartupErrorMessage(aDiagnosticMessage)); +} }
[Libreoffice-commits] core.git: svx/qa svx/source
svx/qa/unit/customshapes.cxx| 48 ++ svx/qa/unit/data/FontworkSameLetterHeights.fodg | 402 svx/source/toolbars/fontworkbar.cxx | 15 3 files changed, 457 insertions(+), 8 deletions(-) New commits: commit 58a4459627a92958ef133868f72af10d8d56ccad Author: Matt K AuthorDate: Thu Jul 13 15:31:14 2023 -0500 Commit: Hossein CommitDate: Thu Jul 20 16:12:36 2023 +0200 tdf#150302 Fix FontworkSameLetterHeights button in Draw This change fixes the Font Work Bar SameLetterHeights button at the bottom of Draw when opening a file without a FontWorkSameLetterHeights property initialied in the XML of the file. The change now applies a default property value which allows the button to properly work and switch the boolean value of property which can then be saved in the XML of the file. Also added a unit test which checks for the correct property value after toggling the button 2 times. The command to run the new unit test is: make CppunitTest_svx_unit CPPUNIT_TEST_NAME=testTdf150302 Change-Id: Id55eaedb625139f0071cdca5f628a0766afab0fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154402 Tested-by: Jenkins Reviewed-by: Hossein diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx index 464a6b542e84..f285baa27e63 100644 --- a/svx/qa/unit/customshapes.cxx +++ b/svx/qa/unit/customshapes.cxx @@ -89,6 +89,54 @@ sal_uInt8 CustomshapesTest::countShapes() return xDrawPage->getCount(); } +CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf150302) +{ +loadFromURL(u"FontworkSameLetterHeights.fodg"); + +CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong number of shapes", static_cast(2), + countShapes()); + +bool bSameHeights = false; +uno::Reference xShape(getShape(0)); +SdrObjCustomShape* pSdrCustomShape( + static_cast(SdrObject::getSdrObjectFromXShape(xShape))); +const SdrCustomShapeGeometryItem& rGeometryItem( +pSdrCustomShape->GetMergedItem(SDRATTR_CUSTOMSHAPE_GEOMETRY)); +const css::uno::Any* pAny += rGeometryItem.GetPropertyValueByName("TextPath", "SameLetterHeights"); +if (pAny) +*pAny >>= bSameHeights; + +CPPUNIT_ASSERT_MESSAGE("Wrong initial value", !bSameHeights); + +// Mark Object +SfxViewShell* pViewShell = SfxViewShell::Current(); +SdrView* pSdrView = pViewShell->GetDrawView(); +pSdrView->MarkObj(pSdrCustomShape, pSdrView->GetSdrPageView()); + +dispatchCommand(mxComponent, ".uno:FontworkSameLetterHeights", {}); + +const SdrCustomShapeGeometryItem& rGeometryItem1 += pSdrCustomShape->GetMergedItem(SDRATTR_CUSTOMSHAPE_GEOMETRY); +pAny = rGeometryItem1.GetPropertyValueByName("TextPath", "SameLetterHeights"); +if (pAny) +*pAny >>= bSameHeights; + +CPPUNIT_ASSERT_MESSAGE("Wrong value after toggle", bSameHeights); + +pSdrView->MarkObj(pSdrCustomShape, pSdrView->GetSdrPageView()); + +dispatchCommand(mxComponent, ".uno:FontworkSameLetterHeights", {}); + +const SdrCustomShapeGeometryItem& rGeometryItem2 += pSdrCustomShape->GetMergedItem(SDRATTR_CUSTOMSHAPE_GEOMETRY); +pAny = rGeometryItem2.GetPropertyValueByName("TextPath", "SameLetterHeights"); +if (pAny) +*pAny >>= bSameHeights; + +CPPUNIT_ASSERT_MESSAGE("Wrong value after toggle 2", !bSameHeights); +} + CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf147409_GeomItemHash) { loadFromURL(u"tdf147409_GeomItemHash.odg"); diff --git a/svx/qa/unit/data/FontworkSameLetterHeights.fodg b/svx/qa/unit/data/FontworkSameLetterHeights.fodg new file mode 100755 index ..424b850c5ddb --- /dev/null +++ b/svx/qa/unit/data/FontworkSameLetterHeights.fodg @@ -0,0 +1,402 @@ + + +http://openoffice.org/2004/office; xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink; xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:rpt="http://openoffice.org/2005/report; xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:ooow="http://openoffice.org/200 4/writer" xmlns:oooc="http://openoffice.org/2004/calc; xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xforms="http://www.w3.org/2002/xforms; xmlns:tableooo="http://openoffice.org/2009/table;
[Libreoffice-commits] core.git: sc/source
sc/source/ui/app/inputwin.cxx | 39 ++- 1 file changed, 38 insertions(+), 1 deletion(-) New commits: commit b247630d8b5e81041e0ed515572dfede49ccdf46 Author: Matt K AuthorDate: Thu Jul 13 18:12:16 2023 -0500 Commit: Mike Kaganski CommitDate: Fri Jul 14 06:40:06 2023 +0200 tdf#150262 Split Autosum button and default to sum on click This change follows with comments in the bug report by changing the Button Type to dropdown and adding back the code to do the autosum on default click of the sigma button. Change-Id: Ibe7afa1c7b8346b6a6de5d1db8223dab17ee720a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154405 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 005b29e3b573..2c46b93db54d 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -197,7 +197,7 @@ ScInputWindow::ScInputWindow( vcl::Window* pParent, const SfxBindings* pBind ) : // sigma and equal buttons if (!bIsLOKMobilePhone) { -InsertItem (SID_INPUT_SUM, Image(StockImage::Yes, RID_BMP_INPUT_SUM), ToolBoxItemBits::DROPDOWNONLY, 3); +InsertItem (SID_INPUT_SUM, Image(StockImage::Yes, RID_BMP_INPUT_SUM), ToolBoxItemBits::DROPDOWN, 3); InsertItem (SID_INPUT_EQUAL,Image(StockImage::Yes, RID_BMP_INPUT_EQUAL), ToolBoxItemBits::NONE, 4); InsertItem (SID_INPUT_CANCEL, Image(StockImage::Yes, RID_BMP_INPUT_CANCEL), ToolBoxItemBits::NONE, 5); InsertItem (SID_INPUT_OK, Image(StockImage::Yes, RID_BMP_INPUT_OK), ToolBoxItemBits::NONE, 6); @@ -366,6 +366,43 @@ void ScInputWindow::Select() SetSumAssignMode(); mxTextWindow->Invalidate(); // Or else the Selection remains } +else if (curItemId == SID_INPUT_SUM) +{ +ScTabViewShell* pViewSh = dynamic_cast(SfxViewShell::Current()); +if (pViewSh) +{ +bool bSubTotal = false; +bool bRangeFinder = false; +const OUString aFormula = pViewSh->DoAutoSum(bRangeFinder, bSubTotal, ocSum); +if (!aFormula.isEmpty()) +{ +SetFuncString(aFormula); +if (bRangeFinder && pScMod->IsEditMode()) +{ +ScInputHandler* pHdl = pScMod->GetInputHdl(pViewSh); +if (pHdl) +{ +pHdl->InitRangeFinder(aFormula); + +//! SetSelection at the InputHandler? +//! Set bSelIsRef? +const sal_Int32 nOpen = aFormula.indexOf('('); +const sal_Int32 nLen = aFormula.getLength(); +if (nOpen != -1 && nLen > nOpen) +{ +ESelection aSel(0, nOpen + (bSubTotal ? 3 : 1), 0, nLen - 1); +EditView* pTableView = pHdl->GetTableView(); +if (pTableView) +pTableView->SetSelection(aSel); +EditView* pTopView = pHdl->GetTopView(); +if (pTopView) +pTopView->SetSelection(aSel); +} +} +} +} +} +} else if (curItemId == SID_INPUT_EQUAL) { StartFormula();
[Libreoffice-commits] core.git: sw/source
sw/source/uibase/inc/navipi.hxx |1 + sw/source/uibase/utlui/navipi.cxx | 33 +++-- 2 files changed, 32 insertions(+), 2 deletions(-) New commits: commit 7019eef453954785ad039bebd8c8a00183992584 Author: Matt K AuthorDate: Fri Jul 7 00:15:02 2023 -0500 Commit: Heiko Tietze CommitDate: Mon Jul 10 16:41:26 2023 +0200 tdf#146273 Do not allow non-numeric values for Navigator "Go to" This change modifies "SwNavigationPI::EditAction" and adds a new "connect_changed" handler "PageModifiedHdl" to the spin control (needed to intercept text handling). In both functions we perform checks to ensure that only numeric values can be entered and only values within the page range of the document. This now matches the behavior of the "Go to Page" feature. To go to the first page, just enter a character input. To go to the last page, just enter a value higher than the total number of pages. Change-Id: Ia020d72f4bed5b98b668ba95888bc4bc1d65e07d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154156 Tested-by: Jenkins Reviewed-by: Mike Kaganski Reviewed-by: Heiko Tietze diff --git a/sw/source/uibase/inc/navipi.hxx b/sw/source/uibase/inc/navipi.hxx index 5b9862101254..f87474ab7cba 100644 --- a/sw/source/uibase/inc/navipi.hxx +++ b/sw/source/uibase/inc/navipi.hxx @@ -113,6 +113,7 @@ class SwNavigationPI final : public PanelLayout DECL_LINK( EditActionHdl, weld::Entry&, bool ); DECL_LINK( SetFocusChildHdl, weld::Container&, void ); DECL_LINK( NavigateByComboBoxSelectHdl, weld::ComboBox&, void ); +DECL_LINK( PageModifiedHdl, weld::Entry&, void ); bool EditAction(); void UsePage(); diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx index 399e3824bf76..2506b5c83793 100644 --- a/sw/source/uibase/utlui/navipi.cxx +++ b/sw/source/uibase/utlui/navipi.cxx @@ -404,8 +404,17 @@ bool SwNavigationPI::EditAction() if (pView->GetEditWin().HasFocus()) return false; -SwWrtShell = m_pCreateView->GetWrtShell(); -sal_uInt16 nNewPage = m_xEdit->get_value(); +if (m_xEdit->get_text().isEmpty()) +return false; +sal_Int64 nNewPage = m_xEdit->get_text().toInt32(); +SwWrtShell& rSh = m_pCreateView->GetWrtShell(); +sal_Int64 max = rSh.GetPageCnt(); +if (nNewPage <= 0) +nNewPage = 1; +else if (nNewPage > max) +nNewPage = max; +m_xEdit->set_value(nNewPage); +m_xEdit->set_position(-1); rSh.GotoPage(nNewPage, true); m_pCreateView->GetViewFrame().GetBindings().Invalidate(FN_STAT_PAGE); @@ -500,6 +509,25 @@ std::unique_ptr SwNavigationPI::Create(weld::Widget* pParent, return std::make_unique(pParent, rxFrame, pBindings, nullptr); } +IMPL_LINK_NOARG(SwNavigationPI, PageModifiedHdl, weld::Entry&, void) +{ +SwView* pView = GetCreateView(); +if (!pView) +return; +if (m_xEdit->get_text().isEmpty()) +return; +sal_Int64 page_value = m_xEdit->get_text().toInt32(); +SwWrtShell& rSh = m_pCreateView->GetWrtShell(); +sal_Int64 max = rSh.GetPageCnt(); +if (page_value <= 0) +m_xEdit->set_value(1); +else if (page_value > max) +m_xEdit->set_value(max); +else +m_xEdit->set_value(page_value); +m_xEdit->set_position(-1); +} + SwNavigationPI::SwNavigationPI(weld::Widget* pParent, const css::uno::Reference& rxFrame, SfxBindings* _pBindings, SfxNavigator* pNavigatorDlg) @@ -590,6 +618,7 @@ SwNavigationPI::SwNavigationPI(weld::Widget* pParent, m_xEdit->set_width_chars(3); m_xEdit->connect_activate(LINK(this, SwNavigationPI, EditActionHdl)); m_xEdit->connect_value_changed(LINK(this, SwNavigationPI, PageEditModifyHdl)); +m_xEdit->connect_changed(LINK(this, SwNavigationPI, PageModifiedHdl)); m_xEdit->set_help_id("modules/swriter/ui/navigatorpanel/numericfield"); if (!IsGlobalDoc())
[Libreoffice-commits] core.git: sw/source
sw/source/core/doc/DocumentContentOperationsManager.cxx |7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) New commits: commit 6d30ef2d9418ff6d2bd89c20a61c757bc3abb9b2 Author: Matt K AuthorDate: Thu Jul 6 17:11:48 2023 -0500 Commit: Mike Kaganski CommitDate: Fri Jul 7 11:00:22 2023 +0200 tdf#69183 Pasting a table in Writer no longer inherits list formatting The entry point of the paste is in SwFEShell::Paste as stated in the bug comments. This code calls "rClpDoc.getIDocumentContentOperations().CopyRange" which calls "DocumentContentOperationsManager::CopyImplImpl". In that function, there is a check for whether to propagate the formatting of a previous list in the document. All we do is add a check there to see if additionally it is a table we are pasting, and if so to ignore propagating the list format. Change-Id: I655f54c4df44385fc82976b37d3e21b5fabf45ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154149 Tested-by: Mike Kaganski Reviewed-by: Mike Kaganski diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 1387ebfe65a9..0b51fc65e46e 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -4968,10 +4968,13 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo // Do not propagate previous found list, if // - destination is an empty paragraph which is not in a list and // - source contains at least one paragraph which is not in a list +// or +// - source is a table if ( pNumRuleToPropagate && - pDestTextNd && !pDestTextNd->GetText().getLength() && + ((pDestTextNd && !pDestTextNd->GetText().getLength() && !pDestTextNd->IsInList() && - !lcl_ContainsOnlyParagraphsInList( rPam ) ) + !lcl_ContainsOnlyParagraphsInList(rPam)) || + rPam.GetBound().nNode.GetNode().GetNodeType() == SwNodeType::Table) ) { pNumRuleToPropagate = nullptr; }
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/doc/docfile.cxx |2 +- sfx2/source/doc/objserv.cxx |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) New commits: commit 25a997c15d39fb30676a375df8ea4ce1ed2e1acd Author: Matt K AuthorDate: Mon Aug 15 21:22:37 2022 -0500 Commit: Thorsten Behrens CommitDate: Mon Aug 29 13:28:40 2022 +0200 tdf#53530 Only show 1 error dialog instead of 3 on export to PDF SfxObjectShell::ExecFile_Impl is called when exporting to PDF, and the 3rd error message pops up here, so we just add a check to see if we're about to show the general IO error during pdf export and skip showing the error message there. The first 2 error messages pop up from SfxMedium::TransactedTransferForFS_Impl, and so we just add a check to see if the first error message popped up in which case an abort error code is returned and we then skip popping up the 2nd error. Change-Id: Ifa85ca1e451b1f87c6ddd89a98d377ea04aeaa0f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138333 Tested-by: Jenkins Reviewed-by: Thorsten Behrens diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 645cbc81f3d2..29bb07b03e6e 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -2144,7 +2144,7 @@ void SfxMedium::TransactedTransferForFS_Impl( const INetURLObject& aSource, pImpl->pTempFile.reset(); } } -else if ( bTransactStarted ) +else if ( bTransactStarted && pImpl->m_eError != ERRCODE_ABORT ) { UseBackupToRestore_Impl( aOriginalContent, xDummyEnv ); } diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 37f131d08098..4434e3ca855b 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -1020,7 +1020,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest ) { if (comphelper::LibreOfficeKit::isActive()) sendErrorToLOK(lErr); -else +else if (!(lErr == ERRCODE_IO_GENERAL && bIsPDFExport)) { SfxErrorContext aEc(ERRCTX_SFX_SAVEASDOC,GetTitle()); ErrorHandler::HandleError(lErr, pDialogParent);
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/doc/objstor.cxx | 19 ++- 1 file changed, 18 insertions(+), 1 deletion(-) New commits: commit 07250a832787acdd432dccd458536de2987a58b2 Author: Matt K AuthorDate: Wed Jul 27 19:33:50 2022 -0500 Commit: Mike Kaganski CommitDate: Sat Jul 30 06:27:05 2022 +0200 tdf#117967 Fixes Save confirmation dialog for user cancel The "Confirm save" dialog is launched from SfxMedium::CheckFileDate via "xHandler->handle( xInteractionRequestImpl );" and if the user canceled it the error is saved in the SfxMedium via "SetError(ERRCODE_ABORT);". Then, control is returned to the calling function SfxObjectShell::SaveTo_Impl which currently doesn't handle the cancel error condition, so this change just adds a check to detect it and return instead of doing more "save" processing. This return then goes to the calling function SfxObjectShell::DoSave_Impl which also does some save processing after cancel, in particular it updates the timestamps of the current SfxMedium (which are checked in SfxMedium::CheckFileDate from above and determines whether the "Confirm save" dialog will be launched), so this change prevents the updates to the timestamps by exiting early (i.e. before "DoSaveCompleted();" is called) if the abort error condition is seen so as to avoid a timestamp comparison result of equality which would prevent the "Confirm save" dialog from showing on every subsequent save action from the user. Now the behavior is for the timestamp comparison to fail equality (as would be expected if the file changed underneath the user) so as to ensure the "Confirm save" dialog continues to show for every subsequent save action by the user. Change-Id: I9c4aefc163a06029c80a8a28cdf4a09dff0031a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137540 Reviewed-by: Mike Kaganski Tested-by: Jenkins diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 6e406d332f9a..c0872029ae5e 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -1229,7 +1229,15 @@ bool SfxObjectShell::SaveTo_Impl bStoreToSameLocation = true; if ( pMedium->DocNeedsFileDateCheck() ) +{ rMedium.CheckFileDate( pMedium->GetInitFileDate( false ) ); +if (rMedium.GetErrorCode() == ERRCODE_ABORT) +{ +// if user cancels the save, exit early to avoid resetting SfxMedium values that +// would cause an invalid subsequent filedate check +return false; +} +} // before we overwrite the original file, we will make a backup if there is a demand for that // if the backup is not created here it will be created internally and will be removed in case of successful saving @@ -2616,7 +2624,16 @@ bool SfxObjectShell::DoSave_Impl( const SfxItemSet* pArgs ) else { // transfer error code from medium to objectshell -SetError(pMediumTmp->GetError()); +ErrCode errCode = pMediumTmp->GetError(); +SetError(errCode); + +if (errCode == ERRCODE_ABORT) +{ +// avoid doing DoSaveCompleted() which updates the SfxMedium timestamp values +// and prevents subsequent filedate checks from being accurate +delete pMediumTmp; +return false; +} // reconnect to object storage DoSaveCompleted();
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - framework/source offapi/com offapi/UnoApi_offapi.mk sfx2/source uui/inc uui/Library_uui.mk uui/source
framework/source/interaction/quietinteraction.cxx| 15 - offapi/UnoApi_offapi.mk |1 offapi/com/sun/star/document/ReadOnlyOpenRequest.idl | 51 --- sfx2/source/doc/docfile.cxx | 44 uui/Library_uui.mk |1 uui/inc/strings.hrc |5 - uui/source/iahndl-locking.cxx| 50 -- uui/source/iahndl.cxx|3 - uui/source/iahndl.hxx|3 - uui/source/readonlyopen.cxx | 38 -- uui/source/readonlyopen.hxx | 35 - 11 files changed, 1 insertion(+), 245 deletions(-) New commits: commit 63cb67f9e7a1920b43510df8f222c88a56fdf82d Author: Matt K AuthorDate: Sun Nov 14 15:33:43 2021 -0600 Commit: Adolfo Jayme Barrientos CommitDate: Thu Nov 18 10:37:57 2021 +0100 tdf#143971 Removes pop-up dialog for read-only documents No longer does the user get a pop-up dialog when opening documents that are read-only, asking whether they want to be notified when the document becomes editable. The change removes some of the functionality introduced in commit 95eb088802562b75f8b299908160145c7e88d763 "tdf#47065 Add new file open UI options and implement a new thread". Change-Id: Ic25e8e293e7224fb5086249a9d4814914fa961d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125340 Tested-by: Mike Kaganski Reviewed-by: Mike Kaganski Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125398 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos diff --git a/framework/source/interaction/quietinteraction.cxx b/framework/source/interaction/quietinteraction.cxx index 3719e00dc3ec..b6f3495fff09 100644 --- a/framework/source/interaction/quietinteraction.cxx +++ b/framework/source/interaction/quietinteraction.cxx @@ -24,7 +24,6 @@ #include #include #include -#include #include #include @@ -78,7 +77,6 @@ void SAL_CALL QuietInteraction::handle( const css::uno::Reference< css::task::XI css::task::ErrorCodeRequest aErrorCodeRequest; css::document::LockedDocumentRequest aLockedDocumentRequest; css::document::FilterOptionsRequest aFilterOptionsRequest; -css::document::ReadOnlyOpenRequest aReadOnlyOpenRequest; if( aRequest >>= aErrorCodeRequest ) { @@ -111,19 +109,6 @@ void SAL_CALL QuietInteraction::handle( const css::uno::Reference< css::task::XI } } else -if (aRequest >>= aReadOnlyOpenRequest) -{ -// allow unit tests to run on read-only SRCDIR -if (xApprove.is()) -{ -xApprove->select(); -} -else if (xAbort.is()) -{ -xAbort->select(); -} -} -else if (xAbort.is()) xAbort->select(); } diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 01dd48280fea..2260be2bda38 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -2211,7 +2211,6 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/document,\ NoSuchFilterRequest \ OwnLockOnDocumentRequest \ PrinterIndependentLayout \ - ReadOnlyOpenRequest \ RedlineDisplayType \ ReloadEditableRequest \ UndoContextNotClosedException \ diff --git a/offapi/com/sun/star/document/ReadOnlyOpenRequest.idl b/offapi/com/sun/star/document/ReadOnlyOpenRequest.idl deleted file mode 100644 index 49a82b7016f9.. --- a/offapi/com/sun/star/document/ReadOnlyOpenRequest.idl +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef __com_sun_star_document_ReadOnlyOpenRequest_idl__ -#define __com_sun_star_document_ReadOnlyOpenRequest_idl__ - -#include - -module com -{ -module sun -{ -module star -{ -module document -{ -
[Libreoffice-commits] core.git: framework/source offapi/com offapi/type_reference offapi/UnoApi_offapi.mk sfx2/source uui/inc uui/Library_uui.mk uui/source
framework/source/interaction/quietinteraction.cxx| 15 - offapi/UnoApi_offapi.mk |1 offapi/com/sun/star/document/ReadOnlyOpenRequest.idl | 51 --- offapi/type_reference/offapi.idl |3 - sfx2/source/doc/docfile.cxx | 43 uui/Library_uui.mk |1 uui/inc/strings.hrc |5 - uui/source/iahndl-locking.cxx| 49 -- uui/source/iahndl.cxx|3 - uui/source/iahndl.hxx|3 - uui/source/readonlyopen.cxx | 38 -- uui/source/readonlyopen.hxx | 35 - 12 files changed, 1 insertion(+), 246 deletions(-) New commits: commit f9ab31366dbe466ef739015734bb5b6a1a0deca4 Author: Matt K AuthorDate: Sun Nov 14 15:33:43 2021 -0600 Commit: Mike Kaganski CommitDate: Wed Nov 17 10:51:00 2021 +0100 tdf#143971 Removes pop-up dialog for read-only documents No longer does the user get a pop-up dialog when opening documents that are read-only, asking whether they want to be notified when the document becomes editable. The change removes some of the functionality introduced in commit 95eb088802562b75f8b299908160145c7e88d763 "tdf#47065 Add new file open UI options and implement a new thread". Change-Id: Ic25e8e293e7224fb5086249a9d4814914fa961d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125340 Tested-by: Mike Kaganski Reviewed-by: Mike Kaganski diff --git a/framework/source/interaction/quietinteraction.cxx b/framework/source/interaction/quietinteraction.cxx index feeecf7c6568..e9dc218576e0 100644 --- a/framework/source/interaction/quietinteraction.cxx +++ b/framework/source/interaction/quietinteraction.cxx @@ -24,7 +24,6 @@ #include #include #include -#include #include #include @@ -77,7 +76,6 @@ void SAL_CALL QuietInteraction::handle( const css::uno::Reference< css::task::XI css::task::ErrorCodeRequest aErrorCodeRequest; css::document::LockedDocumentRequest aLockedDocumentRequest; css::document::FilterOptionsRequest aFilterOptionsRequest; -css::document::ReadOnlyOpenRequest aReadOnlyOpenRequest; if( aRequest >>= aErrorCodeRequest ) { @@ -110,19 +108,6 @@ void SAL_CALL QuietInteraction::handle( const css::uno::Reference< css::task::XI } } else -if (aRequest >>= aReadOnlyOpenRequest) -{ -// allow unit tests to run on read-only SRCDIR -if (xApprove.is()) -{ -xApprove->select(); -} -else if (xAbort.is()) -{ -xAbort->select(); -} -} -else if (xAbort.is()) xAbort->select(); } diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 6f1dc604a8e3..3eb002520e42 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -2214,7 +2214,6 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/document,\ NoSuchFilterRequest \ OwnLockOnDocumentRequest \ PrinterIndependentLayout \ - ReadOnlyOpenRequest \ RedlineDisplayType \ ReloadEditableRequest \ UndoContextNotClosedException \ diff --git a/offapi/com/sun/star/document/ReadOnlyOpenRequest.idl b/offapi/com/sun/star/document/ReadOnlyOpenRequest.idl deleted file mode 100644 index 49a82b7016f9.. --- a/offapi/com/sun/star/document/ReadOnlyOpenRequest.idl +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef __com_sun_star_document_ReadOnlyOpenRequest_idl__ -#define __com_sun_star_document_ReadOnlyOpenRequest_idl__ - -#include - -module com -{ -module sun -{ -module star -{ -module document -{ -/** Is used for interaction handle to query user decision regarding whether to open -a
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - cui/source cui/uiconfig sfx2/source
cui/source/dialogs/tipofthedaydlg.cxx | 31 +++ cui/source/factory/dlgfact.cxx| 14 -- cui/source/factory/dlgfact.hxx| 13 + cui/source/inc/tipofthedaydlg.hxx |5 + cui/uiconfig/ui/tipofthedaydialog.ui |4 ++-- sfx2/source/appl/appserv.cxx |2 +- 6 files changed, 64 insertions(+), 5 deletions(-) New commits: commit 9be322687ab09f61439da0c6d4934dbae08cbcc4 Author: Matt K AuthorDate: Sat Apr 3 01:24:30 2021 -0500 Commit: Andras Timar CommitDate: Thu Jun 17 09:28:01 2021 +0200 tdf#127533 Make Tip-of-the-Day dialog non-modal and allow multiple tips to open The Tip-of-the-Day dialog is made non-modal and stays on-top of the main window while allowing the user to interact with the rest of application. Change-Id: I51e1a3488ab74d8371b71a8585d1512ce051f637 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113782 Reviewed-by: Matt K Reviewed-by: Heiko Tietze Tested-by: Jenkins Signed-off-by: Michael Meeks Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117341 Tested-by: Jenkins CollaboraOffice Reviewed-by: Andras Timar diff --git a/cui/source/dialogs/tipofthedaydlg.cxx b/cui/source/dialogs/tipofthedaydlg.cxx index 2404052271e6..42f0a331fbfa 100644 --- a/cui/source/dialogs/tipofthedaydlg.cxx +++ b/cui/source/dialogs/tipofthedaydlg.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -38,12 +39,14 @@ #include #include #include +#include #include #include #include TipOfTheDayDialog::TipOfTheDayDialog(weld::Window* pParent) : GenericDialogController(pParent, "cui/ui/tipofthedaydialog.ui", "TipOfTheDayDialog") +, m_pParent(pParent) , m_pText(m_xBuilder->weld_label("lbText")) , m_pShowTip(m_xBuilder->weld_check_button("cbShowTip")) , m_pNext(m_xBuilder->weld_button("btnNext")) @@ -55,6 +58,17 @@ TipOfTheDayDialog::TipOfTheDayDialog(weld::Window* pParent) m_nCurrentTip = officecfg::Office::Common::Misc::LastTipOfTheDayID::get(); +if (pParent != nullptr) +{ +css::uno::Reference xWindow = pParent->GetXWindow(); +if (xWindow.is()) +{ +VclPtr xVclWin(VCLUnoHelper::GetWindow(xWindow)); +if (xVclWin != nullptr) +xVclWin->AddEventListener(LINK(this, TipOfTheDayDialog, Terminated)); +} +} + const auto t0 = std::chrono::system_clock::now().time_since_epoch(); m_nDay = std::chrono::duration_cast(t0).count() / 24; if (m_nDay > officecfg::Office::Common::Misc::LastTipOfTheDayShown::get()) @@ -63,6 +77,12 @@ TipOfTheDayDialog::TipOfTheDayDialog(weld::Window* pParent) UpdateTip(); } +IMPL_LINK(TipOfTheDayDialog, Terminated, VclWindowEvent&, rEvent, void) +{ +if (rEvent.GetId() == VclEventId::ObjectDying) +TipOfTheDayDialog::response(RET_OK); +} + TipOfTheDayDialog::~TipOfTheDayDialog() { std::shared_ptr xChanges( @@ -71,6 +91,17 @@ TipOfTheDayDialog::~TipOfTheDayDialog() officecfg::Office::Common::Misc::LastTipOfTheDayID::set(m_nCurrentTip, xChanges); officecfg::Office::Common::Misc::ShowTipOfTheDay::set(m_pShowTip->get_active(), xChanges); xChanges->commit(); + +if (m_pParent != nullptr) +{ +css::uno::Reference xWindow = m_pParent->GetXWindow(); +if (xWindow.is()) +{ +VclPtr xVclWin(VCLUnoHelper::GetWindow(xWindow)); +if (xVclWin != nullptr) +xVclWin->RemoveEventListener(LINK(this, TipOfTheDayDialog, Terminated)); +} +} } static bool file_exists(const OUString& fileName) diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index e731ae7fe3d9..7ee30c9b621a 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -106,6 +106,16 @@ short CuiAbstractController_Impl::Execute() return m_xDlg->run(); } +short CuiAbstractTipController_Impl::Execute() +{ +return m_xDlg->run(); +} + +bool CuiAbstractTipController_Impl::StartExecuteAsync(AsyncContext& rCtx) +{ +return weld::DialogController::runAsync(m_xDlg, rCtx.maEndDialogFn); +} + short CuiAbstractSingleTabController_Impl::Execute() { return m_xDlg->run(); @@ -1686,8 +1696,8 @@ AbstractDialogFactory_Impl::CreateAboutDialog(weld::Window* pParent) VclPtr AbstractDialogFactory_Impl::CreateTipOfTheDayDialog(weld::Window* pParent) { -return VclPtr::Create( -std::make_unique(pParent)); +return VclPtr::Create( +std::make_shared(pParent)); } VclPtr diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index 7d97167193b8..b39e29efe821 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -121,6 +121,19 @@ public: virtual short Execute() override; }; +class CuiAbstractTipController_Impl : public VclAbstractDialog +{ +
[Libreoffice-commits] core.git: compilerplugins/clang include/sfx2 offapi/com offapi/UnoApi_offapi.mk sfx2/source uui/inc uui/Library_uui.mk uui/source
compilerplugins/clang/badstatics.cxx |4 include/sfx2/docfile.hxx | 12 offapi/UnoApi_offapi.mk|2 offapi/com/sun/star/document/ReadOnlyOpenRequest.idl | 51 + offapi/com/sun/star/document/ReloadEditableRequest.idl | 50 + sfx2/source/doc/docfile.cxx| 517 - sfx2/source/view/viewfrm.cxx | 15 uui/Library_uui.mk |2 uui/inc/strings.hrc| 21 uui/source/alreadyopen.cxx |1 uui/source/iahndl-locking.cxx | 104 +++ uui/source/iahndl.cxx |6 uui/source/iahndl.hxx |6 uui/source/lockcorrupt.cxx |1 uui/source/lockfailed.cxx |1 uui/source/openlocked.cxx |1 uui/source/readonlyopen.cxx| 38 + uui/source/readonlyopen.hxx| 35 + uui/source/reloadeditable.cxx | 37 + uui/source/reloadeditable.hxx | 35 + 20 files changed, 919 insertions(+), 20 deletions(-) New commits: commit 95eb088802562b75f8b299908160145c7e88d763 Author: Matt K AuthorDate: Fri Feb 26 10:24:38 2021 -0600 Commit: Mike Kaganski CommitDate: Thu May 27 12:31:38 2021 +0200 tdf#47065 Add new file open UI options and implement a new thread Add new UI options when opening a locked or non-writeable document to allow the user to be notified when such a document becomes editable . If the user selects "Notify", then that document is added to a list of open documents to be checked by a thread every 60 seconds for read/write access and whether lock file is available/obtainable. If access is allowed for a document, then show UI dialog to the user asking to Reload that document. If Reload is selected by the user then that document is reloaded with read/write access. The checking thread is spawned only once no matter how many "Notify" documents there are. The thread is spawned if not already running when a new "Notify" document is opened, and it terminates when all "Notify" documents have been closed or the application terminates. Also update badstatics clang plugin to ignore new global variables introduced. Change-Id: I7555ce6f5df79c2c87216e0129ef3b2883c7d921 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111654 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/compilerplugins/clang/badstatics.cxx b/compilerplugins/clang/badstatics.cxx index bb6241eafa5e..0856d8faac39 100644 --- a/compilerplugins/clang/badstatics.cxx +++ b/compilerplugins/clang/badstatics.cxx @@ -218,6 +218,10 @@ public: // Windows-only extensions/source/scanner/scanwin.cxx, problematic // Twain::mpThread -> ShimListenerThread::mxTopWindow released via Twain::Reset // clearing mpThread +|| name == "g_newReadOnlyDocs" + // sfx2/source/doc/docfile.cxx, warning about map's key +|| name == "g_existingReadOnlyDocs" + // sfx2/source/doc/docfile.cxx, warning about map's key ) // these variables appear unproblematic { return true; diff --git a/include/sfx2/docfile.hxx b/include/sfx2/docfile.hxx index ad316dd2fca8..83bcb91c5812 100644 --- a/include/sfx2/docfile.hxx +++ b/include/sfx2/docfile.hxx @@ -30,6 +30,7 @@ #include #include #include +#include namespace com::sun::star::beans { struct PropertyValue; } namespace com::sun::star::embed { class XStorage; } @@ -53,6 +54,7 @@ class SfxMedium_Impl; class INetURLObject; class SfxFrame; class DateTime; +struct ImplSVEvent; namespace weld { @@ -93,6 +95,15 @@ public: virtual ~SfxMedium() override; +DECL_STATIC_LINK(SfxMedium, ShowReloadEditableDialog, void*, void); +bool CheckCanGetLockfile() const; +void SetOriginallyReadOnly(bool val); +void AddToCheckEditableWorkerList(); +void SetWorkerReloadEvent(ImplSVEvent* pEvent); +ImplSVEvent* GetWorkerReloadEvent() const; +std::shared_ptr GetCheckEditableMutex() const; +void CancelCheckEditableEntry(bool bRemoveEvent = true); + voidUseInteractionHandler( bool ); css::uno::Reference< css::task::XInteractionHandler > GetInteractionHandler( bool bGetAlways = false ); @@ -291,6 +302,7 @@ private: bool bIsLoading, bool bOwnLock, bool bHandleSysLocked); enum class MessageDlg { LockFileIgnore, LockFileCorrupt }; bool
[Libreoffice-commits] core.git: cui/source cui/uiconfig sfx2/source
cui/source/dialogs/tipofthedaydlg.cxx | 31 +++ cui/source/factory/dlgfact.cxx| 14 -- cui/source/factory/dlgfact.hxx| 13 + cui/source/inc/tipofthedaydlg.hxx |5 + cui/uiconfig/ui/tipofthedaydialog.ui |4 ++-- sfx2/source/appl/appserv.cxx |2 +- 6 files changed, 64 insertions(+), 5 deletions(-) New commits: commit 7f032b2f16fad56beea1df826eb59c6f85c71268 Author: Matt K AuthorDate: Sat Apr 3 01:24:30 2021 -0500 Commit: Heiko Tietze CommitDate: Tue May 18 09:02:22 2021 +0200 tdf#127533 Make Tip-of-the-Day dialog non-modal and allow multiple tips to open The Tip-of-the-Day dialog is made non-modal and stays on-top of the main window while allowing the user to interact with the rest of application. Change-Id: I51e1a3488ab74d8371b71a8585d1512ce051f637 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113782 Reviewed-by: Matt K Reviewed-by: Heiko Tietze Tested-by: Jenkins diff --git a/cui/source/dialogs/tipofthedaydlg.cxx b/cui/source/dialogs/tipofthedaydlg.cxx index 9d43fd21f4ba..8356f6f0e36f 100644 --- a/cui/source/dialogs/tipofthedaydlg.cxx +++ b/cui/source/dialogs/tipofthedaydlg.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -38,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -47,6 +49,7 @@ const Size ThumbSize(150, 150); TipOfTheDayDialog::TipOfTheDayDialog(weld::Window* pParent) : GenericDialogController(pParent, "cui/ui/tipofthedaydialog.ui", "TipOfTheDayDialog") +, m_pParent(pParent) , m_pText(m_xBuilder->weld_label("lbText")) , m_pShowTip(m_xBuilder->weld_check_button("cbShowTip")) , m_pNext(m_xBuilder->weld_button("btnNext")) @@ -58,6 +61,17 @@ TipOfTheDayDialog::TipOfTheDayDialog(weld::Window* pParent) m_nCurrentTip = officecfg::Office::Common::Misc::LastTipOfTheDayID::get(); m_pPreview->set_size_request(ThumbSize.Width(), ThumbSize.Height()); +if (pParent != nullptr) +{ +css::uno::Reference xWindow = pParent->GetXWindow(); +if (xWindow.is()) +{ +VclPtr xVclWin(VCLUnoHelper::GetWindow(xWindow)); +if (xVclWin != nullptr) +xVclWin->AddEventListener(LINK(this, TipOfTheDayDialog, Terminated)); +} +} + const auto t0 = std::chrono::system_clock::now().time_since_epoch(); m_nDay = std::chrono::duration_cast(t0).count() / 24; if (m_nDay > officecfg::Office::Common::Misc::LastTipOfTheDayShown::get()) @@ -66,6 +80,12 @@ TipOfTheDayDialog::TipOfTheDayDialog(weld::Window* pParent) UpdateTip(); } +IMPL_LINK(TipOfTheDayDialog, Terminated, VclWindowEvent&, rEvent, void) +{ +if (rEvent.GetId() == VclEventId::ObjectDying) +TipOfTheDayDialog::response(RET_OK); +} + TipOfTheDayDialog::~TipOfTheDayDialog() { std::shared_ptr xChanges( @@ -74,6 +94,17 @@ TipOfTheDayDialog::~TipOfTheDayDialog() officecfg::Office::Common::Misc::LastTipOfTheDayID::set(m_nCurrentTip, xChanges); officecfg::Office::Common::Misc::ShowTipOfTheDay::set(m_pShowTip->get_active(), xChanges); xChanges->commit(); + +if (m_pParent != nullptr) +{ +css::uno::Reference xWindow = m_pParent->GetXWindow(); +if (xWindow.is()) +{ +VclPtr xVclWin(VCLUnoHelper::GetWindow(xWindow)); +if (xVclWin != nullptr) +xVclWin->RemoveEventListener(LINK(this, TipOfTheDayDialog, Terminated)); +} +} } static bool file_exists(const OUString& fileName) diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index 6d0a44086d47..6d0e9e31f77f 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -106,6 +106,16 @@ short CuiAbstractController_Impl::Execute() return m_xDlg->run(); } +short CuiAbstractTipController_Impl::Execute() +{ +return m_xDlg->run(); +} + +bool CuiAbstractTipController_Impl::StartExecuteAsync(AsyncContext& rCtx) +{ +return weld::DialogController::runAsync(m_xDlg, rCtx.maEndDialogFn); +} + short CuiAbstractSingleTabController_Impl::Execute() { return m_xDlg->run(); @@ -1682,8 +1692,8 @@ AbstractDialogFactory_Impl::CreateAboutDialog(weld::Window* pParent) VclPtr AbstractDialogFactory_Impl::CreateTipOfTheDayDialog(weld::Window* pParent) { -return VclPtr::Create( -std::make_unique(pParent)); +return VclPtr::Create( +std::make_shared(pParent)); } VclPtr diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index 1abf42683c95..1678d3c6349b 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -121,6 +121,19 @@ public: virtual short Execute() override; }; +class CuiAbstractTipController_Impl : public VclAbstractDialog +{ +std::shared_ptr m_xDlg; + +public: +explicit
[Libreoffice-commits] core.git: fpicker/Library_fps.mk fpicker/source
fpicker/Library_fps.mk |1 fpicker/source/win32/VistaFilePicker.cxx | 212 + fpicker/source/win32/VistaFilePicker.hxx | 10 fpicker/source/win32/VistaFilePickerEventHandler.cxx | 36 -- fpicker/source/win32/VistaFilePickerImpl.cxx | 307 +++ fpicker/source/win32/VistaFilePickerImpl.hxx | 66 +--- fpicker/source/win32/asyncrequests.cxx | 227 -- fpicker/source/win32/asyncrequests.hxx | 211 - fpicker/source/win32/requests.hxx| 76 9 files changed, 334 insertions(+), 812 deletions(-) New commits: commit 1c1226709c6be39c5462f5e6e1262ca630b30b34 Author: Matt K AuthorDate: Wed Apr 21 17:34:16 2021 -0500 Commit: Mike Kaganski CommitDate: Thu Apr 22 22:20:55 2021 +0200 tdf#106282 Change Windows File Dialog to run on the main thread Windows crashes when an IFileDialog object is used on a non-main thread when cancelling a long search operation, when COM is initialized as single-threaded apartment for that thread. Trying to use a non-main thread with COM initialized to multi-threaded apartment hangs the dialog UI. The only solution that works is to run all File Dialogs on the main thread. This has a performance penalty on the application while a File Dialog is open or if multiple dialogs are searching and then cancelled, but it's better than crashing. Other applications like Firefox use only the main thread for File Dialogs, but have additional processes to avoid the performance penalty. Change-Id: Icf8a8179dbea19bd3d749a1c2fe8e67dbfc726c6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114482 Reviewed-by: Matt K Reviewed-by: Jan-Marek Glogowski Reviewed-by: Mike Kaganski Tested-by: Jenkins diff --git a/fpicker/Library_fps.mk b/fpicker/Library_fps.mk index e41a8a40a081..047e888e3954 100644 --- a/fpicker/Library_fps.mk +++ b/fpicker/Library_fps.mk @@ -54,7 +54,6 @@ $(eval $(call gb_Library_add_libs,fps,\ endif $(eval $(call gb_Library_add_exception_objects,fps,\ - fpicker/source/win32/asyncrequests \ fpicker/source/win32/FilterContainer \ fpicker/source/win32/VistaFilePicker \ fpicker/source/win32/VistaFilePickerEventHandler \ diff --git a/fpicker/source/win32/VistaFilePicker.cxx b/fpicker/source/win32/VistaFilePicker.cxx index e391bcf53c58..367f938dd3a6 100644 --- a/fpicker/source/win32/VistaFilePicker.cxx +++ b/fpicker/source/win32/VistaFilePicker.cxx @@ -19,8 +19,6 @@ #include -#include - #include "VistaFilePicker.hxx" #include "WinImplHelper.hxx" @@ -36,7 +34,6 @@ #include #include #include -#include #include #include @@ -48,9 +45,6 @@ namespace vista{ VistaFilePicker::VistaFilePicker(bool bFolderPicker) : TVistaFilePickerBase (m_aMutex ) -, m_rDialog (std::make_shared()) -, m_aAsyncExecute (m_rDialog) -, m_nFilePickerThreadId (0) , m_bInitialized(false) , m_bFolderPicker (bFolderPicker) { @@ -62,20 +56,20 @@ VistaFilePicker::~VistaFilePicker() void SAL_CALL VistaFilePicker::addFilePickerListener(const css::uno::Reference< css::ui::dialogs::XFilePickerListener >& xListener) { -RequestRef rRequest = std::make_shared(); -rRequest->setRequest (VistaFilePickerImpl::E_ADD_PICKER_LISTENER); -rRequest->setArgument(PROP_PICKER_LISTENER, xListener); +Request rRequest; +rRequest.setRequest (VistaFilePickerImpl::E_ADD_PICKER_LISTENER); +rRequest.setArgument(PROP_PICKER_LISTENER, xListener); -m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::NON_BLOCKED); +m_rDialog.doRequest(rRequest); } void SAL_CALL VistaFilePicker::removeFilePickerListener(const css::uno::Reference< css::ui::dialogs::XFilePickerListener >& xListener ) { -RequestRef rRequest = std::make_shared(); -rRequest->setRequest (VistaFilePickerImpl::E_REMOVE_PICKER_LISTENER); -rRequest->setArgument(PROP_PICKER_LISTENER, xListener); +Request rRequest; +rRequest.setRequest (VistaFilePickerImpl::E_REMOVE_PICKER_LISTENER); +rRequest.setArgument(PROP_PICKER_LISTENER, xListener); -m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::NON_BLOCKED); +m_rDialog.doRequest(rRequest); } void VistaFilePicker::disposing(const css::lang::EventObject& /*aEvent*/) @@ -86,95 +80,95 @@ void SAL_CALL VistaFilePicker::setMultiSelectionMode(sal_Bool bMode) { ensureInit(); -RequestRef rRequest = std::make_shared(); -rRequest->setRequest (VistaFilePickerImpl::E_SET_MULTISELECTION_MODE); -rRequest->setArgument(PROP_MULTISELECTION_MODE, bMode); +Request rRequest; +rRequest.setRequest (VistaFilePickerImpl::E_SET_MULTISELECTION_MODE); +
[Libreoffice-commits] core.git: cui/Library_cui.mk cui/source cui/uiconfig cui/UIConfig_cui.mk desktop/source include/vcl officecfg/registry solenv/sanitizers vcl/inc vcl/Library_vcl.mk vcl/win
cui/Library_cui.mk |5 cui/UIConfig_cui.mk|6 cui/source/dialogs/fileextcheckdlg.cxx | 55 +++ cui/source/factory/dlgfact.cxx | 11 cui/source/factory/dlgfact.hxx |6 cui/source/inc/fileextcheckdlg.hxx | 39 ++ cui/source/options/optgdlg.cxx | 43 +- cui/source/options/optgdlg.hxx |1 cui/uiconfig/ui/fileextcheckdialog.ui | 109 +++ cui/uiconfig/ui/optgeneralpage.ui | 15 desktop/source/app/app.cxx | 10 include/vcl/abstdlg.hxx|6 include/vcl/fileregistration.hxx | 21 + officecfg/registry/data/org/openoffice/Office/Common.xcu |3 officecfg/registry/schema/org/openoffice/Office/Common.xcs |7 solenv/sanitizers/ui/cui.suppr |1 vcl/Library_vcl.mk |1 vcl/inc/strings.hrc|3 vcl/win/app/fileregistration.cxx | 198 + 19 files changed, 514 insertions(+), 26 deletions(-) New commits: commit 6a6cd129f34220fadf5d134a2dc2c1e368acbc4f Author: Matt K AuthorDate: Thu Mar 25 00:40:33 2021 -0500 Commit: Mike Kaganski CommitDate: Thu Apr 1 06:30:36 2021 +0200 tdf#45735 New UI dialog at app startup to check default file formats On Windows only, and only on a non-admin installation, check on application startup whether the file formats ".ods", ".odt", and ".odp" are registered to be opened by LibreOffice by default. If any of the formats are not default, show a UI dialog informing the user which formats are not default and ask the user to set the defaults. If the user selects "OK" to set defaults then the Windows UI corresponding to the user's Windows version is opened for selecting defaults per program. There is also a checkbox on the dialog to select whether checking is performed on application startup. Also, in Tools -> Options -> General, add a UI checkbox for performing this check on application startup, and refactor the existing button "Windows Default apps" to use the same Windows UI Launch APIs. Change-Id: I5e7258d111ff7da8f68805e60405aec064ddcf7c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112370 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk index f2df06cc5f2c..d6fa68e0d194 100644 --- a/cui/Library_cui.mk +++ b/cui/Library_cui.mk @@ -85,7 +85,10 @@ ifeq ($(OS),WNT) $(eval $(call gb_Library_use_system_win32_libs,cui,\ advapi32 \ shlwapi \ -ole32 \ +)) + +$(eval $(call gb_Library_add_exception_objects,cui,\ +cui/source/dialogs/fileextcheckdlg \ )) endif diff --git a/cui/UIConfig_cui.mk b/cui/UIConfig_cui.mk index 153d6fe98fda..ff3c718b21d6 100644 --- a/cui/UIConfig_cui.mk +++ b/cui/UIConfig_cui.mk @@ -9,6 +9,12 @@ $(eval $(call gb_UIConfig_UIConfig,cui)) +ifeq ($(OS),WNT) +$(eval $(call gb_UIConfig_add_uifiles,cui,\ + cui/uiconfig/ui/fileextcheckdialog \ +)) +endif + $(eval $(call gb_UIConfig_add_uifiles,cui,\ cui/uiconfig/ui/aboutdialog \ cui/uiconfig/ui/aboutconfigdialog\ diff --git a/cui/source/dialogs/fileextcheckdlg.cxx b/cui/source/dialogs/fileextcheckdlg.cxx new file mode 100644 index ..732f8367436a --- /dev/null +++ b/cui/source/dialogs/fileextcheckdlg.cxx @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include + +#include +#include + +#include + +FileExtCheckDialog::FileExtCheckDialog(weld::Window* pParent, const OUString& sTitle, + const OUString& sMsg) +: GenericDialogController(pParent, "cui/ui/fileextcheckdialog.ui", "FileExtCheckDialog") +,