core.git: editeng/source
editeng/source/editeng/impedit4.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 73ba9a65834455cba992f1661222f881649af448 Author: Caolán McNamara AuthorDate: Fri Oct 4 12:51:32 2024 +0100 Commit: Caolán McNamara CommitDate: Sat Oct 5 22:27:08 2024 +0200 use ConvertStringToHTML for the URL too Change-Id: Iee10356c6311c4ac791dc59081ca2a208d3c0710 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174505 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index 0417e8f3f4ec..8ffb3faf47b8 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -1106,7 +1106,7 @@ OString ImpEditEngine::GetSimpleHtml() const OUString aRTFStr = EditDoc::GetParaAsString(pNode, nIndex, nIndex + rTextPortion.GetLen()); if (pURLField) -aOutput.append("GetURL().toUtf8() + "\">"); +aOutput.append("GetURL()) + "\">"); aOutput.append(HTMLOutFuncs::ConvertStringToHTML(aRTFStr));
core.git: editeng/source include/editeng sw/inc sw/source
editeng/source/editeng/editview.cxx |5 ++ editeng/source/editeng/impedit.hxx |1 editeng/source/editeng/impedit4.cxx | 55 +++ include/editeng/editview.hxx |1 sw/inc/AnnotationWin.hxx |2 + sw/source/uibase/docvw/AnnotationWin.cxx |5 ++ sw/source/uibase/docvw/PostItMgr.cxx |1 sw/source/uibase/uno/unotxdoc.cxx|1 8 files changed, 71 insertions(+) New commits: commit 5212833fa0ec1aa5cb9112c67a3715a9ddf57168 Author: Caolán McNamara AuthorDate: Wed Oct 2 14:20:55 2024 +0100 Commit: Caolán McNamara CommitDate: Sat Oct 5 20:55:15 2024 +0200 add a 'simple-html' export to editeng currently justs supports hyperlinks and nothing else over plain text. puts each paragraph in a separate div Change-Id: I645d28e0bb6ed13e930e1555753846d10ecf5dd9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174388 Reviewed-by: Miklos Vajna Tested-by: Jenkins CollaboraOffice Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174504 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index d76f0a1c69c0..590b2680834c 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -668,6 +668,11 @@ ErrCode EditView::Read( SvStream& rInput, EETextFormat eFormat, SvKeyValueIterat return rInput.GetError(); } +OString EditView::GetSimpleHtml() const +{ +return mpImpEditView->mpEditEngine->mpImpEditEngine->GetSimpleHtml(); +} + void EditView::Cut() { Reference aClipBoard(GetClipboard()); diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index d9d8f6ea8b4a..3387607c4c5b 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -1039,6 +1039,7 @@ public: EditPaM Read( SvStream& rInput, const OUString& rBaseURL, EETextFormat eFormat, const EditSelection& rSel, SvKeyValueIterator* pHTTPHeaderAttrs = nullptr); voidWrite( SvStream& rOutput, EETextFormat eFormat ); voidWrite(SvStream& rOutput, EETextFormat eFormat, const EditSelection& rSel); +OString GetSimpleHtml() const; std::unique_ptr CreateTextObject(sal_Int32 nPara, sal_Int32 nParas); std::unique_ptr CreateTextObject(); diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index 7df703d9e559..0417e8f3f4ec 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -58,6 +58,7 @@ #include #include "textconv.hxx" #include +#include #include #include #include @@ -1067,6 +1068,60 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, } } +// Currently not good enough to be used for a ::Write of EETextFormat::Html, it +// only supports hyperlinks over plain text +OString ImpEditEngine::GetSimpleHtml() const +{ +OStringBuffer aOutput; + +sal_Int32 nStartNode = 0; +sal_Int32 nEndNode = maEditDoc.Count()-1; + +// iterate over the paragraphs ... +for (sal_Int32 nNode = nStartNode; nNode <= nEndNode; nNode++) +{ +const ContentNode* pNode = maEditDoc.GetObject( nNode ); + +const ParaPortion* pParaPortion = FindParaPortion( pNode ); + +sal_Int32 nIndex = 0; +sal_Int32 nEndPortion = pParaPortion->GetTextPortions().Count() - 1; + +aOutput.append(""); +for (sal_Int32 n = 0; n <= nEndPortion; n++) +{ +const TextPortion& rTextPortion = pParaPortion->GetTextPortions()[n]; + +const SvxURLField* pURLField = nullptr; +if ( rTextPortion.GetKind() == PortionKind::FIELD ) +{ +const EditCharAttrib* pAttr = pNode->GetCharAttribs().FindFeature(nIndex); +const SvxFieldItem* pFieldItem = dynamic_cast(pAttr->GetItem()); +if( pFieldItem ) +{ +const SvxFieldData* pFieldData = pFieldItem->GetField(); +pURLField = dynamic_cast(pFieldData); +} +} + +OUString aRTFStr = EditDoc::GetParaAsString(pNode, nIndex, nIndex + rTextPortion.GetLen()); +if (pURLField) +aOutput.append("GetURL().toUtf8() + "\">"); + +aOutput.append(HTMLOutFuncs::ConvertStringToHTML(aRTFStr)); + +if (pURLField) +aOutput.append(""); + +nIndex = nIndex + rTextPortion.GetLen(); +} + +aOutput.append(""); +} + +return aOutput.makeStringAndClear(); +} + std::unique_ptr ImpEditEngine::GetEmptyTextObject() { EditSelection aEmptySel; diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx index a1cb4eb9603b..9672506dc9a4 100644 --- a/include/editeng/editview.hxx +++ b/include/editeng
core.git: editeng/source sw/source
editeng/source/editeng/eehtml.cxx| 30 -- editeng/source/editeng/eehtml.hxx|2 ++ sw/source/uibase/docvw/AnnotationWin.cxx |7 ++- 3 files changed, 36 insertions(+), 3 deletions(-) New commits: commit f61cc4f12249bf4905355cee35bfc44e88d9fc39 Author: Caolán McNamara AuthorDate: Wed Oct 2 14:18:45 2024 +0100 Commit: Caolán McNamara CommitDate: Fri Oct 4 15:28:47 2024 +0200 allow editeng html import to treat divs as inserting a newline optional, currently cowardly defaulted off, except for the specific use-case. Change-Id: I8a6176ee356fa4d2b665d5325d9b7aba2a6579f6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174472 Reviewed-by: Caolán McNamara Tested-by: Jenkins diff --git a/editeng/source/editeng/eehtml.cxx b/editeng/source/editeng/eehtml.cxx index 24fd670ad9ba..11cf8811bf9d 100644 --- a/editeng/source/editeng/eehtml.cxx +++ b/editeng/source/editeng/eehtml.cxx @@ -41,6 +41,7 @@ EditHTMLParser::EditHTMLParser( SvStream& rIn, OUString _aBaseURL, SvKeyValueIte mpEditEngine(nullptr), bInPara(false), bWasInPara(false), +mbBreakForDivs(false), bFieldsInserted(false), bInTitle(false), nInTable(0), @@ -57,7 +58,25 @@ EditHTMLParser::EditHTMLParser( SvStream& rIn, OUString _aBaseURL, SvKeyValueIte SetSwitchToUCS2( true ); if ( pHTTPHeaderAttrs ) +{ SetEncodingByHTTPHeader( pHTTPHeaderAttrs ); +SetBreakForDivs(*pHTTPHeaderAttrs); +} +} + +void EditHTMLParser::SetBreakForDivs(SvKeyValueIterator& rHTTPOptions) +{ +SvKeyValue aKV; +bool bCont = rHTTPOptions.GetFirst(aKV); +while (bCont) +{ +if (aKV.GetKey() == "newline-on-div") +{ +mbBreakForDivs = aKV.GetValue() == "true"; +break; +} +bCont = rHTTPOptions.GetNext(aKV); +} } EditHTMLParser::~EditHTMLParser() @@ -290,6 +309,15 @@ void EditHTMLParser::NextToken( HtmlTokenId nToken ) nInCell++; Newline(); break; + +case HtmlTokenId::DIVISION_ON: +case HtmlTokenId::DIVISION_OFF: +{ +if (mbBreakForDivs) +Newline(); +break; +} + case HtmlTokenId::BLOCKQUOTE_ON: case HtmlTokenId::BLOCKQUOTE_OFF: case HtmlTokenId::BLOCKQUOTE30_ON: @@ -356,8 +384,6 @@ void EditHTMLParser::NextToken( HtmlTokenId nToken ) // HTML 3.0 case HtmlTokenId::BANNER_ON: case HtmlTokenId::BANNER_OFF: -case HtmlTokenId::DIVISION_ON: -case HtmlTokenId::DIVISION_OFF: // case HtmlTokenId::LISTHEADER_ON://! special handling // case HtmlTokenId::LISTHEADER_OFF: case HtmlTokenId::NOTE_ON: diff --git a/editeng/source/editeng/eehtml.hxx b/editeng/source/editeng/eehtml.hxx index 9f8009c715c8..7b6591e2ccf4 100644 --- a/editeng/source/editeng/eehtml.hxx +++ b/editeng/source/editeng/eehtml.hxx @@ -45,6 +45,7 @@ private: boolbInPara:1; boolbWasInPara:1; // Remember bInPara before HeadingStart, because afterwards it will be gone. +boolmbBreakForDivs:1; // Create newlines on encountering divs boolbFieldsInserted:1; boolbInTitle:1; @@ -68,6 +69,7 @@ private: voidImpSetAttribs( const SfxItemSet& rItems ); voidImpSetStyleSheet( sal_uInt16 nHeadingLevel ); +voidSetBreakForDivs(SvKeyValueIterator& rHTTPOptions); protected: virtual voidNextToken( HtmlTokenId nToken ) override; diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx b/sw/source/uibase/docvw/AnnotationWin.cxx index 670425779212..1ad47437caa7 100644 --- a/sw/source/uibase/docvw/AnnotationWin.cxx +++ b/sw/source/uibase/docvw/AnnotationWin.cxx @@ -32,6 +32,7 @@ #include #include +#include #include #include #include @@ -490,7 +491,11 @@ void SwAnnotationWin::UpdateHTML(const OUString& rHtml) OString sHtmlContent(rHtml.toUtf8()); SvMemoryStream aHTMLStream(const_cast(sHtmlContent.getStr()), sHtmlContent.getLength(), StreamMode::READ); -GetOutlinerView()->Read(aHTMLStream, EETextFormat::Html, nullptr); +SvKeyValueIteratorRef xValues(new SvKeyValueIterator); +// Insert newlines for divs, not normally done, so to keep things simple +// only enable tthat for this case. +xValues->Append(SvKeyValue("newline-on-div", "true")); +GetOutlinerView()->Read(aHTMLStream, EETextFormat::Html, xValues.get()); UpdateData(); }
core.git: editeng/source
editeng/source/editeng/eehtml.cxx | 28 editeng/source/editeng/eehtml.hxx |1 + 2 files changed, 17 insertions(+), 12 deletions(-) New commits: commit 5739280623bcc111a0d8b808ca4cc5e6598f9cce Author: Caolán McNamara AuthorDate: Wed Oct 2 13:25:09 2024 +0100 Commit: Caolán McNamara CommitDate: Fri Oct 4 13:01:10 2024 +0200 Split out this html parsing hunk as a separate NewLine method Change-Id: I1fb034af2419306f96152ce6802d193d7a1560af Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174441 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/editeng/source/editeng/eehtml.cxx b/editeng/source/editeng/eehtml.cxx index 1b73960d129f..24fd670ad9ba 100644 --- a/editeng/source/editeng/eehtml.cxx +++ b/editeng/source/editeng/eehtml.cxx @@ -95,6 +95,14 @@ SvParserState EditHTMLParser::CallParser(EditEngine* pEE, const EditPaM& rPaM) return _eState; } +void EditHTMLParser::Newline() +{ +bool bHasText = HasTextInCurrentPara(); +if ( bHasText ) +ImpInsertParaBreak(); +StartPara( false ); +} + void EditHTMLParser::NextToken( HtmlTokenId nToken ) { switch( nToken ) @@ -280,7 +288,8 @@ void EditHTMLParser::NextToken( HtmlTokenId nToken ) case HtmlTokenId::TABLEHEADER_ON: case HtmlTokenId::TABLEDATA_ON: nInCell++; -[[fallthrough]]; +Newline(); +break; case HtmlTokenId::BLOCKQUOTE_ON: case HtmlTokenId::BLOCKQUOTE_OFF: case HtmlTokenId::BLOCKQUOTE30_ON: @@ -291,28 +300,23 @@ void EditHTMLParser::NextToken( HtmlTokenId nToken ) case HtmlTokenId::DT_ON: case HtmlTokenId::ORDERLIST_ON: case HtmlTokenId::UNORDERLIST_ON: -{ -bool bHasText = HasTextInCurrentPara(); -if ( bHasText ) -ImpInsertParaBreak(); -StartPara( false ); -} +Newline(); break; case HtmlTokenId::TABLEHEADER_OFF: case HtmlTokenId::TABLEDATA_OFF: -{ if ( nInCell ) nInCell--; -[[fallthrough]]; -} +EndPara(); +break; case HtmlTokenId::LISTHEADER_OFF: case HtmlTokenId::LI_OFF: case HtmlTokenId::DD_OFF: case HtmlTokenId::DT_OFF: case HtmlTokenId::ORDERLIST_OFF: -case HtmlTokenId::UNORDERLIST_OFF: EndPara(); -break; +case HtmlTokenId::UNORDERLIST_OFF: +EndPara(); +break; case HtmlTokenId::TABLEROW_ON: case HtmlTokenId::TABLEROW_OFF: // A RETURN only after a CELL, for Calc diff --git a/editeng/source/editeng/eehtml.hxx b/editeng/source/editeng/eehtml.hxx index fddd567ac6ba..9f8009c715c8 100644 --- a/editeng/source/editeng/eehtml.hxx +++ b/editeng/source/editeng/eehtml.hxx @@ -53,6 +53,7 @@ private: sal_uInt8 nDefListLevel; voidStartPara( bool bReal ); +voidNewline(); voidEndPara(); voidAnchorStart(); voidAnchorEnd();
core.git: editeng/source i18nutil/qa i18nutil/source include/i18nutil include/vcl sw/source vcl/qa vcl/source
editeng/source/editeng/impedit3.cxx | 14 +- i18nutil/qa/cppunit/test_kashida.cxx | 38 + i18nutil/source/utility/kashida.cxx | 62 +--- include/i18nutil/kashida.hxx |4 include/vcl/outdev.hxx |3 sw/source/core/inc/scriptinfo.hxx|8 + sw/source/core/text/itradj.cxx | 70 -- sw/source/core/text/porlay.cxx | 21 +++ vcl/qa/cppunit/pdfexport/data/tdf163105-editeng.fodt | 131 +++ vcl/qa/cppunit/pdfexport/data/tdf163105-writer.fodt | 114 vcl/qa/cppunit/pdfexport/pdfexport2.cxx | 95 + vcl/source/outdev/font.cxx | 29 12 files changed, 553 insertions(+), 36 deletions(-) New commits: commit d8f430e4bef414616fd80bbf4ea16d767991b5b9 Author: Jonathan Clark AuthorDate: Wed Sep 25 16:07:06 2024 -0600 Commit: Jonathan Clark CommitDate: Thu Sep 26 22:44:03 2024 +0200 tdf#163105 Use HB data while selecting kashida insertion positions Previously, Writer and Edit Engine would skip inserting kashida in words if the highest-priority candidate position is marked as invalid by HarfBuzz. This would happen even if the word contained multiple lower-ranked valid candidate positions. This change updates Writer and Edit Engine to pass HarfBuzz kashida position data to the selection algorithm. The algorithm has been updated to return the highest-priority valid position, if any. The algorithm has also been updated to use raw positions marked as valid by HarfBuzz as a fallback, if no better positions could be found. Change-Id: I40c6432c4607aee197e8767e5667db504469956a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173963 Tested-by: Jenkins Reviewed-by: Jonathan Clark diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index b961393bb24b..5993ab9a3ca0 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -60,6 +60,7 @@ #include #include +#include #include #include @@ -2344,10 +2345,17 @@ void ImpEditEngine::ImpAdjustBlocks(ParaPortion& rParaPortion, EditLine& rLine, void ImpEditEngine::ImpFindKashidas(ContentNode* pNode, sal_Int32 nStart, sal_Int32 nEnd, std::vector& rArray, sal_Int32 nRemainingSpace) { +auto nOldLayout = GetRefDevice()->GetLayoutMode(); +comphelper::ScopeGuard stGuard{ [this, nOldLayout] +{ GetRefDevice()->SetLayoutMode(nOldLayout); } }; + +GetRefDevice()->SetLayoutMode(nOldLayout | vcl::text::ComplexTextLayoutFlags::BiDiRtl); + // Kashida glyph looks suspicious, skip Kashida justification if (GetRefDevice()->GetMinKashida() <= 0) return; +std::vector aValidPositions; std::vector aKashidaArray; std::vector aMinKashidaArray; sal_Int32 nTotalMinKashida = 0U; @@ -2367,11 +2375,12 @@ void ImpEditEngine::ImpFindKashidas(ContentNode* pNode, sal_Int32 nStart, sal_In aWordSel.Max().SetIndex( nEnd ); OUString aWord = GetSelected( aWordSel ); +GetRefDevice()->GetWordKashidaPositions(aWord, &aValidPositions); // restore selection for proper iteration at the end of the function aWordSel.Max().SetIndex( nSavPos ); -auto stKashidaPos = i18nutil::GetWordKashidaPosition(aWord); +auto stKashidaPos = i18nutil::GetWordKashidaPosition(aWord, aValidPositions); if (stKashidaPos.has_value()) { @@ -2406,12 +2415,9 @@ void ImpEditEngine::ImpFindKashidas(ContentNode* pNode, sal_Int32 nStart, sal_In // Validate std::vector aDropped; -auto nOldLayout = GetRefDevice()->GetLayoutMode(); -GetRefDevice()->SetLayoutMode(nOldLayout | vcl::text::ComplexTextLayoutFlags::BiDiRtl); GetRefDevice()->ValidateKashidas(pNode->GetString(), nStart, nEnd - nStart, /*nPartIdx=*/nStart, /*nPartLen=*/nEnd - nStart, aKashidaArray, &aDropped); -GetRefDevice()->SetLayoutMode(nOldLayout); for (auto const& pos : aKashidaArray) if (std::find(aDropped.begin(), aDropped.end(), pos) == aDropped.end()) diff --git a/i18nutil/qa/cppunit/test_kashida.cxx b/i18nutil/qa/cppunit/test_kashida.cxx index 1ab2729cb06a..46b40c2a5b7a 100644 --- a/i18nutil/qa/cppunit/test_kashida.cxx +++ b/i18nutil/qa/cppunit/test_kashida.cxx @@ -22,13 +22,17 @@ class KashidaTest : public CppUnit::TestFixture { public: void testCharacteristic(); +void testManualKashida(); void testFinalYeh(); void testNoZwnjExpansion(); +void testExcludeInvalid(); CPPUNIT_TEST_SUITE(KashidaTest); CPPUNIT_TEST(testCharacteristic); +CPPUNIT_TEST(testManualKashida);
core.git: editeng/source i18nutil/CppunitTest_i18nutil_kashida.mk i18nutil/Library_i18nutil.mk i18nutil/Module_i18nutil.mk i18nutil/qa i18nutil/source include/i18nutil sw/source
editeng/source/editeng/impedit3.cxx | 239 - i18nutil/CppunitTest_i18nutil_kashida.mk | 24 ++ i18nutil/Library_i18nutil.mk |1 i18nutil/Module_i18nutil.mk |4 i18nutil/qa/cppunit/test_kashida.cxx | 58 ++ i18nutil/source/utility/kashida.cxx | 286 +++ include/i18nutil/kashida.hxx | 24 ++ sw/source/core/text/porlay.cxx | 269 - 8 files changed, 409 insertions(+), 496 deletions(-) New commits: commit fe4687ed174c54f2eb25f8088bf3fb6cb4858175 Author: Jonathan Clark AuthorDate: Mon Sep 23 15:26:45 2024 -0600 Commit: Jonathan Clark CommitDate: Wed Sep 25 01:25:07 2024 +0200 tdf#163105 Consolidated duplicated kashida justification code The kashida candidate position selection logic was copied-and-pasted from Writer into Edit Engine. This change consolidates the shared code into a library. This change also adds some minimal characteristic tests, which previously did not exist. Change-Id: I2bfbfa79858347803474b754566436f3e74d1a54 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173883 Reviewed-by: Jonathan Clark Tested-by: Jenkins diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 6f7d1e7ac928..b961393bb24b 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -68,6 +68,7 @@ #include #include #include +#include #include #include @@ -232,93 +233,6 @@ static void lcl_DrawRedLines( OutputDevice& rOutDev, } } -// For Kashidas from sw/source/core/text/porlay.cxx - -#define IS_JOINING_GROUP(c, g) ( u_getIntPropertyValue( (c), UCHAR_JOINING_GROUP ) == U_JG_##g ) -#define isAinChar(c)IS_JOINING_GROUP((c), AIN) -#define isAlefChar(c) IS_JOINING_GROUP((c), ALEF) -#define isDalChar(c)IS_JOINING_GROUP((c), DAL) -#define isFehChar(c) (IS_JOINING_GROUP((c), FEH) || IS_JOINING_GROUP((c), AFRICAN_FEH)) -#define isGafChar(c)IS_JOINING_GROUP((c), GAF) -#define isHehChar(c)IS_JOINING_GROUP((c), HEH) -#define isKafChar(c)IS_JOINING_GROUP((c), KAF) -#define isLamChar(c)IS_JOINING_GROUP((c), LAM) -#define isQafChar(c) (IS_JOINING_GROUP((c), QAF) || IS_JOINING_GROUP((c), AFRICAN_QAF)) -#define isRehChar(c)IS_JOINING_GROUP((c), REH) -#define isTahChar(c)IS_JOINING_GROUP((c), TAH) -#define isTehMarbutaChar(c) IS_JOINING_GROUP((c), TEH_MARBUTA) -#define isWawChar(c)IS_JOINING_GROUP((c), WAW) -#define isSeenOrSadChar(c) (IS_JOINING_GROUP((c), SAD) || IS_JOINING_GROUP((c), SEEN)) - -// Beh and characters that behave like Beh in medial form. -static bool isBehChar(sal_Unicode cCh) -{ -bool bRet = false; -switch (u_getIntPropertyValue(cCh, UCHAR_JOINING_GROUP)) -{ -case U_JG_BEH: -case U_JG_NOON: -case U_JG_AFRICAN_NOON: -case U_JG_NYA: -case U_JG_YEH: -case U_JG_FARSI_YEH: -case U_JG_BURUSHASKI_YEH_BARREE: -bRet = true; -break; -default: -bRet = false; -break; -} - -return bRet; -} - -// Yeh and characters that behave like Yeh in final form. -static bool isYehChar(sal_Unicode cCh) -{ -bool bRet = false; -switch (u_getIntPropertyValue(cCh, UCHAR_JOINING_GROUP)) -{ -case U_JG_YEH: -case U_JG_FARSI_YEH: -case U_JG_YEH_BARREE: -case U_JG_BURUSHASKI_YEH_BARREE: -case U_JG_YEH_WITH_TAIL: -bRet = true; -break; -default: -bRet = false; -break; -} - -return bRet; -} - -static bool isTransparentChar ( sal_Unicode cCh ) -{ -return u_getIntPropertyValue( cCh, UCHAR_JOINING_TYPE ) == U_JT_TRANSPARENT; -} - -static bool lcl_IsLigature( sal_Unicode cCh, sal_Unicode cNextCh ) -{ -// Lam + Alef -return ( isLamChar ( cCh ) && isAlefChar ( cNextCh )); -} - -static bool lcl_ConnectToPrev( sal_Unicode cCh, sal_Unicode cPrevCh ) -{ -const int32_t nJoiningType = u_getIntPropertyValue( cPrevCh, UCHAR_JOINING_TYPE ); -bool bRet = nJoiningType != U_JT_RIGHT_JOINING && nJoiningType != U_JT_NON_JOINING; - -// check for ligatures cPrevChar + cChar -if ( bRet ) -bRet = ! lcl_IsLigature( cPrevCh, cCh ); - -return bRet; -} - - - void ImpEditEngine::UpdateViews( EditView* pCurView ) { if ( !IsUpdateLayout() || IsFormatting() || maInvalidRect.IsEmpty() ) @@ -2317,9 +2231,6 @@ void ImpEditEngine::ImpAdjustBlocks(ParaPortion& rParaPortion, EditLine& rLine, { EditPaM aPaM( pNode, nChar+1 ); sal_uInt16 nScript = GetI18NScriptType(aPaM); -// Arabic script is handled above, but if no Kashida positions are found, use blanks. -if (nKashidas) -continue; if ( pNode->GetChar(nChar) == ' ' ) { @@ -2460,154 +2371,12 @@ void ImpEditEngine::ImpFindKashidas(ContentNode* pNode, sal_Int
core.git: editeng/source include/oox include/sax oox/qa oox/source sax/qa sax/source sw/source unoxml/qa xmloff/inc xmloff/qa xmloff/source
editeng/source/misc/SvXMLAutoCorrectTokenHandler.cxx |8 - editeng/source/misc/SvXMLAutoCorrectTokenHandler.hxx |2 include/oox/core/fasttokenhandler.hxx| 10 - include/oox/helper/attributelist.hxx | 15 +- include/oox/token/tokenmap.hxx | 75 ++-- include/sax/fastattribs.hxx |3 oox/qa/token/tokenmap-test.cxx | 12 -- oox/source/core/fasttokenhandler.cxx | 20 +-- oox/source/crypto/AgileEngine.cxx|2 oox/source/drawingml/customshapeproperties.cxx |2 oox/source/drawingml/table/tablecell.cxx |2 oox/source/helper/attributelist.cxx | 110 --- oox/source/mathml/importutils.cxx|2 oox/source/token/tokenmap.cxx| 86 -- sax/qa/cppunit/parser.cxx|2 sax/qa/cppunit/xmlimport.cxx |9 - sax/source/tools/fastattribs.cxx | 16 +- sw/source/core/inc/SwXMLBlockImport.hxx |4 sw/source/core/swg/SwXMLBlockImport.cxx | 16 +- sw/source/writerfilter/ooxml/OOXMLStreamImpl.cxx |2 unoxml/qa/unit/domtest.cxx |2 xmloff/inc/fasttokenhandler.hxx | 59 +- xmloff/qa/unit/tokenmap-test.cxx | 18 --- xmloff/source/core/fasttokenhandler.cxx | 81 ++--- xmloff/source/core/xmlimp.cxx|6 - 25 files changed, 223 insertions(+), 341 deletions(-) New commits: commit 3a37d8320c0b8a7bced8e67f7ed2581d4013e38b Author: Mike Kaganski AuthorDate: Thu Sep 12 14:34:26 2024 +0500 Commit: Mike Kaganski CommitDate: Thu Sep 12 23:09:23 2024 +0200 Optimize TokenMap and AttributeList in oox and xo Shaves lots of string allocations, and uses optimized code paths Change-Id: I8e33e2aecdc7e0d2f2c31b774daa36304b3973ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173179 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/editeng/source/misc/SvXMLAutoCorrectTokenHandler.cxx b/editeng/source/misc/SvXMLAutoCorrectTokenHandler.cxx index 4bdadcdcde61..ae1744615073 100644 --- a/editeng/source/misc/SvXMLAutoCorrectTokenHandler.cxx +++ b/editeng/source/misc/SvXMLAutoCorrectTokenHandler.cxx @@ -35,7 +35,7 @@ SvXMLAutoCorrectTokenHandler::~SvXMLAutoCorrectTokenHandler() sal_Int32 SAL_CALL SvXMLAutoCorrectTokenHandler::getTokenFromUTF8( const Sequence< sal_Int8 >& Identifier ) { -return getTokenDirect( reinterpret_cast< const char* >( Identifier.getConstArray() ), Identifier.getLength() ); +return getTokenDirect( std::string_view(reinterpret_cast< const char* >( Identifier.getConstArray() ), Identifier.getLength()) ); } Sequence< sal_Int8 > SAL_CALL SvXMLAutoCorrectTokenHandler::getUTF8Identifier( sal_Int32 ) @@ -43,11 +43,9 @@ Sequence< sal_Int8 > SAL_CALL SvXMLAutoCorrectTokenHandler::getUTF8Identifier( s return Sequence< sal_Int8 >(); } -sal_Int32 SvXMLAutoCorrectTokenHandler::getTokenDirect( const char *pTag, sal_Int32 nLength ) const +sal_Int32 SvXMLAutoCorrectTokenHandler::getTokenDirect(std::string_view token) const { -if( !nLength ) -nLength = strlen( pTag ); -const struct xmltoken* pToken = Perfect_Hash::in_word_set( pTag, nLength ); +const struct xmltoken* pToken = Perfect_Hash::in_word_set(token.data(), token.size()); return pToken ? pToken->nToken : XML_TOKEN_INVALID; } diff --git a/editeng/source/misc/SvXMLAutoCorrectTokenHandler.hxx b/editeng/source/misc/SvXMLAutoCorrectTokenHandler.hxx index df913dbe6b01..0c86077fd4b5 100644 --- a/editeng/source/misc/SvXMLAutoCorrectTokenHandler.hxx +++ b/editeng/source/misc/SvXMLAutoCorrectTokenHandler.hxx @@ -39,7 +39,7 @@ public: virtual css::uno::Sequence< sal_Int8 > SAL_CALL getUTF8Identifier( sal_Int32 Token ) override; // Much faster direct C++ shortcut to the method that matters -virtual sal_Int32 getTokenDirect( const char *pToken, sal_Int32 nLength ) const override; +virtual sal_Int32 getTokenDirect(std::string_view token) const override; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/oox/core/fasttokenhandler.hxx b/include/oox/core/fasttokenhandler.hxx index 396474b988a1..d47c81dd0130 100644 --- a/include/oox/core/fasttokenhandler.hxx +++ b/include/oox/core/fasttokenhandler.hxx @@ -29,8 +29,6 @@ #include #include -namespace oox { class TokenMap; } - namespace oox::core { @@ -41,8 +39,7 @@ class OOX_DLLPUBLIC FastTokenHandler final : public cppu::ImplInheritanceHelper< sax_fastparser::FastTokenHandlerBase, css::lang::XServiceInfo > { public: -explicitFastTokenHandler(); -virtual ~FastTokenHandler() override; +explicitFa
core.git: editeng/source vcl/qa
editeng/source/editeng/impedit.hxx |3 editeng/source/editeng/impedit3.cxx | 40 +- vcl/qa/cppunit/pdfexport/data/tdf151748.fodt | 160 +++ vcl/qa/cppunit/pdfexport/pdfexport2.cxx | 60 ++ 4 files changed, 254 insertions(+), 9 deletions(-) New commits: commit 937023bca427f803a9e7085d5090d5d2b17623ed Author: Jonathan Clark AuthorDate: Fri Aug 30 00:21:12 2024 -0600 Commit: Jonathan Clark CommitDate: Fri Aug 30 16:17:21 2024 +0200 tdf#151748 editeng: Improve kashida position validation Previously, editeng did not validate whether kashida insertion positions had enough room for at least a single kashida glyph. This caused kashida glyphs to overlap other characters in some situations. Editeng will now drop candidate kashida insertion positions from the beginning of the line, until there is enough room to safely justify the remaining text. This approximates Writer's behavior. Change-Id: I804cae72503332bea8dc9e60cdfe08bd3429dc52 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172641 Reviewed-by: Jonathan Clark Tested-by: Jenkins diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index 5ea71794912d..d62edc53419b 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -719,7 +719,8 @@ private: boolImplHasText() const; -voidImpFindKashidas( ContentNode* pNode, sal_Int32 nStart, sal_Int32 nEnd, std::vector& rArray ); +void ImpFindKashidas(ContentNode* pNode, sal_Int32 nStart, sal_Int32 nEnd, + std::vector& rArray, sal_Int32 nRemainingSpace); voidInsertContent(std::unique_ptr pNode, sal_Int32 nPos); EditPaM SplitContent( sal_Int32 nNode, sal_Int32 nSepPos ); diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index d8a89139cd59..3cd8ef12eb4d 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -2306,17 +2306,16 @@ void ImpEditEngine::ImpAdjustBlocks(ParaPortion& rParaPortion, EditLine& rLine, std::vector aPositions; // Kashidas ? -ImpFindKashidas( pNode, nFirstChar, nLastChar, aPositions ); +ImpFindKashidas(pNode, nFirstChar, nLastChar, aPositions, nRemainingSpace); auto nKashidas = aPositions.size(); sal_uInt16 nLastScript = i18n::ScriptType::LATIN; for ( sal_Int32 nChar = nFirstChar; nChar <= nLastChar; nChar++ ) { EditPaM aPaM( pNode, nChar+1 ); -LanguageType eLang = GetLanguage(aPaM).nLang; sal_uInt16 nScript = GetI18NScriptType(aPaM); // Arabic script is handled above, but if no Kashida positions are found, use blanks. -if (MsLangId::getPrimaryLanguage(eLang) == LANGUAGE_ARABIC_PRIMARY_ONLY && nKashidas) +if (nKashidas) continue; if ( pNode->GetChar(nChar) == ' ' ) @@ -2348,8 +2347,7 @@ void ImpEditEngine::ImpAdjustBlocks(ParaPortion& rParaPortion, EditLine& rLine, // If the last character is a blank, it is rejected! // The width must be distributed to the blockers in front... // But not if it is the only one. -if ( ( pNode->GetChar( nLastChar ) == ' ' ) && ( aPositions.size() > 1 ) && - ( MsLangId::getPrimaryLanguage( GetLanguage( EditPaM( pNode, nLastChar ) ).nLang ) != LANGUAGE_ARABIC_PRIMARY_ONLY ) ) +if ((pNode->GetChar(nLastChar) == ' ') && (aPositions.size() > 1) && (!nKashidas)) { aPositions.pop_back(); sal_Int32 nPortionStart, nPortion; @@ -2427,13 +2425,16 @@ void ImpEditEngine::ImpAdjustBlocks(ParaPortion& rParaPortion, EditLine& rLine, } // For Kashidas from sw/source/core/text/porlay.cxx -void ImpEditEngine::ImpFindKashidas( ContentNode* pNode, sal_Int32 nStart, sal_Int32 nEnd, std::vector& rArray ) +void ImpEditEngine::ImpFindKashidas(ContentNode* pNode, sal_Int32 nStart, sal_Int32 nEnd, +std::vector& rArray, sal_Int32 nRemainingSpace) { // Kashida glyph looks suspicious, skip Kashida justification if (GetRefDevice()->GetMinKashida() <= 0) return; std::vector aKashidaArray; +std::vector aMinKashidaArray; +sal_Int32 nTotalMinKashida = 0U; // the search has to be performed on a per word base @@ -2442,6 +2443,7 @@ void ImpEditEngine::ImpFindKashidas( ContentNode* pNode, sal_Int32 nStart, sal_I if ( aWordSel.Min().GetIndex() < nStart ) aWordSel.Min().SetIndex( nStart ); +SvxFont aTmpFont(pNode->GetCharAttribs().GetDefFont()); while ( ( aWordSel.Min().GetNode() == pNode ) && ( aWordSel.Min().GetIndex() < nEnd ) ) { const sal_Int32 nSavPos = aWordSel.Max().GetIndex(); @@ -2599,13 +2601,35 @@ void ImpEditEngine::ImpFindKashidas( ContentNode* pNode, sal_Int32 nStart, sal_I ++nIdx;
core.git: editeng/source
editeng/source/editeng/impedit3.cxx |7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) New commits: commit 1aed9e3dae4b17e677a2af9e9f76a67d7c57dec0 Author: Caolán McNamara AuthorDate: Wed Aug 28 14:13:10 2024 +0100 Commit: Caolán McNamara CommitDate: Thu Aug 29 11:22:28 2024 +0200 If there editeng backcolor is unknown, assume bg is the doccolor Change-Id: I65b2cd329db2c5868e6e84592303fd277ed63d56 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172534 Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172564 Tested-by: Jenkins diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 4c11d780c6f8..d8a89139cd59 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -4955,10 +4955,13 @@ Color ImpEditEngine::GetAutoColor() const { Color aColor; -SfxViewShell* pKitSh = comphelper::LibreOfficeKit::isActive() ? SfxViewShell::Current() : nullptr; +const SfxViewShell* pKitSh = comphelper::LibreOfficeKit::isActive() ? SfxViewShell::Current() : nullptr; if (pKitSh) { -if (GetBackgroundColor().IsDark() ) +Color aBackgroundColor = GetBackgroundColor(); +if (aBackgroundColor == COL_AUTO) +aBackgroundColor = pKitSh->GetColorConfigColor(svtools::DOCCOLOR); +if (aBackgroundColor.IsDark()) aColor = COL_WHITE; else aColor = COL_BLACK;
core.git: editeng/source
editeng/source/editeng/impedit3.cxx |4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) New commits: commit a37c185bbc598d57385ab461c0a85c1b1b78c325 Author: Pranam Lashkari AuthorDate: Wed Aug 28 13:23:43 2024 +0200 Commit: Caolán McNamara CommitDate: Thu Aug 29 11:12:10 2024 +0200 LOK: avoid dark auto color font on dark background Change-Id: I259d1af222af33c0226a3d11c7b146a8a5fd72f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172527 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172563 Tested-by: Jenkins diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index b627c2447e81..4c11d780c6f8 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -4958,9 +4958,7 @@ Color ImpEditEngine::GetAutoColor() const SfxViewShell* pKitSh = comphelper::LibreOfficeKit::isActive() ? SfxViewShell::Current() : nullptr; if (pKitSh) { -// Get document background color from current view instead -aColor = pKitSh->GetColorConfigColor(svtools::DOCCOLOR); -if (aColor.IsDark()) +if (GetBackgroundColor().IsDark() ) aColor = COL_WHITE; else aColor = COL_BLACK;
core.git: editeng/source include/editeng
editeng/source/items/frmitems.cxx | 18 ++ include/editeng/brushitem.hxx |2 ++ 2 files changed, 20 insertions(+) New commits: commit 01d183d2290668c310d592bf2e4c298ddcfb10b4 Author: Noel Grandin AuthorDate: Fri Aug 23 14:17:01 2024 +0200 Commit: Noel Grandin CommitDate: Fri Aug 23 16:45:31 2024 +0200 tdf#158556 make SvxBrushItem hashable Change-Id: I82794dbf004781a86c8443b72263528167fe0359 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172316 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 25ac10818176..f457781e39bd 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -4255,6 +4255,7 @@ bool SvxBrushItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const bool SvxBrushItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { +ASSERT_CHANGE_REFCOUNTED_ITEM; nMemberId &= ~CONVERT_TWIPS; switch( nMemberId) { @@ -4462,6 +4463,23 @@ bool SvxBrushItem::operator==( const SfxPoolItem& rAttr ) const return bEqual; } +size_t SvxBrushItem::hashCode() const +{ +std::size_t seed(0); +o3tl::hash_combine(seed, static_cast(aColor)); +o3tl::hash_combine(seed, maComplexColor); +o3tl::hash_combine(seed, static_cast(aFilterColor)); +o3tl::hash_combine(seed, eGraphicPos); +o3tl::hash_combine(seed, nGraphicTransparency); +if ( GPOS_NONE != eGraphicPos ) +{ +o3tl::hash_combine(seed, maStrLink); +o3tl::hash_combine(seed, maStrFilter); +} +o3tl::hash_combine(seed, nShadingValue); +return seed; +} + SvxBrushItem* SvxBrushItem::Clone( SfxItemPool* ) const { return new SvxBrushItem( *this ); diff --git a/include/editeng/brushitem.hxx b/include/editeng/brushitem.hxx index 6897e319a3b6..cc71f6135d80 100644 --- a/include/editeng/brushitem.hxx +++ b/include/editeng/brushitem.hxx @@ -85,6 +85,8 @@ public: OUString &rText, const IntlWrapper& ) const override; virtual bool operator==( const SfxPoolItem& ) const override; +virtual bool supportsHashCode() const override { return true; } +virtual size_t hashCode() const override; virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
core.git: editeng/source include/editeng
editeng/source/items/textitem.cxx |8 include/editeng/colritem.hxx |2 ++ 2 files changed, 10 insertions(+) New commits: commit 1c4b613cda515e678a914a9bde4af3cc557532a6 Author: Noel Grandin AuthorDate: Fri Aug 23 13:20:17 2024 +0200 Commit: Noel Grandin CommitDate: Fri Aug 23 16:44:41 2024 +0200 tdf#158556 make SvxColorItem hashable Change-Id: I39cfd46a8255b6231b0215ff22f4ac5f77fa38e0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172312 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index cf4d9e27a8d8..a4ad9f8847f8 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -1507,6 +1507,14 @@ bool SvxColorItem::operator==( const SfxPoolItem& rAttr ) const maComplexColor == rColorItem.maComplexColor; } +size_t SvxColorItem::hashCode() const +{ +std::size_t seed(0); +o3tl::hash_combine(seed, static_cast(mColor)); +o3tl::hash_combine(seed, maComplexColor); +return seed; +} + bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { nMemberId &= ~CONVERT_TWIPS; diff --git a/include/editeng/colritem.hxx b/include/editeng/colritem.hxx index 15c352ebff25..1acb863f6a86 100644 --- a/include/editeng/colritem.hxx +++ b/include/editeng/colritem.hxx @@ -44,6 +44,8 @@ public: // "pure virtual Methods" from SfxPoolItem virtual bool operator==(const SfxPoolItem& rPoolItem) const override; +virtual bool supportsHashCode() const override { return true; } +virtual size_t hashCode() const override; virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override; virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override;
core.git: editeng/source include/editeng
editeng/source/items/frmitems.cxx | 23 +++ include/editeng/lrspitem.hxx |8 +--- include/editeng/shaditem.hxx |8 +--- 3 files changed, 33 insertions(+), 6 deletions(-) New commits: commit f2b6a04f37e24e47984eb2539771a86cf7b08d4b Author: Noel Grandin AuthorDate: Thu Aug 22 19:45:45 2024 +0200 Commit: Noel Grandin CommitDate: Fri Aug 23 12:01:27 2024 +0200 tdf#158556 make SvxFirstLineIndentItem hashable Change-Id: Ic23d0956b87eefb575696dad7af775a37cd50b10 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172289 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 93c4a9fe646f..25ac10818176 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -497,6 +497,7 @@ void SvxLRSpaceItem::SetRight(const tools::Long nR, const sal_uInt16 nProp) void SvxFirstLineIndentItem::SetTextFirstLineOffset( const short nF, const sal_uInt16 nProp) { +ASSERT_CHANGE_REFCOUNTED_ITEM; m_nFirstLineOffset = short((tools::Long(nF) * nProp ) / 100); m_nPropFirstLineOffset = nProp; } @@ -967,6 +968,7 @@ bool SvxFirstLineIndentItem::QueryValue(uno::Any& rVal, sal_uInt8 nMemberId) con bool SvxFirstLineIndentItem::PutValue(const uno::Any& rVal, sal_uInt8 nMemberId) { +ASSERT_CHANGE_REFCOUNTED_ITEM; bool bConvert = 0 != (nMemberId & CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -1018,6 +1020,15 @@ bool SvxFirstLineIndentItem::operator==(const SfxPoolItem& rAttr) const && m_bAutoFirst == rOther.IsAutoFirst()); } +size_t SvxFirstLineIndentItem::hashCode() const +{ +std::size_t seed(0); +o3tl::hash_combine(seed, m_nFirstLineOffset); +o3tl::hash_combine(seed, m_nPropFirstLineOffset); +o3tl::hash_combine(seed, m_bAutoFirst); +return seed; +} + SvxFirstLineIndentItem* SvxFirstLineIndentItem::Clone(SfxItemPool *) const { return new SvxFirstLineIndentItem(*this); @@ -1070,6 +1081,7 @@ bool SvxFirstLineIndentItem::GetPresentation void SvxFirstLineIndentItem::ScaleMetrics(tools::Long const nMult, tools::Long const nDiv) { +ASSERT_CHANGE_REFCOUNTED_ITEM; m_nFirstLineOffset = static_cast(BigInt::Scale(m_nFirstLineOffset, nMult, nDiv)); } @@ -2108,6 +2120,7 @@ bool SvxShadowItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const bool SvxShadowItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { +ASSERT_CHANGE_REFCOUNTED_ITEM; bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -2178,6 +2191,15 @@ bool SvxShadowItem::operator==( const SfxPoolItem& rAttr ) const ( eLocation == rItem.GetLocation() ) ); } +size_t SvxShadowItem::hashCode() const +{ +std::size_t seed(0); +o3tl::hash_combine(seed, sal_Int32(aShadowColor)); +o3tl::hash_combine(seed, nWidth); +o3tl::hash_combine(seed, static_cast(eLocation)); +return seed; +} + SvxShadowItem* SvxShadowItem::Clone( SfxItemPool* ) const { return new SvxShadowItem( *this ); @@ -2277,6 +2299,7 @@ bool SvxShadowItem::GetPresentation void SvxShadowItem::ScaleMetrics( tools::Long nMult, tools::Long nDiv ) { +ASSERT_CHANGE_REFCOUNTED_ITEM; nWidth = static_cast(BigInt::Scale( nWidth, nMult, nDiv )); } diff --git a/include/editeng/lrspitem.hxx b/include/editeng/lrspitem.hxx index ca46cd0dfc15..4f69ce21639a 100644 --- a/include/editeng/lrspitem.hxx +++ b/include/editeng/lrspitem.hxx @@ -142,16 +142,16 @@ private: public: bool IsAutoFirst() const { return m_bAutoFirst; } -void SetAutoFirst(const bool bNew) { m_bAutoFirst = bNew; } +void SetAutoFirst(const bool bNew) { ASSERT_CHANGE_REFCOUNTED_ITEM; m_bAutoFirst = bNew; } void SetTextFirstLineOffset(const short nF, const sal_uInt16 nProp = 100); short GetTextFirstLineOffset() const { return m_nFirstLineOffset; } void SetPropTextFirstLineOffset(const sal_uInt16 nProp) -{ m_nPropFirstLineOffset = nProp; } +{ ASSERT_CHANGE_REFCOUNTED_ITEM; m_nPropFirstLineOffset = nProp; } sal_uInt16 GetPropTextFirstLineOffset() const { return m_nPropFirstLineOffset; } void SetTextFirstLineOffsetValue(const short nValue) -{ m_nFirstLineOffset = nValue; } +{ ASSERT_CHANGE_REFCOUNTED_ITEM; m_nFirstLineOffset = nValue; } explicit SvxFirstLineIndentItem(const sal_uInt16 nId); SvxFirstLineIndentItem(const short nOffset, const sal_uInt16 nId); @@ -159,6 +159,8 @@ public: // "pure virtual Methods" from SfxPoolItem virtual bool operator==(const SfxPoolItem&) const override; +virtual bool supportsHashCode() const override { return true; } +virtual size_t hashCode() const override; virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override; virtual bool PutValue
core.git: editeng/source include/editeng
editeng/source/items/frmitems.cxx | 12 include/editeng/lrspitem.hxx |2 ++ 2 files changed, 14 insertions(+) New commits: commit ba0f68732ed89e11157dc618a697bfeb173c6252 Author: Noel Grandin AuthorDate: Thu Aug 22 20:54:34 2024 +0200 Commit: Noel Grandin CommitDate: Fri Aug 23 09:59:44 2024 +0200 tdf#158556 make SvxTextLeftMarginItem hashable Change-Id: Idc91bf66e8ba050fcd133ef98f8364fbbb2e8efa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172294 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 3a02201b65f0..93c4a9fe646f 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -532,6 +532,7 @@ void SvxTextLeftMarginItem::SetLeft(SvxFirstLineIndentItem const& rFirstLine, void SvxTextLeftMarginItem::SetTextLeft(const tools::Long nL, const sal_uInt16 nProp) { +ASSERT_CHANGE_REFCOUNTED_ITEM; m_nTextLeftMargin = (nL * nProp) / 100; m_nPropLeftMargin = nProp; } @@ -784,6 +785,7 @@ bool SvxTextLeftMarginItem::QueryValue(uno::Any& rVal, sal_uInt8 nMemberId) cons bool SvxTextLeftMarginItem::PutValue(const uno::Any& rVal, sal_uInt8 nMemberId) { +ASSERT_CHANGE_REFCOUNTED_ITEM; bool bConvert = 0 != (nMemberId & CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -830,6 +832,15 @@ bool SvxTextLeftMarginItem::operator==(const SfxPoolItem& rAttr) const && m_nPropLeftMargin == rOther.GetPropLeft()); } +size_t SvxTextLeftMarginItem::hashCode() const +{ +std::size_t seed(0); +o3tl::hash_combine(seed, m_nTextLeftMargin); +o3tl::hash_combine(seed, m_nPropLeftMargin); +return seed; +} + + SvxTextLeftMarginItem* SvxTextLeftMarginItem::Clone(SfxItemPool *) const { return new SvxTextLeftMarginItem(*this); @@ -881,6 +892,7 @@ bool SvxTextLeftMarginItem::GetPresentation void SvxTextLeftMarginItem::ScaleMetrics(tools::Long const nMult, tools::Long const nDiv) { +ASSERT_CHANGE_REFCOUNTED_ITEM; m_nTextLeftMargin = BigInt::Scale(m_nTextLeftMargin, nMult, nDiv); } diff --git a/include/editeng/lrspitem.hxx b/include/editeng/lrspitem.hxx index edab3ef23d73..ca46cd0dfc15 100644 --- a/include/editeng/lrspitem.hxx +++ b/include/editeng/lrspitem.hxx @@ -111,6 +111,8 @@ public: // "pure virtual Methods" from SfxPoolItem virtual bool operator==(const SfxPoolItem&) const override; +virtual bool supportsHashCode() const override { return true; } +virtual size_t hashCode() const override; virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override; virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override;
core.git: editeng/source
editeng/source/items/paraitem.cxx |7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) New commits: commit 7d3817289586d8765e066fee6551b66ddb5d0ab3 Author: Noel Grandin AuthorDate: Thu Aug 22 13:35:33 2024 +0200 Commit: Noel Grandin CommitDate: Fri Aug 23 08:04:48 2024 +0200 tdf#158556 improve SvxTabStopItem::hashCode to provide more discrimination, which means we spend less time in operator== when searching the pool Change-Id: I9beb8218fdd4b4fb3d60ecf6db461ae818d2a9ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172291 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/editeng/source/items/paraitem.cxx b/editeng/source/items/paraitem.cxx index 4019a6ce2c6b..27331148d486 100644 --- a/editeng/source/items/paraitem.cxx +++ b/editeng/source/items/paraitem.cxx @@ -1065,9 +1065,12 @@ bool SvxTabStopItem::operator==( const SfxPoolItem& rAttr ) const size_t SvxTabStopItem::hashCode() const { std::size_t seed(0); -o3tl::hash_combine(seed, Which()); o3tl::hash_combine(seed, mnDefaultDistance); -o3tl::hash_combine(seed, maTabStops.size()); +for (const SvxTabStop & rStop : maTabStops) +{ +o3tl::hash_combine(seed, rStop.GetTabPos()); +o3tl::hash_combine(seed, rStop. GetAdjustment()); +} return seed; }
core.git: editeng/source include/editeng
editeng/source/items/frmitems.cxx | 13 + include/editeng/ulspitem.hxx | 14 +- 2 files changed, 22 insertions(+), 5 deletions(-) New commits: commit 7e241c2babf3ad705619a120ffc71e475ce7bb7a Author: Noel Grandin AuthorDate: Thu Aug 22 18:58:52 2024 +0200 Commit: Noel Grandin CommitDate: Thu Aug 22 21:59:21 2024 +0200 tdf#158556 make SvxULSpaceItem hashable Change-Id: I381379bb4be4e27cb8af32a77505dfbb357dd720 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172288 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index ee8c84888c45..3a02201b65f0 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -1713,6 +1713,7 @@ bool SvxULSpaceItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const bool SvxULSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { +ASSERT_CHANGE_REFCOUNTED_ITEM; bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; sal_Int32 nVal = 0; @@ -1785,6 +1786,17 @@ bool SvxULSpaceItem::operator==( const SfxPoolItem& rAttr ) const nPropLower == rSpaceItem.nPropLower ); } +size_t SvxULSpaceItem::hashCode() const +{ +std::size_t seed(0); +o3tl::hash_combine(seed, nUpper); +o3tl::hash_combine(seed, nLower); +o3tl::hash_combine(seed, bContext); +o3tl::hash_combine(seed, nPropUpper); +o3tl::hash_combine(seed, nPropLower); +return seed; +} + SvxULSpaceItem* SvxULSpaceItem::Clone( SfxItemPool* ) const { return new SvxULSpaceItem( *this ); @@ -1854,6 +1866,7 @@ bool SvxULSpaceItem::GetPresentation void SvxULSpaceItem::ScaleMetrics( tools::Long nMult, tools::Long nDiv ) { +ASSERT_CHANGE_REFCOUNTED_ITEM; nUpper = static_cast(BigInt::Scale( nUpper, nMult, nDiv )); nLower = static_cast(BigInt::Scale( nLower, nMult, nDiv )); } diff --git a/include/editeng/ulspitem.hxx b/include/editeng/ulspitem.hxx index b0131ab9904d..59e92f4b691b 100644 --- a/include/editeng/ulspitem.hxx +++ b/include/editeng/ulspitem.hxx @@ -47,6 +47,8 @@ public: // "pure virtual Methods" from SfxPoolItem virtual booloperator==( const SfxPoolItem& ) const override; +virtual boolsupportsHashCode() const override { return true; } +virtual size_t hashCode() const override; virtual boolQueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual boolPutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; @@ -63,11 +65,11 @@ public: inline void SetUpper( const sal_uInt16 nU, const sal_uInt16 nProp = 100 ); inline void SetLower( const sal_uInt16 nL, const sal_uInt16 nProp = 100 ); -void SetUpperValue( const sal_uInt16 nU ) { nUpper = nU; } -void SetLowerValue( const sal_uInt16 nL ) { nLower = nL; } -void SetContextValue( const bool bC ) { bContext = bC; } -void SetPropUpper( const sal_uInt16 nU ) { nPropUpper = nU; } -void SetPropLower( const sal_uInt16 nL ) { nPropLower = nL; } +void SetUpperValue( const sal_uInt16 nU ) { ASSERT_CHANGE_REFCOUNTED_ITEM; nUpper = nU; } +void SetLowerValue( const sal_uInt16 nL ) { ASSERT_CHANGE_REFCOUNTED_ITEM; nLower = nL; } +void SetContextValue( const bool bC ) { ASSERT_CHANGE_REFCOUNTED_ITEM; bContext = bC; } +void SetPropUpper( const sal_uInt16 nU ) { ASSERT_CHANGE_REFCOUNTED_ITEM; nPropUpper = nU; } +void SetPropLower( const sal_uInt16 nL ) { ASSERT_CHANGE_REFCOUNTED_ITEM; nPropLower = nL; } sal_uInt16 GetUpper() const { return nUpper; } sal_uInt16 GetLower() const { return nLower; } @@ -81,10 +83,12 @@ public: inline void SvxULSpaceItem::SetUpper( const sal_uInt16 nU, const sal_uInt16 nProp ) { +ASSERT_CHANGE_REFCOUNTED_ITEM; nUpper = sal_uInt16((sal_uInt32(nU) * nProp ) / 100); nPropUpper = nProp; } inline void SvxULSpaceItem::SetLower( const sal_uInt16 nL, const sal_uInt16 nProp ) { +ASSERT_CHANGE_REFCOUNTED_ITEM; nLower = sal_uInt16((sal_uInt32(nL) * nProp ) / 100); nPropLower = nProp; }
core.git: editeng/source include/editeng
editeng/source/items/paraitem.cxx | 14 ++ include/editeng/tstpitem.hxx |4 +++- 2 files changed, 17 insertions(+), 1 deletion(-) New commits: commit d78a07573eac1960c8c6c736e6c05bf304f96cb1 Author: Noel Grandin AuthorDate: Wed Aug 21 11:23:37 2024 +0200 Commit: Noel Grandin CommitDate: Wed Aug 21 12:56:21 2024 +0200 tdf#158556 make SvxTabStopItem hashable speeds up searching for it in the item pool Change-Id: I37e8889e41d63a41e1a4bf2a35b4aa303745e15c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172171 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/editeng/source/items/paraitem.cxx b/editeng/source/items/paraitem.cxx index f70ff274e787..4019a6ce2c6b 100644 --- a/editeng/source/items/paraitem.cxx +++ b/editeng/source/items/paraitem.cxx @@ -50,6 +50,7 @@ #include #include #include +#include using namespace ::com::sun::star; @@ -877,6 +878,7 @@ sal_uInt16 SvxTabStopItem::GetPos( const sal_Int32 nPos ) const void SvxTabStopItem::SetDefaultDistance(sal_Int32 nDefaultDistance) { +ASSERT_CHANGE_REFCOUNTED_ITEM; mnDefaultDistance = nDefaultDistance; } @@ -933,6 +935,7 @@ bool SvxTabStopItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const bool SvxTabStopItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { +ASSERT_CHANGE_REFCOUNTED_ITEM; bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch ( nMemberId ) @@ -1059,6 +1062,15 @@ bool SvxTabStopItem::operator==( const SfxPoolItem& rAttr ) const return true; } +size_t SvxTabStopItem::hashCode() const +{ +std::size_t seed(0); +o3tl::hash_combine(seed, Which()); +o3tl::hash_combine(seed, mnDefaultDistance); +o3tl::hash_combine(seed, maTabStops.size()); +return seed; +} + SvxTabStopItem* SvxTabStopItem::Clone( SfxItemPool * ) const { return new SvxTabStopItem( *this ); @@ -1098,6 +1110,7 @@ bool SvxTabStopItem::GetPresentation bool SvxTabStopItem::Insert( const SvxTabStop& rTab ) { +ASSERT_CHANGE_REFCOUNTED_ITEM; sal_uInt16 nTabPos = GetPos(rTab); if(SVX_TAB_NOTFOUND != nTabPos ) Remove(nTabPos); @@ -1106,6 +1119,7 @@ bool SvxTabStopItem::Insert( const SvxTabStop& rTab ) void SvxTabStopItem::Insert( const SvxTabStopItem* pTabs ) { +ASSERT_CHANGE_REFCOUNTED_ITEM; for( sal_uInt16 i = 0; i < pTabs->Count(); i++ ) { const SvxTabStop& rTab = (*pTabs)[i]; diff --git a/include/editeng/tstpitem.hxx b/include/editeng/tstpitem.hxx index f0f99ce9cc86..840b294243f9 100644 --- a/include/editeng/tstpitem.hxx +++ b/include/editeng/tstpitem.hxx @@ -116,7 +116,7 @@ public: boolInsert( const SvxTabStop& rTab ); voidInsert( const SvxTabStopItem* pTabs ); voidRemove( const sal_uInt16 nPos, const sal_uInt16 nLen = 1 ) -{ maTabStops.erase( maTabStops.begin() + nPos, maTabStops.begin() + nPos + nLen ); } +{ ASSERT_CHANGE_REFCOUNTED_ITEM; maTabStops.erase( maTabStops.begin() + nPos, maTabStops.begin() + nPos + nLen ); } // Assignment operator, equality operator (caution: expensive!) @@ -134,6 +134,8 @@ public: // "pure virtual Methods" from SfxPoolItem virtual bool operator==( const SfxPoolItem& ) const override; +virtual bool supportsHashCode() const override { return true; } +virtual size_t hashCode() const override final; virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
core.git: editeng/source include/editeng svx/source
editeng/source/editeng/editview.cxx |2 ++ editeng/source/outliner/outlvw.cxx |2 ++ include/editeng/editview.hxx|1 + include/editeng/outliner.hxx|1 + svx/source/svdraw/svdedxv.cxx | 16 +++- 5 files changed, 17 insertions(+), 5 deletions(-) New commits: commit 75aeaab5ef36f819cdc11e88244f59efc4fbc5a6 Author: Jaume Pujantell AuthorDate: Mon Jul 29 12:35:50 2024 +0200 Commit: Miklos Vajna CommitDate: Thu Aug 1 13:54:28 2024 +0200 cool#9352 unassign cursor on SdrObjEditView to avoid crash On stress test with shapes and typing a segfault ocurred due to using a freed vcl::Cursor. On SdrObjEditView::SdrEndTextEdit, delete pOLV can delete the cursor remembered in pTECursorBuffer. But if it is set to the window before the deletion, it will be safely removed from the window. And on SdrObjEditView::ModelHasChanged a re-anchoring sets a cursor on the window that sholdn't be there and other SdrObjEditView can see, remeber, and use it even after this one died and freed the cursor. Change-Id: I3cfef3b68b77e6e6b49c3b68297a6a20e1f9394a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171184 Reviewed-by: Miklos Vajna Tested-by: Jenkins CollaboraOffice (cherry picked from commit 3b5738ab1a646d089fa7cc59ffaeda7d011c1e07) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171288 Tested-by: Jenkins diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index a686ccb04111..d76f0a1c69c0 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -568,6 +568,8 @@ void EditView::HideCursor(bool bDeactivate) } } +bool EditView::IsCursorVisible() const { return getImpl().GetCursor()->IsVisible(); } + Pair EditView::Scroll( tools::Long ndX, tools::Long ndY, ScrollRangeCheck nRangeCheck ) { return getImpl().Scroll( ndX, ndY, nRangeCheck ); diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index 4bcd01905283..e4f06d4548a0 100644 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -1255,6 +1255,8 @@ void OutlinerView::HideCursor(bool bDeactivate) pEditView->HideCursor(bDeactivate); } +bool OutlinerView::IsCursorVisible() const { return pEditView->IsCursorVisible(); } + void OutlinerView::SetWindow( vcl::Window* pWin ) { pEditView->SetWindow( pWin ); diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx index f2c5f9c46d7d..a1cb4eb9603b 100644 --- a/include/editeng/editview.hxx +++ b/include/editeng/editview.hxx @@ -205,6 +205,7 @@ public: tools::Rectangle GetEditCursor() const; voidShowCursor( bool bGotoCursor = true, bool bForceVisCursor = true, bool bActivate = false ); voidHideCursor( bool bDeactivate = false ); +bool IsCursorVisible() const; voidSetSelectionMode( EESelectionMode eMode ); diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index cd3acaf9452d..4b28af42ab00 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -221,6 +221,7 @@ public: voidShowCursor( bool bGotoCursor = true, bool bActivate = false ); voidHideCursor( bool bDeactivate = false ); +bool IsCursorVisible() const; Outliner* GetOutliner() const { return pOwner; } diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index fe647da817a1..ec938c51c320 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -434,8 +434,8 @@ void SdrObjEditView::ModelHasChanged() for (size_t nOV = 0; nOV < nOutlViewCnt; nOV++) { OutlinerView* pOLV = mpTextEditOutliner->GetView(nOV); +vcl::Window* pWin = pOLV->GetWindow(); { // invalidate old OutlinerView area -vcl::Window* pWin = pOLV->GetWindow(); tools::Rectangle aTmpRect(aOldArea); sal_uInt16 nPixSiz = pOLV->GetInvalidateMore() + 1; Size aMore(pWin->PixelToLogic(Size(nPixSiz, nPixSiz))); @@ -450,9 +450,15 @@ void SdrObjEditView::ModelHasChanged() if (bColorChg) pOLV->SetBackgroundColor(aNewColor); +bool bWasCoursorVisible = pOLV->IsCursorVisible(); +vcl::Cursor* pOldCursor = pWin->GetCursor(); pOLV->SetOutputArea( aTextEditArea); // because otherwise, we're not re-anchoring correctly ImpInvalidateOutlinerView(*pOLV); +// Undo SetOutputArea setting and showing the cursor +if (!bWasCoursorVisible) +pOLV->HideCursor(); +pWin->SetCursor(pOldCursor); } mpTextEditOutlinerView->ShowCursor(); } @@ -1853,
core.git: editeng/source include/rtl sal/osl stoc/source
editeng/source/editeng/ContentNode.cxx |5 + include/rtl/ustring.hxx| 14 +++--- sal/osl/w32/file_url.cxx |2 +- stoc/source/security/permissions.cxx |3 +-- 4 files changed, 14 insertions(+), 10 deletions(-) New commits: commit 550ef55881f992b53f860b7f29f4716846779ea0 Author: Mike Kaganski AuthorDate: Wed Jul 31 11:07:14 2024 +0500 Commit: Mike Kaganski CommitDate: Wed Jul 31 12:15:38 2024 +0200 Reintroduce OUString::replaceAt taking an OUString to LIBO_INTERNAL_ONLY This allows optimizations when 'this' is empty, avoiding allocations, and making it possible to not special-case it in other places, as was done in ContentNode::Insert in commit 8ab44b114c6706ab2e3d8a19884daeb544d3c2e1 (tdf#161846 avoid allocation in ContentNode::Insert, 2024-07-30). A couple of disambiguation templated overloads was introduced. Change-Id: I2b5e94c2175379b2696c34e600393d32731f0ab6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171271 Tested-by: Jenkins Reviewed-by: Noel Grandin Reviewed-by: Mike Kaganski diff --git a/editeng/source/editeng/ContentNode.cxx b/editeng/source/editeng/ContentNode.cxx index de5e2150b151..b7e7f4b0e8ee 100644 --- a/editeng/source/editeng/ContentNode.cxx +++ b/editeng/source/editeng/ContentNode.cxx @@ -564,10 +564,7 @@ void ContentNode::SetChar(sal_Int32 nPos, sal_Unicode c) void ContentNode::Insert(const OUString& rStr, sal_Int32 nPos) { -if (nPos == 0 && maString.getLength() == 0) -maString = rStr; // avoid allocation -else -maString = maString.replaceAt(nPos, 0, rStr); +maString = maString.replaceAt(nPos, 0, rStr); } void ContentNode::Append(std::u16string_view rStr) diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx index d4f54f76a1f6..3a6531b4f3a5 100644 --- a/include/rtl/ustring.hxx +++ b/include/rtl/ustring.hxx @@ -2631,8 +2631,6 @@ public: } #endif -// hide this from internal code to avoid ambiguous lookup error -#ifndef LIBO_INTERNAL_ONLY /** Returns a new string resulting from replacing n = count characters from position index in this string with newStr. @@ -2652,7 +2650,6 @@ public: rtl_uString_newReplaceStrAt( &pNew, pData, index, count, newStr.pData ); return OUString( pNew, SAL_NO_ACQUIRE ); } -#endif #ifdef LIBO_INTERNAL_ONLY SAL_WARN_UNUSED_RESULT OUString replaceAt( sal_Int32 index, sal_Int32 count, std::u16string_view newStr ) const @@ -2661,6 +2658,17 @@ public: rtl_uString_newReplaceStrAtUtf16L( &pNew, pData, index, count, newStr.data(), newStr.size() ); return OUString( pNew, SAL_NO_ACQUIRE ); } +// Disambiguation +template +SAL_WARN_UNUSED_RESULT OUString replaceAt( sal_Int32 index, sal_Int32 count, const sal_Unicode (&newStr)[N] ) const +{ +return replaceAt(index, count, std::u16string_view(newStr, N - 1)); +} +template , int> = 0> +SAL_WARN_UNUSED_RESULT OUString replaceAt( sal_Int32 index, sal_Int32 count, const T& newStr ) const +{ +return replaceAt(index, count, std::u16string_view(newStr)); +} #endif /** diff --git a/sal/osl/w32/file_url.cxx b/sal/osl/w32/file_url.cxx index e074fbff54e6..82428a326621 100644 --- a/sal/osl/w32/file_url.cxx +++ b/sal/osl/w32/file_url.cxx @@ -424,7 +424,7 @@ DWORD IsValidFilePath(const OUString& path, DWORD dwFlags, OUString* corrected) // Correct path by merging consecutive slashes: if (o3tl::starts_with(*oComponent, u"\") && corrected != nullptr) { sal_Int32 i = oComponent->data() - lastCorrected.getStr(); -*corrected = lastCorrected.replaceAt(i, 1, {}); +*corrected = lastCorrected.replaceAt(i, 1, std::u16string_view{}); //TODO: handle out-of-memory lastCorrected = *corrected; oComponent = lastCorrected.subView(i); diff --git a/stoc/source/security/permissions.cxx b/stoc/source/security/permissions.cxx index 77da8459987b..b99aa9420a59 100644 --- a/stoc/source/security/permissions.cxx +++ b/stoc/source/security/permissions.cxx @@ -327,9 +327,8 @@ FilePermission::FilePermission( // correct win drive letters if (9 < m_url.getLength() && '|' == m_url[ 9 ]) // file:///X| { -constexpr OUStringLiteral s_colon = u":"; // common case in API is a ':' (sal), so convert '|' to ':' -m_url = m_url.replaceAt( 9, 1, s_colon ); +m_url = m_url.replaceAt(9, 1, u":"); } #endif }
core.git: editeng/source
editeng/source/uno/unotext.cxx |8 1 file changed, 4 insertions(+), 4 deletions(-) New commits: commit 952ded08943731b6e367d7a2b7a54ee7f35464a8 Author: Noel Grandin AuthorDate: Tue Jul 30 10:09:27 2024 +0200 Commit: Noel Grandin CommitDate: Wed Jul 31 07:05:52 2024 +0200 tdf#161846 no need to CloneAsValue() here the methods are already returning by value Change-Id: Ie9eaf2ba3ae0ca4ad79b05229dd6856537580044 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171249 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx index 5e935f0569d0..9d70aee46828 100644 --- a/editeng/source/uno/unotext.cxx +++ b/editeng/source/uno/unotext.cxx @@ -625,9 +625,9 @@ uno::Any SvxUnoTextRangeBase::_getPropertyValue(const OUString& PropertyName, sa { std::optional oAttribs; if( nPara != -1 ) -oAttribs.emplace(pForwarder->GetParaAttribs( nPara ).CloneAsValue()); +oAttribs.emplace(pForwarder->GetParaAttribs( nPara )); else -oAttribs.emplace(pForwarder->GetAttribs( GetSelection() ).CloneAsValue()); +oAttribs.emplace(pForwarder->GetAttribs( GetSelection() )); // Replace Dontcare with Default, so that one always has a mirror oAttribs->ClearInvalidItems(); @@ -922,9 +922,9 @@ uno::Sequence< uno::Any > SvxUnoTextRangeBase::_getPropertyValues( const uno::Se { std::optional oAttribs; if( nPara != -1 ) -oAttribs.emplace(pForwarder->GetParaAttribs( nPara ).CloneAsValue()); +oAttribs.emplace(pForwarder->GetParaAttribs( nPara )); else -oAttribs.emplace(pForwarder->GetAttribs( GetSelection() ).CloneAsValue() ); +oAttribs.emplace(pForwarder->GetAttribs( GetSelection() )); oAttribs->ClearInvalidItems();
core.git: editeng/source
editeng/source/editeng/impedit2.cxx |8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) New commits: commit 24a0ecfc9c8d76dc2af6a44212d5a0a6ed6ffe6b Author: Noel Grandin AuthorDate: Mon Jul 29 20:53:07 2024 +0200 Commit: Noel Grandin CommitDate: Tue Jul 30 12:30:07 2024 +0200 tdf#161846 reduce re-alloc in ImpEditEngine::GetSelected we can fairly easily allocate the exact buffer size we need and avoid needing to extend the buffer Change-Id: I7f0b2533dab03452db60ddaa5b8a5f3471c195ba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171225 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index f63a12a5bbc1..b2d4a1283cff 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -283,7 +283,13 @@ OUString ImpEditEngine::GetSelected( const EditSelection& rSel ) const OSL_ENSURE( nStartNode <= nEndNode, "Selection not sorted ?" ); -OUStringBuffer aText(256); +// calculate buffer size we need +sal_Int32 nBufSize = (aSel.Max().GetIndex() - aSel.Min().GetIndex() + 1) + + (nEndNode - nStartNode + 1); +// protect against sometimes whacky selection +if (nBufSize < 0 || nBufSize > 64 * 1024) +nBufSize = 256; +OUStringBuffer aText(nBufSize); const OUString aSep = EditDoc::GetSepStr( LINEEND_LF ); // iterate over the paragraphs ...
core.git: editeng/source include/editeng include/svl linguistic/source reportdesign/source sc/inc sc/source sd/inc sd/source svl/source svx/source sw/inc sw/source
editeng/source/uno/unoipset.cxx |2 +- editeng/source/uno/unotext.cxx |6 +++--- include/editeng/unoipset.hxx |2 +- include/editeng/unotext.hxx |2 +- include/svl/itemprop.hxx | 18 ++ linguistic/source/lngopt.cxx |2 +- reportdesign/source/ui/misc/UITools.cxx |6 -- sc/inc/optuno.hxx|4 ++-- sc/inc/styleuno.hxx | 10 +- sc/source/ui/unoobj/optuno.cxx |4 ++-- sc/source/ui/unoobj/styleuno.cxx | 10 +- sc/source/ui/view/viewfunc.cxx |3 ++- sd/inc/stlsheet.hxx |2 +- sd/source/core/stlsheet.cxx |2 +- sd/source/ui/unoidl/unopage.cxx |3 ++- sd/source/ui/unoidl/unopback.cxx |5 +++-- sd/source/ui/unoidl/unopback.hxx |2 +- svl/source/items/itemprop.cxx| 26 -- svx/source/unodraw/unoshape.cxx |6 -- sw/inc/unocrsrhelper.hxx |6 +++--- sw/source/core/access/accpara.cxx|6 -- sw/source/core/unocore/unocrsrhelper.cxx |3 ++- sw/source/core/unocore/unofield.cxx |2 +- sw/source/core/unocore/unoobj.cxx|6 +++--- sw/source/core/unocore/unostyle.cxx |5 +++-- 25 files changed, 69 insertions(+), 74 deletions(-) New commits: commit c39978f41dccbeb2e973c919a67d9b1d974f8f3c Author: Noel Grandin AuthorDate: Sat Jul 27 15:39:06 2024 +0200 Commit: Noel Grandin CommitDate: Mon Jul 29 15:10:19 2024 +0200 tdf#161846 use unordered_map in SfxItemPropertyMap with large property maps, even a binary search starts showing up, but we can do a O(1) search here by using a map Change-Id: Ie7916076073e6dd393f0a1fb5a0db1b973999408 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171173 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/editeng/source/uno/unoipset.cxx b/editeng/source/uno/unoipset.cxx index 8782217fd394..8737b2ea77d1 100644 --- a/editeng/source/uno/unoipset.cxx +++ b/editeng/source/uno/unoipset.cxx @@ -209,7 +209,7 @@ void SvxItemPropertySet::setPropertyValue( const SfxItemPropertyMapEntry* pMap, } -const SfxItemPropertyMapEntry* SvxItemPropertySet::getPropertyMapEntry(std::u16string_view rName) const +const SfxItemPropertyMapEntry* SvxItemPropertySet::getPropertyMapEntry(const OUString& rName) const { return m_aPropertyMap.getByName( rName ); } diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx index 7c4c3fbfbc26..5e935f0569d0 100644 --- a/editeng/source/uno/unotext.cxx +++ b/editeng/source/uno/unotext.cxx @@ -1058,7 +1058,7 @@ beans::PropertyState SvxUnoTextRangeBase::_getPropertyState(const SfxItemPropert throw beans::UnknownPropertyException(); } -beans::PropertyState SvxUnoTextRangeBase::_getPropertyState(std::u16string_view PropertyName, sal_Int32 nPara /* = -1 */) +beans::PropertyState SvxUnoTextRangeBase::_getPropertyState(const OUString& PropertyName, sal_Int32 nPara /* = -1 */) { SolarMutexGuard aGuard; @@ -1364,9 +1364,9 @@ void SAL_CALL SvxUnoTextRangeBase::setAllPropertiesToDefault() if( pForwarder ) { -for (const SfxItemPropertyMapEntry* entry : mpPropSet->getPropertyMap().getPropertyEntries()) +for (auto const & rPair : mpPropSet->getPropertyMap().getPropertyEntries()) { -_setPropertyToDefault( pForwarder, entry, -1 ); +_setPropertyToDefault( pForwarder, rPair.second, -1 ); } } } diff --git a/include/editeng/unoipset.hxx b/include/editeng/unoipset.hxx index 87a6f29c10a4..7801a27e 100644 --- a/include/editeng/unoipset.hxx +++ b/include/editeng/unoipset.hxx @@ -52,7 +52,7 @@ public: css::uno::Reference< css::beans::XPropertySetInfo > const & getPropertySetInfo() const; const SfxItemPropertyMap& getPropertyMap() const { return m_aPropertyMap;} -const SfxItemPropertyMapEntry* getPropertyMapEntry(std::u16string_view rName) const; +const SfxItemPropertyMapEntry* getPropertyMapEntry(const OUString& rName) const; }; struct SvxIDPropertyCombine diff --git a/include/editeng/unotext.hxx b/include/editeng/unotext.hxx index 38efd32e0aaf..9cb53b5b3063 100644 --- a/include/editeng/unotext.hxx +++ b/include/editeng/unotext.hxx @@ -286,7 +286,7 @@ protected: SAL_DLLPRIVATE css::beans::PropertyState _getPropertyState( const SfxItemPropertyMapEntry* pMap, sal_Int32 nPara = -1 ); /// @throws css::beans::UnknownPropertyException /// @throws css::uno::RuntimeException -SAL_DLLPRIVATE css::beans::PropertyState _getPropertyState( std::u16string_view PropertyName, sal_Int32 nPara = -1 ); +SAL_DLLPRIVATE css::beans::PropertyState _getPropertyState( const OUString& PropertyName, sal_Int32 nPara = -1 ); /// @throws css::beans::UnknownPropertyException
core.git: editeng/source
editeng/source/items/borderline.cxx | 24 +++- editeng/source/items/itemtype.cxx |6 +++--- editeng/source/items/paraitem.cxx |2 +- 3 files changed, 15 insertions(+), 17 deletions(-) New commits: commit f0a79b4dc1e96eb5dda35097d0975aae9f3e0c98 Author: Tuukka Orava AuthorDate: Sat May 4 20:00:25 2024 +0300 Commit: Hossein CommitDate: Wed Jul 24 10:32:08 2024 +0200 tdf#147021 Use std::size instead of SAL_N_ELEMENTS in editeng Change-Id: I6cf0557b1e44dff08fa1efa4aefa14dec276458e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167134 Reviewed-by: Hossein Tested-by: Jenkins diff --git a/editeng/source/items/borderline.cxx b/editeng/source/items/borderline.cxx index 05742eb95131..e258d876c398 100644 --- a/editeng/source/items/borderline.cxx +++ b/editeng/source/items/borderline.cxx @@ -455,24 +455,22 @@ void SvxBorderLine::GuessLinesWidths( SvxBorderLineStyle nStyle, sal_uInt16 nOut SvxBorderLineStyle::THICKTHIN_LARGEGAP }; -static size_t const len = SAL_N_ELEMENTS(aDoubleStyles); tools::Long nWidth = 0; -SvxBorderLineStyle nTestStyle(SvxBorderLineStyle::NONE); -for (size_t i = 0; i < len && nWidth == 0; ++i) +for (auto nTestStyle : aDoubleStyles) { -nTestStyle = aDoubleStyles[i]; BorderWidthImpl aWidthImpl = getWidthImpl( nTestStyle ); nWidth = aWidthImpl.GuessWidth( nOut, nIn, nDist ); +if (nWidth != 0) +{ +// If anything matched, then set it +nStyle = nTestStyle; +SetBorderLineStyle(nStyle); +m_nWidth = nWidth; +break; +} } -// If anything matched, then set it -if ( nWidth > 0 ) -{ -nStyle = nTestStyle; -SetBorderLineStyle(nStyle); -m_nWidth = nWidth; -} -else +if (nWidth == 0) { // fdo#38542: not a known double, default to something custom... SetBorderLineStyle(nStyle); @@ -664,7 +662,7 @@ OUString SvxBorderLine::GetValueString(MapUnit eSrcUnit, }; OUString aStr = "(" + ::GetColorString(m_aColor) + cpDelim; -if ( static_cast(m_nStyle) < int(SAL_N_ELEMENTS(aStyleIds)) ) +if ( static_cast(m_nStyle) < std::size(aStyleIds) ) { TranslateId pResId = aStyleIds[static_cast(m_nStyle)]; aStr += EditResId(pResId); diff --git a/editeng/source/items/itemtype.cxx b/editeng/source/items/itemtype.cxx index cbb83c83be35..b95c62c1a386 100644 --- a/editeng/source/items/itemtype.cxx +++ b/editeng/source/items/itemtype.cxx @@ -146,7 +146,7 @@ OUString GetColorString( const Color& rCol ) COL_LIGHTRED, COL_LIGHTMAGENTA, COL_YELLOW, COL_WHITE }; sal_uInt16 nColor = 0; -while ( nColor < SAL_N_ELEMENTS(aColAry) && +while ( nColor < std::size(aColAry) && aColAry[nColor] != rCol.GetRGBColor() ) { nColor += 1; @@ -172,10 +172,10 @@ OUString GetColorString( const Color& rCol ) RID_SVXITEMS_COLOR_WHITE }; -static_assert(SAL_N_ELEMENTS(aColAry) == SAL_N_ELEMENTS(RID_SVXITEMS_COLORS), "must match"); +static_assert(std::size(aColAry) == std::size(RID_SVXITEMS_COLORS), "must match"); OUString sStr; -if ( nColor < SAL_N_ELEMENTS(aColAry) ) +if ( nColor < std::size(aColAry) ) sStr = EditResId(RID_SVXITEMS_COLORS[nColor]); if ( sStr.isEmpty() ) diff --git a/editeng/source/items/paraitem.cxx b/editeng/source/items/paraitem.cxx index 87d892dc3409..f70ff274e787 100644 --- a/editeng/source/items/paraitem.cxx +++ b/editeng/source/items/paraitem.cxx @@ -451,7 +451,7 @@ OUString SvxAdjustItem::GetValueTextByPos( sal_uInt16 nPos ) RID_SVXITEMS_ADJUST_CENTER, RID_SVXITEMS_ADJUST_BLOCKLINE }; -static_assert(SAL_N_ELEMENTS(RID_SVXITEMS_ADJUST) - 1 == size_t(SvxAdjust::BlockLine), "unexpected size"); +static_assert(std::size(RID_SVXITEMS_ADJUST) - 1 == static_cast(SvxAdjust::BlockLine), "unexpected size"); assert(nPos <= sal_uInt16(SvxAdjust::BlockLine) && "enum overflow!"); return EditResId(RID_SVXITEMS_ADJUST[nPos]); }
core.git: editeng/source sc/source sw/source
editeng/source/editeng/impedit3.cxx |8 sc/source/core/data/patattr.cxx | 17 + sw/source/core/txtnode/fntcache.cxx | 14 +- 3 files changed, 14 insertions(+), 25 deletions(-) New commits: commit 8534ad7b7b9aae2520d731cf748ff0aadfe2f0ed Author: Heiko Tietze AuthorDate: Thu Jul 4 14:31:09 2024 +0200 Commit: Heiko Tietze CommitDate: Mon Jul 22 13:01:43 2024 +0200 Resolves tdf#159541 - Fix font color must not change depending on background Change-Id: I954c9e3f8502a5243c664ed0bf066fb4c4cb4ccc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169991 Reviewed-by: Heiko Tietze Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 66ecfb814774..944f3a1c14a9 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -4958,13 +4958,13 @@ Color ImpEditEngine::GetAutoColor() const } else { -aColor = GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor; +aColor = GetColorConfig().GetColorValue(svtools::FONTCOLOR, false).nColor; -if ( GetBackgroundColor() != COL_AUTO ) +if ( aColor == COL_AUTO ) { -if ( GetBackgroundColor().IsDark() && aColor.IsDark() ) +if ( GetBackgroundColor().IsDark() ) aColor = COL_WHITE; -else if ( GetBackgroundColor().IsBright() && aColor.IsBright() ) +else aColor = COL_BLACK; } } diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx index da278bd53c30..0bf5cfc6ca41 100644 --- a/sc/source/core/data/patattr.cxx +++ b/sc/source/core/data/patattr.cxx @@ -798,22 +798,7 @@ void ScPatternAttr::fillColor(model::ComplexColor& rComplexColor, const SfxItemS aSysTextColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor; } -// select the resulting color -if ( aBackColor.IsDark() && aSysTextColor.IsDark() ) -{ -// use white instead of dark on dark -aColor = COL_WHITE; -} -else if ( aBackColor.IsBright() && aSysTextColor.IsBright() ) -{ -// use black instead of bright on bright -aColor = COL_BLACK; -} -else -{ -// use aSysTextColor (black for ScAutoFontColorMode::Print, from style settings otherwise) -aColor = aSysTextColor; -} +aColor = aSysTextColor; } aComplexColor.setFinalColor(aColor); rComplexColor = aComplexColor; diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index 52a9e71dff1d..d52484432791 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -58,6 +58,7 @@ #include #include #include "justify.hxx" +#include using namespace ::com::sun::star; @@ -2293,11 +2294,14 @@ bool SwDrawTextInfo::ApplyAutoColor( vcl::Font* pFont ) } // change painting color depending of dark/bright background -Color aTmpColor( nNewColor ); -if ( pCol->IsDark() && aTmpColor.IsDark() ) -nNewColor = COL_WHITE; -else if ( pCol->IsBright() && aTmpColor.IsBright() ) -nNewColor = COL_BLACK; +if (!pVSh->GetWin() || // ie. IsPrinting, see SwViewShell::GetWin() +svtools::ColorConfig().GetColorValue(svtools::FONTCOLOR, false).nColor == COL_AUTO) // GetFontColor() uses the smart flag +{ +if ( pCol->IsDark() ) +nNewColor = COL_WHITE; +else +nNewColor = COL_BLACK; +} } }
core.git: editeng/source include/editeng include/svl svl/source sw/inc sw/source
editeng/source/items/textitem.cxx | 119 +++--- include/editeng/fhgtitem.hxx |1 include/editeng/fontitem.hxx |1 include/svl/cintitem.hxx | 12 +++ include/svl/eitem.hxx | 10 +++ include/svl/poolitem.hxx | 14 +--- svl/source/items/cintitem.cxx | 61 +++ svl/source/items/globalpool.cxx | 14 +++- svl/source/items/poolitem.cxx | 10 +++ sw/inc/fmtfsize.hxx |1 sw/inc/fmtornt.hxx|2 sw/source/core/layout/atrfrm.cxx | 113 +++- 12 files changed, 175 insertions(+), 183 deletions(-) New commits: commit c3e8dbc139c3b1644ea07101a8c572ffa017 Author: Noel Grandin AuthorDate: Sun Jul 21 14:35:21 2024 +0200 Commit: Noel Grandin CommitDate: Mon Jul 22 11:29:32 2024 +0200 Improve the perf for pool item scanning.. for large complex documents with lots of shapes. When that happens, we spend a lot of time scanning the std::unordered_set inside DefaultItemInstanceManager. Since most of our items are already capable of being hashed, and thus avoiding the scanning cost, make it so we can use the HashableItemInstanceManager most of the time. Change-Id: I43f4c04e956d316c976bea67d1941529d2d91182 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170813 Reviewed-by: Noel Grandin Tested-by: Jenkins Tested-by: Armin Le Grand Tested-by: Noel Grandin diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index a44ca0bfe612..cf4d9e27a8d8 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -159,35 +159,22 @@ bool SvxFontListItem::GetPresentation // class SvxFontItem - -namespace +ItemInstanceManager* SvxFontItem::getItemInstanceManager() const { -class SvxFontItemInstanceManager : public HashedItemInstanceManager -{ -protected: -virtual size_t hashCode(const SfxPoolItem& rItem) const override -{ -const SvxFontItem& rFontItem(static_cast(rItem)); -std::size_t seed(0); -o3tl::hash_combine(seed, rItem.Which()); -o3tl::hash_combine(seed, rFontItem.GetFamilyName().hashCode()); -o3tl::hash_combine(seed, rFontItem.GetStyleName().hashCode()); -o3tl::hash_combine(seed, rFontItem.GetFamily()); -o3tl::hash_combine(seed, rFontItem.GetPitch()); -o3tl::hash_combine(seed, rFontItem.GetCharSet()); -return seed; -} -public: -SvxFontItemInstanceManager(SfxItemType aSfxItemType) -: HashedItemInstanceManager(aSfxItemType) -{ -} -}; +static HashedItemInstanceManager aInstanceManager(ItemType()); +return &aInstanceManager; } -ItemInstanceManager* SvxFontItem::getItemInstanceManager() const +size_t SvxFontItem::hashCode() const { -static SvxFontItemInstanceManager aInstanceManager(ItemType()); -return &aInstanceManager; +std::size_t seed(0); +o3tl::hash_combine(seed, Which()); +o3tl::hash_combine(seed, GetFamilyName().hashCode()); +o3tl::hash_combine(seed, GetStyleName().hashCode()); +o3tl::hash_combine(seed, GetFamily()); +o3tl::hash_combine(seed, GetPitch()); +o3tl::hash_combine(seed, GetCharSet()); +return seed; } SvxFontItem::SvxFontItem( @@ -414,31 +401,9 @@ void SvxFontItem::dumpAsXml(xmlTextWriterPtr pWriter) const // class SvxPostureItem -- -namespace -{ -class SvxPostureItemInstanceManager : public HashedItemInstanceManager -{ -protected: -virtual size_t hashCode(const SfxPoolItem& rItem) const override -{ -auto const & rPostureItem = static_cast(rItem); -std::size_t seed(0); -o3tl::hash_combine(seed, rItem.Which()); -o3tl::hash_combine(seed, rPostureItem.Which()); -o3tl::hash_combine(seed, rPostureItem. GetEnumValue()); -return seed; -} -public: -SvxPostureItemInstanceManager(SfxItemType aSfxItemType) -: HashedItemInstanceManager(aSfxItemType) -{ -} -}; -} - ItemInstanceManager* SvxPostureItem::getItemInstanceManager() const { -static SvxPostureItemInstanceManager aInstanceManager(ItemType()); +static HashedItemInstanceManager aInstanceManager(ItemType()); return &aInstanceManager; } @@ -688,34 +653,20 @@ void SvxWeightItem::dumpAsXml(xmlTextWriterPtr pWriter) const // class SvxFontHeightItem --- -namespace +ItemInstanceManager* SvxFontHeightItem::getItemInstanceManager() const { -class SvxFontHeightItemInstanceManager : public HashedItemInstanceManager -{ -protected: -virtual size_t hashCode(const SfxPoolItem& rItem) const ove
core.git: editeng/source i18npool/qa i18npool/source sw/qa sw/source sw/uiconfig
editeng/source/editeng/impedit4.cxx |3 i18npool/qa/cppunit/test_breakiterator.cxx | 98 +--- i18npool/source/breakiterator/breakiterator_unicode.cxx |2 sw/qa/core/uwriter.cxx | 42 ++ sw/source/core/txtnode/txtedt.cxx | 67 +++--- sw/uiconfig/swriter/ui/wordcount-mobile.ui |4 sw/uiconfig/swriter/ui/wordcount.ui |2 7 files changed, 153 insertions(+), 65 deletions(-) New commits: commit aa938fe03cfb968f7f4ed9760dcbe579a74bdc02 Author: Jonathan Clark AuthorDate: Tue Jul 16 16:50:10 2024 -0600 Commit: Jonathan Clark CommitDate: Wed Jul 17 15:45:41 2024 +0200 tdf#150621 Changed Korean word counting to use words Previously, Writer counted characters for all CJK languages, rather than words. This is the correct behavior for Chinese and Japanese, which make extensive use of ideographs. However, it is not correct for Korean. This change adjusts the Writer word count algorithm to count Korean words, rather than Korean characters. Change-Id: I6e77136867baca1a7b51248886ee5fd7073ad364 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170621 Tested-by: Jenkins Reviewed-by: Jonathan Clark diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index 35070a4dd740..e1f655c1cc89 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -2904,7 +2904,8 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, } i18n::Boundary aCurWordBndry( aSttBndry ); -while (aCurWordBndry.endPos && aCurWordBndry.startPos <= aEndBndry.startPos) +while (aCurWordBndry.startPos != aCurWordBndry.endPos + && aCurWordBndry.startPos <= aEndBndry.startPos) { nCurrentStart = aCurWordBndry.startPos; nCurrentEnd = aCurWordBndry.endPos; diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx index 3b4ae3efea3d..84ae6d5fe72b 100644 --- a/i18npool/qa/cppunit/test_breakiterator.cxx +++ b/i18npool/qa/cppunit/test_breakiterator.cxx @@ -1867,33 +1867,32 @@ void TestBreakIterator::testLegacySurrogatePairs() void TestBreakIterator::testWordCount() { -auto count_words_fn = [&](const OUString& str, const lang::Locale& aLocale) -> int +auto fnCountWords = [&](const OUString& aStr, const lang::Locale& aLocale) -> int { -int num_words = 0; -sal_Int32 next_pos = 0; -int iter_guard = 0; +int nWords = 0; +sal_Int32 nNextPos = 0; +int nIterGuard = 0; -if (m_xBreak->isBeginWord(str, next_pos, aLocale, i18n::WordType::WORD_COUNT)) +if (m_xBreak->isBeginWord(aStr, nNextPos, aLocale, i18n::WordType::WORD_COUNT)) { -++num_words; +++nWords; } while (true) { -CPPUNIT_ASSERT_MESSAGE("Tripped infinite loop check", ++iter_guard < 100); +CPPUNIT_ASSERT_MESSAGE("Tripped infinite loop check", ++nIterGuard < 100); -auto aBounds = m_xBreak->nextWord(str, next_pos, aLocale, i18n::WordType::WORD_COUNT); - -if (aBounds.endPos < next_pos || aBounds.startPos == aBounds.endPos) +auto aBounds = m_xBreak->nextWord(aStr, nNextPos, aLocale, i18n::WordType::WORD_COUNT); +if (aBounds.endPos == aBounds.startPos) { break; } -next_pos = aBounds.endPos; -++num_words; +nNextPos = aBounds.endPos; +++nWords; } -return num_words; +return nWords; }; // i#80815: "Word count differs from MS Word" @@ -1903,29 +1902,29 @@ void TestBreakIterator::testWordCount() aLocale.Language = "en"; aLocale.Country = "US"; -const OUString str = u"" - "test data for word count issue #80815 " - "fo\\'sforos " - "archipi\\'elago " - "do\^me " - "f**k " - " " - "battery-driven " - "and/or " - "apple(s) " - "money+opportunity " - "Micro$oft " - " " - "300$ " - "I(not you) " - "an " - "1+3=4 " - " " - "aaa.aaa " - "aaa,aaa " - "aaa;aaa "_ustr; - -CPPUNIT_ASSERT_EQUAL
core.git: editeng/source include/comphelper
editeng/source/accessibility/AccessibleEditableTextPara.cxx |2 +- include/comphelper/sequence.hxx |4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) New commits: commit 8d279e8c4fbef0599d4d84c98695871fb5b42275 Author: Caolán McNamara AuthorDate: Sun Jul 14 15:08:56 2024 +0100 Commit: Caolán McNamara CommitDate: Mon Jul 15 11:11:08 2024 +0200 cid#1607843 Use of auto that causes a copy and cid#1555160 Use of auto that causes a copy Change-Id: I2e2056ddbfb2d11d288a5b2df273e8bc049387fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170455 Reviewed-by: Caolán McNamara Tested-by: Jenkins diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx b/editeng/source/accessibility/AccessibleEditableTextPara.cxx index 1c784db88ef3..19620ea093a0 100644 --- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx +++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx @@ -1236,7 +1236,7 @@ namespace accessibility // create sorted sequences according to index array uno::Sequence aNewValues( nLength ); std::transform(indices.begin(), indices.end(), aNewValues.getArray(), - [&aRes](sal_Int32 index) { return aRes[index]; }); + [&aRes](sal_Int32 index) -> const beans::PropertyValue& { return aRes[index]; }); return aNewValues; } diff --git a/include/comphelper/sequence.hxx b/include/comphelper/sequence.hxx index 30c7d00e4b42..4a9d132c271e 100644 --- a/include/comphelper/sequence.hxx +++ b/include/comphelper/sequence.hxx @@ -300,7 +300,7 @@ namespace comphelper { css::uno::Sequence< typename M::key_type > ret( static_cast(map.size()) ); std::transform(map.begin(), map.end(), ret.getArray(), - [](const auto& i) { return i.first; }); + [](const auto& i) -> const typename M::key_type& { return i.first; }); return ret; } @@ -309,7 +309,7 @@ namespace comphelper { css::uno::Sequence< typename M::mapped_type > ret( static_cast(map.size()) ); std::transform(map.begin(), map.end(), ret.getArray(), - [](const auto& i) { return i.second; }); + [](const auto& i) -> const typename M::mapped_type& { return i.second; }); return ret; }
core.git: editeng/source filter/source include/tools sw/source tools/inc tools/source vcl/source
editeng/source/misc/txtrange.cxx |3 +-- filter/source/svg/svgwriter.cxx | 13 +++-- include/tools/poly.hxx| 11 +++ sw/source/core/docnode/ndnotxt.cxx| 11 +++ sw/source/filter/ww8/writerhelper.cxx |9 +++-- tools/inc/poly.h |9 + tools/source/generic/poly2.cxx| 20 vcl/source/filter/imet/ios2met.cxx|4 ++-- vcl/source/filter/wmf/emfwr.cxx | 13 + vcl/source/filter/wmf/wmfwr.cxx | 20 +--- 10 files changed, 70 insertions(+), 43 deletions(-) New commits: commit cfe6ce1656754776568be5b30217efc08aa70dc0 Author: Yuki Joou AuthorDate: Wed Jun 12 00:30:31 2024 +0200 Commit: Noel Grandin CommitDate: Sun Jul 14 12:24:14 2024 +0200 tdf#145538 - related: Make tools::PolyPolygon iterable This patch allows tools::PolyPolygon to be iterated using c++11's fancy range-based for-loops. It also upgrades a bunch of old-style for-loops iterating over polypolygons to the new style to make code more readable. Note that not all for-loops iterating over polypolygons have been upgraded, as I didn't find a way to automatically find those. I just did a few I found manually. Change-Id: Ifa8d0d44e6f0aa28fdcfd87d70058b12f48c1349 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168730 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/editeng/source/misc/txtrange.cxx b/editeng/source/misc/txtrange.cxx index 2f02a1150f91..02e452209876 100644 --- a/editeng/source/misc/txtrange.cxx +++ b/editeng/source/misc/txtrange.cxx @@ -305,9 +305,8 @@ void SvxBoundArgs::Calc( const tools::PolyPolygon& rPoly ) { sal_uInt16 nCount; nAct = 0; -for( sal_uInt16 i = 0; i < rPoly.Count(); ++i ) +for( auto const& rPol : rPoly ) { -const tools::Polygon& rPol = rPoly[ i ]; nCount = rPol.GetSize(); if( nCount ) { diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx index 57a039f32a18..d9446a886f8a 100644 --- a/filter/source/svg/svgwriter.cxx +++ b/filter/source/svg/svgwriter.cxx @@ -1882,9 +1882,9 @@ tools::PolyPolygon& SVGActionWriter::ImplMap( const tools::PolyPolygon& rPolyPol rDstPolyPoly = tools::PolyPolygon(); -for( sal_uInt16 i = 0, nCount = rPolyPoly.Count(); i < nCount; ++i ) +for( auto const& poly : rPolyPoly ) { -rDstPolyPoly.Insert( ImplMap( rPolyPoly[ i ], aPoly ) ); +rDstPolyPoly.Insert( ImplMap( poly, aPoly ) ); } return rDstPolyPoly; @@ -1898,9 +1898,10 @@ OUString SVGActionWriter::GetPathString( const tools::PolyPolygon& rPolyPoly, bo static constexpr OUString aComma( u","_ustr ); Point aPolyPoint; -for( tools::Long i = 0, nCount = rPolyPoly.Count(); i < nCount; i++ ) + +for( auto rPolyIter = rPolyPoly.begin(); rPolyIter != rPolyPoly.end(); ++rPolyIter ) { -const tools::Polygon& rPoly = rPolyPoly[ static_cast(i) ]; +auto const& rPoly = *rPolyIter; sal_uInt16 n = 1, nSize = rPoly.GetSize(); if( nSize > 1 ) @@ -1950,10 +1951,10 @@ OUString SVGActionWriter::GetPathString( const tools::PolyPolygon& rPolyPoly, bo } } -if(bClose) +if( bClose ) aPathData.append(" Z"); -if( i < ( nCount - 1 ) ) +if( rPolyIter != rPolyPoly.end() ) aPathData.append(aBlank); } } diff --git a/include/tools/poly.hxx b/include/tools/poly.hxx index 74e95141c710..95d39d8df5ab 100644 --- a/include/tools/poly.hxx +++ b/include/tools/poly.hxx @@ -197,6 +197,10 @@ private: TOOLS_DLLPRIVATE void ImplDoOperation( const tools::PolyPolygon& rPolyPoly, tools::PolyPolygon& rResult, PolyClipOp nOperation ) const; public: + +typedef std::vector::iterator iterator; +typedef std::vector::const_iterator const_iterator; + explicit PolyPolygon( sal_uInt16 nInitSize = 16 ); explicit PolyPolygon( const tools::Polygon& rPoly ); explicit PolyPolygon( const tools::Rectangle& ); @@ -264,6 +268,13 @@ public: // constructor to convert from ::basegfx::B2DPolyPolygon // #i76339# made explicit explicit PolyPolygon(const ::basegfx::B2DPolyPolygon& rPolyPolygon); + + +iterator begin(); +iterator end(); + +const_iterator begin() const; +const_iterator end() const; }; template< typename charT, typename traits > diff --git a/sw/source/core/docnode/ndnotxt.cxx b/sw/source/core/docnode/ndnotxt.cxx index e4641de22325..d044f4e90dd3 100644 --- a/sw/source/core/docnode/ndnotxt.cxx +++ b/sw/source/core/docnode/ndnotxt.cxx @@ -126,11 +126,9 @@ const tools::PolyPolygon *SwNoTextNode::HasContour() const OutputDevice* pOutDev = (bPixelGrf ||
core.git: editeng/source
editeng/source/editeng/editeng.cxx | 34 +++--- 1 file changed, 3 insertions(+), 31 deletions(-) New commits: commit 3fcdebc47275d739d8b68e66eca5cbafea8ffc7f Author: Noel Grandin AuthorDate: Sat Jul 13 15:06:42 2024 +0200 Commit: Noel Grandin CommitDate: Sat Jul 13 18:48:25 2024 +0200 use DeleteOnDeinit for EditEngine pool to avoid it accidentally coming to life during shutdown. Change-Id: I016a3396639c30350432b60c375c9777e551eb84 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170425 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index 1bc8ae77a564..172f6ad2c108 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -67,6 +67,7 @@ #include #include #include +#include #include #include #include @@ -81,8 +82,6 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::linguistic2; -static rtl::Reference pGlobalPool; - ImpEditEngine& EditEngine::getImpl() const { return *mpImpEditEngine; @@ -1721,37 +1720,10 @@ rtl::Reference EditEngine::CreatePool() } -/** If we let the libc runtime clean us up, we trigger a crash */ -namespace -{ -class TerminateListener : public ::cppu::WeakImplHelper< css::frame::XTerminateListener > -{ -void SAL_CALL queryTermination( const lang::EventObject& ) override -{} -void SAL_CALL notifyTermination( const lang::EventObject& ) override -{ -pGlobalPool.clear(); -} -virtual void SAL_CALL disposing( const ::css::lang::EventObject& ) override -{} -}; -}; - SfxItemPool& EditEngine::GetGlobalItemPool() { -if ( !pGlobalPool ) -{ -pGlobalPool = CreatePool(); -#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) -// TerminateListener option not available, force it to leak -pGlobalPool->acquire(); -#else -uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(comphelper::getProcessComponentContext()); -uno::Reference< frame::XTerminateListener > xListener( new TerminateListener ); -xDesktop->addTerminateListener( xListener ); -#endif -} -return *pGlobalPool; +static vcl::DeleteOnDeinit> pGlobalPool(CreatePool()); +return **pGlobalPool.get(); } void EditEngine::SetFontInfoInItemSet( SfxItemSet& rSet, const vcl::Font& rFont )
core.git: editeng/source include/editeng include/svl svl/source sw/source
editeng/source/items/frmitems.cxx | 10 +-- editeng/source/items/paraitem.cxx |2 - editeng/source/items/textitem.cxx | 53 +++--- include/editeng/boxitem.hxx |3 -- include/svl/poolitem.hxx | 33 +++ svl/source/items/cenumitm.cxx |7 ++--- svl/source/items/globalpool.cxx | 26 -- sw/source/core/layout/atrfrm.cxx | 30 + 8 files changed, 97 insertions(+), 67 deletions(-) New commits: commit ece698a575710ac7de0c628ef7b8dc7f59e03108 Author: Armin Le Grand (allotropia) AuthorDate: Wed Jul 10 15:54:40 2024 +0200 Commit: Armin Le Grand CommitDate: Thu Jul 11 11:01:01 2024 +0200 ITEM: replaced typeid/hash_code with SfxItemType for the ItemInstanceManager the identification was done using typeid/hash_code, but that has problems - it is only defined to be identical for two instances of the same type, but other types can have the same code. Thanks to Noel to find that out, that is not reliable to be used. In the meantime we have SfxItemType to identify Item instances, so I changed the code to use that. The master had five additionally added Items that use the (2a) method of this mechanism (see comments in svl/source/items/globalpool.cxx for that). The gloal is to use as less as possible of this Items in that mechanism, so I checked. For four of these hashing was used, so the mem/runtime aspect is okay -> access is fast enough to prefer mem over runtime. Adding hashed Items (or any other fast mechanism) is always okay. One did not have that (SvxBoxItem) and used just the fallback ItemInstanceManager, so I removed it. We now have 18 Items for which that mechanism is initialized immediately. Noel also already moved the countdown for starting to use the mechanism in case of default handling (case (1), NUMBER_OF_UNSHARED_INSTANCES) to the unorderd_set. someting I had already planned to do, too - thanks! Change-Id: Icf6f427e5ea64672f385357aaad75bb5b7fcbf98 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170314 Reviewed-by: Noel Grandin Tested-by: Jenkins Reviewed-by: Armin Le Grand diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 0ecf0b6afed1..d2a788370e77 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -3263,12 +3263,6 @@ SvxBoxInfoItem::SvxBoxInfoItem(const sal_uInt16 nId) ResetFlags(); } -ItemInstanceManager* SvxBoxItem::getItemInstanceManager() const -{ -static DefaultItemInstanceManager aInstanceManager(typeid(SvxBoxItem).hash_code()); -return &aInstanceManager; -} - SvxBoxInfoItem::SvxBoxInfoItem( const SvxBoxInfoItem& rCopy ) : SfxPoolItem(rCopy) , mpHorizontalLine(rCopy.mpHorizontalLine ? new SvxBorderLine(*rCopy.mpHorizontalLine) : nullptr) @@ -3985,7 +3979,7 @@ void SvxLineItem::SetLine( const SvxBorderLine* pNew ) ItemInstanceManager* SvxBrushItem::getItemInstanceManager() const { -static DefaultItemInstanceManager aInstanceManager(typeid(SvxBrushItem).hash_code()); +static DefaultItemInstanceManager aInstanceManager(ItemType()); return &aInstanceManager; } @@ -4602,7 +4596,7 @@ void SvxBrushItem::dumpAsXml(xmlTextWriterPtr pWriter) const ItemInstanceManager* SvxFrameDirectionItem::getItemInstanceManager() const { -static DefaultItemInstanceManager aInstanceManager(typeid(SvxFrameDirectionItem).hash_code()); +static DefaultItemInstanceManager aInstanceManager(ItemType()); return &aInstanceManager; } diff --git a/editeng/source/items/paraitem.cxx b/editeng/source/items/paraitem.cxx index 06ab7170341d..87d892dc3409 100644 --- a/editeng/source/items/paraitem.cxx +++ b/editeng/source/items/paraitem.cxx @@ -341,7 +341,7 @@ void SvxLineSpacingItem::SetEnumValue( sal_uInt16 nVal ) ItemInstanceManager* SvxAdjustItem::getItemInstanceManager() const { -static DefaultItemInstanceManager aInstanceManager(typeid(SvxAdjustItem).hash_code()); +static DefaultItemInstanceManager aInstanceManager(ItemType()); return &aInstanceManager; } diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index 65b83fbff620..a44ca0bfe612 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -161,7 +161,7 @@ bool SvxFontListItem::GetPresentation namespace { -class SvxFontItemInstanceManager : public TypeSpecificItemInstanceManager +class SvxFontItemInstanceManager : public HashedItemInstanceManager { protected: virtual size_t hashCode(const SfxPoolItem& rItem) const override @@ -176,12 +176,17 @@ namespace o3tl::hash_combine(seed, rFontItem.GetCharSet()); return seed; } +public: +SvxFontItemInstanceManager(SfxItemType aSfxItemType) +
core.git: editeng/source include/editeng sw/qa sw/source
editeng/source/items/svxfont.cxx|6 + include/editeng/svxfont.hxx |3 sw/qa/extras/ooxmlexport/data/tdf43767_caseMapNumbering.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport21.cxx | 66 sw/source/core/text/inftxt.cxx |3 sw/source/core/text/txtfld.cxx |8 + 6 files changed, 85 insertions(+), 1 deletion(-) New commits: commit 5c6c6a73e9c58ad934a4f89505d5b3e2b781e0b9 Author: Justin Luth AuthorDate: Mon Jun 24 13:12:59 2024 -0400 Commit: Justin Luth CommitDate: Fri Jun 28 01:24:36 2024 +0200 tdf#43767 mso-format layout: no smallcaps applied to numbering If the paragraph marker is formatted as Uppercase, then Uppercase is applied to that line's numbering as well. However, if the marker is formatted as SmallCaps, it MUST NOT be applied for MSO formats. Apparently MSO only supports Uppercase and SmallCaps, not Lowercase or Titlease. I don't like these adhoc exceptions, so I didn't attempt to apply them to ODF formats. Let's keep it simple for ODF - any char format that applies to the entire paragraph should apply to numbering as well (except for the existing underline/overline exceptions). - if you don't like that char attributes apply at all, blame MSO. - if you don't like that DOCX is missing your goofy formatting, blame MSO for being inconsistent. ooxmlexport12's tdf143384_tableInFoot_negativeMargins.docx is almost interesting because it applies superscript and small caps. However, the list is already uppercase, so it can't be used for the test. make CppunitTest_sw_ooxmlexport21 \ CPPUNIT_TEST_NAME=testTdf43767_caseMapNumbering Change-Id: I273baebc996adfd001e1c591dbb9aef9272a42f0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169476 Reviewed-by: Justin Luth Tested-by: Jenkins diff --git a/editeng/source/items/svxfont.cxx b/editeng/source/items/svxfont.cxx index 2df18feb449f..3bd2c8086c07 100644 --- a/editeng/source/items/svxfont.cxx +++ b/editeng/source/items/svxfont.cxx @@ -670,6 +670,12 @@ SvxFont& SvxFont::operator=( const SvxFont& rFont ) return *this; } +bool SvxFont::SvxFontSubsetEquals(const SvxFont& rFont) const +{ +return nEsc == rFont.GetEscapement() && nPropr == rFont.GetPropr() +&& eCaseMap == rFont.GetCaseMap(); +} + namespace { class SvxDoGetCapitalSize : public SvxDoCapitals diff --git a/include/editeng/svxfont.hxx b/include/editeng/svxfont.hxx index 126b56f8f65f..9061ffe398d2 100644 --- a/include/editeng/svxfont.hxx +++ b/include/editeng/svxfont.hxx @@ -113,6 +113,9 @@ public: SvxFont&operator=( const SvxFont& rFont ); SvxFont&operator=( const Font& rFont ); + +// returns true if the SvxFont's own properties are equal (the SvxFont portion of an operator==) +bool SvxFontSubsetEquals(const SvxFont& rFont) const; }; #endif // INCLUDED_EDITENG_SVXFONT_HXX diff --git a/sw/qa/extras/ooxmlexport/data/tdf43767_caseMapNumbering.odt b/sw/qa/extras/ooxmlexport/data/tdf43767_caseMapNumbering.odt new file mode 100644 index ..9b9c9a299503 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf43767_caseMapNumbering.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx index 43dff8ae68cf..9ef569e47683 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx @@ -327,6 +327,72 @@ DECLARE_OOXMLEXPORT_TEST(testTdf158597, "tdf158597.docx") } } +DECLARE_OOXMLEXPORT_TEST(testTdf43767_caseMapNumbering, "tdf43767_caseMapNumbering.odt") +{ +// given a document with 2 numbered Lists [each entry restarts numbering for visual comparison] +xmlDocUniquePtr pDump = parseLayoutDump(); + +// using the relative width difference between "A)" and "a)" as the test comparison +// since ListLabelString etc. does not output the actual string that is displayed on the screen + +// When the entire paragraph has a certain character attribute, that property is also applied +// to the list numbering itself (with some differing exceptions) for both ODT and DOCX. + +// ESTABLISH A BASELINE: these baseline paragraphs have no special character attributes. +// Paragraph 1/list 1(uppercase): no formatting applied to list numbering. Width is 253 for me +const sal_Int32 nUpperCaseWidth += getXPath(pDump, "//body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion"_ostr, + "width"_ostr) + .toInt32(); +// Paragraph 4/list 2(lowercase): no formatting applied to list numbering. Width is 186 for me. +const sal_Int32 nLowerCaseWidth += getXPath(pDump, "//body/txt[5]/SwParaPortion/SwLineLayout/SwFieldPortion"_ostr, + "width"_ost
core.git: editeng/source include/svl
editeng/source/items/textitem.cxx | 221 ++ include/svl/poolitem.hxx | 39 ++ 2 files changed, 77 insertions(+), 183 deletions(-) New commits: commit 534b8f6d8a7cc0bb98c243c8086ed0c81f87901d Author: Noel Grandin AuthorDate: Wed Jun 26 12:31:38 2024 +0200 Commit: Noel Grandin CommitDate: Thu Jun 27 12:51:43 2024 +0200 reduce boilerplate code for type-specific ItemInstanceManagers create a template class to reduce repetition Change-Id: I8c9c71fdfdac20a3b34432affac07aa1d46e8373 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169613 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index f187637866e5..2bdfdd6890d9 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -159,61 +159,24 @@ bool SvxFontListItem::GetPresentation // class SvxFontItem - -typedef std::unordered_map SvxFontItemMap; - namespace { -class SvxFontItemInstanceManager : public ItemInstanceManager +class SvxFontItemInstanceManager : public TypeSpecificItemInstanceManager { -SvxFontItemMap maRegistered; - -public: -SvxFontItemInstanceManager() -: ItemInstanceManager(typeid(SvxFontItem).hash_code()) +protected: +virtual size_t hashCode(const SfxPoolItem& rItem) const override { +const SvxFontItem& rFontItem(static_cast(rItem)); +std::size_t seed(0); +o3tl::hash_combine(seed, rItem.Which()); +o3tl::hash_combine(seed, rFontItem.GetFamilyName().hashCode()); +o3tl::hash_combine(seed, rFontItem.GetStyleName().hashCode()); +o3tl::hash_combine(seed, rFontItem.GetFamily()); +o3tl::hash_combine(seed, rFontItem.GetPitch()); +o3tl::hash_combine(seed, rFontItem.GetCharSet()); +return seed; } - -private: -static size_t hashCode(const SfxPoolItem&); - -// standard interface, accessed exclusively -// by implCreateItemEntry/implCleanupItemEntry -virtual const SfxPoolItem* find(const SfxPoolItem&) const override; -virtual void add(const SfxPoolItem&) override; -virtual void remove(const SfxPoolItem&) override; }; - -size_t SvxFontItemInstanceManager::hashCode(const SfxPoolItem& rItem) -{ -const SvxFontItem& rFontItem(static_cast(rItem)); -std::size_t seed(0); -o3tl::hash_combine(seed, rItem.Which()); -o3tl::hash_combine(seed, rFontItem.GetFamilyName().hashCode()); -o3tl::hash_combine(seed, rFontItem.GetStyleName().hashCode()); -o3tl::hash_combine(seed, rFontItem.GetFamily()); -o3tl::hash_combine(seed, rFontItem.GetPitch()); -o3tl::hash_combine(seed, rFontItem.GetCharSet()); -return seed; -} - -const SfxPoolItem* SvxFontItemInstanceManager::find(const SfxPoolItem& rItem) const -{ -SvxFontItemMap::const_iterator aHit(maRegistered.find(hashCode(rItem))); -if (aHit != maRegistered.end()) -return aHit->second; -return nullptr; -} - -void SvxFontItemInstanceManager::add(const SfxPoolItem& rItem) -{ -maRegistered.insert({hashCode(rItem), &rItem}); -} - -void SvxFontItemInstanceManager::remove(const SfxPoolItem& rItem) -{ -maRegistered.erase(hashCode(rItem)); -} - } ItemInstanceManager* SvxFontItem::getItemInstanceManager() const @@ -446,56 +409,20 @@ void SvxFontItem::dumpAsXml(xmlTextWriterPtr pWriter) const // class SvxPostureItem -- -typedef std::unordered_map SvxPostureItemMap; - namespace { -class SvxPostureItemInstanceManager : public ItemInstanceManager +class SvxPostureItemInstanceManager : public TypeSpecificItemInstanceManager { -SvxPostureItemMap maRegistered; - -public: -SvxPostureItemInstanceManager() -: ItemInstanceManager(typeid(SvxPostureItem).hash_code()) +protected: +virtual size_t hashCode(const SfxPoolItem& rItem) const override { +auto const & rPostureItem = static_cast(rItem); +std::size_t seed(0); +o3tl::hash_combine(seed, rPostureItem.Which()); +o3tl::hash_combine(seed, rPostureItem. GetEnumValue()); +return seed; } - -private: -static size_t hashCode(const SfxPoolItem&); - -// standard interface, accessed exclusively -// by implCreateItemEntry/implCleanupItemEntry -virtual const SfxPoolItem* find(const SfxPoolItem&) const override; -virtual void add(const SfxPoolItem&) override; -virtual void remove(const SfxPoolItem&) override; }; - -size_t SvxPostureItemInstanceManager::hashCode(const SfxPoolItem& rItem) -{ -
core.git: editeng/source include/editeng
editeng/source/editeng/editeng.cxx | 18 ++ editeng/source/editeng/impedit.hxx |1 + editeng/source/editeng/impedit3.cxx |6 ++ include/editeng/editeng.hxx |1 - 4 files changed, 13 insertions(+), 13 deletions(-) New commits: commit 6e3cefc89e80ec0f7fab058a583d3ac4c702400e Author: Noel Grandin AuthorDate: Fri Jun 21 17:36:06 2024 +0200 Commit: Noel Grandin CommitDate: Fri Jun 21 20:51:41 2024 +0200 move ensureDocumentFormatted from EditEngine to ImpEditEngine so we have the implementation in one class, instead of bouncing back and forth between two. Change-Id: I851578ff553b01fb7d48cf5aa8f7a2d795496751 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169340 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index e86e4b40b5d4..7707ce81ce42 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -420,12 +420,6 @@ sal_Int32 EditEngine::GetParagraphCount() const return getImpl().maEditDoc.Count(); } -void EditEngine::ensureDocumentFormatted() const -{ -if (!getImpl().IsFormatted()) -getImpl().FormatDoc(); -} - sal_Int32 EditEngine::GetLineCount( sal_Int32 nParagraph ) const { return getImpl().GetLineCount(nParagraph); @@ -459,7 +453,7 @@ tools::Rectangle EditEngine::GetParaBounds( sal_Int32 nPara ) sal_uInt32 EditEngine::GetTextHeight( sal_Int32 nParagraph ) const { -ensureDocumentFormatted(); +getImpl().EnsureDocumentFormatted(); sal_uInt32 nHeight = getImpl().GetParaHeight(nParagraph); return nHeight; } @@ -801,14 +795,14 @@ bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView, v sal_uInt32 EditEngine::GetTextHeight() const { -ensureDocumentFormatted(); +getImpl().EnsureDocumentFormatted(); sal_uInt32 nHeight = !IsEffectivelyVertical() ? getImpl().GetTextHeight() : getImpl().CalcTextWidth( true ); return nHeight; } sal_uInt32 EditEngine::CalcTextWidth() { -ensureDocumentFormatted(); +getImpl().EnsureDocumentFormatted(); sal_uInt32 nWidth = !IsEffectivelyVertical() ? getImpl().CalcTextWidth(true) : getImpl().GetTextHeight(); return nWidth; } @@ -1147,7 +1141,7 @@ tools::Long EditEngine::GetFirstLineStartX( sal_Int32 nParagraph ) if ( pPPortion ) { DBG_ASSERT(getImpl().IsFormatted() || !getImpl().IsFormatting(), "GetFirstLineStartX: Doc not formatted - unable to format!"); -ensureDocumentFormatted(); +getImpl().EnsureDocumentFormatted(); const EditLine& rFirstLine = pPPortion->GetLines()[0]; nX = rFirstLine.GetStartPosX(); } @@ -1192,7 +1186,7 @@ bool EditEngine::IsRightToLeft( sal_Int32 nPara ) const bool EditEngine::IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder ) { -ensureDocumentFormatted(); +getImpl().EnsureDocumentFormatted(); // take unrotated positions for calculation here Point aDocPos = GetDocPos( rPaperPos ); @@ -1580,7 +1574,7 @@ tools::Rectangle EditEngine::GetCharacterBounds( const EPosition& rPos ) const ParagraphInfos EditEngine::GetParagraphInfos( sal_Int32 nPara ) { // This only works if not already in the format ... -ensureDocumentFormatted(); +getImpl().EnsureDocumentFormatted(); ParagraphInfos aInfos; aInfos.bValid = getImpl().IsFormatted(); diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index 6a686723a184..768bbbadfc29 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -988,6 +988,7 @@ public: void ScaleContentToFitWindow(o3tl::sorted_vector& rRepaintParagraphs); void FormatDoc(); void FormatFullDoc(); +void EnsureDocumentFormatted(); voidDraw( OutputDevice& rOutDev, const Point& rStartPos, Degree10 nOrientation ); voidDraw( OutputDevice& rOutDev, const tools::Rectangle& rOutRect, const Point& rStartDocPos, bool bClip ); diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index df5a13a83e71..7c1ccc19cfa8 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -500,6 +500,12 @@ void ImpEditEngine::ScaleContentToFitWindow(o3tl::sorted_vector& aRep } } +void ImpEditEngine::EnsureDocumentFormatted() +{ +if (!IsFormatted()) +FormatDoc(); +} + void ImpEditEngine::FormatDoc() { if (!IsUpdateLayout() || IsFormatting()) diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx index 27e5da82febc..e2b40613b0f2 100644 --- a/include/editeng/editeng.hxx +++ b/include/editeng/editeng.hxx @@ -196,7 +196,6 @@ private: SAL_DLLPRIVATE bool HasText() const; SAL_DLLPRIVATE const EditSelectionEngine& GetSelectionEngine() const; SAL_DLLPRIVATE void SetInSelectionMode(bool b); -
core.git: editeng/source
editeng/source/editeng/editundo.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 0989bc478e75e466509b09905e5286cffd1643c9 Author: Andrea Gelmini AuthorDate: Wed Jun 19 22:01:10 2024 +0200 Commit: Julien Nabet CommitDate: Wed Jun 19 22:55:02 2024 +0200 Fix typo Change-Id: I0b82778c57b0da2dc4f1e685349d5f423a3d4090 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169241 Reviewed-by: Julien Nabet Tested-by: Julien Nabet diff --git a/editeng/source/editeng/editundo.cxx b/editeng/source/editeng/editundo.cxx index 9c9b50759276..f785c7057df0 100644 --- a/editeng/source/editeng/editundo.cxx +++ b/editeng/source/editeng/editundo.cxx @@ -108,7 +108,7 @@ bool EditUndoManager::Redo() EditSelection aNewSel( mpEditEngine->GetActiveView()->getImpl().GetEditSelection() ); DBG_ASSERT( !aNewSel.IsInvalid(), "Invalid selection after Undo () "); -DBG_ASSERT( !aNewSel.DbgIsBuggy( mpEditEngine->GetEditDoc() ), "Broken selection afte Undo () "); +DBG_ASSERT( !aNewSel.DbgIsBuggy( mpEditEngine->GetEditDoc() ), "Broken selection after Undo () "); aNewSel.Min() = aNewSel.Max(); mpEditEngine->GetActiveView()->getImpl().SetEditSelection( aNewSel );
core.git: editeng/source
editeng/source/editeng/editundo.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 9a86b1f336ffca2910428dc0df4ab26c7d0f5846 Author: Andrea Gelmini AuthorDate: Wed Jun 19 21:52:53 2024 +0200 Commit: Julien Nabet CommitDate: Wed Jun 19 22:52:17 2024 +0200 Fix typo Change-Id: I3bcbaa4005e65ecdb8d1344a792a465b83aec9fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169237 Tested-by: Julien Nabet Reviewed-by: Julien Nabet diff --git a/editeng/source/editeng/editundo.cxx b/editeng/source/editeng/editundo.cxx index e6678e78f681..9c9b50759276 100644 --- a/editeng/source/editeng/editundo.cxx +++ b/editeng/source/editeng/editundo.cxx @@ -72,7 +72,7 @@ bool EditUndoManager::Undo() EditSelection aNewSel( mpEditEngine->GetActiveView()->getImpl().GetEditSelection() ); DBG_ASSERT( !aNewSel.IsInvalid(), "Invalid selection after Undo () "); -DBG_ASSERT( !aNewSel.DbgIsBuggy( mpEditEngine->GetEditDoc() ), "Broken selection afte Undo () "); +DBG_ASSERT( !aNewSel.DbgIsBuggy( mpEditEngine->GetEditDoc() ), "Broken selection after Undo () "); aNewSel.Min() = aNewSel.Max(); mpEditEngine->GetActiveView()->getImpl().SetEditSelection( aNewSel );
core.git: editeng/source
editeng/source/editeng/editeng.cxx | 19 +-- editeng/source/editeng/impedit.hxx |1 + editeng/source/editeng/impedit2.cxx | 23 +++ 3 files changed, 25 insertions(+), 18 deletions(-) New commits: commit d42957a83660565695ada1a91547148860a5c10b Author: Noel Grandin AuthorDate: Mon Jun 17 19:16:07 2024 +0200 Commit: Noel Grandin CommitDate: Tue Jun 18 11:15:03 2024 +0200 move GetParaBounds code from EditEngine to ImpEditEngine so we have the implementation in one class, instead of bouncing back and forth between two. Change-Id: I103c53783b286be0c8472b1850e3cf3e3d6a925f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169057 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index 8f5ba24de8d7..e86e4b40b5d4 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -454,24 +454,7 @@ sal_uInt32 EditEngine::GetLineHeight( sal_Int32 nParagraph ) tools::Rectangle EditEngine::GetParaBounds( sal_Int32 nPara ) { -ensureDocumentFormatted(); -Point aPnt = GetDocPosTopLeft( nPara ); - -if( IsEffectivelyVertical() ) -{ -sal_Int32 nTextHeight = getImpl().GetTextHeight(); -sal_Int32 nParaWidth = getImpl().CalcParaWidth(nPara, true); -sal_Int32 nParaHeight = getImpl().GetParaHeight(nPara); - -return tools::Rectangle( nTextHeight - aPnt.Y() - nParaHeight, 0, nTextHeight - aPnt.Y(), nParaWidth ); -} -else -{ -sal_Int32 nParaWidth = getImpl().CalcParaWidth( nPara, true ); -sal_Int32 nParaHeight = getImpl().GetParaHeight( nPara ); - -return tools::Rectangle( 0, aPnt.Y(), nParaWidth, aPnt.Y() + nParaHeight ); -} +return getImpl().GetParaBounds(nPara); } sal_uInt32 EditEngine::GetTextHeight( sal_Int32 nParagraph ) const diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index edc2fbe60c9d..a1086a8cab93 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -1060,6 +1060,7 @@ public: sal_uInt16 GetLineHeight( sal_Int32 nParagraph, sal_Int32 nLine ); sal_uInt32 GetParaHeight(sal_Int32 nParagraph) const; Point GetDocPosTopLeft( sal_Int32 nParagraph ); +tools::Rectangle GetParaBounds( sal_Int32 nPara ); SfxItemSet GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, GetAttribsFlags nFlags = GetAttribsFlags::ALL ) const; SfxItemSet GetAttribs( EditSelection aSel, EditEngineAttribs nOnlyHardAttrib = EditEngineAttribs::All ); diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 92017257334e..83c495072ab8 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -3747,6 +3747,29 @@ sal_uInt16 ImpEditEngine::GetLineHeight( sal_Int32 nParagraph, sal_Int32 nLine ) return 0x; } +tools::Rectangle ImpEditEngine::GetParaBounds( sal_Int32 nPara ) +{ +if (!IsFormatted()) +FormatDoc(); +Point aPnt = GetDocPosTopLeft( nPara ); + +if( IsEffectivelyVertical() ) +{ +sal_Int32 nTextHeight = GetTextHeight(); +sal_Int32 nParaWidth = CalcParaWidth(nPara, true); +sal_Int32 nParaHeight = GetParaHeight(nPara); + +return tools::Rectangle( nTextHeight - aPnt.Y() - nParaHeight, 0, nTextHeight - aPnt.Y(), nParaWidth ); +} +else +{ +sal_Int32 nParaWidth = CalcParaWidth( nPara, true ); +sal_Int32 nParaHeight = GetParaHeight( nPara ); + +return tools::Rectangle( 0, aPnt.Y(), nParaWidth, aPnt.Y() + nParaHeight ); +} +} + Point ImpEditEngine::GetDocPosTopLeft( sal_Int32 nParagraph ) { const ParaPortion* pPPortion = maParaPortionList.SafeGetObject(nParagraph);
core.git: editeng/source include/editeng
editeng/source/editeng/editeng.cxx | 10 -- editeng/source/editeng/impedit.hxx |1 - editeng/source/editeng/impedit2.cxx |7 --- include/editeng/editeng.hxx |1 - 4 files changed, 19 deletions(-) New commits: commit 90ff738d1ba1df253d66cc1137b7c0adf450d1d7 Author: Noel Grandin AuthorDate: Mon Jun 17 14:40:19 2024 +0200 Commit: Noel Grandin CommitDate: Mon Jun 17 20:03:38 2024 +0200 EditEngine::GetTextHeightNTP is unused ever since commit 2d8056d884ee3ab7b4454c378618dceb6f5a7ae8 Author: Noel Grandin Date: Thu Apr 4 10:55:36 2024 +0200 loplugin:unusedmethods Change-Id: I2ccdbf45ac688e39df23fd69b8ec21efebad044c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169003 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index 14d200612696..abf2ea72f4da 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -828,16 +828,6 @@ sal_uInt32 EditEngine::GetTextHeight() const return nHeight; } -sal_uInt32 EditEngine::GetTextHeightNTP() const -{ -ensureDocumentFormatted(); - -if (IsEffectivelyVertical()) -return getImpl().CalcTextWidth(true); - -return getImpl().GetTextHeightNTP(); -} - sal_uInt32 EditEngine::CalcTextWidth() { ensureDocumentFormatted(); diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index 494de98136be..f493231d 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -1050,7 +1050,6 @@ public: tools::Long CalcTextHeight( tools::Long* pHeightNTP ); sal_uInt32 GetTextHeight() const; -sal_uInt32 GetTextHeightNTP() const; sal_uInt32 CalcTextWidth( bool bIgnoreExtraSpace); sal_uInt32 CalcParaWidth( sal_Int32 nParagraph, bool bIgnoreExtraSpace ); sal_uInt32 CalcLineWidth(ParaPortion const& rPortion, EditLine const& rLine, bool bIgnoreExtraSpace); diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 0f253f222ed6..c77325fc87c5 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -3538,13 +3538,6 @@ sal_uInt32 ImpEditEngine::CalcLineWidth(ParaPortion const& rPortion, EditLine co return nWidth; } -sal_uInt32 ImpEditEngine::GetTextHeightNTP() const -{ -assert( IsUpdateLayout() && "Should not be used for Update=FALSE: GetTextHeight" ); -DBG_ASSERT( IsFormatted() || IsFormatting(), "GetTextHeight: Not formatted" ); -return mnCurTextHeightNTP; -} - tools::Long ImpEditEngine::Calc1ColumnTextHeight(tools::Long* pHeightNTP) { tools::Long nHeight = 0; diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx index 93ec14037ccd..27e5da82febc 100644 --- a/include/editeng/editeng.hxx +++ b/include/editeng/editeng.hxx @@ -282,7 +282,6 @@ public: OUStringGetText( const ESelection& rSelection ) const; sal_Int32 GetTextLen() const; sal_uInt32 GetTextHeight() const; -SAL_DLLPRIVATE sal_uInt32 GetTextHeightNTP() const; sal_uInt32 CalcTextWidth(); OUStringGetText( sal_Int32 nParagraph ) const;
core.git: editeng/source
editeng/source/editeng/editeng.cxx | 70 -- editeng/source/editeng/impedit.hxx |1 editeng/source/editeng/impedit5.cxx | 73 3 files changed, 75 insertions(+), 69 deletions(-) New commits: commit 04eedb4aec5ffa3966dd4e21ae2f594b289ac53b Author: Noel Grandin AuthorDate: Mon Jun 17 14:12:38 2024 +0200 Commit: Noel Grandin CommitDate: Mon Jun 17 20:02:45 2024 +0200 move SetControlWord code from EditEngine to ImpEditEngine so we have the implementation in one class, instead of bouncing back and forth between two. Change-Id: Ie653fc6880e096ca4fad4dc1cf77bb3f16915dbf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169000 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index bfba5faa811f..4c2eef100fac 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -1167,75 +1167,7 @@ void EditEngine::SetSingleLine(bool bValue) void EditEngine::SetControlWord( EEControlBits nWord ) { - -if (nWord == getImpl().GetStatus().GetControlWord()) -return; - -EEControlBits nPrev = getImpl().GetStatus().GetControlWord(); -getImpl().GetStatus().GetControlWord() = nWord; - -EEControlBits nChanges = nPrev ^ nWord; -if (getImpl().IsFormatted()) -{ -// possibly reformat: -if ( ( nChanges & EEControlBits::USECHARATTRIBS ) || - ( nChanges & EEControlBits::ONECHARPERLINE ) || - ( nChanges & EEControlBits::STRETCHING ) || - ( nChanges & EEControlBits::OUTLINER ) || - ( nChanges & EEControlBits::NOCOLORS ) || - ( nChanges & EEControlBits::OUTLINER2 ) ) -{ -if ( nChanges & EEControlBits::USECHARATTRIBS ) -{ -getImpl().GetEditDoc().CreateDefFont(true); -} - -getImpl().FormatFullDoc(); -getImpl().UpdateViews(getImpl().GetActiveView()); -} -} - -bool bSpellingChanged = bool(nChanges & EEControlBits::ONLINESPELLING); - -if ( !bSpellingChanged ) -return; - -getImpl().StopOnlineSpellTimer(); -if (nWord & EEControlBits::ONLINESPELLING) -{ -// Create WrongList, start timer... -sal_Int32 nNodes = getImpl().GetEditDoc().Count(); -for (sal_Int32 nNode = 0; nNode < nNodes; nNode++) -{ -ContentNode* pNode = getImpl().GetEditDoc().GetObject(nNode); -pNode->CreateWrongList(); -} -if (getImpl().IsFormatted()) -getImpl().StartOnlineSpellTimer(); -} -else -{ -tools::Long nY = 0; -sal_Int32 nNodes = getImpl().GetEditDoc().Count(); -for ( sal_Int32 nNode = 0; nNode < nNodes; nNode++) -{ -ContentNode* pNode = getImpl().GetEditDoc().GetObject(nNode); -ParaPortion const& rPortion = getImpl().GetParaPortions().getRef(nNode); -bool bWrongs = false; -if (pNode->GetWrongList() != nullptr) -bWrongs = !pNode->GetWrongList()->empty(); -pNode->DestroyWrongList(); -if ( bWrongs ) -{ -getImpl().maInvalidRect.SetLeft(0); - getImpl().maInvalidRect.SetRight(getImpl().GetPaperSize().Width()); -getImpl().maInvalidRect.SetTop(nY + 1); -getImpl().maInvalidRect.SetBottom(nY + rPortion.GetHeight() - 1); -getImpl().UpdateViews(getImpl().mpActiveView); -} -nY += rPortion.GetHeight(); -} -} +getImpl().SetControlWord(nWord); } EEControlBits EditEngine::GetControlWord() const diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index 482ea3ecd357..bdae6e7c7b36 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -1172,6 +1172,7 @@ public: const MapMode& GetRefMapMode() const { return mpRefDev->GetMapMode(); } voidSetRefMapMode(const MapMode& rMapMode); +void SetControlWord( EEControlBits nWord ); InternalEditStatus& GetStatus() { return maStatus; } InternalEditStatus const& GetStatus() const{ return maStatus; } diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx index 22536c3cd44a..7e3f6ef970c5 100644 --- a/editeng/source/editeng/impedit5.cxx +++ b/editeng/source/editeng/impedit5.cxx @@ -1339,6 +1339,79 @@ bool ImpEditEngine::IsSimpleCharInput( const KeyEvent& rKeyEvent ) ( KEY_MOD1 != (rKeyEvent.GetKeyCode().GetModifier() & ~KEY_SHIFT ) ); } +void ImpEditEngine::SetControlWord( EEControlBits nWord ) +{ + +if (nWord == maStatus.GetControlWord()) +return; + +EEControlBits nPrev = maStatus.GetControlWord(); +maStatus.GetControlWord() = nWord; + +EEControlBits nChanges
core.git: editeng/source
editeng/source/editeng/editeng.cxx | 11 +-- editeng/source/editeng/impedit.hxx |1 + editeng/source/editeng/impedit5.cxx | 14 ++ 3 files changed, 16 insertions(+), 10 deletions(-) New commits: commit 43ec63461428f05ee2decf68e791bde94d839ff9 Author: Noel Grandin AuthorDate: Mon Jun 17 14:07:34 2024 +0200 Commit: Noel Grandin CommitDate: Mon Jun 17 19:00:25 2024 +0200 move RemoveAttribs code from EditEngine to ImpEditEngine so we have the implementation in one class, instead of bouncing back and forth between two. Change-Id: I55f419e08323d0fe7cc16bc525fc93920980f4c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168999 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index c1f5824f7af7..bfba5faa811f 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -1092,16 +1092,7 @@ SfxItemSet EditEngine::GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int32 void EditEngine::RemoveAttribs( const ESelection& rSelection, bool bRemoveParaAttribs, sal_uInt16 nWhich ) { -const EERemoveParaAttribsMode eMode = bRemoveParaAttribs? -EERemoveParaAttribsMode::RemoveAll : -EERemoveParaAttribsMode::RemoveCharItems; - -getImpl().UndoActionStart(EDITUNDO_RESETATTRIBS); -EditSelection aSel(getImpl().ConvertSelection(rSelection.nStartPara, rSelection.nStartPos, rSelection.nEndPara, rSelection.nEndPos)); -getImpl().RemoveCharAttribs(aSel, eMode, nWhich); -getImpl().UndoActionEnd(); -if (getImpl().IsUpdateLayout()) -getImpl().FormatAndLayout(); +getImpl().RemoveAttribs(rSelection, bRemoveParaAttribs, nWhich); } vcl::Font EditEngine::GetStandardFont( sal_Int32 nPara ) diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index d0224d11b6a2..482ea3ecd357 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -1063,6 +1063,7 @@ public: SfxItemSet GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, GetAttribsFlags nFlags = GetAttribsFlags::ALL ) const; SfxItemSet GetAttribs( EditSelection aSel, EditEngineAttribs nOnlyHardAttrib = EditEngineAttribs::All ); voidSetAttribs( EditSelection aSel, const SfxItemSet& rSet, SetAttribsMode nSpecial = SetAttribsMode::NONE, bool bSetSelection = true ); +voidRemoveAttribs( const ESelection& rSelection, bool bRemoveParaAttribs, sal_uInt16 nWhich ); voidRemoveCharAttribs( EditSelection aSel, EERemoveParaAttribsMode eMode, sal_uInt16 nWhich ); voidRemoveCharAttribs( sal_Int32 nPara, sal_uInt16 nWhich = 0, bool bRemoveFeatures = false ); voidSetFlatMode( bool bFlat ); diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx index 68134542b157..22536c3cd44a 100644 --- a/editeng/source/editeng/impedit5.cxx +++ b/editeng/source/editeng/impedit5.cxx @@ -591,6 +591,20 @@ void ImpEditEngine::SetAttribs( EditSelection aSel, const SfxItemSet& rSet, SetA } } +void ImpEditEngine::RemoveAttribs( const ESelection& rSelection, bool bRemoveParaAttribs, sal_uInt16 nWhich ) +{ +const EERemoveParaAttribsMode eMode = bRemoveParaAttribs? +EERemoveParaAttribsMode::RemoveAll : +EERemoveParaAttribsMode::RemoveCharItems; + +UndoActionStart(EDITUNDO_RESETATTRIBS); +EditSelection aSel(ConvertSelection(rSelection.nStartPara, rSelection.nStartPos, rSelection.nEndPara, rSelection.nEndPos)); +RemoveCharAttribs(aSel, eMode, nWhich); +UndoActionEnd(); +if (IsUpdateLayout()) +FormatAndLayout(); +} + void ImpEditEngine::RemoveCharAttribs( EditSelection aSel, EERemoveParaAttribsMode eMode, sal_uInt16 nWhich ) { aSel.Adjust( maEditDoc );
core.git: editeng/source
editeng/source/editeng/editeng.cxx | 15 +-- editeng/source/editeng/impedit.hxx |3 ++- editeng/source/editeng/impedit5.cxx | 19 +++ 3 files changed, 22 insertions(+), 15 deletions(-) New commits: commit 965052fac15f00ce80f2747323c0dca9d1641e79 Author: Noel Grandin AuthorDate: Sun Jun 16 12:31:16 2024 +0200 Commit: Noel Grandin CommitDate: Sun Jun 16 14:34:33 2024 +0200 move SetPolygon code from EditEngine to ImpEditEngine so we have the implementation in one class, instead of bouncing back and forth between two. Change-Id: Ia91df69b95159f5487d914a67848fb3f18a69dc5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168923 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index ce9b182c0f54..77deee5c6ef0 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -522,20 +522,7 @@ void EditEngine::SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon ) void EditEngine::SetPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DPolyPolygon* pLinePolyPolygon) { -bool bSimple(false); - -if(pLinePolyPolygon && 1 == rPolyPolygon.count()) -{ -if(rPolyPolygon.getB2DPolygon(0).isClosed()) -{ -// open polygon -bSimple = true; -} -} - -TextRanger* pRanger = new TextRanger( rPolyPolygon, pLinePolyPolygon, 30, 2, 2, bSimple, true ); -getImpl().SetTextRanger( std::unique_ptr(pRanger) ); -getImpl().SetPaperSize( pRanger->GetBoundRect().GetSize() ); +getImpl().SetPolygon(rPolyPolygon, pLinePolyPolygon); } void EditEngine::ClearPolygon() diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index 07f6af002358..2da7087e4308 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -943,7 +943,8 @@ public: const ViewsType& GetEditViews() const { return maEditViews; } const Size& GetPaperSize() const { return maPaperSize; } -void SetPaperSize(const Size& rSize) { maPaperSize = rSize; } + +voidSetPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DPolyPolygon* pLinePolyPolygon); voidSetVertical( bool bVertical); boolIsEffectivelyVertical() const { return GetEditDoc().IsEffectivelyVertical(); } diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx index 396e529c514d..512d16ffcaee 100644 --- a/editeng/source/editeng/impedit5.cxx +++ b/editeng/source/editeng/impedit5.cxx @@ -20,6 +20,7 @@ #include #include "impedit.hxx" #include +#include #include #include #include @@ -788,6 +789,24 @@ void ImpEditEngine::ParaAttribsToCharAttribs( ContentNode* pNode ) // Portion does not need to be invalidated here, happens elsewhere. } +void ImpEditEngine::SetPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DPolyPolygon* pLinePolyPolygon) +{ +bool bSimple(false); + +if(pLinePolyPolygon && 1 == rPolyPolygon.count()) +{ +if(rPolyPolygon.getB2DPolygon(0).isClosed()) +{ +// open polygon +bSimple = true; +} +} + +TextRanger* pRanger = new TextRanger( rPolyPolygon, pLinePolyPolygon, 30, 2, 2, bSimple, true ); +SetTextRanger( std::unique_ptr(pRanger) ); +maPaperSize = pRanger->GetBoundRect().GetSize(); +} + IdleFormattter::IdleFormattter() : Idle("editeng::ImpEditEngine aIdleFormatter") {
core.git: editeng/source
editeng/source/editeng/impedit3.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit ee206e25852ba47824ceb910fe67a83825bb19b3 Author: Caolán McNamara AuthorDate: Thu Jun 13 09:53:59 2024 +0100 Commit: Caolán McNamara CommitDate: Thu Jun 13 15:01:12 2024 +0200 put the font test before the script test no difference at all, just annoying to be different to its sibling checks Change-Id: I1713958f2d2d425d47c626f72a3aa0f3c687526e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168772 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index f1d9a706c9e0..a644a3d523f6 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -3064,7 +3064,7 @@ void ImpEditEngine::SeekCursor( ContentNode* pNode, sal_Int32 nPos, SvxFont& rFo rFont.SetKerning( rFont.GetKerning() | FontKerning::Asian ); // tdf#160401/#i78474# small caps do not exist in CTL fonts, so turn that off here where we know the script type -if (nScriptTypeI18N == i18n::ScriptType::COMPLEX && rFont.IsCapital()) +if (rFont.IsCapital() && nScriptTypeI18N == i18n::ScriptType::COMPLEX) rFont.SetCaseMap(SvxCaseMap::NotMapped); if (maStatus.DoNotUseColors())
core.git: editeng/source
editeng/source/editeng/impedit3.cxx |4 1 file changed, 4 insertions(+) New commits: commit 5ad110499343d2ec0469e605168c1c1cd129d0e7 Author: Caolán McNamara AuthorDate: Wed Jun 12 14:35:11 2024 +0100 Commit: Caolán McNamara CommitDate: Wed Jun 12 17:15:26 2024 +0200 Resolves: tdf#160401/#i78474# small caps do not exist in CTL fonts so turn that off here in editeng where we know the script type Change-Id: I8e385d35910e378655deb21bce89c4335724a36d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168733 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index b28532ae46d0..f1d9a706c9e0 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -3063,6 +3063,10 @@ void ImpEditEngine::SeekCursor( ContentNode* pNode, sal_Int32 nPos, SvxFont& rFo if ( (rFont.GetKerning() != FontKerning::NONE) && IsKernAsianPunctuation() && ( nScriptTypeI18N == i18n::ScriptType::ASIAN ) ) rFont.SetKerning( rFont.GetKerning() | FontKerning::Asian ); +// tdf#160401/#i78474# small caps do not exist in CTL fonts, so turn that off here where we know the script type +if (nScriptTypeI18N == i18n::ScriptType::COMPLEX && rFont.IsCapital()) +rFont.SetCaseMap(SvxCaseMap::NotMapped); + if (maStatus.DoNotUseColors()) { rFont.SetColor( /* rColorItem.GetValue() */ COL_BLACK );
core.git: editeng/source include/svl sc/inc sc/source svl/qa svl/source svx/source sw/source
editeng/source/rtf/svxrtf.cxx | 47 - include/svl/itemiter.hxx | 49 - include/svl/itemset.hxx | 138 --- include/svl/whichranges.hxx | 12 include/svl/whiter.hxx| 31 sc/inc/patattr.hxx|5 sc/source/core/data/patattr.cxx | 47 - sc/source/ui/view/cellsh3.cxx |5 svl/qa/unit/items/stylepool.cxx | 11 svl/source/items/itemiter.cxx | 54 - svl/source/items/itemset.cxx | 1155 +++--- svl/source/items/whiter.cxx | 37 svx/source/dialog/srchdlg.cxx | 12 sw/source/core/crsr/findattr.cxx | 28 sw/source/core/doc/DocumentRedlineManager.cxx |5 sw/source/core/doc/docfly.cxx | 34 sw/source/core/doc/docfmt.cxx |5 sw/source/core/txtnode/ndtxt.cxx |2 sw/source/core/txtnode/thints.cxx | 36 sw/source/core/undo/rolbck.cxx| 132 +- sw/source/core/undo/undobj1.cxx |3 sw/source/filter/ww8/docxattributeoutput.cxx |6 sw/source/filter/ww8/rtfattributeoutput.cxx |1 sw/source/filter/ww8/writerhelper.cxx | 20 sw/source/filter/ww8/ww8atr.cxx | 58 + sw/source/filter/ww8/ww8attributeoutput.hxx |2 sw/source/uibase/app/docstyle.cxx | 30 sw/source/uibase/uiview/srcview.cxx | 14 sw/source/uibase/wrtsh/wrtsh1.cxx | 20 29 files changed, 757 insertions(+), 1242 deletions(-) New commits: commit 290c8f6e048fedf63437e3fdf629555ac89dd3ad Author: Armin Le Grand (allotropia) AuthorDate: Wed May 1 19:34:36 2024 +0200 Commit: Armin Le Grand CommitDate: Tue Jun 11 17:26:42 2024 +0200 ITEM: Change SfxItemSet to use unordered_set With all the changes done for Items we can now do deeper basic changes to the ItemSet itself with manageable risk. I already did https://gerrit.libreoffice.org/c/core/+/166455 aka 'ITEM: Add measurements for SfxItemSet usages' to get some statistical information about the fill/usage grade of the ItemSet's fixed PtrArray to SfxPoolItems, check that out to get an own picture. Those results show that an average usage is between some extremes ranging from 0% to 50%, but when using more checks and using multiple files/interactions/edits in all applications we end up with around typical 12%-19% of that array used, the rest is nullptr's. Thus I thought about one of the initial ideas of this series of changes (ITEM), to use a std::unordered_map (A) instead of that fixed array of SfxPoolItem Ptr's (B). Tthat again was for a complete type-based rewrite, which I once did a POC, but the code cannot be adapted to that, just too much work. Those are very different in architecture, (B) is done since a long time (since ever), but as pointed out above, (A) is now possible. There are many aspects to it, let's grep some: Speed (iterate): (A) and (B) are both linear. (A) has less entries, but may touch different mem areas (buckets). (B) is linear, but many empty spaces which are usually uselessly iterated. Speed (access Item by WhichID): (A) is hashed by WhichID, so mostly linear for unordered_set/hash. (B) is in a linear array, but has to calculate the offset for each WhichID access. So I guess speed will mostly equal out. Memory: (A) will be dynamically allocated (buckets), but stl is highly optimized and may even re-use areas, has to provide some extra info but will need less places for Items since it's dynamic and can start empty. (B) will be allocated once (except AllItemSet) and may even be 'derived' to the ItemSet (SfxItemSetFixed), but has to allocate all space at once. I can go in lots of more detail here, but due to the results of the statistics I just made a test now, including measuring some results (will include in gerrit, not here). I used two pro versions for that. That way I have some data now. Result is: - It is now possible to do this, it runs stable :-) - Speed: As expected, mostly no change - Memory: Depending on usage, 0% to 25% less, usually around 8-10% Side effects: - SfxAllItemSet could be done without WhichRanges, thus without expensive 'merges' - SfxItemSetFixed is not needed. While the idea is good, it needs a lot of extra stuff - Access to Items is linear if set - WhichRanges: Still needed, but for vaildity checking/filtering of ItemSet content - WhichRanges: Worth to think about if these are needed at all, probably just exist for historical reasons since allocation/number of adde
core.git: editeng/source include/editeng
editeng/source/items/textitem.cxx | 169 +- include/editeng/rsiditem.hxx |3 2 files changed, 170 insertions(+), 2 deletions(-) New commits: commit bcc30f482b0833460e38a48c07295a8e86b23478 Author: Noel Grandin AuthorDate: Fri May 31 15:41:34 2024 +0200 Commit: Noel Grandin CommitDate: Sun Jun 2 17:41:44 2024 +0200 tdf#144208 speedup doc with lots of redline(3) Shave 5% off load time by using ItemInstanceManager subclasses for some the more heavily used pool items Change-Id: Id389ebb397e2fccfcbae28c8043fe05011b8f1cb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168307 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index b4fa77d59d6f..914ca28a051d 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -445,9 +445,61 @@ void SvxFontItem::dumpAsXml(xmlTextWriterPtr pWriter) const // class SvxPostureItem -- +typedef std::unordered_map SvxPostureItemMap; + +namespace +{ +class SvxPostureItemInstanceManager : public ItemInstanceManager +{ +SvxPostureItemMap maRegistered; + +public: +SvxPostureItemInstanceManager() +: ItemInstanceManager(typeid(SvxPostureItem).hash_code()) +{ +} + +private: +static size_t hashCode(const SfxPoolItem&); + +// standard interface, accessed exclusively +// by implCreateItemEntry/implCleanupItemEntry +virtual const SfxPoolItem* find(const SfxPoolItem&) const override; +virtual void add(const SfxPoolItem&) override; +virtual void remove(const SfxPoolItem&) override; +}; + +size_t SvxPostureItemInstanceManager::hashCode(const SfxPoolItem& rItem) +{ +auto const & rPostureItem = static_cast(rItem); +std::size_t seed(0); +o3tl::hash_combine(seed, rPostureItem.Which()); +o3tl::hash_combine(seed, rPostureItem. GetEnumValue()); +return seed; +} + +const SfxPoolItem* SvxPostureItemInstanceManager::find(const SfxPoolItem& rItem) const +{ +auto aHit(maRegistered.find(hashCode(rItem))); +if (aHit != maRegistered.end()) +return aHit->second; +return nullptr; +} + +void SvxPostureItemInstanceManager::add(const SfxPoolItem& rItem) +{ +maRegistered.insert({hashCode(rItem), &rItem}); +} + +void SvxPostureItemInstanceManager::remove(const SfxPoolItem& rItem) +{ +maRegistered.erase(hashCode(rItem)); +} +} + ItemInstanceManager* SvxPostureItem::getItemInstanceManager() const { -static DefaultItemInstanceManager aInstanceManager(typeid(SvxPostureItem).hash_code()); +static SvxPostureItemInstanceManager aInstanceManager; return &aInstanceManager; } @@ -697,9 +749,63 @@ void SvxWeightItem::dumpAsXml(xmlTextWriterPtr pWriter) const // class SvxFontHeightItem --- +typedef std::unordered_map SvxFontHeightItemMap; + +namespace +{ +class SvxFontHeightItemInstanceManager : public ItemInstanceManager +{ +SvxFontHeightItemMap maRegistered; + +public: +SvxFontHeightItemInstanceManager() +: ItemInstanceManager(typeid(SvxFontHeightItem).hash_code()) +{ +} + +private: +static size_t hashCode(const SfxPoolItem&); + +// standard interface, accessed exclusively +// by implCreateItemEntry/implCleanupItemEntry +virtual const SfxPoolItem* find(const SfxPoolItem&) const override; +virtual void add(const SfxPoolItem&) override; +virtual void remove(const SfxPoolItem&) override; +}; + +size_t SvxFontHeightItemInstanceManager::hashCode(const SfxPoolItem& rItem) +{ +auto const & rFontHeightItem = static_cast(rItem); +std::size_t seed(0); +o3tl::hash_combine(seed, rFontHeightItem.Which()); +o3tl::hash_combine(seed, rFontHeightItem.GetHeight()); +o3tl::hash_combine(seed, rFontHeightItem.GetProp()); +o3tl::hash_combine(seed, rFontHeightItem.GetPropUnit()); +return seed; +} + +const SfxPoolItem* SvxFontHeightItemInstanceManager::find(const SfxPoolItem& rItem) const +{ +auto aHit(maRegistered.find(hashCode(rItem))); +if (aHit != maRegistered.end()) +return aHit->second; +return nullptr; +} + +void SvxFontHeightItemInstanceManager::add(const SfxPoolItem& rItem) +{ +maRegistered.insert({hashCode(rItem), &rItem}); +} + +void SvxFontHeightItemInstanceManager::remove(const SfxPoolItem& rItem) +{ +maRegistered.erase(hashCode(rItem)); +} +} + ItemInstanceManager* SvxFontHeightItem::getItemInstanceManager() const { -static DefaultItemInstanceManager aInstanceManager(typeid(SvxFontHeightItem).
core.git: editeng/source include/vcl sw/source vcl/CppunitTest_vcl_text.mk vcl/inc vcl/Library_vcl.mk vcl/qa vcl/source
editeng/source/editeng/impedit3.cxx|5 include/vcl/glyphitemcache.hxx |5 include/vcl/metaact.hxx| 15 include/vcl/outdev.hxx | 27 include/vcl/pdfwriter.hxx |8 include/vcl/rendercontext/SalLayoutFlags.hxx |3 include/vcl/vcllayout.hxx |2 sw/source/core/text/guess.cxx | 21 sw/source/core/text/itradj.cxx | 39 - sw/source/core/txtnode/fntcache.cxx|4 vcl/CppunitTest_vcl_text.mk|1 vcl/Library_vcl.mk |4 vcl/inc/ImplLayoutArgs.hxx | 13 vcl/inc/impglyphitem.hxx |7 vcl/inc/justificationdata.hxx | 125 +++ vcl/inc/pdf/pdfwriter_impl.hxx |4 vcl/inc/sallayout.hxx | 17 vcl/qa/cppunit/justificationdata.cxx | 113 +++ vcl/qa/cppunit/pdfexport/data/tdf124116-hebrew-track-untrack.odt |binary vcl/qa/cppunit/pdfexport/data/tdf134226-shadda-in-hidden-span.fodt | 328 ++ vcl/qa/cppunit/pdfexport/data/tdf71956-styled-diacritics.fodt | 320 + vcl/qa/cppunit/pdfexport/pdfexport2.cxx| 179 + vcl/qa/cppunit/svm/data/textarraycontext.svm |binary vcl/qa/cppunit/svm/svmtest.cxx | 31 vcl/source/filter/svm/SvmReader.cxx| 28 vcl/source/filter/svm/SvmWriter.cxx| 11 vcl/source/gdi/CommonSalLayout.cxx | 212 +- vcl/source/gdi/gdimtf.cxx |6 vcl/source/gdi/impglyphitem.cxx| 28 vcl/source/gdi/metaact.cxx | 44 + vcl/source/gdi/mtfxmldump.cxx |8 vcl/source/gdi/pdfwriter.cxx | 16 vcl/source/gdi/pdfwriter_impl.cxx | 27 vcl/source/gdi/pdfwriter_impl2.cxx |5 vcl/source/gdi/sallayout.cxx | 46 - vcl/source/outdev/font.cxx | 45 - vcl/source/outdev/text.cxx | 164 +++-- vcl/source/outdev/transparent.cxx | 23 vcl/source/text/ImplLayoutArgs.cxx | 22 39 files changed, 1761 insertions(+), 195 deletions(-) New commits: commit ab0a4543cab77ae0c7c0a79feb8aebab71163dd7 Author: Jonathan Clark AuthorDate: Tue May 7 02:43:00 2024 -0600 Commit: Jonathan Clark CommitDate: Wed May 22 19:20:38 2024 +0200 tdf#124116 Correct Writer text shaping across formatting changes Previously, Writer performed shaping for each span of text separately. In certain situations, this caused incorrect glyph use, or incorrect glyph positioning. This change updates Writer so it will also consider neighboring text while performing shaping. This change resolves the outstanding duplicates filed against tdf#61444. As a side effect, this change also fixes tdf#134226. In addition to the shaping fix, this change implements rendering for individually-styled glyphs, which is required to fix tdf#71956. However, this change does not implement diacritic selection, which is also required for that issue. Change-Id: Iab4774ffaab5ad6113778c54d02cb260a70c1010 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167699 Reviewed-by: Jonathan Clark Tested-by: Jenkins diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index ffd47d95f56a..b28532ae46d0 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -2596,11 +2596,12 @@ void ImpEditEngine::ImpFindKashidas( ContentNode* pNode, sal_Int32 nStart, sal_I } // Validate -std::vector aDropped(aKashidaArray.size()); +std::vector aDropped; auto nOldLayout = GetRefDevice()->GetLayoutMode(); GetRefDevice()->SetLayoutMode(nOldLayout | vcl::text::ComplexTextLayoutFlags::BiDiRtl); GetRefDevice()->ValidateKashidas(pNode->GetString(), nStart, nEnd - nStart, -aKashidaArray.size(), aKashidaArray.data(), aDropped.data()); + /*nPartIdx=*/nStart, /*nPartLen=*/nEnd - n
core.git: editeng/source
editeng/source/items/numitem.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit a94db2e3b6e130fe90de31cbd909ce54f5450601 Author: Justin Luth AuthorDate: Sat May 18 11:36:24 2024 -0400 Commit: Justin Luth CommitDate: Mon May 20 15:40:58 2024 +0200 tdf#156105 sw: make SvxNumberFormat GetPrefix/Suffix more trustworthy As soon as SetPrefix or SetSuffix are called, any partially formed sListFormat is invalid (unless nothing changed). ListFormat creates sPrefix/sSuffix as a convenience/compat item, and changing it directly is NOT reflected in the sListFormat itself. Trying to keep them in sync would be very complicated. Any process that uses these functions OUGHT TO be doing it as building blocks to eventually call SetListFormat(prefix, suffix, lvl), at which point a proper sListFormat will be created. Change-Id: I05f681c812ea5207cb8127b30dafbd543ffea219 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167832 Reviewed-by: Justin Luth Tested-by: Jenkins Reviewed-by: Vasily Melenchuk diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx index 0d677dfc6696..f0fe0085e157 100644 --- a/editeng/source/items/numitem.cxx +++ b/editeng/source/items/numitem.cxx @@ -571,7 +571,7 @@ OUString SvxNumberFormat::CreateRomanString( sal_Int32 nNo, bool bUpper ) void SvxNumberFormat::SetPrefix(const OUString& rSet) { // ListFormat manages the prefix. If badly changed via this function, sListFormat is invalidated -if (sListFormat && rSet.getLength() != sPrefix.getLength()) +if (sListFormat) sListFormat.reset(); sPrefix = rSet; @@ -580,7 +580,7 @@ void SvxNumberFormat::SetPrefix(const OUString& rSet) void SvxNumberFormat::SetSuffix(const OUString& rSet) { // ListFormat manages the suffix. If badly changed via this function, sListFormat is invalidated -if (sListFormat && rSet.getLength() != sSuffix.getLength()) +if (sListFormat) sListFormat.reset(); sSuffix = rSet;
core.git: editeng/source
editeng/source/items/numitem.cxx | 28 +--- 1 file changed, 25 insertions(+), 3 deletions(-) New commits: commit 047e3f62901ae89da30bf1367218104e57439f70 Author: Justin Luth AuthorDate: Fri May 17 10:01:50 2024 -0400 Commit: Justin Luth CommitDate: Mon May 20 15:40:07 2024 +0200 related tdf#156105 sw UI: recognize '%' in numbering prefix/suffix bug 156105's listWithPercents.odt is an example of a properly defined ListFormat which contains a percent symbol in the prefix and suffix, which looked fine in the document itself, but was cut off short in the UI. sw/qa/extras/ooxmlexport/data/tdf116883.docx is also an example, which can be seen if you reduce the first entry to level 1 instead of level 2. Level 1 is improperly defined as "1%>". This is invalid formatting, so the entire thing should be considered a suffix. MS Word also considers it to be a suffix. This code segment still isn't completely comprehensive because it won't properly parse "%1xyz%1%." and "%1xyz%10%." but I'm losing patience. There is still a potential problem with the nInclUpperLevels calculation in case a '%' is used as an in-between separator, but that seems extremely theoretical and irrelevant to me. IIUC, the main impact is that it shows some extra dots in the bullets and numbering UI preview. Change-Id: Ic1b8fbda62917ad4c7b88bf4fff136d72242f977 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167782 Reviewed-by: Justin Luth Reviewed-by: Vasily Melenchuk Tested-by: Jenkins diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx index b81172f9e5a2..0d677dfc6696 100644 --- a/editeng/source/items/numitem.cxx +++ b/editeng/source/items/numitem.cxx @@ -626,17 +626,39 @@ void SvxNumberFormat::SetListFormat(std::optional oSet) // For backward compatibility and UI we should create something looking like // a prefix, suffix and included levels also. This is not possible in general case // since level format string is much more flexible. But for most cases is okay + +// If properly formatted, sListFormat should look something like "%1%…%10%" +// with an optional prefix or suffix (which could theoretically include a percent symbol) +const sal_Int32 nLen = sListFormat->getLength(); sal_Int32 nFirstReplacement = sListFormat->indexOf('%'); -sal_Int32 nLastReplacement = sListFormat->lastIndexOf('%') + 1; +while (nFirstReplacement > -1 && nFirstReplacement < nLen - 1 + && ((*sListFormat)[nFirstReplacement + 1] < '1' + || (*sListFormat)[nFirstReplacement + 1] > '9')) +{ +nFirstReplacement = sListFormat->indexOf('%', nFirstReplacement + 1); +} + +sal_Int32 nLastReplacement = nFirstReplacement == -1 ? -1 : sListFormat->lastIndexOf('%'); +while (nLastReplacement > 0 + && ((*sListFormat)[nLastReplacement - 1] < '0' + || (*sListFormat)[nLastReplacement - 1] > '9')) +{ +nLastReplacement = sListFormat->lastIndexOf('%', nLastReplacement); +} +if (nLastReplacement < nFirstReplacement) +nLastReplacement = nFirstReplacement; +else +++nLastReplacement; + if (nFirstReplacement > 0) // Everything before first '%' will be prefix sPrefix = sListFormat->copy(0, nFirstReplacement); -if (nLastReplacement >= 0 && nLastReplacement < sListFormat->getLength()) +if (nLastReplacement >= 0 && nLastReplacement < nLen) // Everything beyond last '%' is a suffix sSuffix = sListFormat->copy(nLastReplacement); sal_uInt8 nPercents = 0; -for (sal_Int32 i = 0; i < sListFormat->getLength(); i++) +for (sal_Int32 i = nFirstReplacement > 0 ? nFirstReplacement : 0; i < nLastReplacement; i++) { if ((*sListFormat)[i] == '%') nPercents++;
core.git: editeng/source
editeng/source/misc/svxacorr.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit 4c7686b7e1f4d012c00892f1cac1ae8a3298da5a Author: László Németh AuthorDate: Wed May 15 01:46:09 2024 +0200 Commit: László Németh CommitDate: Wed May 15 10:32:41 2024 +0200 tdf#156792 sw Catalan AutoCorrect: no superscript ordinal indicator According to the orthography, disable superscript for the Catalan ordinal indicators (only used for -a): 20a, 20è, 20ns, 20es. Change-Id: I2a3cd17b51a29300e9cfcacdcf0cb123d225248a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167652 Tested-by: Jenkins Reviewed-by: László Németh diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 1597e523a766..4cc64f90a766 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -474,6 +474,8 @@ bool SvxAutoCorrect::FnChgOrdinalNumber( // In some languages ordinal suffixes should never be // changed to superscript. Let's break for those languages. if (!eLang.anyOf( + LANGUAGE_CATALAN, // tdf#156792 + LANGUAGE_CATALAN_VALENCIAN, LANGUAGE_SWEDISH, LANGUAGE_SWEDISH_FINLAND)) {
core.git: editeng/source sw/qa
editeng/source/misc/svxacorr.cxx | 42 --- sw/qa/extras/uiwriter/data/tdf44293.fodt | 14 ++ sw/qa/extras/uiwriter/uiwriter8.cxx | 16 +++ 3 files changed, 68 insertions(+), 4 deletions(-) New commits: commit 7cc712eaa6757a461ac68532d77add2a49bd9181 Author: László Németh AuthorDate: Wed May 15 01:15:16 2024 +0200 Commit: László Németh CommitDate: Wed May 15 10:32:03 2024 +0200 tdf#44293 sw AutoCorrect: fix Portuguese ordinal indicators Add missing dot, support plural and alternative forms with 'r': – add missing dot: 1a -> 1.ª, 1o -> 1.º – support plural forms: 43as -> 43.ªˢ, 43os -> 43ºˢ - support alternative forms: 1ra -> 1.ª, 1ro -> 1.º, 43ras -> 43.ªˢ, 43ros -> 43.ºˢ Change-Id: Ibaeae958ca209edffb13f611ee8a71c80bf15a26 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167649 Tested-by: Jenkins Reviewed-by: László Németh diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 12c63fc5f272..1597e523a766 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -507,28 +508,61 @@ bool SvxAutoCorrect::FnChgOrdinalNumber( if (bFoundEnd && isValidNumber) { sal_Int32 nNum = o3tl::toInt32(rTxt.subView(nSttPos, nNumEnd - nSttPos + 1)); +std::u16string_view sEnd = rTxt.subView(nNumEnd + 1, nEndPos - nNumEnd - 1); // Check if the characters after that number correspond to the ordinal suffix uno::Reference< i18n::XOrdinalSuffix > xOrdSuffix = i18n::OrdinalSuffix::create(comphelper::getProcessComponentContext()); -const uno::Sequence< OUString > aSuffixes = xOrdSuffix->getOrdinalSuffix(nNum, rCC.getLanguageTag().getLocale()); -for (OUString const & sSuffix : aSuffixes) +uno::Sequence< OUString > aSuffixes = xOrdSuffix->getOrdinalSuffix(nNum, rCC.getLanguageTag().getLocale()); + +// add extra suffixes for languages not handled by i18npool/ICU +if ( primary(eLang) == primary(LANGUAGE_PORTUGUESE) && +( nEndPos == nNumEnd + 3 || nEndPos == nNumEnd + 4 ) && +( sEnd[0] == 'a' || sEnd[0] == 'o' || sEnd[0] == 'r' ) ) { -std::u16string_view sEnd = rTxt.subView(nNumEnd + 1, nEndPos - nNumEnd - 1); + auto aExtendedSuffixes = comphelper::sequenceToContainer< std::vector >(aSuffixes); + aExtendedSuffixes.push_back("as"); // plural form of 'a' + aExtendedSuffixes.push_back("os"); // plural form of 'o' + aExtendedSuffixes.push_back("ra"); // alternative form of 'a' + aExtendedSuffixes.push_back("ro"); // alternative form of 'o' + aExtendedSuffixes.push_back("ras"); // alternative form of "as" + aExtendedSuffixes.push_back("ros"); // alternative form of "os" + aSuffixes = comphelper::containerToSequence(aExtendedSuffixes); +} +for (OUString const & sSuffix : aSuffixes) +{ if (sSuffix == sEnd) { // Check if the ordinal suffix has to be set as super script if (rCC.isLetter(sSuffix)) { +sal_Int32 nNumberChanged = 0; +sal_Int32 nSuffixChanged = 0; +// exceptions for Portuguese +// add missing dot: 1a -> 1.ª +// and remove optional 'r': 1ro -> 1.º +if ( primary(eLang) == primary(LANGUAGE_PORTUGUESE) ) +{ +if ( sSuffix.startsWith("r") ) +{ +rDoc.Delete( nNumEnd + 1, nNumEnd + 2 ); +nSuffixChanged = -1; +} +rDoc.Insert( nNumEnd + 1, "." ); +nNumberChanged = 1; +} + // Do the change SvxEscapementItem aSvxEscapementItem(DFLT_ESC_AUTO_SUPER, DFLT_ESC_PROP, SID_ATTR_CHAR_ESCAPEMENT); -rDoc.SetAttr(nNumEnd + 1, nEndPos, +rDoc.SetAttr(nNumEnd + 1 + nNumberChanged, +nEndPos + nNumberChanged + nSuffixChanged, SID_ATTR_CHAR_ESCAPEMENT, aSvxEscapementItem); bChg = true; +break; } } } diff --git a/sw/qa/extras/uiwriter/data/tdf44293.fodt b/sw/qa/extras/uiwriter/data/tdf44
core.git: editeng/source sd/qa
editeng/source/editeng/impedit3.cxx|2 - sd/qa/unit/data/odg/adjust-to-contour.fodg | 52 + sd/qa/unit/layout-tests.cxx| 48 ++ 3 files changed, 101 insertions(+), 1 deletion(-) New commits: commit 4d0987564c33bbccc9b58e041d106c6caf7686a3 Author: Mike Kaganski AuthorDate: Fri May 3 14:14:26 2024 +0500 Commit: Mike Kaganski CommitDate: Fri May 3 18:43:44 2024 +0200 tdf#152906: use correct Y offset GetEditCursor now returns the position relative to the line, not to the whole text. In ImpEditEngine::CreateLines, its use wasn't fixed, and so the Y position of all lines in the calculation was the same, thus adjusting to the same contour's horizontal stripe. Change-Id: I16362bab47f3064281eefb45a12834d836a8ada3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167042 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index f548e2423490..288afb5a33bd 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -923,7 +923,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) { GetTextRanger()->SetVertical( IsEffectivelyVertical() ); -tools::Long nTextY = nStartPosY + GetEditCursor(rParaPortion, *pLine, pLine->GetStart(), CursorFlags()).Top(); +tools::Long nTextY = nCurrentPosY + GetEditCursor(rParaPortion, *pLine, pLine->GetStart(), CursorFlags()).Top(); if ( !bSameLineAgain ) { SeekCursor( pNode, nTmpPos+1, aTmpFont ); diff --git a/sd/qa/unit/data/odg/adjust-to-contour.fodg b/sd/qa/unit/data/odg/adjust-to-contour.fodg new file mode 100644 index ..a5ec6fed74fc --- /dev/null +++ b/sd/qa/unit/data/odg/adjust-to-contour.fodg @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum consequat mi quis pretium semper. Proin luctus orci ac neque venenatis, quis commodo dolor posuere. Curabitur dignissim sapien quis cursus egestas. Donec blandit auctor arcu, nec pellentesque eros molestie eget. In consectetur aliquam hendrerit. Sed cursus mauris vitae ligula pellentesque, non pellentesque urna aliquet. Fusce placerat mauris enim, nec rutrum purus semper vel. Praesent tincidunt neque eu pellentesque pharetra. Fusce pellentesque est orci. + + + + + \ No newline at end of file diff --git a/sd/qa/unit/layout-tests.cxx b/sd/qa/unit/layout-tests.cxx index 1735f6574be3..8143b82e5a1b 100644 --- a/sd/qa/unit/layout-tests.cxx +++ b/sd/qa/unit/layout-tests.cxx @@ -380,6 +380,54 @@ CPPUNIT_TEST_FIXTURE(SdLayoutTest, testTdf112594) u"11\u202f\u1824"_ustr); } +CPPUNIT_TEST_FIXTURE(SdLayoutTest, testTdf152906_AdjustToContour) +{ +// Test that the text adjusts to contour properly + +constexpr OUString sText += u"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum consequat mi quis " + "pretium semper. Proin luctus orci ac neque venenatis, quis commodo dolor posuere. " + "Curabitur dignissim sapien quis cursus egestas. Donec blandit auctor arcu, nec " + "pellentesque eros molestie eget. In consectetur aliquam hendrerit. Sed cursus mauris " + "vitae ligula pellentesque, non pellentesque urna aliquet. Fusce placerat mauris enim, " + "nec rutrum purus semper vel. Praesent tincidunt neque eu pellentesque pharetra. Fusce " + "pellentesque est orci."_ustr; + +// index, length, x, y +const std::tuple strings[] = { +{ 0, 6, 9599, 8647 }, //Lorem +{ 6, 22, 7570, 9358 }, // ipsum dolor sit amet, +{ 28, 29, 6775, 10069 }, // consectetur adipiscing elit. +{ 57, 29, 6299, 10780 }, // Vestibulum consequat mi quis +{ 86, 37, 5453, 11491 }, // pretium semper. Proin luctus orci ac +{ 123, 36, 5134, 12202 }, // neque venenatis, quis commodo dolor +{ 159, 41, 4764, 12913 }, // posuere. Curabitur dignissim sapien quis +{ 200, 43, 4481, 13624 }, // cursus egestas. Donec blandit auctor arcu, +{ 243, 40, 4975, 14335 }, // nec pellentesque eros molestie eget. In +{ 283, 42, 4552, 15046 }, // consectetur aliquam hendrerit. Sed cursus +{ 325, 38, 5363, 15757 }, //mauris vitae ligula pellentesque, non +{ 363, 42, 4692, 16468 }, // pellentesque urna aliquet. Fusce placerat +{ 405, 37, 5047, 17179 }, //mauris enim, nec rutrum purus semper +{ 442, 33, 5963, 17890 }, // vel. Praesent tincidunt neque eu +{ 475, 29, 6387, 18601
core.git: editeng/source
editeng/source/editeng/impedit3.cxx |3 +++ 1 file changed, 3 insertions(+) New commits: commit d84c900bb78168dd9bd0fd1ea02c0769a5ba5f14 Author: Samuel Mehrbrodt AuthorDate: Mon Jan 15 16:53:50 2024 +0100 Commit: Samuel Mehrbrodt CommitDate: Fri Apr 26 11:36:35 2024 +0200 tdf#156955 Properly align text when tabstop is outside of textbox Co-authored-by: Tibor Nagy Change-Id: I9f7ead01d93e0701f8df30ad1dcfe24ef0af7067 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162113 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 72bc2022b1ea..c0a8b1fc734c 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -1096,6 +1096,9 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) aCurrentTab.nTabPortion = nTmpPortion; } +if (nMaxLineWidth < aCurrentTab.nTabPos && nTmpWidth != nMaxLineWidth - 1) +aCurrentTab.nTabPos = nMaxLineWidth - 1; + pPortion->SetKind(PortionKind::TAB); pPortion->SetExtraValue( aCurrentTab.aTabStop.GetFill() ); pPortion->setWidth( aCurrentTab.nTabPos - (nTmpWidth+nStartX) );
core.git: editeng/source
editeng/source/accessibility/AccessibleParaManager.cxx | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) New commits: commit f063aac5143f14226f3e909c3d0a87e040d03538 Author: Michael Weghorn AuthorDate: Mon Apr 22 17:54:42 2024 +0200 Commit: Michael Weghorn CommitDate: Tue Apr 23 08:06:38 2024 +0200 editeng a11y: Switch DBG_ASSERT to real assert All current callers check the index before calling `AccessibleParaManager::IsReferencable`. Change-Id: If585e11eba3c48037b65439e8b95cb8d27bd4ffe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166465 Reviewed-by: Michael Weghorn Tested-by: Jenkins diff --git a/editeng/source/accessibility/AccessibleParaManager.cxx b/editeng/source/accessibility/AccessibleParaManager.cxx index c88f82d67709..aae8c5817f36 100644 --- a/editeng/source/accessibility/AccessibleParaManager.cxx +++ b/editeng/source/accessibility/AccessibleParaManager.cxx @@ -17,10 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include // Global header - - #include #include #include @@ -29,10 +28,7 @@ #include #include - // Project-local header - - #include #include @@ -116,8 +112,8 @@ namespace accessibility bool AccessibleParaManager::IsReferencable( sal_Int32 nChild ) const { -DBG_ASSERT( 0 <= nChild && maChildren.size() > o3tl::make_unsigned(nChild), -"AccessibleParaManager::IsReferencable: invalid index" ); +assert(0 <= nChild && maChildren.size() > o3tl::make_unsigned(nChild) + && "AccessibleParaManager::IsReferencable: invalid index"); if( 0 <= nChild && maChildren.size() > o3tl::make_unsigned(nChild) ) {
core.git: editeng/source
editeng/source/uno/unotext.cxx |8 1 file changed, 4 insertions(+), 4 deletions(-) New commits: commit e211607dffe2986601359dcb1ef757fda3805fb3 Author: Mohit Marathe AuthorDate: Sun Mar 24 22:06:46 2024 +0530 Commit: Hossein CommitDate: Tue Apr 9 09:06:27 2024 +0200 tdf#42982: Improve UNO API error reporting Change-Id: If075965f2b020767b35692ea110ca768daf342c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165228 Tested-by: Jenkins Reviewed-by: Hossein diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx index 09a117d82123..b5f329e62050 100644 --- a/editeng/source/uno/unotext.cxx +++ b/editeng/source/uno/unotext.cxx @@ -314,7 +314,7 @@ uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextRangeBase::getStart() SvxUnoTextBase* pText = comphelper::getFromUnoTunnel( getText() ); if(pText == nullptr) -throw uno::RuntimeException(); +throw uno::RuntimeException("Failed to retrieve a valid text base object from the Uno Tunnel"); rtl::Reference pRange = new SvxUnoTextRange( *pText ); xRange = pRange; @@ -342,7 +342,7 @@ uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextRangeBase::getEnd() SvxUnoTextBase* pText = comphelper::getFromUnoTunnel( getText() ); if(pText == nullptr) -throw uno::RuntimeException(); +throw uno::RuntimeException("Failed to retrieve a valid text base object from the Uno Tunnel"); rtl::Reference pNew = new SvxUnoTextRange( *pText ); xRet = pNew; @@ -704,12 +704,12 @@ bool SvxUnoTextRangeBase::GetPropertyValueHelper( SfxItemSet const & rSet, cons { SfxItemState eState = rSet.GetItemState( EE_PARA_NUMBULLET ); if( eState != SfxItemState::SET && eState != SfxItemState::DEFAULT) -throw uno::RuntimeException(); +throw uno::RuntimeException("Invalid item state for paragraph numbering/bullet. Expected SET or DEFAULT."); const SvxNumBulletItem* pBulletItem = rSet.GetItem( EE_PARA_NUMBULLET ); if( pBulletItem == nullptr ) -throw uno::RuntimeException(); +throw uno::RuntimeException("Unable to retrieve paragraph numbering/bullet item."); aAny <<= SvxCreateNumRule( pBulletItem->GetNumRule() ); }
core.git: editeng/source sw/qa writerfilter/source
editeng/source/items/paraitem.cxx |2 sw/qa/extras/ooxmlexport/data/tdf160518_allowHyphenationAtTrackBottom.docx |binary sw/qa/extras/ooxmlexport/data/tdf160518_useWord2013TrackBottomHyphenation.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 64 ++ writerfilter/source/dmapper/DomainMapperTableHandler.cxx |3 writerfilter/source/dmapper/PropertyIds.cxx |1 writerfilter/source/dmapper/PropertyIds.hxx |1 writerfilter/source/dmapper/SettingsTable.cxx | 17 ++ writerfilter/source/dmapper/SettingsTable.hxx |2 9 files changed, 85 insertions(+), 5 deletions(-) New commits: commit c8ee0e8f581b8a6e41b1a6b8aa4d40b442c1d463 Author: László Németh AuthorDate: Thu Apr 4 14:08:23 2024 +0200 Commit: László Németh CommitDate: Thu Apr 4 22:46:12 2024 +0200 tdf160518 DOCX: import hyphenation-keep to fix layout To fix layout interoperability, import DOCX compatSettings allowHyphenationAtTrackBottom and useWord2013TrackBottomHyphenation as hyphenation-keep setting "COLUMN", shifting last hyphenated lines of pages and columns, like MSO does. Follow-up to commit 9574a62add8e4901405e12117e75c86c2d2c2f21 "tdf#132599 cui offapi sw xmloff: implement hyphenate-keep". Change-Id: Ib2a06efc22a4f30d8f8be8a752460b09d09e97a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165798 Tested-by: Jenkins Reviewed-by: László Németh diff --git a/editeng/source/items/paraitem.cxx b/editeng/source/items/paraitem.cxx index 3e99813f628d..4103fe2ea521 100644 --- a/editeng/source/items/paraitem.cxx +++ b/editeng/source/items/paraitem.cxx @@ -616,7 +616,7 @@ boolSvxHyphenZoneItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) con bool SvxHyphenZoneItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { nMemberId &= ~CONVERT_TWIPS; -sal_Int16 nNewVal = 0; +sal_Int32 nNewVal = 0; // sal_Int32 needs for MID_HYPHEN_KEEP if( nMemberId != MID_IS_HYPHEN && nMemberId != MID_HYPHEN_NO_CAPS && nMemberId != MID_HYPHEN_NO_LAST_WORD ) diff --git a/sw/qa/extras/ooxmlexport/data/tdf160518_allowHyphenationAtTrackBottom.docx b/sw/qa/extras/ooxmlexport/data/tdf160518_allowHyphenationAtTrackBottom.docx new file mode 100644 index ..61e81cf1f539 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf160518_allowHyphenationAtTrackBottom.docx differ diff --git a/sw/qa/extras/ooxmlexport/data/tdf160518_useWord2013TrackBottomHyphenation.docx b/sw/qa/extras/ooxmlexport/data/tdf160518_useWord2013TrackBottomHyphenation.docx new file mode 100644 index ..26acacc462b3 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf160518_useWord2013TrackBottomHyphenation.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index a045a03407ff..c33275b62394 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -28,6 +28,8 @@ #include #include #include +#include +#include #include #include @@ -1424,6 +1426,68 @@ DECLARE_OOXMLEXPORT_TEST(testTdf159032, "tdf124795-5.docx") CPPUNIT_ASSERT_EQUAL(57, getPages()); } +DECLARE_OOXMLEXPORT_TEST(testTdf160518, "tdf160518_useWord2013TrackBottomHyphenation.docx") +{ +uno::Reference xHyphenator = LinguMgr::GetHyphenator(); +if (!xHyphenator->hasLocale(lang::Locale("en", "US", OUString( +return; + +// TODO: fix export too +if (isExported()) +return; +// This was 2 (without shifting last hyphenated line of the page) +CPPUNIT_ASSERT_EQUAL(3, getPages()); +} + +DECLARE_OOXMLEXPORT_TEST(testTdf160518_compatible, "tdf160518_allowHyphenationAtTrackBottom.docx") +{ +uno::Reference xHyphenator = LinguMgr::GetHyphenator(); +if (!xHyphenator->hasLocale(lang::Locale("en", "US", OUString( +return; + +// TODO: fix export too +if (isExported()) +return; +// This is still 2 +CPPUNIT_ASSERT_EQUAL(2, getPages()); +} + +DECLARE_OOXMLEXPORT_TEST(testTdf160518_ODT, "tdf160518_useWord2013TrackBottomHyphenation.docx") +{ +uno::Reference xHyphenator = LinguMgr::GetHyphenator(); +if (!xHyphenator->hasLocale(lang::Locale("en", "US", OUString( +return; + +// TODO: fix export too +if (isExported()) +return; +// This was 2 (without shifting last hyphenated line of the page) +CPPUNIT_ASSERT_EQUAL(3, getPages()); + +// check compatibility option in ODT export/import, too +saveAndReload("writer8"); + +CPPUNIT_ASSERT_EQUAL(3, getPages()); +} + +DECLARE_OOXMLEXPORT_TEST(testTdf160518_ODT_compatible, "tdf160518_allowHyphenationAtTrackBo
core.git: editeng/source sw/source
editeng/source/editeng/impedit4.cxx |5 + sw/source/uibase/shells/textsh.cxx |9 ++--- 2 files changed, 11 insertions(+), 3 deletions(-) New commits: commit ec5898cb245c68cf116a22b3714408e4a96ee15d Author: Oliver Specht AuthorDate: Tue Mar 19 09:19:38 2024 +0100 Commit: Thorsten Behrens CommitDate: Thu Apr 4 17:27:02 2024 +0200 tdf#63259 cycle case on sentences Cycle case will be applied to the sentence if the cursor is at a sentence end. Writer now also keeps the word/sentence selection after case change. Change-Id: I9dd561775ac612689526bcb118533ba81b5722be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165018 Tested-by: Jenkins Tested-by: Gabor Kelemen Reviewed-by: Thorsten Behrens diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index b7e322b68ccd..b7d4be999016 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -2711,6 +2711,11 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, if ( !aSel.HasRange() ) { aSel = SelectWord( aSel, css::i18n::WordType::ANYWORD_IGNOREWHITESPACES, true, true ); +if (!aSel.HasRange() && aSel.Min().GetIndex() > 0 && + OUString(".!?").indexOf(aSel.Min().GetNode()->GetChar(aSel.Min().GetIndex() - 1)) > -1 ) +{ +aSel = SelectSentence(aSel); +} } // tdf#107176: if there's still no range, just return aSel diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx index 5c4713736081..1b1fb47fd1f3 100644 --- a/sw/source/uibase/shells/textsh.cxx +++ b/sw/source/uibase/shells/textsh.cxx @@ -885,10 +885,13 @@ void SwTextShell::ExecRotateTransliteration( SfxRequest const & rReq ) } else { -rSh.Push(); // save cur cursor -if ((rSh.IsEndWrd() || rSh.IsStartWord() || rSh.IsInWord()) && rSh.SelWrd()) +if (rSh.IsEndSentence()) +{ +rSh.BwdSentence(true); +rSh.TransliterateText(m_aRotateCase.getNextMode()); +} +else if ((rSh.IsEndWrd() || rSh.IsStartWord() || rSh.IsInWord()) && rSh.SelWrd()) rSh.TransliterateText(m_aRotateCase.getNextMode()); -rSh.Pop(SwCursorShell::PopMode::DeleteCurrent); } } }
core.git: editeng/source
editeng/source/editeng/ContentNode.cxx | 32 1 file changed, 24 insertions(+), 8 deletions(-) New commits: commit 5ebe81f068dba0c141ebe92f64731d0c95179dae Author: Tomaž Vajngerl AuthorDate: Mon Mar 25 16:28:39 2024 +0900 Commit: Tomaž Vajngerl CommitDate: Thu Apr 4 04:06:40 2024 +0200 editeng: make it ContentNode::FindFeature clearer Change-Id: Ia3498df3cb11b06ac71e3c75839cc98cc0f3d88c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165337 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/editeng/source/editeng/ContentNode.cxx b/editeng/source/editeng/ContentNode.cxx index a02a3fde0d39..08bf250b6c86 100644 --- a/editeng/source/editeng/ContentNode.cxx +++ b/editeng/source/editeng/ContentNode.cxx @@ -947,16 +947,20 @@ EditCharAttrib* CharAttribList::FindEmptyAttrib( sal_uInt16 nWhich, sal_Int32 nP return nullptr; } -namespace { +namespace +{ class FindByStartPos { sal_Int32 mnPos; public: -explicit FindByStartPos(sal_Int32 nPos) : mnPos(nPos) {} -bool operator() (const std::unique_ptr& r) const +explicit FindByStartPos(sal_Int32 nPos) +: mnPos(nPos) +{} + +bool operator() (std::unique_ptr const& pCharAttrib) const { -return r->GetStart() >= mnPos; +return pCharAttrib->GetStart() >= mnPos; } }; @@ -965,16 +969,28 @@ public: const EditCharAttrib* CharAttribList::FindFeature( sal_Int32 nPos ) const { // First, find the first attribute that starts at or after specified position. -AttribsType::const_iterator it = +AttribsType::const_iterator iterator = std::find_if(maAttribs.begin(), maAttribs.end(), FindByStartPos(nPos)); -if (it == maAttribs.end()) +if (iterator == maAttribs.end()) +{ // All attributes are before the specified position. return nullptr; +} // And find the first attribute with feature. -it = std::find_if(it, maAttribs.end(), [](const std::unique_ptr& aAttrib) { return aAttrib->IsFeature(); } ); -return it == maAttribs.end() ? nullptr : it->get(); +iterator = std::find_if(iterator, maAttribs.end(), [](const std::unique_ptr& aAttrib) { +return aAttrib->IsFeature(); +}); + +if (iterator == maAttribs.end()) +{ +// Couldn't find the feature +return nullptr; +} + +// Found +return iterator->get(); } void CharAttribList::DeleteEmptyAttribs()
core.git: editeng/source include/editeng oox/source sd/qa sd/source svx/source
editeng/source/editeng/impedit.hxx | 16 +++--- editeng/source/editeng/impedit3.cxx| 50 ++--- editeng/source/outliner/outliner.cxx |8 +-- include/editeng/editdata.hxx | 18 ++- oox/source/drawingml/textbodypropertiescontext.cxx |4 - oox/source/export/drawingml.cxx|4 - sd/qa/unit/TextFittingTest.cxx | 22 - sd/source/ui/dlg/NotesChildWindow.cxx |2 sd/source/ui/view/drtxtob.cxx |4 - svx/source/svdraw/svdotext.cxx | 22 - svx/source/svdraw/svdotextdecomposition.cxx|2 svx/source/unodraw/unoshape.cxx|8 +-- 12 files changed, 76 insertions(+), 84 deletions(-) New commits: commit a3daf52dd21ae03a8b04e1f9132a6713c9cc414f Author: Mike Kaganski AuthorDate: Tue Apr 2 11:16:30 2024 +0500 Commit: Mike Kaganski CommitDate: Wed Apr 3 16:41:59 2024 +0200 Base scale on 1.0, not on 100.0 Simplifies things by avoiding many repeated multiplications / divisions by 100 during calculations. Change-Id: Ib063d343549139c8d83e5b06570dc61f39ea0df6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165666 Tested-by: Mike Kaganski Reviewed-by: Mike Kaganski diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index e09712f74bad..07f6af002358 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -780,34 +780,34 @@ private: double scaleXSpacingValue(tools::Long nXValue) const { -if (!maStatus.DoStretch() || maScalingParameters.fSpacingX == 100.0) +if (!maStatus.DoStretch() || maScalingParameters.fSpacingX == 1.0) return nXValue; -return double(nXValue) * (maScalingParameters.fSpacingX / 100.0); +return double(nXValue) * maScalingParameters.fSpacingX; } double scaleYSpacingValue(sal_uInt16 nYValue) const { -if (!maStatus.DoStretch() || maScalingParameters.fSpacingY == 100.0) +if (!maStatus.DoStretch() || maScalingParameters.fSpacingY == 1.0) return nYValue; -return double(nYValue) * (maScalingParameters.fSpacingY / 100.0); +return double(nYValue) * maScalingParameters.fSpacingY; } double scaleXFontValue(tools::Long nXValue) const { -if (!maStatus.DoStretch() || (maScalingParameters.fFontX == 100.0)) +if (!maStatus.DoStretch() || (maScalingParameters.fFontX == 1.0)) return nXValue; -return double(nXValue) * (maScalingParameters.fFontX / 100.0); +return double(nXValue) * maScalingParameters.fFontX; } double scaleYFontValue(sal_uInt16 nYValue) const { -if (!maStatus.DoStretch() || (maScalingParameters.fFontY == 100.0)) +if (!maStatus.DoStretch() || (maScalingParameters.fFontY == 1.0)) return nYValue; -return double(nYValue) * (maScalingParameters.fFontY / 100.0); +return double(nYValue) * maScalingParameters.fFontY; } void setRoundToNearestPt(bool bRound) { mbRoundToNearestPt = bRound; } diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index a2dee889aa63..75fe99e684ee 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -447,19 +447,19 @@ namespace { constexpr std::array constScaleLevels = { -ScalingParameters{100.0, 100.0, 100.0, 90.0 }, -ScalingParameters{ 92.5, 92.5, 100.0, 90.0 }, -ScalingParameters{ 92.5, 92.5, 100.0, 80.0 }, -ScalingParameters{ 85.0, 85.0, 100.0, 90.0 }, -ScalingParameters{ 85.0, 85.0, 100.0, 80.0 }, -ScalingParameters{ 77.5, 77.5, 100.0, 80.0 }, -ScalingParameters{ 70.0, 70.0, 100.0, 80.0 }, -ScalingParameters{ 62.5, 62.5, 100.0, 80.0 }, -ScalingParameters{ 55.0, 55.0, 100.0, 80.0 }, -ScalingParameters{ 47.5, 47.5, 100.0, 80.0 }, -ScalingParameters{ 40.0, 40.0, 100.0, 80.0 }, -ScalingParameters{ 32.5, 32.5, 100.0, 80.0 }, -ScalingParameters{ 25.0, 25.0, 100.0, 80.0 }, +ScalingParameters{ 1.000, 1.000, 1.0, 0.9 }, +ScalingParameters{ 0.925, 0.925, 1.0, 0.9 }, +ScalingParameters{ 0.925, 0.925, 1.0, 0.8 }, +ScalingParameters{ 0.850, 0.850, 1.0, 0.9 }, +ScalingParameters{ 0.850, 0.850, 1.0, 0.8 }, +ScalingParameters{ 0.775, 0.775, 1.0, 0.8 }, +ScalingParameters{ 0.700, 0.700, 1.0, 0.8 }, +ScalingParameters{ 0.625, 0.625, 1.0, 0.8 }, +ScalingParameters{ 0.550, 0.550, 1.0, 0.8 }, +ScalingParameters{ 0.475, 0.475, 1.0, 0.8 }, +ScalingParameters{ 0.400, 0.400, 1.0, 0.8 }, +ScalingParameters{ 0.325, 0.325, 1.0, 0.8 }, +ScalingParameters{ 0.250, 0.250, 1.0, 0.8 }, }; } // end anonymous ns @@ -1069,8 +1069,8 @@ bool ImpEditEngin
core.git: editeng/source include/editeng sd/qa sd/source svx/source
editeng/source/editeng/editeng.cxx | 28 ++--- editeng/source/editeng/impedit.hxx | 41 editeng/source/editeng/impedit2.cxx |4 - editeng/source/editeng/impedit3.cxx | 57 editeng/source/editeng/impedit4.cxx | 12 +++-- editeng/source/outliner/outlin2.cxx | 15 +++ editeng/source/outliner/outliner.cxx| 14 ++ include/editeng/editdata.hxx| 16 +++ include/editeng/editeng.hxx |9 +--- include/editeng/outliner.hxx|9 +++- sd/qa/unit/TextFittingTest.cxx | 12 ++--- sd/source/ui/dlg/NotesChildWindow.cxx |2 sd/source/ui/view/drtxtob.cxx |2 svx/source/svdraw/svdotext.cxx | 24 --- svx/source/svdraw/svdotextdecomposition.cxx |4 + svx/source/svdraw/svdoutl.cxx |2 16 files changed, 116 insertions(+), 135 deletions(-) New commits: commit 4bdbf0f898e8642b0a34195537d1516cc8eee819 Author: Tomaž Vajngerl AuthorDate: Mon Apr 1 20:12:09 2024 +0900 Commit: Tomaž Vajngerl CommitDate: Tue Apr 2 05:48:41 2024 +0200 editeng: combine scaling parameters into ScalingParameters struct This makes dealing with scaling parameters much clearer and it improves readability. Change-Id: I327b6530ef5587972cc0075390704754a33563a9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165632 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index 2493325ac578..7f13edfcf1be 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -2229,35 +2229,19 @@ bool EditEngine::HasText( const SvxSearchItem& rSearchItem ) return getImpl().HasText(rSearchItem); } -void EditEngine::setGlobalScale(double fFontScaleX, double fFontScaleY, double fSpacingScaleX, double fSpacingScaleY) +ScalingParameters EditEngine::getScalingParameters() const { -getImpl().setScale(fFontScaleX, fFontScaleY, fSpacingScaleX, fSpacingScaleY); +return getImpl().getScalingParameters(); } -void EditEngine::getGlobalSpacingScale(double& rX, double& rY) const +void EditEngine::resetScalingParameters() { -getImpl().getSpacingScale(rX, rY); +getImpl().resetScalingParameters(); } -basegfx::B2DTuple EditEngine::getGlobalSpacingScale() const +void EditEngine::setScalingParameters(ScalingParameters const& rScalingParameters) { -double x = 0.0; -double y = 0.0; -getImpl().getSpacingScale(x, y); -return {x, y}; -} - -void EditEngine::getGlobalFontScale(double& rX, double& rY) const -{ -getImpl().getFontScale(rX, rY); -} - -basegfx::B2DTuple EditEngine::getGlobalFontScale() const -{ -double x = 0.0; -double y = 0.0; -getImpl().getFontScale(x, y); -return {x, y}; +getImpl().setScalingParameters(rScalingParameters); } void EditEngine::setRoundFontSizeToPt(bool bRound) diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index cc469fc867a2..a694196dbade 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -571,10 +571,7 @@ private: Color maBackgroundColor; -double mfFontScaleX; -double mfFontScaleY; -double mfSpacingScaleX; -double mfSpacingScaleY; +ScalingParameters maScalingParameters; bool mbRoundToNearestPt; CharCompressType mnAsianCompressionMode; @@ -781,34 +778,34 @@ private: double scaleXSpacingValue(tools::Long nXValue) const { -if (!maStatus.DoStretch() || mfSpacingScaleX == 100.0) +if (!maStatus.DoStretch() || maScalingParameters.fSpacingX == 100.0) return nXValue; -return double(nXValue) * mfSpacingScaleX / 100.0; +return double(nXValue) * (maScalingParameters.fSpacingX / 100.0); } double scaleYSpacingValue(sal_uInt16 nYValue) const { -if (!maStatus.DoStretch() || mfSpacingScaleY == 100.0) +if (!maStatus.DoStretch() || maScalingParameters.fSpacingY == 100.0) return nYValue; -return double(nYValue) * mfSpacingScaleY / 100.0; +return double(nYValue) * (maScalingParameters.fSpacingY / 100.0); } -double scaleYFontValue(sal_uInt16 nYValue) const +double scaleXFontValue(tools::Long nXValue) const { -if (!maStatus.DoStretch() || (mfFontScaleY == 100.0)) -return nYValue; +if (!maStatus.DoStretch() || (maScalingParameters.fFontX == 100.0)) +return nXValue; -return double(nYValue) * mfFontScaleY / 100.0; +return double(nXValue) * (maScalingParameters.fFontX / 100.0); } -double scaleXFontValue(tools::Long nXValue) const +double scaleYFontValue(sal_uInt16 nYValue) const { -if (!maStatus.DoStretch() || (mfFontSca
core.git: editeng/source
editeng/source/editeng/impedit.cxx |1 - 1 file changed, 1 deletion(-) New commits: commit f3bbb442e2a9482e9a8e951d956baed08a06b944 Author: Tomaž Vajngerl AuthorDate: Mon Mar 25 15:35:22 2024 +0900 Commit: Tomaž Vajngerl CommitDate: Mon Mar 25 10:08:18 2024 +0100 editeng: fix unintended duplication of the line Change-Id: I90f787cc504d46d32581caa1f0b1c7b9e86968a9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165265 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index c43bdfca21a1..94d707cf902e 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -1603,7 +1603,6 @@ Pair ImpEditView::Scroll( tools::Long ndX, tools::Long ndY, ScrollRangeCheck nRa // rectangle ... maVisDocStartPos = rOutDev.LogicToPixel(maVisDocStartPos); maVisDocStartPos = rOutDev.PixelToLogic(maVisDocStartPos); -maVisDocStartPos = rOutDev.PixelToLogic(maVisDocStartPos); tools::Rectangle aRect(maOutputArea); if (mpOutputWindow)
core.git: editeng/source
editeng/source/outliner/outlvw.cxx |7 +++ 1 file changed, 7 insertions(+) New commits: commit f3f3ea4cc9c3bec761d095fbfefd6ba8724fcdef Author: Gülşah Köse AuthorDate: Thu Mar 14 09:09:51 2024 +0300 Commit: Mike Kaganski CommitDate: Fri Mar 15 12:12:51 2024 +0100 tdf#160213 Don't let insert empty line with numbering, end numbering We applied the writer's empty bullet line policy to impres. Now We don't let insert empty bullet lines in impress too. Instead we end numbering and start to write normal paragraph at the same line. Signed-off-by: Gülşah Köse Change-Id: I28042d9db59b5622434da0826f8b760f01ad64f9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164799 Reviewed-by: Mike Kaganski Tested-by: Mike Kaganski diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index e3e28207d11e..cd01503731eb 100644 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -189,6 +189,13 @@ bool OutlinerView::PostKeyEvent( const KeyEvent& rKEvt, vcl::Window const * pFra if( !aKeyCode.IsShift() ) { +// Don't let insert empty paragraph with numbering. Instead end numbering. +if (pPara->GetDepth() > -1 && +pOwner->pEditEngine->GetTextLen( aSel.nEndPara ) == 0) +{ +ToggleBullets(); +return true; +} // ImpGetCursor again??? if( !bSelection && aSel.nEndPos == pOwner->pEditEngine->GetTextLen( aSel.nEndPara ) )
core.git: editeng/source include/svl sc/source svx/source sw/source
editeng/source/editeng/impedit5.cxx |2 - include/svl/hint.hxx|2 + sc/source/ui/condformat/condformatdlgentry.cxx |4 +- sc/source/ui/condformat/condformateasydlg.cxx |3 +- sc/source/ui/docshell/docsh4.cxx| 21 +++ svx/source/sdr/properties/attributeproperties.cxx |1 svx/source/sdr/properties/customshapeproperties.cxx |4 ++ svx/source/sdr/properties/textproperties.cxx| 28 +--- svx/source/tbxctrls/StylesPreviewWindow.cxx |3 +- sw/source/uibase/app/docstyle.cxx |6 ++-- 10 files changed, 40 insertions(+), 34 deletions(-) New commits: commit 9c5fda14fff397d5d503f749ad019791d7e4ef83 Author: Noel Grandin AuthorDate: Wed Mar 6 16:20:41 2024 +0200 Commit: Noel Grandin CommitDate: Thu Mar 7 06:52:22 2024 +0100 tdf#158773 reduce dynamic_cast'ing in CustomShapeProperties::Notify shaves 2% off the load time Change-Id: I579825bd6101b57a44b0f3118ede17ec2393d9d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164477 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx index 0469d43235d0..6b1a303ae8da 100644 --- a/editeng/source/editeng/impedit5.cxx +++ b/editeng/source/editeng/impedit5.cxx @@ -152,7 +152,7 @@ void ImpEditEngine::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SfxStyleSheet* pStyle = static_cast( pStyleSheetHint->GetStyleSheet() ); RemoveStyleFromParagraphs( pStyle ); } -else if ( nId == SfxHintId::StyleSheetModified ) +else if ( nId == SfxHintId::StyleSheetModified || nId == SfxHintId::StyleSheetModifiedExtended ) { const SfxStyleSheetHint* pStyleSheetHint = static_cast(&rHint); SfxStyleSheet* pStyle = static_cast( pStyleSheetHint->GetStyleSheet() ); diff --git a/include/svl/hint.hxx b/include/svl/hint.hxx index ec0c7b1d9872..860ea4219c56 100644 --- a/include/svl/hint.hxx +++ b/include/svl/hint.hxx @@ -104,6 +104,7 @@ enum class SfxHintId { // SFX stylesheet StyleSheetCreated, // new StyleSheetModified, // changed +StyleSheetModifiedExtended, // changed, but using the SfxStyleSheetModifiedHint, not the SfxStyleSheetHint StyleSheetChanged, // erased and re-created (replaced) StyleSheetErased, // erased StyleSheetInDestruction, // in the process of being destructed @@ -229,6 +230,7 @@ inline std::basic_ostream & operator <<( case SfxHintId::ScAccWindowResized: return stream << "ScAccWindowResized"; case SfxHintId::StyleSheetCreated: return stream << "StyleSheetCreated"; case SfxHintId::StyleSheetModified: return stream << "StyleSheetModified"; +case SfxHintId::StyleSheetModifiedExtended: return stream << "StyleSheetModifiedExtended"; case SfxHintId::StyleSheetChanged: return stream << "StyleSheetChanged"; case SfxHintId::StyleSheetErased: return stream << "StyleSheetErased"; case SfxHintId::StyleSheetInDestruction: return stream << "StyleSheetInDestruction"; diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx index ade0cede7cef..860e8c225150 100644 --- a/sc/source/ui/condformat/condformatdlgentry.cxx +++ b/sc/source/ui/condformat/condformatdlgentry.cxx @@ -419,7 +419,7 @@ void UpdateStyleList(weld::ComboBox& rLbStyle, const ScDocument* pDoc) void ScConditionFrmtEntry::Notify(SfxBroadcaster&, const SfxHint& rHint) { -if(rHint.GetId() == SfxHintId::StyleSheetModified) +if(rHint.GetId() == SfxHintId::StyleSheetModified || rHint.GetId() == SfxHintId::StyleSheetModifiedExtended) { if(!mbIsInStyleCreate) UpdateStyleList(*mxLbStyle, mpDoc); @@ -1282,7 +1282,7 @@ void ScDateFrmtEntry::SetInactive() void ScDateFrmtEntry::Notify( SfxBroadcaster&, const SfxHint& rHint ) { -if(rHint.GetId() == SfxHintId::StyleSheetModified) +if(rHint.GetId() == SfxHintId::StyleSheetModified || rHint.GetId() == SfxHintId::StyleSheetModifiedExtended) { if(!mbIsInStyleCreate) UpdateStyleList(*mxLbStyle, mpDoc); diff --git a/sc/source/ui/condformat/condformateasydlg.cxx b/sc/source/ui/condformat/condformateasydlg.cxx index a368ec310c7d..ba28d1e687dd 100644 --- a/sc/source/ui/condformat/condformateasydlg.cxx +++ b/sc/source/ui/condformat/condformateasydlg.cxx @@ -154,7 +154,8 @@ ConditionalFormatEasyDialog::~ConditionalFormatEasyDialog() {} void ConditionalFormatEasyDialog::Notify(SfxBroadcaster&, const SfxHint& rHint) { -if (rHint.GetId() == SfxHintId::StyleSheetModified) +if (rHint.GetId() == SfxHintId::StyleSheetModified +|| rHint.GetId() == SfxHintId::StyleSheetModifiedExtended) UpdateStyleList(mpDocument, *mxStyles); } diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshel
core.git: editeng/source include/editeng sc/source sd/source svx/source sw/source
editeng/source/editeng/editobj.cxx | 14 ++ editeng/source/editeng/editobj2.hxx |2 ++ editeng/source/outliner/overflowingtxt.cxx |2 +- include/editeng/editobj.hxx |4 sc/source/filter/xcl97/xcl97rec.cxx |3 +-- sc/source/ui/Accessibility/AccessiblePageHeader.cxx |2 +- sc/source/ui/view/viewfunc.cxx |2 +- sd/source/filter/ppt/pptinanimations.cxx|2 +- svx/source/svdraw/svdotxat.cxx | 19 +-- svx/source/table/cell.cxx |2 +- sw/source/uibase/docvw/AnnotationWin.cxx|2 +- 11 files changed, 36 insertions(+), 18 deletions(-) New commits: commit 6f8073caf0d6b331232f6edb5f18d14ddefdb465 Author: Noel Grandin AuthorDate: Wed Mar 6 09:43:28 2024 +0200 Commit: Noel Grandin CommitDate: Wed Mar 6 13:00:19 2024 +0100 tdf#158773 reduce cost of ContentInfo::GetText The specific path that is showing up on the perf profile is SdrTextObj::HasText -> EditTextObjectImpl::GetText -> ContentInfo::GetText Reduce the cost by 10% there by adding a method to check if we have text, and avoid the cost of constructing an OUString from an svl::SharedString. Also make use of the new method in places. Change-Id: Ibc2e0f61c4a2a6c33eea7f2cce09d692d82fd2b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164449 Tested-by: Noel Grandin Reviewed-by: Noel Grandin diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx index 762cac112ddb..9b17e434e53d 100644 --- a/editeng/source/editeng/editobj.cxx +++ b/editeng/source/editeng/editobj.cxx @@ -126,6 +126,12 @@ OUString ContentInfo::GetText() const return OUString(p); } +sal_Int32 ContentInfo::GetTextLen() const +{ +const rtl_uString* p = maText.getData(); +return p->length; +} + void ContentInfo::SetText( const OUString& rStr ) { maText = svl::SharedString(rStr.pData, nullptr); @@ -392,6 +398,14 @@ OUString EditTextObjectImpl::GetText(sal_Int32 nPara) const return maContents[nPara]->GetText(); } +sal_Int32 EditTextObjectImpl::GetTextLen(sal_Int32 nPara ) const +{ +if (nPara < 0 || o3tl::make_unsigned(nPara) >= maContents.size()) +return 0; + +return maContents[nPara]->GetTextLen(); +} + void EditTextObjectImpl::ClearPortionInfo() { mpPortionInfo.reset(); diff --git a/editeng/source/editeng/editobj2.hxx b/editeng/source/editeng/editobj2.hxx index fd1f1437e910..4392022b77a3 100644 --- a/editeng/source/editeng/editobj2.hxx +++ b/editeng/source/editeng/editobj2.hxx @@ -140,6 +140,7 @@ public: const svl::SharedString& GetSharedString() const { return maText;} OUString GetText() const; void SetText( const OUString& rStr ); +sal_Int32 GetTextLen() const; void dumpAsXml(xmlTextWriterPtr pWriter) const; @@ -225,6 +226,7 @@ public: virtual sal_Int32 GetParagraphCount() const override; virtual OUString GetText(sal_Int32 nParagraph) const override; +virtual sal_Int32 GetTextLen(sal_Int32 nParagraph) const override; virtual void ClearPortionInfo() override; diff --git a/editeng/source/outliner/overflowingtxt.cxx b/editeng/source/outliner/overflowingtxt.cxx index 8346f432b41b..0a17cd609100 100644 --- a/editeng/source/outliner/overflowingtxt.cxx +++ b/editeng/source/outliner/overflowingtxt.cxx @@ -45,7 +45,7 @@ std::optional TextChainingUtils::JuxtaposeParaObject( // Special case: if only empty text remove it at the end bool bOnlyOneEmptyPara = !pNextPObj || (pOutl->GetParagraphCount() == 1 && - pNextPObj->GetTextObject().GetText(0).isEmpty()); + !pNextPObj->GetTextObject().HasText(0)); EditEngine &rEditEngine = const_cast(pOutl->GetEditEngine()); diff --git a/include/editeng/editobj.hxx b/include/editeng/editobj.hxx index 5badaf8e8a2a..b78b1a918b27 100644 --- a/include/editeng/editobj.hxx +++ b/include/editeng/editobj.hxx @@ -87,6 +87,10 @@ public: virtual OUString GetText(sal_Int32 nPara) const = 0; +virtual sal_Int32 GetTextLen(sal_Int32 nPara) const = 0; + +bool HasText(sal_Int32 nPara) const { return GetTextLen(nPara) > 0; } + virtual void ClearPortionInfo() = 0; virtual bool HasOnlineSpellErrors() const = 0; diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index 65facba4b739..8abe7dc68372 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -921,8 +921,7 @@ XclTxo::XclTxo( const XclExpRoot& rRoot, const EditTextObject& rEditObj, SdrObje // Excel has one alignment per NoteObject while Calc supports // one alignment per paragraph - use the first paragraph // alignment (if set) as our overall alignment. -
core.git: editeng/source include/editeng sc/source
editeng/source/editeng/editstt2.hxx |3 --- editeng/source/editeng/impedit.hxx |2 -- editeng/source/editeng/impedit2.cxx |3 +-- editeng/source/editeng/impedit3.cxx | 35 --- include/editeng/editstat.hxx|9 - sc/source/core/data/column2.cxx | 20 sc/source/ui/app/inputhdl.cxx | 15 --- sc/source/ui/view/output2.cxx |2 -- 8 files changed, 5 insertions(+), 84 deletions(-) New commits: commit b60048cbd7ac033294155f23d27bd446124b64fd Author: Caolán McNamara AuthorDate: Wed Feb 28 10:03:59 2024 + Commit: Caolán McNamara CommitDate: Wed Feb 28 12:46:47 2024 +0100 drop EEControlBits::FORMAT100 FORMAT100 is only used by calc (since #i51508#) and looks to me as a workaround for the same fundamental issue addressed by contemporary resolution independent text layout and rendering. Change-Id: Ifd0a0adaff717da97bb94d9f81e14c65f3213d34 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164084 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/editeng/source/editeng/editstt2.hxx b/editeng/source/editeng/editstt2.hxx index 09e7f02e1831..8cc09ff5dbe0 100644 --- a/editeng/source/editeng/editstt2.hxx +++ b/editeng/source/editeng/editstt2.hxx @@ -88,9 +88,6 @@ public: boolDoAutoComplete() const { return bool( nControlBits & EEControlBits::AUTOCOMPLETE ); } -boolDoFormat100() const -{ return bool( nControlBits & EEControlBits::FORMAT100 ); } - boolULSpaceSummation() const { return bool( nControlBits & EEControlBits::ULSPACESUMMATION ); } diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index 31f9b156962c..41803a52eb64 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -718,8 +718,6 @@ private: EditPaM ImpFastInsertText( EditPaM aPaM, const OUString& rStr ); EditPaM ImpFastInsertParagraph( sal_Int32 nPara ); -boolImpCheckRefMapMode(); - boolImplHasText() const; voidImpFindKashidas( ContentNode* pNode, sal_Int32 nStart, sal_Int32 nEnd, std::vector& rArray ); diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 77e3933c085f..b6dfc01f1e5b 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -137,8 +137,7 @@ ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* pItemPool ) : { maStatus.GetControlWord() = EEControlBits::USECHARATTRIBS | EEControlBits::DOIDLEFORMAT | EEControlBits::PASTESPECIAL | EEControlBits::UNDOATTRIBS | -EEControlBits::ALLOWBIGOBJS | EEControlBits::RTFSTYLESHEETS | -EEControlBits::FORMAT100; +EEControlBits::ALLOWBIGOBJS | EEControlBits::RTFSTYLESHEETS; maSelEngine.SetFunctionSet(&maSelFuncSet); diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 0c8b9bae8223..e5816803f7ce 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -413,7 +413,6 @@ void ImpEditEngine::FormatDoc() bool bGrow = false; // Here already, so that not always in CreateLines... -bool bMapChanged = ImpCheckRefMapMode(); sal_Int32 nParaCount = GetParaPortions().Count(); o3tl::sorted_vector aRepaintParas; aRepaintParas.reserve(nParaCount); @@ -506,37 +505,9 @@ void ImpEditEngine::FormatDoc() mbIsFormatting = false; mbFormatted = true; -if ( bMapChanged ) -GetRefDevice()->Pop(); - CallStatusHdl();// If Modified... } -bool ImpEditEngine::ImpCheckRefMapMode() -{ -bool bChange = false; - -if ( maStatus.DoFormat100() ) -{ -MapMode aMapMode( GetRefDevice()->GetMapMode() ); -if ( aMapMode.GetScaleX().GetNumerator() != aMapMode.GetScaleX().GetDenominator() ) -bChange = true; -else if ( aMapMode.GetScaleY().GetNumerator() != aMapMode.GetScaleY().GetDenominator() ) -bChange = true; - -if ( bChange ) -{ -Fraction Scale1( 1, 1 ); -aMapMode.SetScaleX( Scale1 ); -aMapMode.SetScaleY( Scale1 ); -GetRefDevice()->Push(); -GetRefDevice()->SetMapMode( aMapMode ); -} -} - -return bChange; -} - void ImpEditEngine::CheckAutoPageSize() { Size aPrevPaperSize( GetPaperSize() ); @@ -705,9 +676,6 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) // Initialization... -// Always format for 100%: -bool bMapChanged = ImpCheckRefMapMode(); - if (rParaPortion.GetLines().Count() == 0) { rParaPortion.GetLines().Append(std::make_un
core.git: editeng/source include/editeng
editeng/source/editeng/editstt2.hxx |4 +++- editeng/source/editeng/impedit3.cxx |6 +++--- include/editeng/editstat.hxx|5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) New commits: commit 57ac7b73e898cf8889819d7f3beb3608e61b179b Author: Attila Szűcs AuthorDate: Wed Feb 21 10:57:14 2024 +0100 Commit: Caolán McNamara CommitDate: Wed Feb 21 15:13:32 2024 +0100 tdf#67347 fix regression stacked text in calc Added a new element (STACKED) to EEControlBits. It would be better to use only ONECHARPERLINE, but calc and impress used it from different places, and couldn't recognise each other, so they may overwrite each other. With this fix they both set a separate flag, and editeng check if any of the flags are set. regression was made by: I535da45e3a2f2d1550bad2a40e9909e0d561d0ef Change-Id: I60496059f3ce2773b232970bf2c3b7264ce64c5b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163682 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/editeng/source/editeng/editstt2.hxx b/editeng/source/editeng/editstt2.hxx index 334622b23495..09e7f02e1831 100644 --- a/editeng/source/editeng/editstt2.hxx +++ b/editeng/source/editeng/editstt2.hxx @@ -47,7 +47,9 @@ public: { return bool( nControlBits & EEControlBits::UNDOATTRIBS ); } boolOneCharPerLine() const -{ return bool( nControlBits & EEControlBits::ONECHARPERLINE ); } +{ +return bool(nControlBits & (EEControlBits::ONECHARPERLINE | EEControlBits::STACKED)); +} boolIsOutliner() const { return bool( nControlBits & EEControlBits::OUTLINER ); } diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 8bbcebcebf2a..0c8b9bae8223 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -695,13 +695,13 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) return false; } -//If the paragraph SvxFrameDirection is Stacked, use ONECHARPERLINE +//If the paragraph SvxFrameDirection is Stacked, use STACKED const SvxFrameDirectionItem* pFrameDirItem = &GetParaAttrib(nPara, EE_PARA_WRITINGDIR); bool bStacked = pFrameDirItem->GetValue() == SvxFrameDirection::Stacked; if (bStacked) -maStatus.TurnOnFlags(EEControlBits::ONECHARPERLINE); +maStatus.TurnOnFlags(EEControlBits::STACKED); else -maStatus.TurnOffFlags(EEControlBits::ONECHARPERLINE); +maStatus.TurnOffFlags(EEControlBits::STACKED); // Initialization... diff --git a/include/editeng/editstat.hxx b/include/editeng/editstat.hxx index 29653d5eec4f..4e839254df1c 100644 --- a/include/editeng/editstat.hxx +++ b/include/editeng/editstat.hxx @@ -32,7 +32,7 @@ enum class EEControlBits PASTESPECIAL = 0x0010, // Allow PasteSpecial AUTOINDENTING = 0x0020, // Automatic indenting UNDOATTRIBS= 0x0040, // Undo for Attributes... -ONECHARPERLINE = 0x0080, // One character per line +ONECHARPERLINE = 0x0080, // One character per line (used in calc) NOCOLORS = 0x0100, // Engine: No Color OUTLINER = 0x0200, // Special treatment Outliner/Outline mode OUTLINER2 = 0x0400, // Special treatment Outliner/Page @@ -51,10 +51,11 @@ enum class EEControlBits FORMAT100 = 0x0100, // Always format to 100% ULSPACESUMMATION = 0x0200, // MS Compat: sum SA and SB, not maximum value SINGLELINE = 0x0400, // One line for all text +STACKED= 0x0800, // Same as ONECHARPERLINE (used in impress) }; namespace o3tl { -template<> struct typed_flags : is_typed_flags {}; +template<> struct typed_flags : is_typed_flags {}; } enum class EVControlBits
core.git: editeng/source
editeng/source/misc/svxacorr.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 95017739a05c4f515fc42caebfd1e01e8a9ba160 Author: Oliver Specht AuthorDate: Tue Feb 20 15:38:36 2024 +0100 Commit: Thorsten Behrens CommitDate: Wed Feb 21 15:03:42 2024 +0100 tdf#159797 replace dash also between sentences Autocorrection replaces " - " with " " also after dot, question mark and exclamation mark. Change-Id: Iad4b6c6073ab90b0c86514b8683dd2a07197f59d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163659 Tested-by: Jenkins Reviewed-by: Thorsten Behrens diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 30c598594f5d..a33d4f77ab67 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -614,7 +614,7 @@ bool SvxAutoCorrect::FnChgToEnEmDash( sImplEndSkipChars,(cCh = rTxt[ --n ])); ) ; // found: "[A-z0-9][] - [][A-z0-9] -if( rCC.isLetterNumeric( OUString(cCh) )) +if (rCC.isLetterNumeric(OUString(cCh)) || lcl_IsInArr(u".!?", cCh)) { rDoc.Delete( nTmpPos, nTmpPos + nLen ); rDoc.Insert( nTmpPos, bAlwaysUseEmDash ? sEmDash : sEnDash );
core.git: editeng/source include/editeng
editeng/source/editeng/impedit3.cxx |4 ++-- editeng/source/items/svxfont.cxx|4 ++-- include/editeng/svxfont.hxx |2 +- 3 files changed, 5 insertions(+), 5 deletions(-) New commits: commit 684d63e133fddeca68055a83d85f75bd73319d39 Author: Attila Szűcs AuthorDate: Tue Feb 20 03:19:09 2024 +0100 Commit: Caolán McNamara CommitDate: Tue Feb 20 18:38:00 2024 +0100 tdf#67347 fix stacked text kern problems Disabled some kerning calculations in case of stacked text. Without this: -x position of characters was strange, and the last characters was different. -thin characters, like 'j', 'i', ' ', ... could result issues at editing the text. (if width of character + kern was < 0) Change-Id: I40a23ef445fc9683a1cfd619ea23f1536c525d1c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163608 Tested-by: Jenkins Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index b54e1328a0ac..8bbcebcebf2a 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -1249,14 +1249,14 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) if (bContinueLastPortion) { - Size aSize = aTmpFont.QuickGetTextSize( GetRefDevice(), rParaPortion.GetNode()->GetString(), nTmpPos, nPortionLen, &aCharPositionArray); + Size aSize = aTmpFont.QuickGetTextSize( GetRefDevice(), rParaPortion.GetNode()->GetString(), nTmpPos, nPortionLen, &aCharPositionArray, bStacked); pPortion->adjustSize(aSize.Width(), 0); if (pPortion->GetSize().Height() < aSize.Height()) pPortion->setHeight(aSize.Height()); } else { -Size aSize = aTmpFont.QuickGetTextSize(GetRefDevice(), rParaPortion.GetNode()->GetString(), nTmpPos, nPortionLen, &aCharPositionArray); +Size aSize = aTmpFont.QuickGetTextSize(GetRefDevice(), rParaPortion.GetNode()->GetString(), nTmpPos, nPortionLen, &aCharPositionArray, bStacked); pPortion->SetSize(aSize); } diff --git a/editeng/source/items/svxfont.cxx b/editeng/source/items/svxfont.cxx index 876bc06868f8..a4367de4680e 100644 --- a/editeng/source/items/svxfont.cxx +++ b/editeng/source/items/svxfont.cxx @@ -442,7 +442,7 @@ Size SvxFont::GetPhysTxtSize( const OutputDevice *pOut ) } Size SvxFont::QuickGetTextSize( const OutputDevice *pOut, const OUString &rTxt, - const sal_Int32 nIdx, const sal_Int32 nLen, KernArray* pDXArray ) const + const sal_Int32 nIdx, const sal_Int32 nLen, KernArray* pDXArray, bool bStacked ) const { if ( !IsCaseMap() && !IsFixKerning() ) { @@ -477,7 +477,7 @@ Size SvxFont::QuickGetTextSize( const OutputDevice *pOut, const OUString &rTxt, } SAL_INFO( "editeng.quicktextsize", "SvxFont::QuickGetTextSize after GetTextArray(): Text length: " << nLen << " Text size: " << aTxtSize.Width() << "x" << aTxtSize.Height()); -if( IsFixKerning() && ( nLen > 1 ) ) +if( IsFixKerning() && ( nLen > 1 ) && !bStacked) { auto nKern = GetFixKerning(); tools::Long nOldValue = (*pDXArray)[0]; diff --git a/include/editeng/svxfont.hxx b/include/editeng/svxfont.hxx index a86e2097f80a..126b56f8f65f 100644 --- a/include/editeng/svxfont.hxx +++ b/include/editeng/svxfont.hxx @@ -101,7 +101,7 @@ public: Size QuickGetTextSize( const OutputDevice *pOut, const OUString &rTxt, const sal_Int32 nIdx, const sal_Int32 nLen, - KernArray* pDXArray = nullptr ) const; + KernArray* pDXArray = nullptr, bool bStacked = false ) const; void DrawPrev( OutputDevice* pOut, Printer* pPrinter, const Point &rPos, const OUString &rTxt,
core.git: editeng/source include/o3tl o3tl/qa sw/inc sw/source xmloff/source
editeng/source/misc/svxacorr.cxx |2 include/o3tl/sorted_vector.hxx | 140 - o3tl/qa/test-sorted_vector.cxx | 18 +- sw/inc/docary.hxx |2 sw/inc/edglbldc.hxx|2 sw/inc/ndarr.hxx |4 sw/source/core/doc/docredln.cxx|2 sw/source/core/doc/doctxm.cxx |4 sw/source/core/docnode/ndnum.cxx |8 sw/source/core/docnode/node.cxx|5 sw/source/core/edit/ednumber.cxx |3 sw/source/core/inc/docfld.hxx |2 sw/source/core/inc/swblocks.hxx|2 sw/source/filter/html/htmlfly.hxx |2 sw/source/filter/html/wrthtml.hxx |2 sw/source/filter/inc/wrtswtbl.hxx |7 sw/source/filter/xml/xmltble.cxx |2 sw/source/uibase/docvw/OutlineContentVisibilityWin.cxx |3 sw/source/uibase/inc/dbinsdlg.hxx |2 sw/source/uibase/inc/redlndlg.hxx |2 sw/source/uibase/utlui/content.cxx |2 xmloff/source/style/XMLFontAutoStylePool.cxx |7 xmloff/source/text/XMLTextListAutoStylePool.cxx|7 23 files changed, 78 insertions(+), 152 deletions(-) New commits: commit 1f5efbf8b9ba3fd5887c58574dfed3bf31cd020e Author: Mike Kaganski AuthorDate: Fri Feb 16 23:58:01 2024 +0600 Commit: Mike Kaganski CommitDate: Sat Feb 17 10:07:38 2024 +0100 Generalize search algorithms in sorted_vector This allows to simplify the code somewhat, and also to relax requirements to the arguments, e.g. allowing to pass const objects to search in vector containing non-const objects. Change-Id: Id34911a8694bbdec275d22b51ca4a0845c9fa4c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163519 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index d278b582e833..30c598594f5d 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -2114,7 +2114,7 @@ bool SvxAutoCorrect::FindInWordStartExceptList( LanguageType eLang, static bool lcl_FindAbbreviation(const SvStringsISortDtor* pList, const OUString& sWord) { -SvStringsISortDtor::const_iterator it = pList->find( "~" ); +SvStringsISortDtor::const_iterator it = pList->find(u"~"_ustr); SvStringsISortDtor::size_type nPos = it - pList->begin(); if( nPos < pList->size() ) { diff --git a/include/o3tl/sorted_vector.hxx b/include/o3tl/sorted_vector.hxx index 0f31bc517651..bf28b7166e41 100644 --- a/include/o3tl/sorted_vector.hxx +++ b/include/o3tl/sorted_vector.hxx @@ -21,9 +21,18 @@ namespace o3tl { -// forward declared because it's default template arg for sorted_vector -template -struct find_unique; +/** the elements are totally ordered by Compare, +for no 2 elements !Compare(a,b) && !Compare(b,a) is true + */ +template struct find_unique +{ +template +auto operator()(Iterator first, Iterator last, Comparable const& v) +{ +auto const it = std::lower_bound(first, last, v, Compare()); +return std::make_pair(it, (it != last && !Compare()(v, *it))); +} +}; /** Represents a sorted vector of values. @@ -34,12 +43,11 @@ struct find_unique; template< typename Value, typename Compare = std::less, - template class Find = find_unique, - bool = std::is_copy_constructible::value > + template class Find = find_unique > class sorted_vector { private: -typedef Find Find_t; +typedef Find Find_t; typedef typename std::vector vector_t; typedef typename std::vector::iterator iterator; public: @@ -55,10 +63,10 @@ public: std::sort(m_vector.begin(), m_vector.end(), Compare()); } sorted_vector() = default; -sorted_vector(sorted_vector const&) = default; +sorted_vector(sorted_vector const&) requires std::is_copy_constructible_v = default; sorted_vector(sorted_vector&&) = default; -sorted_vector& operator=(sorted_vector const&) = default; +sorted_vector& operator=(sorted_vector const&) requires std::is_copy_constructible_v = default; sorted_vector& operator=(sorted_vector&&) = default; // MODIFIERS @@ -192,12 +200,12 @@ public: // OPERATIONS -const_iterator lower_bound( const Value& x ) const +template const_iterator lower_bound(const Comparable& x) const { return std::lower_bound( m_vector.begin(), m_vector.end(), x, Compare() ); } -const_iterator upper_bound( const Value& x ) const +template const_iterator upper_bound(const Comparable& x) const {
core.git: editeng/source
editeng/source/editeng/impedit3.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit fb35c64d5b7bb3c6763d09af613d9c79c657f7a9 Author: Andrea Gelmini AuthorDate: Tue Feb 13 18:40:43 2024 +0100 Commit: Julien Nabet CommitDate: Wed Feb 14 08:39:46 2024 +0100 Fix typo Change-Id: I95fb4b60d5afa9b309c477896a6234c12d20ba92 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163318 Tested-by: Julien Nabet Reviewed-by: Julien Nabet diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 9892dfaa783f..51c922ce0b3f 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -725,7 +725,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) bool bQuickFormat = false; -// Determine if quick formt should be used +// Determine if quick format should be used if (!bEmptyNodeWithPolygon && !HasScriptType(nPara, i18n::ScriptType::COMPLEX)) { if (rParaPortion.IsSimpleInvalid() &&
core.git: editeng/source
editeng/source/editeng/impedit.cxx |8 +- editeng/source/editeng/impedit.hxx | 119 ++-- editeng/source/editeng/impedit5.cxx | 40 ++-- 3 files changed, 72 insertions(+), 95 deletions(-) New commits: commit d0317669ac673d52d6fbe8da4c1dcc9fa17cc290 Author: Tomaž Vajngerl AuthorDate: Tue Feb 6 10:33:44 2024 +0900 Commit: Tomaž Vajngerl CommitDate: Sat Feb 10 14:55:38 2024 +0100 editeng: simplify and clean-up struct in for ImpEditEng Change-Id: I8ca190f957e6bf15f6c0aa8b8e22a26e896a9374 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163198 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index 22412fd2fc37..c43bdfca21a1 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -2252,7 +2252,7 @@ void ImpEditView::dragGestureRecognized(const css::datatransfer::dnd::DragGestur if (HasSelection() && mbClickedInSelection) { -mpDragAndDropInfo.reset(new DragAndDropInfo()); +mpDragAndDropInfo.reset(new DragAndDropInfo); } else { @@ -2263,7 +2263,7 @@ void ImpEditView::dragGestureRecognized(const css::datatransfer::dnd::DragGestur const SvxFieldItem* pField = GetField( aMousePos, &nPara, &nPos ); if ( pField ) { -mpDragAndDropInfo.reset(new DragAndDropInfo()); +mpDragAndDropInfo.reset(new DragAndDropInfo); mpDragAndDropInfo->pField = pField; ContentNode* pNode = getEditEngine().GetEditDoc().GetObject( nPara ); aCopySel = EditSelection( EditPaM( pNode, nPos ), EditPaM( pNode, nPos+1 ) ); @@ -2274,7 +2274,7 @@ void ImpEditView::dragGestureRecognized(const css::datatransfer::dnd::DragGestur } else if ( IsBulletArea( aMousePos, &nPara ) ) { -mpDragAndDropInfo.reset(new DragAndDropInfo()); +mpDragAndDropInfo.reset(new DragAndDropInfo); mpDragAndDropInfo->bOutlinerMode = true; EditPaM aStartPaM(getEditEngine().GetEditDoc().GetObject(nPara), 0); EditPaM aEndPaM( aStartPaM ); @@ -2487,7 +2487,7 @@ void ImpEditView::dragEnter( const css::datatransfer::dnd::DropTargetDragEnterEv SolarMutexGuard aVclGuard; if (!mpDragAndDropInfo) -mpDragAndDropInfo.reset(new DragAndDropInfo()); +mpDragAndDropInfo.reset(new DragAndDropInfo); mpDragAndDropInfo->bHasValidData = false; diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index 199a9cd29f12..31f9b156962c 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -100,49 +100,55 @@ struct CursorFlags struct DragAndDropInfo { -tools::Rectangle aCurCursor; -tools::Rectangle aCurSavedCursor; -sal_uInt16 nSensibleRange; -sal_uInt16 nCursorWidth; -ESelection aBeginDragSel; -EditPaM aDropDest; -sal_Int32 nOutlinerDropDest; -ESelection aDropSel; -VclPtr pBackground; -const SvxFieldItem* pField; -boolbVisCursor : 1; -boolbDroppedInMe: 1; -boolbStarterOfDD: 1; -boolbHasValidData : 1; -boolbUndoAction : 1; -boolbOutlinerMode : 1; -boolbDragAccepted : 1; - -DragAndDropInfo() - : nSensibleRange(0), nCursorWidth(0), nOutlinerDropDest(0), pBackground(nullptr), -pField(nullptr), bVisCursor(false), bDroppedInMe(false), bStarterOfDD(false), -bHasValidData(false), bUndoAction(false), bOutlinerMode(false), bDragAccepted(false) -{ -} +tools::Rectangle aCurCursor; +tools::Rectangle aCurSavedCursor; +sal_uInt16 nSensibleRange = 0; +sal_uInt16 nCursorWidth = 0; +ESelection aBeginDragSel; +EditPaM aDropDest; +sal_Int32 nOutlinerDropDest = 0; +ESelection aDropSel; +VclPtr pBackground = nullptr; +const SvxFieldItem* pField = nullptr; +bool bVisCursor : 1 = false; +bool bDroppedInMe : 1 = false; +bool bStarterOfDD : 1 = false; +bool bHasValidData : 1 = false; +bool bUndoAction : 1 = false; +bool bOutlinerMode : 1 = false; +bool bDragAccepted : 1 = false; + ~DragAndDropInfo() { -pBackground.disposeAndClear(); +pBackground.disposeAndClear(); } }; struct ImplIMEInfos { -OUStringaOldTextAfterStartPos; +OUString aOldTextAfterStartPos; std::unique_ptr pAttribs; -EditPaM aPos; -sal_Int32 nLen; -boolbWasCursorOverwrite; +EditPaM aPos; +sal_Int32 nLen = 0; +bool bWasCursorOverwrite = false; -ImplIMEInfos( const EditPaM& rPos, OUString aOldTextAfterStartPos ); -
core.git: editeng/source include/editeng include/svx sd/source svx/source
editeng/source/outliner/outlvw.cxx| 18 ++ include/editeng/outliner.hxx |2 ++ include/svx/sdr/table/tablecontroller.hxx |2 +- include/svx/selectioncontroller.hxx |2 +- include/svx/svdedxv.hxx |8 sd/source/ui/func/fuformatpaintbrush.cxx |7 --- sd/source/ui/inc/fuformatpaintbrush.hxx |1 + svx/source/svdraw/selectioncontroller.cxx |4 +++- svx/source/svdraw/svdedxv.cxx | 29 - svx/source/table/tablecontroller.cxx |5 +++-- 10 files changed, 57 insertions(+), 21 deletions(-) New commits: commit bbe1f37645cf864c7c974d36cf2fe3a73d0c085f Author: Oliver Specht AuthorDate: Tue Feb 6 14:08:12 2024 +0100 Commit: Thorsten Behrens CommitDate: Fri Feb 9 00:05:39 2024 +0100 Clone Formatting in Impress: Include list attribute Copies list type and list level from source to target paragraph(s). Also switches off lists, if source is not in a list. Change-Id: I260f1d7d9936476f16c355a3a09204b3fb4592d0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163054 Tested-by: Jenkins Reviewed-by: Thorsten Behrens diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index 8daeee025c9b..e3e28207d11e 100644 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -384,6 +384,24 @@ void OutlinerView::Select( Paragraph const * pParagraph, bool bSelect ) pEditView->SetSelection( aSel ); } +void OutlinerView::SetDepth(sal_Int32 nParagraph, sal_Int16 nDepth) +{ +Paragraph* pParagraph = pOwner->GetParagraph(nParagraph); +pOwner->SetDepth(pParagraph, nDepth); +} + +sal_Int16 OutlinerView::GetDepth() const +{ +ESelection aESelection = GetSelection(); +aESelection.Adjust(); +sal_Int16 nDepth = pOwner->GetDepth(aESelection.nStartPara); +for (sal_Int32 nPara = aESelection.nStartPara + 1; nPara <= aESelection.nEndPara; ++nPara) +{ +if (nDepth != pOwner->GetDepth(nPara)) +return -2; +} +return nDepth; +} void OutlinerView::SetAttribs( const SfxItemSet& rAttrs ) { diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index 35860b762037..23158264d54b 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -243,6 +243,8 @@ public: voidSelectRange( sal_Int32 nFirst, sal_Int32 nCount ); voidSetAttribs( const SfxItemSet& ); voidIndent( short nDiff ); +sal_Int16 GetDepth() const; +voidSetDepth(sal_Int32 nParagraph, sal_Int16 nDepth); voidAdjustDepth( short nDX ); // Later replace with Indent! voidAdjustHeight( tools::Long nDY ); diff --git a/include/svx/sdr/table/tablecontroller.hxx b/include/svx/sdr/table/tablecontroller.hxx index 91b9ca7ce7b2..ecbd7642b478 100644 --- a/include/svx/sdr/table/tablecontroller.hxx +++ b/include/svx/sdr/table/tablecontroller.hxx @@ -67,7 +67,7 @@ public: SVX_DLLPRIVATE virtual bool GetStyleSheet( SfxStyleSheet* &rpStyleSheet ) const override; SVX_DLLPRIVATE virtual bool SetStyleSheet( SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr ) override; -SVX_DLLPRIVATE virtual bool ApplyFormatPaintBrush( SfxItemSet& rFormatSet, bool bNoCharacterFormats, bool bNoParagraphFormats ) override; +SVX_DLLPRIVATE virtual bool ApplyFormatPaintBrush( SfxItemSet& rFormatSet, sal_Int16 nDepth, bool bNoCharacterFormats, bool bNoParagraphFormats ) override; // slots SVX_DLLPRIVATE void onInsert( sal_uInt16 nSId, const SfxItemSet* pArgs = nullptr ); diff --git a/include/svx/selectioncontroller.hxx b/include/svx/selectioncontroller.hxx index 97adb57542c5..7794f3567f1e 100644 --- a/include/svx/selectioncontroller.hxx +++ b/include/svx/selectioncontroller.hxx @@ -70,7 +70,7 @@ public: if bNoCharacterFormats is true, no character attributes are changed. if bNoParagraphFormats is true, no paragraph attributes are changed. */ -virtual bool ApplyFormatPaintBrush( SfxItemSet& rFormatSet, bool bNoCharacterFormats, bool bNoParagraphFormats ); +virtual bool ApplyFormatPaintBrush( SfxItemSet& rFormatSet, sal_Int16 nDepth, bool bNoCharacterFormats, bool bNoParagraphFormats ); /// This is a table object, and one or more of its cells are selected. virtual bool hasSelectedCells() const; /// Allows adjusting the point or mark of the selection to a document coordinate. diff --git a/include/svx/svdedxv.hxx b/include/svx/svdedxv.hxx index ff3fcbd19b79..8ad7f048b682 100644 --- a/include/svx/svdedxv.hxx +++ b/include/svx/svdedxv.hxx @@ -301,17 +301,17 @@ public: /** returns true if the shape identified by its inventor and identifier supports format paint brush operation */ static bool SupportsFormatPaintbrush( SdrInventor nObjectInventor, SdrObjKind nObjectIdentifier ); -/** returns a format
core.git: editeng/source
editeng/source/editeng/editeng.cxx | 13 +++-- editeng/source/editeng/editview.cxx |2 +- editeng/source/editeng/impedit.cxx | 34 +- editeng/source/editeng/impedit.hxx | 24 ++-- editeng/source/editeng/impedit2.cxx | 29 ++--- editeng/source/editeng/impedit3.cxx |2 +- 6 files changed, 50 insertions(+), 54 deletions(-) New commits: commit f104a9d8c806ccb352c680af6a29422d796114df Author: Tomaž Vajngerl AuthorDate: Fri Feb 2 15:34:25 2024 +0900 Commit: Tomaž Vajngerl CommitDate: Fri Feb 2 11:29:32 2024 +0100 editeng: GetCursorFlags flags to CursorFlags struct of bools Convert bitflags to struct of bools, which is much easier to read and you don't need to mess with bitwise operations. Change-Id: I475eb2743b105f8a5bfcab1159dff2b298594740 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162925 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index 95f605b1ccbf..2493325ac578 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -996,7 +996,7 @@ bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView, v bool bAllowIdle = true; bool bReadOnly = pEditView->IsReadOnly(); -GetCursorFlags nNewCursorFlags = GetCursorFlags::NONE; +CursorFlags aNewCursorFlags; bool bSetCursorFlags = true; EditSelection aCurSel( pEditView->getImpl().GetEditSelection() ); @@ -1122,9 +1122,9 @@ bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView, v bMoved = true; if ( nCode == KEY_HOME ) -nNewCursorFlags |= GetCursorFlags::StartOfLine; +aNewCursorFlags.bStartOfLine = true; else if ( nCode == KEY_END ) -nNewCursorFlags |= GetCursorFlags::EndOfLine; +aNewCursorFlags.bEndOfLine = true; } #if OSL_DEBUG_LEVEL > 1 @@ -1402,7 +1402,7 @@ bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView, v } if (bSetCursorFlags) -pEditView->getImpl().mnExtraCursorFlags = nNewCursorFlags; +pEditView->getImpl().maExtraCursorFlags = aNewCursorFlags; if ( bModified ) { @@ -2410,8 +2410,9 @@ tools::Rectangle EditEngine::GetCharacterBounds( const EPosition& rPos ) const // Check against index, not paragraph if ( pNode && ( rPos.nIndex < pNode->Len() ) ) { -aBounds = getImpl().PaMtoEditCursor(EditPaM(pNode, rPos.nIndex), GetCursorFlags::TextOnly); -tools::Rectangle aR2 = getImpl().PaMtoEditCursor(EditPaM(pNode, rPos.nIndex + 1), GetCursorFlags::TextOnly|GetCursorFlags::EndOfLine); +aBounds = getImpl().PaMtoEditCursor(EditPaM(pNode, rPos.nIndex), CursorFlags{.bTextOnly = true}); +CursorFlags aFlags { .bTextOnly = true, .bEndOfLine = true}; +tools::Rectangle aR2 = getImpl().PaMtoEditCursor(EditPaM(pNode, rPos.nIndex + 1), aFlags); if ( aR2.Right() > aBounds.Right() ) aBounds.SetRight( aR2.Right() ); } diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index c8b702c0de71..e08c3c81d77d 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -1006,7 +1006,7 @@ bool EditView::ExecuteSpellPopup(const Point& rPosPixel, const LinkLen() && ( aPaM.GetIndex() < aPaM.GetNode()->Len() ) ) { // If we are behind a portion, and the next portion has other direction, we must change position... -aEditCursor.SetLeft(getImpEditEngine().PaMtoEditCursor( aPaM, GetCursorFlags::TextOnly|GetCursorFlags::PreferPortionStart ).Left() ); +aEditCursor.SetLeft(getImpEditEngine().PaMtoEditCursor(aPaM, CursorFlags{.bTextOnly = true, .bPreferPortionStart = true}).Left()); aEditCursor.SetRight( aEditCursor.Left() ); sal_Int32 nTextPortion = rParaPortion.GetTextPortions().FindPortion( aPaM.GetIndex(), nTextPortionStart, true ); @@ -1125,9 +1123,9 @@ tools::Rectangle ImpEditView::ImplGetEditCursor(EditPaM& aPaM, GetCursorFlags nS else { EditPaM aNext = getEditEngine().CursorRight( aPaM ); -tools::Rectangle aTmpRect = getImpEditEngine().PaMtoEditCursor( aNext, GetCursorFlags::TextOnly ); +tools::Rectangle aTmpRect = getImpEditEngine().PaMtoEditCursor(aNext, CursorFlags{ .bTextOnly = true }); if ( aTmpRect.Top() != aEditCursor.Top() ) -aTmpRect = getImpEditEngine().PaMtoEditCursor( aNext, GetCursorFlags::TextOnly|GetCursorFlags::EndOfLine ); +aTmpRect = getImpEditEngine().PaMtoEditCursor(aNext, CursorFlags{ .bTextOnly = true, .bEndOfLi
core.git: editeng/source include/editeng
editeng/source/editeng/editdbg.cxx | 12 editeng/source/editeng/editeng.cxx | 1085 + editeng/source/editeng/impedit.hxx |6 editeng/source/editeng/impedit2.cxx|4 editeng/source/outliner/overflowingtxt.cxx |2 include/editeng/editeng.hxx| 22 6 files changed, 544 insertions(+), 587 deletions(-) New commits: commit cc2e1e29489994fd28660cff384820e6676cce06 Author: Tomaž Vajngerl AuthorDate: Sun Jan 28 23:49:50 2024 +0900 Commit: Tomaž Vajngerl CommitDate: Thu Feb 1 01:42:22 2024 +0100 editeng: access ImpEditEngine with getImpl() not direct In EditEngine use getImpl() when accessing ImpEditEngine and not directly via the mpImpEditEngine member variable. Change-Id: I11f9ee21aec4f5e99fbe78bacab57ddc21580af7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162662 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/editeng/source/editeng/editdbg.cxx b/editeng/source/editeng/editdbg.cxx index 1d43b1dc8487..eb31279034b0 100644 --- a/editeng/source/editeng/editdbg.cxx +++ b/editeng/source/editeng/editdbg.cxx @@ -345,9 +345,9 @@ void EditEngine::DumpData(const EditEngine* pEE, bool bInfoBox) fprintf( fp, "" ); fprintf( fp, " == Document " ); fprintf( fp, " " ); -for ( sal_Int32 nPortion = 0; nPortion < pEE->pImpEditEngine->GetParaPortions().Count(); nPortion++) +for ( sal_Int32 nPortion = 0; nPortion < pEE->getImpl().GetParaPortions().Count(); nPortion++) { -ParaPortion const& rPPortion = pEE->pImpEditEngine->GetParaPortions().getRef(nPortion); +ParaPortion const& rPPortion = pEE->getImpl().GetParaPortions().getRef(nPortion); fprintf( fp, " Paragraph %" SAL_PRIdINT32 ": Length = %" SAL_PRIdINT32 ", Invalid = %i Text = '%s'", nPortion, rPPortion.GetNode()->Len(), rPPortion.IsInvalid(), OUStringToOString(rPPortion.GetNode()->GetString(), RTL_TEXTENCODING_UTF8).getStr() ); @@ -434,9 +434,9 @@ void EditEngine::DumpData(const EditEngine* pEE, bool bInfoBox) fprintf( fp, " -" ); } -if ( pEE->pImpEditEngine->GetStyleSheetPool() ) +if (pEE->getImpl().GetStyleSheetPool()) { -SfxStyleSheetIterator aIter( pEE->pImpEditEngine->GetStyleSheetPool(), SfxStyleFamily::All ); +SfxStyleSheetIterator aIter(pEE->getImpl().GetStyleSheetPool(), SfxStyleFamily::All); sal_uInt16 nStyles = aIter.Count(); fprintf( fp, " " ); fprintf( fp, " == Stylesheets =" ); @@ -458,13 +458,13 @@ void EditEngine::DumpData(const EditEngine* pEE, bool bInfoBox) fprintf( fp, " " ); fprintf( fp, " == Defaults " ); fprintf( fp, " " ); -DbgOutItemSet( fp, pEE->pImpEditEngine->GetEmptyItemSet(), true, true ); +DbgOutItemSet(fp, pEE->getImpl().GetEmptyItemSet(), true, true); fprintf( fp, " " ); fprintf( fp, " == EditEngine & Views ==" ); fprintf( fp, " " ); fprintf( fp, " Control: %x", unsigned( pEE->GetControlWord() ) ); -fprintf( fp, " RefMapMode: %i", int( pEE->pImpEditEngine->mpRefDev->GetMapMode().GetMapUnit() ) ); +fprintf( fp, " RefMapMode: %i", int( pEE->getImpl().mpRefDev->GetMapMode().GetMapUnit())); fprintf( fp, " PaperSize: %" SAL_PRIdINT64 " x %" SAL_PRIdINT64, sal_Int64(pEE->GetPaperSize().Width()), sal_Int64(pEE->GetPaperSize().Height()) ); fprintf( fp, " MaxAutoPaperSize: %" SAL_PRIdINT64 " x %" SAL_PRIdINT64, sal_Int64(pEE->GetMaxAutoPaperSize().Width()), sal_Int64(pEE->GetMaxAutoPaperSize().Height()) ); fprintf( fp, " MinAutoPaperSize: %" SAL_PRIdINT64 " x %" SAL_PRIdINT64 , sal_Int64(pEE->GetMinAutoPaperSize().Width()), sal_Int64(pEE->GetMinAutoPaperSize().Height()) ); diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index 51dce307064b..95f605b1ccbf 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -85,125 +85,122 @@ using namespace ::com::sun::star::linguistic2; static bool b
core.git: editeng/source
editeng/source/misc/acorrcfg.cxx |7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) New commits: commit 313836d19f46d0e046d1c2b8c593727b0b0192ea Author: Caolán McNamara AuthorDate: Fri Jan 26 09:44:38 2024 + Commit: Caolán McNamara CommitDate: Mon Jan 29 21:23:43 2024 +0100 LanguageTag ctor can canonicalize against various known tags so can optimize skipping the _lt_tag_canonicalize path which ends up using a fairly expensive xmlXPathEval Change-Id: Ie96f16482d247f3731c1c8eac6d613736b8b289a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162596 Tested-by: Jenkins Reviewed-by: Eike Rathke Reviewed-by: Caolán McNamara diff --git a/editeng/source/misc/acorrcfg.cxx b/editeng/source/misc/acorrcfg.cxx index 616d75c69600..49e48bb48be1 100644 --- a/editeng/source/misc/acorrcfg.cxx +++ b/editeng/source/misc/acorrcfg.cxx @@ -65,13 +65,12 @@ static void scanAutoCorrectDirForLanguageTags( const OUString& rURL ) continue; const OUString aBcp47( aTitle.copy( 5, aTitle.getLength() - 9)); -OUString aCanonicalized; // Ignore invalid langtags and canonicalize for good, // allow private-use tags. -if (!LanguageTag::isValidBcp47( aBcp47, &aCanonicalized)) +const LanguageTag aLanguageTag (aBcp47, true); +if (!aLanguageTag.isValidBcp47()) continue; -const LanguageTag aLanguageTag( aCanonicalized); if (SvtLanguageTable::HasLanguageType( aLanguageTag.getLanguageType())) continue; @@ -83,7 +82,7 @@ static void scanAutoCorrectDirForLanguageTags( const OUString& rURL ) // other private-use tag (which should not fallback, // but avoid). if (aLanguageTag.getCountry().isEmpty() -&& LanguageTag::isValidBcp47( aCanonicalized, nullptr, +&& LanguageTag::isValidBcp47( aLanguageTag.getBcp47(), nullptr, LanguageTag::PrivateUse::DISALLOW)) { LanguageTag aFallback( aLanguageTag);
core.git: editeng/source include/editeng include/svl svl/source
editeng/source/items/frmitems.cxx |8 +- editeng/source/items/paraitem.cxx |4 - editeng/source/items/textitem.cxx | 58 +-- include/editeng/udlnitem.hxx |9 +- include/svl/poolitem.hxx | 27 ++- svl/source/items/cenumitm.cxx | 13 ++- svl/source/items/itemset.cxx | 141 -- 7 files changed, 188 insertions(+), 72 deletions(-) New commits: commit 37f148c58974210707e069f21da2cc2b9ae086dd Author: Armin Le Grand (allotropia) AuthorDate: Wed Jan 24 17:53:19 2024 +0100 Commit: Armin Le Grand CommitDate: Thu Jan 25 01:58:36 2024 +0100 ITEM: Slight re-design of global Item-Reusage Unfortunately I had overseen something with derived classes, but it came now up on CI ASan/UBsan build with a failing UnitTest - thanks to pointing me at it. The ItemInstanceManager at the SfxPoolItems are now no longer static but constructed instances returned on-demand. Also added checks to really use an incarnated/ registered one *only* for that derivation and made sure this is now correctly supported. Had to change again, using createItemInstanceManager to always create instances was less effective than intended, back to getItemInstanceManager & static instances in the Item implementations. Also added some stuff to implCreateItemEntry/implCleanupItemEntry to be more effective, e.g. direct handling of slot stuff in latter one. Also some more asserts and comments. Slot stuff is now handled without RefCounting, takes some write accesses away... Change-Id: I6cd69556b416510b5b23549dd042ff3ba19d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162521 Tested-by: Jenkins Reviewed-by: Armin Le Grand diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index c3a5836b082a..e84ae2140e33 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -3980,8 +3980,8 @@ void SvxLineItem::SetLine( const SvxBorderLine* pNew ) ItemInstanceManager* SvxBrushItem::getItemInstanceManager() const { -static DefaultItemInstanceManager aManager; -return &aManager; +static DefaultItemInstanceManager aInstanceManager(typeid(SvxBrushItem).hash_code()); +return &aInstanceManager; } SvxBrushItem::SvxBrushItem(sal_uInt16 _nWhich) @@ -4598,8 +4598,8 @@ void SvxBrushItem::dumpAsXml(xmlTextWriterPtr pWriter) const ItemInstanceManager* SvxFrameDirectionItem::getItemInstanceManager() const { -static DefaultItemInstanceManager aManager; -return &aManager; +static DefaultItemInstanceManager aInstanceManager(typeid(SvxFrameDirectionItem).hash_code()); +return &aInstanceManager; } SvxFrameDirectionItem::SvxFrameDirectionItem( SvxFrameDirection nValue , diff --git a/editeng/source/items/paraitem.cxx b/editeng/source/items/paraitem.cxx index 2a9a514a6461..e080b517eb43 100644 --- a/editeng/source/items/paraitem.cxx +++ b/editeng/source/items/paraitem.cxx @@ -340,8 +340,8 @@ void SvxLineSpacingItem::SetEnumValue( sal_uInt16 nVal ) ItemInstanceManager* SvxAdjustItem::getItemInstanceManager() const { -static DefaultItemInstanceManager aManager; -return &aManager; +static DefaultItemInstanceManager aInstanceManager(typeid(SvxAdjustItem).hash_code()); +return &aInstanceManager; } SvxAdjustItem::SvxAdjustItem(const SvxAdjust eAdjst, const sal_uInt16 nId ) diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index 0bed0a7d077d..77e4c6c9cda0 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -168,8 +168,17 @@ namespace { SvxFontItemMap maRegistered; +public: +SvxFontItemInstanceManager() +: ItemInstanceManager(typeid(SvxFontItem).hash_code()) +{ +} + +private: static size_t hashCode(const SfxPoolItem&); +// standard interface, accessed exclusively +// by implCreateItemEntry/implCleanupItemEntry virtual const SfxPoolItem* find(const SfxPoolItem&) const override; virtual void add(const SfxPoolItem&) override; virtual void remove(const SfxPoolItem&) override; @@ -209,8 +218,8 @@ namespace ItemInstanceManager* SvxFontItem::getItemInstanceManager() const { -static SvxFontItemInstanceManager aManager; -return &aManager; +static SvxFontItemInstanceManager aInstanceManager; +return &aInstanceManager; } SvxFontItem::SvxFontItem( @@ -439,8 +448,8 @@ void SvxFontItem::dumpAsXml(xmlTextWriterPtr pWriter) const ItemInstanceManager* SvxPostureItem::getItemInstanceManager() const { -static DefaultItemInstanceManager aManager; -return &aManager; +static DefaultItemInstanceManager aInstanceManager(typeid(SvxPostureItem).hash_code()); +return &aInstanceManager; } SvxPostureItem::SvxPostureItem( const FontItalic
core.git: editeng/source include/editeng include/svl svl/source vcl/source
editeng/source/items/frmitems.cxx| 33 + editeng/source/items/paraitem.cxx|7 + editeng/source/items/textitem.cxx| 224 --- include/editeng/adjustitem.hxx |7 + include/editeng/brushitem.hxx| 16 ++ include/editeng/charreliefitem.hxx |3 include/editeng/crossedoutitem.hxx |3 include/editeng/emphasismarkitem.hxx |3 include/editeng/fhgtitem.hxx |6 include/editeng/fontitem.hxx | 28 +--- include/editeng/frmdiritem.hxx |3 include/editeng/langitem.hxx |3 include/editeng/postitem.hxx |3 include/editeng/udlnitem.hxx |9 + include/editeng/wghtitem.hxx |3 include/svl/eitem.hxx|6 include/svl/itemset.hxx |1 include/svl/poolitem.hxx | 50 ++- svl/source/items/cenumitm.cxx| 85 + svl/source/items/itemset.cxx | 98 ++- svl/source/items/poolitem.cxx| 17 ++ vcl/source/app/svapp.cxx |3 22 files changed, 550 insertions(+), 61 deletions(-) New commits: commit 063781f4a94e3960a2cb40d1981c0e0ef9a73153 Author: Armin Le Grand (allotropia) AuthorDate: Mon Jan 22 15:43:05 2024 +0100 Commit: Armin Le Grand CommitDate: Tue Jan 23 18:56:12 2024 +0100 tdf#158605 Add global SfxPoolItem re-use The task shows that the commit including the Item paradigm change has follow-ups: It now does no longer try to share Items as much as possible (detailed reasons in that commit). Mainly for speed reasons since that sharing was done before by (mostly) linearly searching in existing instances registered at one Pool, using the operator== of the SfxPoolItems. That costs runtime. There is somewhere a sweet-spot between memory and runtime: the number of Items allocated and the time spent to share them more effectively. This task shows - despite being a non-real-world document - that for extremes like this putting work in sharing is still needed. But there are possibilities to combine both: If we can implement solutions that do not need much time to ideintify an aleady existing instance we will get the best of both worlds. As explained already in that change, if we would need that again, then on a better base. Thus I drove forward ITEM changes to a state where we are now able to share Items globally in the office - not per pool but for all ItemSets/ItemHolders and thus all Apps/ Models/opened documents. NOTE: This currently needs to include the WhichID that is included in the Item, so cannot share pure Item-data (as the old usage did too). This does not need to stay that way: If you think about it, the association between WhichID and Pool/Holder is defined in Pool/Holder, so theoretically the Item does not need to contain the WhichID. This will be hard to do due too many places in the code that use the WhichID stored at the Item. To support that I added an ItemInstanceManager with a simple interface (find/add/remove) and it's usage in the two central Item-existance managing methods implCreateItemEntry/implCleanupItemEntry. The interface is pure virtual and all methods private, only the mentioned managing methods are allowed to access these. Also added a virtual method to SfxPoolItem called getItemInstanceManager() that can be implemented by Items that want to support that. Also added a default implementation of ItemInstanceManager called DefaultItemInstanceManager that uses linear search using operator== from the Item that can be used/added to every Item easily. It works for all Items and does in principle what the former implementation does. It is intended as simple/fast fallback. I also added a statistic element to measure the most used non-RefCounted Items on an Office-run, this will be printed at office shutdown using SAL_LOG and the 'svl.items' flag. I then checked all Items that were used in this error/bug scenario that used an extensive number of incarnations and added an ItemInstanceManager for these. For SvxFontItem I added one that creates a hash and thus needs not to search for instances at all, with the caveat that the WhichID needs to be included. Thus the hash is not at the Item, but only in the ItemInstanceManager implementation. For SfxBoolItem I implemented one that hashes using the WhichID and holding both possible states in an associated std::pair, true and false, thus the SfxBoolItem is identified fast and only two instances per WhichID exist (when used in Pool/Holder). For 11 other Items I just added using the standard implementation, DefaultItemInstanceManager. Of cou
core.git: editeng/source include/editeng include/svl sfx2/source svl/source sw/source
editeng/source/editeng/editdoc.cxx |1 editeng/source/editeng/eerdll.cxx | 21 +++ include/editeng/eeitem.hxx | 13 ++-- include/svl/itemset.hxx| 10 +-- include/svl/poolitem.hxx | 23 +++ sfx2/source/control/bindings.cxx |3 - sfx2/source/control/ctrlitem.cxx |2 sfx2/source/control/dispatch.cxx |4 - sfx2/source/control/shell.cxx |2 sfx2/source/control/statcach.cxx |6 +- sfx2/source/control/unoctitm.cxx |6 +- sfx2/source/doc/objxtor.cxx|2 sfx2/source/statbar/stbitem.cxx|2 sfx2/source/toolbox/tbxitem.cxx|2 svl/source/items/itemset.cxx | 108 + svl/source/items/poolitem.cxx |9 +-- svl/source/items/voiditem.cxx |3 - sw/source/core/attr/swatrset.cxx | 10 +-- sw/source/uibase/docvw/romenu.cxx |2 19 files changed, 95 insertions(+), 134 deletions(-) New commits: commit 38072fd7eb7d53237efbe0d8bacc7db1c4f3131c Author: Armin Le Grand (allotropia) AuthorDate: Mon Jan 22 19:18:32 2024 +0100 Commit: Armin Le Grand CommitDate: Tue Jan 23 10:30:59 2024 +0100 ITEM: Solve SfxVoidItem(0) situation An instance of SfxVoidItem(0) was used to signal the SfxItemState::DISABLED. This was done not only using WhichID == 0, but using isVoidItem() at the SfxPoolItem. Unfortunately this mixes up with usages of SfxVoidItems, mostly for UI stuff/Slots. This also means that all the time an SfxVoidItem had to be cloned/delete when when added/removed from ItemSet or ItemHolder. Much more action than e.g. for INVALID_POOL_ITEM which we already use by havong just a simple ptr to a single static instance of an Item. Disabled should do the same thing. Unfortunately also the functionality was mixed with non-SfxItemState::DISABLED purposes and these were very hard to be separated. But the current solution works now after some quirks doing that. It even oes no more need the isVoidItem() flag at the SfxPoolItem. Change-Id: I99f03db144f541ae4ea35f3775b3b3d58a375a81 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162414 Tested-by: Jenkins Reviewed-by: Armin Le Grand diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index 1bd6504b2374..0e26a5802a00 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -207,7 +207,6 @@ const SfxItemInfo aItemInfos[EDITITEMCOUNT] = { SID_ATTR_CHAR_CTL_POSTURE, SFX_ITEMINFOFLAG_NONE }, // EE_CHAR_ITALIC_CTL { SID_ATTR_CHAR_EMPHASISMARK, SFX_ITEMINFOFLAG_NONE }, // EE_CHAR_EMPHASISMARK { SID_ATTR_CHAR_RELIEF, SFX_ITEMINFOFLAG_NONE },// EE_CHAR_RELIEF -{ 0, SFX_ITEMINFOFLAG_NONE }, // EE_CHAR_RUBI_DUMMY { 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // EE_CHAR_XMLATTRIBS { SID_ATTR_CHAR_OVERLINE, SFX_ITEMINFOFLAG_NONE }, // EE_CHAR_OVERLINE { SID_ATTR_CHAR_CASEMAP, SFX_ITEMINFOFLAG_NONE }, // EE_CHAR_CASEMAP diff --git a/editeng/source/editeng/eerdll.cxx b/editeng/source/editeng/eerdll.cxx index 9e3e8c4cf8c5..d93eded8cbf7 100644 --- a/editeng/source/editeng/eerdll.cxx +++ b/editeng/source/editeng/eerdll.cxx @@ -137,19 +137,18 @@ DefItems::DefItems() rDefItems[44] = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ); rDefItems[45] = new SvxEmphasisMarkItem( FontEmphasisMark::NONE, EE_CHAR_EMPHASISMARK ); rDefItems[46] = new SvxCharReliefItem( FontRelief::NONE, EE_CHAR_RELIEF ); -rDefItems[47] = new SfxVoidItem( EE_CHAR_RUBI_DUMMY ); -rDefItems[48] = new SvXMLAttrContainerItem( EE_CHAR_XMLATTRIBS ); -rDefItems[49] = new SvxOverlineItem( LINESTYLE_NONE, EE_CHAR_OVERLINE ); -rDefItems[50] = new SvxCaseMapItem( SvxCaseMap::NotMapped, EE_CHAR_CASEMAP ); -rDefItems[51] = new SfxGrabBagItem( EE_CHAR_GRABBAG ); -rDefItems[52] = new SvxColorItem( COL_AUTO, EE_CHAR_BKGCOLOR ); +rDefItems[47] = new SvXMLAttrContainerItem( EE_CHAR_XMLATTRIBS ); +rDefItems[48] = new SvxOverlineItem( LINESTYLE_NONE, EE_CHAR_OVERLINE ); +rDefItems[49] = new SvxCaseMapItem( SvxCaseMap::NotMapped, EE_CHAR_CASEMAP ); +rDefItems[50] = new SfxGrabBagItem( EE_CHAR_GRABBAG ); +rDefItems[51] = new SvxColorItem( COL_AUTO, EE_CHAR_BKGCOLOR ); // Features -rDefItems[53] = new SfxVoidItem( EE_FEATURE_TAB ); -rDefItems[54] = new SfxVoidItem( EE_FEATURE_LINEBR ); -rDefItems[55] = new SvxColorItem( COL_RED, EE_FEATURE_NOTCONV ); -rDefItems[56] = new SvxFieldItem( SvxFieldData(), EE_FEATURE_FIELD ); +rDefItems[52] = new SfxVoidItem( EE_FEATURE_TAB ); +rDefItems[53] = new SfxVoidItem( EE_FEATURE_LINEBR ); +rDefItems[54] = new SvxColorItem( COL_RED, EE_FEATURE_NOTCONV ); +rDefItems[55] = new SvxFieldItem( SvxFieldData(), EE_FEATURE
core.git: editeng/source
editeng/source/misc/acorrcfg.cxx |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) New commits: commit ca33b8b35a10243dc13e68c93e7c7512eef937ec Author: Mike Kaganski AuthorDate: Mon Jan 22 12:08:56 2024 +0600 Commit: Mike Kaganski CommitDate: Mon Jan 22 08:36:39 2024 +0100 tdf#159313: pass properties in correct order Regression after commit c4fc18308074634e9578ad12d94d937f259aa22a (Autocorrect: Add option for autoformat bulleted lists after space, 2023-09-07). Change-Id: I35fafc1441b4f67886a86d4d67764a91146b8ece Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162359 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/editeng/source/misc/acorrcfg.cxx b/editeng/source/misc/acorrcfg.cxx index fcafbfca6f0c..616d75c69600 100644 --- a/editeng/source/misc/acorrcfg.cxx +++ b/editeng/source/misc/acorrcfg.cxx @@ -645,7 +645,6 @@ void SvxSwAutoCorrCfg::ImplCommit() css::uno::Any(rParent.bAutoFmtByInput), // "Format/ByInput/Enable" css::uno::Any(rSwFlags.bChgToEnEmDash), // "Format/ByInput/ChangeDash" css::uno::Any(rSwFlags.bSetNumRule), - css::uno::Any(rSwFlags.bSetNumRuleAfterSpace), // "Format/ByInput/ApplyNumbering/Enable" css::uno::Any(rSwFlags.bSetBorder), // "Format/ByInput/ChangeToBorders" css::uno::Any(rSwFlags.bCreateTable), // "Format/ByInput/ChangeToTable" @@ -679,7 +678,9 @@ void SvxSwAutoCorrCfg::ImplCommit() // "Format/ByInput/ApplyNumbering/SpecialCharacter/FontCharset" css::uno::Any(sal_Int32(rSwFlags.aByInputBulletFont.GetPitch())), // "Format/ByInput/ApplyNumbering/SpecialCharacter/FontPitch" - css::uno::Any(rSwFlags.bSetDOIAttr)}); + css::uno::Any(rSwFlags.bSetDOIAttr), + css::uno::Any(rSwFlags.bSetNumRuleAfterSpace), // "Format/ByInput/ApplyNumberingAfterSpace" +}); // "Format/Option/SetDOIAttribute" }
core.git: editeng/source forms/source include/editeng sc/source sd/qa sd/source starmath/source svx/source sw/source
editeng/source/editeng/editeng.cxx |5 editeng/source/editeng/editundo.cxx |2 editeng/source/editeng/editview.cxx | 270 +++ editeng/source/editeng/edtspell.cxx | 36 +- editeng/source/editeng/impedit.cxx | 347 ++-- editeng/source/editeng/impedit.hxx |6 editeng/source/editeng/textconv.cxx | 40 +- editeng/source/misc/urlfieldhelper.cxx |2 editeng/source/outliner/outlvw.cxx | 20 - forms/source/richtext/specialdispatchers.cxx|8 include/editeng/editeng.hxx |2 include/editeng/editview.hxx| 14 sc/source/ui/Accessibility/AccessibleDocument.cxx |4 sc/source/ui/Accessibility/AccessibleEditObject.cxx |4 sc/source/ui/Accessibility/AccessibleText.cxx | 17 sc/source/ui/app/inputhdl.cxx | 53 +-- sc/source/ui/app/inputwin.cxx | 14 sc/source/ui/docshell/docsh4.cxx|2 sc/source/ui/view/cellsh3.cxx |2 sc/source/ui/view/editsh.cxx| 58 +-- sc/source/ui/view/gridwin.cxx | 10 sc/source/ui/view/gridwin4.cxx | 13 sc/source/ui/view/spelldialog.cxx |2 sc/source/ui/view/tabview3.cxx |3 sc/source/ui/view/viewdata.cxx | 31 - sd/qa/unit/TextFittingTest.cxx | 29 - sd/source/ui/annotations/annotationwindow.cxx |2 sd/source/ui/docshell/docshel3.cxx |2 sd/source/ui/func/futext.cxx| 13 sd/source/ui/view/sdwindow.cxx |2 sd/source/ui/view/viewshel.cxx |2 starmath/source/edit.cxx| 16 svx/source/dialog/weldeditview.cxx |2 svx/source/theme/ThemeColorChangerCommon.cxx| 12 sw/source/uibase/docvw/SidebarTxtControl.cxx| 10 sw/source/uibase/shells/drwtxtsh.cxx|2 sw/source/uibase/shells/langhelper.cxx | 24 - sw/source/uibase/uno/unotxdoc.cxx |4 38 files changed, 540 insertions(+), 545 deletions(-) New commits: commit 049bbd95c190e0844da3a8dd88b1ce7a9ccf83b7 Author: Tomaž Vajngerl AuthorDate: Sat Jan 20 15:04:43 2024 +0900 Commit: Tomaž Vajngerl CommitDate: Sun Jan 21 00:54:54 2024 +0100 editeng: change EditEngine getter to ref in {Imp}EditView {Imp}EditView always needs to have EditEngine set (or it would crash otherwise), so we can change the getter to return a referece instead of a pointer. This simplifies things a bit because we get rid of all the nullptr checks and makes the interface more clear. Also change direct access to mpEditEngine in {Imp}EditView to use getEditEngine() and getImpEditEngine() (returning a reference) instead. Change-Id: Ib8f9c565b8364144bb9c35c3093c4975af1970c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162333 Tested-by: Tomaž Vajngerl Reviewed-by: Tomaž Vajngerl diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index c55ace752c2b..26e8fe3099b4 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -88,6 +88,11 @@ static bool bDebugPaint = false; static rtl::Reference pGlobalPool; +ImpEditEngine& EditEngine::getImpl() +{ +return *pImpEditEngine; +} + EditEngine::EditEngine( SfxItemPool* pItemPool ) { pImpEditEngine.reset( new ImpEditEngine( this, pItemPool ) ); diff --git a/editeng/source/editeng/editundo.cxx b/editeng/source/editeng/editundo.cxx index 378e1f8f268e..b13ff7109791 100644 --- a/editeng/source/editeng/editundo.cxx +++ b/editeng/source/editeng/editundo.cxx @@ -29,7 +29,7 @@ static void lcl_DoSetSelection( EditView const * pView, sal_uInt16 nPara ) { EPaM aEPaM( nPara, 0 ); -EditPaM aPaM( pView->GetImpEditEngine()->CreateEditPaM( aEPaM ) ); +EditPaM aPaM = pView->getImpEditEngine().CreateEditPaM(aEPaM); aPaM.SetIndex( aPaM.GetNode()->Len() ); EditSelection aSel( aPaM, aPaM ); pView->GetImpEditView()->SetEditSelection( aSel ); diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index ff979af96698..c8a974df8ec1 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -151,9 +151,10 @@ EditViewCallbacks::~EditViewCallbacks() { } -EditView::EditView( EditEngine* pEng, vcl::Window* pWindow ) +EditView::EditView(EditEngine* pEditEngine, vcl::Window* pWindow) +: pImpEditView(new ImpEditView(this, pEditEngine, pWindow)) { -pImpEditView.reset( new ImpEditView( this, pEng, pWindow ) ); +assert(pEditEngine
core.git: editeng/source
editeng/source/editeng/impedit3.cxx | 76 ++-- 1 file changed, 38 insertions(+), 38 deletions(-) New commits: commit 06aea80b0482c03e8f0a5f735d3a31ec816a07fe Author: Tomaž Vajngerl AuthorDate: Tue Jan 16 10:37:16 2024 +0900 Commit: Tomaž Vajngerl CommitDate: Sun Jan 21 00:49:57 2024 +0100 editeng: in ImpEditEngine::Paint rename confusing variables Change-Id: I6fbbb049dcd2e8ca221a2830cd9766c5590b6f4a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162332 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 30462d21b169..b03c9d0f330b 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -3340,19 +3340,19 @@ void ImpEditEngine::Paint( OutputDevice& rOutDev, tools::Rectangle aClipRect, Po // Over all the paragraphs... -for ( sal_Int32 n = 0; n < GetParaPortions().Count(); n++ ) +for (sal_Int32 nParaPortion = 0; nParaPortion < GetParaPortions().Count(); nParaPortion++) { -ParaPortion const& rPortion = GetParaPortions().getRef(n); +ParaPortion const& rParaPortion = GetParaPortions().getRef(nParaPortion); // if when typing idle formatting, asynchronous Paint. // Invisible Portions may be invalid. -if (rPortion.IsVisible() && rPortion.IsInvalid()) +if (rParaPortion.IsVisible() && rParaPortion.IsInvalid()) return; if ( pPDFExtOutDevData ) pPDFExtOutDevData->WrapBeginStructureElement(vcl::PDFWriter::Paragraph); -const tools::Long nParaHeight = rPortion.GetHeight(); -if (rPortion.IsVisible() && ( +const tools::Long nParaHeight = rParaPortion.GetHeight(); +if (rParaPortion.IsVisible() && ( ( !IsEffectivelyVertical() && ( ( aStartPos.Y() + nParaHeight ) > aClipRect.Top() ) ) || ( IsEffectivelyVertical() && IsTopToBottom() && ( ( aStartPos.X() - nParaHeight ) < aClipRect.Right() ) ) || ( IsEffectivelyVertical() && !IsTopToBottom() && ( ( aStartPos.X() + nParaHeight ) > aClipRect.Left() ) ) ) ) @@ -3362,21 +3362,21 @@ void ImpEditEngine::Paint( OutputDevice& rOutDev, tools::Rectangle aClipRect, Po // Over the lines of the paragraph... -const sal_Int32 nLines = rPortion.GetLines().Count(); +const sal_Int32 nLines = rParaPortion.GetLines().Count(); const sal_Int32 nLastLine = nLines-1; bool bEndOfParagraphWritten(false); -adjustYDirectionAware(aStartPos, rPortion.GetFirstLineOffset()); +adjustYDirectionAware(aStartPos, rParaPortion.GetFirstLineOffset()); -const SvxLineSpacingItem& rLSItem = rPortion.GetNode()->GetContentAttribs().GetItem( EE_PARA_SBL ); +const SvxLineSpacingItem& rLSItem = rParaPortion.GetNode()->GetContentAttribs().GetItem( EE_PARA_SBL ); sal_uInt16 nSBL = ( rLSItem.GetInterLineSpaceRule() == SvxInterLineSpaceRule::Fix ) ? scaleYSpacingValue(rLSItem.GetInterLineSpace()) : 0; bool bPaintBullet (false); for ( sal_Int32 nLine = 0; nLine < nLines; nLine++ ) { -EditLine const& rLine = rPortion.GetLines()[nLine]; +EditLine const& rLine = rParaPortion.GetLines()[nLine]; sal_Int32 nIndex = rLine.GetStart(); tools::Long nLineHeight = rLine.GetHeight(); if (nLine != nLastLine) @@ -3400,10 +3400,10 @@ void ImpEditEngine::Paint( OutputDevice& rOutDev, tools::Rectangle aClipRect, Po { Point aLineStart(aStartPos); adjustYDirectionAware(aLineStart, -nLineHeight); -GetEditEnginePtr()->PaintingFirstLine(n, aLineStart, aOrigin, nOrientation, rOutDev); +GetEditEnginePtr()->PaintingFirstLine(nParaPortion, aLineStart, aOrigin, nOrientation, rOutDev); // Remember whether a bullet was painted. -const SfxBoolItem& rBulletState = mpEditEngine->GetParaAttrib(n, EE_PARA_BULLETSTATE); +const SfxBoolItem& rBulletState = mpEditEngine->GetParaAttrib(nParaPortion, EE_PARA_BULLETSTATE); bPaintBullet = rBulletState.GetValue(); } @@ -3415,10 +3415,10 @@ void ImpEditEngine::Paint( OutputDevice& rOutDev, tools::Rectangle aClipRect, Po for ( sal_Int32 nPortion = rLine.GetStartPortion(); nPortion <= rLine.GetEndPortion(); nPortion++ ) { -DBG_ASSERT(rPortion.GetTextPortions().Count(), "Line without Textportion in Paint!"); -const TextPortion& rTextPortion = rPortion.GetTextPortions()[nPortion]; +
core.git: editeng/source include/vcl sc/qa sc/source vcl/source
editeng/source/editeng/editview.cxx |5 - include/vcl/window.hxx |2 sc/qa/unit/tiledrendering/tiledrendering.cxx | 115 +++ sc/source/ui/inc/gridwin.hxx |1 sc/source/ui/view/gridwin4.cxx | 26 ++ vcl/source/window/paint.cxx |5 + 6 files changed, 153 insertions(+), 1 deletion(-) New commits: commit 78f230713e1e1fd94f9fb1087bdba500fcf9231a Author: Marco Cecchetti AuthorDate: Mon Dec 4 09:31:23 2023 +0100 Commit: Caolán McNamara CommitDate: Tue Jan 16 11:58:52 2024 +0100 calc: on editing invalidation of view with different zoom is wrong This patch fixes the following invalidation issue: There are 2 views with different zoom levels. In a view text editing for a cell occurs. The other view is not invalidated properly: the computed invalidation rectangle is misplaced. Change-Id: I72db61486647640ee68e6cb2db96b2902de5b997 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160303 Tested-by: Jenkins CollaboraOffice Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162161 Tested-by: Jenkins diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index e047e6a41ffa..ff979af96698 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -231,7 +231,10 @@ void EditView::InvalidateOtherViewWindows( const tools::Rectangle& rInvRect ) for (auto& pWin : pImpEditView->aOutWindowSet) { if (pWin) -pWin->Invalidate( bNegativeX ? lcl_negateRectX(rInvRect) : rInvRect ); +{ +if (!pWin->InvalidateByForeignEditView(this)) +pWin->Invalidate( bNegativeX ? lcl_negateRectX(rInvRect) : rInvRect ); +} } } } diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx index 640e9c6c9983..74f1d395e9ad 100644 --- a/include/vcl/window.hxx +++ b/include/vcl/window.hxx @@ -62,6 +62,7 @@ class VclWindowEvent; class AllSettings; class InputContext; class VclEventListeners; +class EditView; enum class ImplPaintFlags; enum class VclEventId; enum class PointerStyle; @@ -967,6 +968,7 @@ public: */ virtual voidLogicInvalidate(const tools::Rectangle* pRectangle); +virtual boolInvalidateByForeignEditView(EditView* ); /** * Notification about some rectangle of the output device got invalidated. Used for the * dialogs and floating windows (e.g. context menu, popup). diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 4937cc71283b..5c51046de950 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -64,6 +65,32 @@ static std::ostream& operator<<(std::ostream& os, ViewShellId const & id) os << static_cast(id); return os; } +namespace { +// for passing data to testInvalidateOnTextEditWithDifferentZoomLevels +struct ColRowZoom +{ +SCCOL col; +SCROW row; +int zoom; +}; +} + +CPPUNIT_NS_BEGIN +namespace StringHelper +{ +// used by CPPUNIT_TEST_PARAMETERIZED for testInvalidateOnTextEditWithDifferentZoomLevels +template<> +inline std::string toString(const ColRowZoom& item) +{ +std::ostringstream ss; +ss << "zoom level: " << item.zoom << ", " + "col: " << item.col << ", " + "row: " << item.row; +return ss.str(); +} +} +CPPUNIT_NS_END + class ScTiledRenderingTest : public UnoApiXmlTest { public: @@ -3144,6 +3171,94 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testGetViewRenderState) CPPUNIT_ASSERT_EQUAL(";Default"_ostr, pModelObj->getViewRenderState()); } +/* + * testInvalidateOnTextEditWithDifferentZoomLevels + * steps: + * set view 1 zoom to the passed zoom level + * in view 1 type a char at the passed cell address + * store invalidation rectangle + * exit from in place editing (press esc) + * create view 2 (keep 100% zoom) + * go to the same cell address used in view 1 + * type a char into the cell + * get invalidation rectangle for view 1 + * check if the invalidation rectangle is equal to the one stored previously +*/ +class testInvalidateOnTextEditWithDifferentZoomLevels : public ScTiledRenderingTest +{ +public: +void TestBody(const ColRowZoom& rData); +CPPUNIT_TEST_SUITE(testInvalidateOnTextEditWithDifferentZoomLevels); +CPPUNIT_TEST_PARAMETERIZED(TestBody, + std::initializer_list + { + // zoom level 120% + {0, 999, 1}, {99, 0, 1}, + // zoom level 40% +
core.git: editeng/source sw/qa
editeng/source/editeng/impedit4.cxx |2 sw/qa/extras/uiwriter/data/tdf159049_LineBreakRTFClipboard.fodt | 300 ++ sw/qa/extras/uiwriter/uiwriter9.cxx | 35 + 3 files changed, 336 insertions(+), 1 deletion(-) New commits: commit c994f2491dd4e977f726f53de1953feff17c2227 Author: Regina Henschel AuthorDate: Tue Jan 9 21:41:40 2024 +0100 Commit: Regina Henschel CommitDate: Fri Jan 12 00:13:21 2024 +0100 tdf#159049 use RTF_LINE for EE_FEATURE_LINEBR for copy Copy of simple text uses ImpEditEngine::WriteItemAsRTF() method. Error was, that in case of a line break (' ') the string OOO_STRING_SVTOOLS_RTF_SL was written, but it needs to be the string OOO_STRING_SVTOOLS_RTF_LINE. Change-Id: I1c2ff2087c563b26e26d8768dfcfd1645be91d2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161842 Tested-by: Jenkins Reviewed-by: Regina Henschel diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index b5151467079a..d63522a555c1 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -905,7 +905,7 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, break; case EE_FEATURE_LINEBR: { -rOutput.WriteOString( OOO_STRING_SVTOOLS_RTF_SL ); +rOutput.WriteOString( OOO_STRING_SVTOOLS_RTF_LINE ); } break; case EE_CHAR_KERNING: diff --git a/sw/qa/extras/uiwriter/data/tdf159049_LineBreakRTFClipboard.fodt b/sw/qa/extras/uiwriter/data/tdf159049_LineBreakRTFClipboard.fodt new file mode 100644 index ..22472c197053 --- /dev/null +++ b/sw/qa/extras/uiwriter/data/tdf159049_LineBreakRTFClipboard.fodt @@ -0,0 +1,300 @@ + + +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:css3t="http://www.w3.org/TR/css3-text/"; xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:math="http://www.w3.org/1998/Math/MathML"; xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:dom="http://www.w3.org/2001/xml-events"; xmlns:xforms="http://www.w3.org/2002/xforms"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:xhtml="http://www.w3.org/1999/xhtml"; xmlns:grddl="http://www.w3.org/2003/g/data-view#"; office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text"> + Regina Henschel2024-01-08T23:25:06.849002024-01-09T20:51:07.36300Regina HenschelPT18M48S8LOmyBuild/24.8.0.0.alpha0$Windows_X86_64 LibreOffice_project/00eae23267bf64e07cf057f828cd85f3c38ac669 + + + 0 + 0 + 21338 + 14543 + true + false + + + view2 + 11003 + 1000 + 0 + 0 + 21336 + 14542 + 0 + 1 + false + 100 + false + false + false + false + false + false + + + + + true + + false + false + false + false + true + 1 + true + false + false + false + + false + + false + false + false + Person + 0 + false + true + true + false + false + false + IDAnredeVornameNachname + 0 + + true + high-resolution + false + false + true + true + true + false + false + true + true + false + true + true + false + false + false + true + false + true + false + false + true + false + false + false + false + false + false + 757206 + 303919 + false + false + true + true + false + true + true + false + true + true + true + false + false + false + false + true + false + true + false + false + false + false + false + true + 0 + true + false + true + true + false + false + true + false + 0 + true + false + true + true + true + false +
core.git: editeng/source sw/source
editeng/source/misc/svxacorr.cxx |2 ++ sw/source/core/swg/SwXMLTextBlocks.cxx |2 ++ 2 files changed, 4 insertions(+) New commits: commit a03a9236b01437b573cb68112959b9403418e11b Author: Andreas Heinisch AuthorDate: Thu Jan 11 13:09:51 2024 +0100 Commit: Andreas Heinisch CommitDate: Thu Jan 11 19:25:50 2024 +0100 tdf#156769 - Escape the question mark in the storage name Otherwise, an auto-text using the question mark for its shortcut cannot be inserted. Change-Id: I369e3d0f2ff82cea2d053896964a5c2c23b8d6f6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161921 Tested-by: Jenkins Reviewed-by: Andreas Heinisch diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index ff2c4518aadd..d278b582e833 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -1976,6 +1976,8 @@ static void GeneratePackageName ( std::u16string_view rShort, OUString& rPackage case ':': case '.': case '\': +// tdf#156769 - escape the question mark in the storage name +case '?': aBuf[nPos] = '_'; break; default: diff --git a/sw/source/core/swg/SwXMLTextBlocks.cxx b/sw/source/core/swg/SwXMLTextBlocks.cxx index efc3e530b0f2..f69311dfdb5f 100644 --- a/sw/source/core/swg/SwXMLTextBlocks.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks.cxx @@ -527,6 +527,8 @@ OUString SwXMLTextBlocks::GeneratePackageName ( std::u16string_view rShort ) case ':': case '.': case '\': +// tdf#156769 - escape the question mark in the storage name for auto-texts +case '?': aBuf[nPos] = '_'; break; default:
core.git: editeng/source sc/qa
editeng/source/editeng/impedit3.cxx | 52 +- sc/qa/extras/scpdfexport.cxx | 60 +++ sc/qa/extras/testdocuments/tdf159065.ods |binary 3 files changed, 94 insertions(+), 18 deletions(-) New commits: commit 4202218af61573825edfe5ec5a1bba710d7df1f7 Author: Tibor Nagy AuthorDate: Tue Jan 9 23:54:43 2024 +0100 Commit: Nagy Tibor CommitDate: Wed Jan 10 08:49:29 2024 +0100 tdf#159065 sc: fix PDF/UA link annotation Change-Id: I1586608780cc82908eaef62158887afee69c148f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161843 Tested-by: Jenkins Reviewed-by: Nagy Tibor diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index d50c2eb1338e..bc93802694fd 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -3855,6 +3855,25 @@ void ImpEditEngine::Paint( OutputDevice& rOutDev, tools::Rectangle aClipRect, Po ' ' == aText[nTextStart + nTextLen - 1] ) --nTextLen; +// PDF export: +const SvxFieldData* pFieldData = nullptr; +if (pPDFExtOutDevData) +{ +if (rTextPortion.GetKind() == PortionKind::FIELD) +{ +const EditCharAttrib* pAttr = pPortion->GetNode()->GetCharAttribs().FindFeature(nIndex); +const SvxFieldItem* pFieldItem = dynamic_cast(pAttr->GetItem()); +if (pFieldItem) +{ +pFieldData = pFieldItem->GetField(); +auto pUrlField = dynamic_cast(pFieldData); +if (pUrlField) +if (pPDFExtOutDevData->GetIsExportTaggedPDF()) + pPDFExtOutDevData->WrapBeginStructureElement(vcl::PDFWriter::Link, "Link"); +} +} +} + // output directly aTmpFont.QuickDrawText( &rOutDev, aRealOutPos, aText, nTextStart, nTextLen, pDXArray, pKashidaArray ); @@ -3869,27 +3888,24 @@ void ImpEditEngine::Paint( OutputDevice& rOutDev, tools::Rectangle aClipRect, Po } // PDF export: -if ( pPDFExtOutDevData ) +if (pPDFExtOutDevData) { -if ( rTextPortion.GetKind() == PortionKind::FIELD ) +if (auto pUrlField = dynamic_cast(pFieldData)) { -const EditCharAttrib* pAttr = pPortion->GetNode()->GetCharAttribs().FindFeature(nIndex); -const SvxFieldItem* pFieldItem = dynamic_cast(pAttr->GetItem()); -if( pFieldItem ) +Point aTopLeft(aTmpPos); + aTopLeft.AdjustY(-(pLine->GetMaxAscent())); + +tools::Rectangle aRect(aTopLeft, rTextPortion.GetSize()); +vcl::PDFExtOutDevBookmarkEntry aBookmark; +aBookmark.nLinkId = pPDFExtOutDevData->CreateLink(aRect, pUrlField->GetRepresentation()); +aBookmark.aBookmark = pUrlField->GetURL(); +std::vector< vcl::PDFExtOutDevBookmarkEntry >& rBookmarks = pPDFExtOutDevData->GetBookmarks(); + rBookmarks.push_back(aBookmark); + +if (pPDFExtOutDevData->GetIsExportTaggedPDF()) { -const SvxFieldData* pFieldData = pFieldItem->GetField(); -if ( auto pUrlField = dynamic_cast< const SvxURLField* >( pFieldData ) ) -{ -
core.git: editeng/source
editeng/source/editeng/editdoc.cxx |5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) New commits: commit 89b9302ccf870c4fdbc1071751536b80429a7d27 Author: Tomaž Vajngerl AuthorDate: Fri Jan 5 11:59:46 2024 +0900 Commit: Tomaž Vajngerl CommitDate: Wed Jan 10 03:40:40 2024 +0100 editeng: move for loop to range based Change-Id: I6d997d6315f8d5043de33fe43b6aaabf5bef7cdd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161820 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index efc95b944833..7dbee3890a6c 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -892,11 +892,10 @@ void EditDoc::CreateDefFont( bool bUseStyles ) maDefFont.SetVertical( IsEffectivelyVertical() ); maDefFont.SetOrientation( Degree10(IsEffectivelyVertical() ? (IsTopToBottom() ? 2700 : 900) : 0) ); -for ( sal_Int32 nNode = 0; nNode < Count(); nNode++ ) +for (std::unique_ptr& pNode : maContents) { -ContentNode* pNode = GetObject( nNode ); pNode->GetCharAttribs().GetDefFont() = maDefFont; -if ( bUseStyles ) +if (bUseStyles) pNode->CreateDefFont(); } }
core.git: editeng/source
editeng/source/editeng/impedit2.cxx | 38 1 file changed, 22 insertions(+), 16 deletions(-) New commits: commit 548f0b1883e18ff2870a40bccf047864ff35c18b Author: Tomaž Vajngerl AuthorDate: Tue Jan 2 15:29:52 2024 +0900 Commit: Tomaž Vajngerl CommitDate: Tue Jan 2 09:56:55 2024 +0100 editeng: preserve ContentNode in a unique_ptr when moving paras When we move the paragraphs, we can just take the unique_ptr of ContetNodes out of the EditDoc and move it to new position inside EditDoc, like it is done for ParaPortions in ParaPortionList. No need to muck with the raw pointers and releasing the ContentNode from a unique_ptr and later moving it back again. Also just use a std::vector for ParaPortions instead of a new instance of ParaPortionList. Change-Id: I8634ccc83121c1ee683be4c2cfb0cedbd469c05d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161531 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 78a56dc926bc..6e9351a7c80e 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -2199,36 +2199,42 @@ EditSelection ImpEditEngine::ImpMoveParagraphs( Range aOldPositions, sal_Int32 n // do not lose sight of the Position ! ParaPortion* pDestPortion = GetParaPortions().SafeGetObject( nNewPos ); -ParaPortionList aTmpPortionList; +// Temporary containers used for moving the paragraph portions and content nodes to a new location +std::vector> aParagraphPortionVector; +std::vector> aContentNodeVector; + +// Take the paragraph portions and content nodes out of its containers for (tools::Long i = aOldPositions.Min(); i <= aOldPositions.Max(); i++ ) { -// always aOldPositions.Min(), since Remove(). -std::unique_ptr pTmpPortion = GetParaPortions().Release(aOldPositions.Min()); -auto pContentNode = maEditDoc.Release(aOldPositions.Min()); -pContentNode.release(); -aTmpPortionList.Append(std::move(pTmpPortion)); +// always aOldPositions.Min() as the index, since we remove and the elements from the containers and the +// other elements shift to the left. +std::unique_ptr pPortion = GetParaPortions().Release(aOldPositions.Min()); +aParagraphPortionVector.push_back(std::move(pPortion)); + +std::unique_ptr pContentNode = maEditDoc.Release(aOldPositions.Min()); +aContentNodeVector.push_back(std::move(pContentNode)); } +// Determine the new location for paragraphs sal_Int32 nRealNewPos = pDestPortion ? GetParaPortions().GetPos( pDestPortion ) : GetParaPortions().Count(); assert( nRealNewPos != EE_PARA_NOT_FOUND && "ImpMoveParagraphs: Invalid Position!" ); +// Add the paragraph portions and content nodes to a new position sal_Int32 i = 0; -while( aTmpPortionList.Count() > 0 ) +for (auto& pPortion : aParagraphPortionVector) { -std::unique_ptr pTmpPortion = aTmpPortionList.Release(0); -if ( i == 0 ) -aSelection.Min().SetNode( pTmpPortion->GetNode() ); - -aSelection.Max().SetNode( pTmpPortion->GetNode() ); -aSelection.Max().SetIndex( pTmpPortion->GetNode()->Len() ); +if (i == 0) +aSelection.Min().SetNode(pPortion->GetNode()); +aSelection.Max().SetNode(pPortion->GetNode()); +aSelection.Max().SetIndex(pPortion->GetNode()->Len()); -ContentNode* pNode = pTmpPortion->GetNode(); -maEditDoc.Insert(nRealNewPos+i, std::unique_ptr(pNode)); +maEditDoc.Insert(nRealNewPos + i, std::move(aContentNodeVector[i])); +GetParaPortions().Insert(nRealNewPos + i, std::move(pPortion)); -GetParaPortions().Insert(nRealNewPos+i, std::move(pTmpPortion)); ++i; } +// Signal end of paragraph moving maEndMovingParagraphsHdl.Call( aMoveParagraphsInfo ); if ( GetNotifyHdl().IsSet() )
core.git: editeng/source
editeng/source/editeng/editeng.cxx | 84 +++ editeng/source/editeng/impedit.hxx | 153 +-- editeng/source/editeng/impedit2.cxx | 182 editeng/source/editeng/impedit3.cxx | 114 ++-- editeng/source/editeng/impedit4.cxx | 199 +--- editeng/source/editeng/impedit5.cxx | 20 +-- 6 files changed, 374 insertions(+), 378 deletions(-) New commits: commit de385412949e2ca52c999546677744ed070d189c Author: Tomaž Vajngerl AuthorDate: Mon Jan 1 14:31:13 2024 +0900 Commit: Tomaž Vajngerl CommitDate: Tue Jan 2 04:12:32 2024 +0100 editeng: prefix members of ImpEditEngine Change-Id: I05a738be8956ebaa2912c6c8a20a05002d67b789 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161529 Tested-by: Tomaž Vajngerl Reviewed-by: Tomaž Vajngerl diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index c5db1b5ca9ab..7af59f499e12 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -393,7 +393,7 @@ void EditEngine::SetPaperSize( const Size& rNewSize ) if ( !(bAutoPageSize || ( aNewSize.Width() != aOldSize.Width() )) ) return; -for (EditView* pView : pImpEditEngine->aEditViews) +for (EditView* pView : pImpEditEngine->maEditViews) { if ( bAutoPageSize ) pView->pImpEditView->RecalcOutputArea(); @@ -414,7 +414,7 @@ void EditEngine::SetPaperSize( const Size& rNewSize ) pImpEditEngine->UpdateViews( pImpEditEngine->GetActiveView() ); if ( pImpEditEngine->IsUpdateLayout() && pImpEditEngine->GetActiveView() ) -pImpEditEngine->pActiveView->ShowCursor( false, false ); +pImpEditEngine->mpActiveView->ShowCursor( false, false ); } } @@ -685,7 +685,7 @@ void EditEngine::CheckIdleFormatter() bool EditEngine::IsIdleFormatterActive() const { -return pImpEditEngine->aIdleFormatter.IsActive(); +return pImpEditEngine->maIdleFormatter.IsActive(); } ParaPortion* EditEngine::FindParaPortion(ContentNode const * pNode) @@ -725,7 +725,7 @@ bool EditEngine::IsCallParaInsertedOrDeleted() const void EditEngine::AppendDeletedNodeInfo(DeletedNodeInfo* pInfo) { - pImpEditEngine->aDeletedNodes.push_back(std::unique_ptr(pInfo)); + pImpEditEngine->maDeletedNodes.push_back(std::unique_ptr(pInfo)); } void EditEngine::UpdateSelections() @@ -969,12 +969,12 @@ EditPaM EditEngine::DeleteSelected(const EditSelection& rSel) void EditEngine::HandleBeginPasteOrDrop(PasteOrDropInfos& rInfos) { -pImpEditEngine->aBeginPasteOrDropHdl.Call(rInfos); +pImpEditEngine->maBeginPasteOrDropHdl.Call(rInfos); } void EditEngine::HandleEndPasteOrDrop(PasteOrDropInfos& rInfos) { -pImpEditEngine->aEndPasteOrDropHdl.Call(rInfos); +pImpEditEngine->maEndPasteOrDropHdl.Call(rInfos); } bool EditEngine::HasText() const @@ -984,7 +984,7 @@ bool EditEngine::HasText() const const EditSelectionEngine& EditEngine::GetSelectionEngine() const { -return pImpEditEngine->aSelEngine; +return pImpEditEngine->maSelEngine; } void EditEngine::SetInSelectionMode(bool b) @@ -1049,7 +1049,7 @@ bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView, v sal_Int32 nParas = GetParagraphCount(); Point aPos; Point aViewStart( pEditView->GetOutputArea().TopLeft() ); -tools::Long n20 = 40 * pImpEditEngine->nOnePixelInRef; +tools::Long n20 = 40 * pImpEditEngine->mnOnePixelInRef; for ( sal_Int32 n = 0; n < nParas; n++ ) { tools::Long nH = GetTextHeight( n ); @@ -1316,7 +1316,7 @@ bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView, v // Only at end of word... sal_Int32 nIndex = aCurSel.Max().GetIndex(); if ( ( nIndex >= aCurSel.Max().GetNode()->Len() ) || - ( pImpEditEngine->aWordDelimiters.indexOf( aCurSel.Max().GetNode()->GetChar( nIndex ) ) != -1 ) ) + ( pImpEditEngine->maWordDelimiters.indexOf( aCurSel.Max().GetNode()->GetChar( nIndex ) ) != -1 ) ) { EditPaM aStart( pImpEditEngine->WordLeft( aCurSel.Max() ) ); OUString aWord = pImpEditEngine->GetSelected( EditSelection( aStart, aCurSel.Max() ) ); @@ -1327,18 +1327,18 @@ bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView, v LanguageType eLang = pImpEditEngine->GetLanguage( EditPaM( aStart.GetNode(), aStart.GetIndex()+1)).nLang; LanguageTag aLanguageTag( eLang); -if (!pImpEditEngine->xLocaleDataWrapper.isI
core.git: editeng/source
editeng/source/items/textitem.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit d048de6e9fb9197250e924553d46fd6ec4820cb9 Author: Caolán McNamara AuthorDate: Fri Dec 29 16:19:51 2023 + Commit: Caolán McNamara CommitDate: Fri Dec 29 20:16:53 2023 +0100 ofz#65377 Timeout reduce further to 120points Change-Id: Idf9892ae01fb6ff3e6cf9b064c2999da9a3a94d4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161430 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index e242566bd36f..9fd6c651985e 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -765,7 +765,7 @@ bool SvxFontHeightItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) if (fPoint < 0. || fPoint > 1.) return false; static bool bFuzzing = utl::ConfigManager::IsFuzzing(); -if (bFuzzing && fPoint > 240) +if (bFuzzing && fPoint > 120) { SAL_WARN("editeng.items", "SvxFontHeightItem ignoring font size of " << fPoint << " for performance"); return false;
core.git: editeng/source
editeng/source/editeng/editview.cxx |7 --- 1 file changed, 4 insertions(+), 3 deletions(-) New commits: commit e48dbe4f14da4677db631edffc5275c3c24b3ede Author: Caolán McNamara AuthorDate: Thu Dec 28 20:16:48 2023 + Commit: Caolán McNamara CommitDate: Fri Dec 29 14:54:39 2023 +0100 Resolves: tdf#158608 put calc spelling suggestions at start of context menu a problem since: commit 57544b075b77331b7b1cc7cb18898a52e7bb21a6 Author: Caolán McNamara Date: Sat Dec 12 21:21:09 2020 + weld editview menu Change-Id: Id2ffd7f4f3da15d5c0ebc1c7a17247e8ab1ec5bc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161389 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index 77dab94e6b98..e047e6a41ffa 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -1087,10 +1087,11 @@ bool EditView::ExecuteSpellPopup(const Point& rPosPixel, const Linkappend(OUString::number(MN_ALTSTART + nW), aAlternate); -xAutoMenu->append(OUString::number(MN_AUTOSTART + nW), aAlternate); +OUString sId(OUString::number(MN_ALTSTART + nW)); +xPopupMenu->insert(nW, sId, aAlternate, nullptr, nullptr, nullptr, TRISTATE_INDET); +xAutoMenu->append(sId, aAlternate); } -xPopupMenu->append_separator("separator2"); +xPopupMenu->insert_separator(nWords, "separator2"); } else {
core.git: editeng/source
editeng/source/editeng/impedit.cxx | 36 +--- 1 file changed, 17 insertions(+), 19 deletions(-) New commits: commit feb035b265210379ed81511d1694466b28695ff3 Author: Tomaž Vajngerl AuthorDate: Fri Dec 8 16:54:13 2023 +0900 Commit: Tomaž Vajngerl CommitDate: Thu Dec 28 08:08:42 2023 +0100 editeng: ImpEditView - clean-up UNO types use com::sun::star namespace as the base for UNO types Change-Id: I5ce71f21a914f4653d908162f5ec6f773023165e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161347 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index 92fb5affa6c3..abf3c5337255 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -46,9 +46,7 @@ #include #include -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::linguistic2; +using namespace css; #define SCRLRANGE 20 // Scroll 1/20 of the width/height, when in QueryDrop @@ -1416,7 +1414,7 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor ) else { // is cursor at a misspelled word ? -Reference< linguistic2::XSpellChecker1 > xSpeller( pEditEngine->pImpEditEngine->GetSpeller() ); +uno::Reference xSpeller( pEditEngine->pImpEditEngine->GetSpeller() ); bool bIsWrong = xSpeller.is() && IsWrongSpelledWord(aPaM, /*bMarkIfWrong*/ false); EditView* pActiveView = GetEditViewPtr(); @@ -1648,7 +1646,7 @@ Pair ImpEditView::Scroll( tools::Long ndX, tools::Long ndY, ScrollRangeCheck nRa return Pair( nRealDiffX, nRealDiffY ); } -Reference ImpEditView::GetClipboard() const +uno::Reference ImpEditView::GetClipboard() const { if (EditViewCallbacks* pCallbacks = getEditViewCallbacks()) return pCallbacks->GetClipboard(); @@ -1671,7 +1669,7 @@ bool ImpEditView::PostKeyEvent( const KeyEvent& rKeyEvent, vcl::Window const * p { if ( !bReadOnly ) { -Reference aClipBoard(GetClipboard()); +uno::Reference aClipBoard(GetClipboard()); CutCopy( aClipBoard, true ); bDone = true; } @@ -1679,7 +1677,7 @@ bool ImpEditView::PostKeyEvent( const KeyEvent& rKeyEvent, vcl::Window const * p break; case KeyFuncType::COPY: { -Reference aClipBoard(GetClipboard()); +uno::Reference aClipBoard(GetClipboard()); CutCopy( aClipBoard, false ); bDone = true; } @@ -1689,7 +1687,7 @@ bool ImpEditView::PostKeyEvent( const KeyEvent& rKeyEvent, vcl::Window const * p if ( !bReadOnly && IsPasteEnabled() ) { pEditEngine->pImpEditEngine->UndoActionStart( EDITUNDO_PASTE ); -Reference aClipBoard(GetClipboard()); +uno::Reference aClipBoard(GetClipboard()); Paste( aClipBoard, pEditEngine->pImpEditEngine->GetStatus().AllowPasteSpecial() ); pEditEngine->pImpEditEngine->UndoActionEnd(); bDone = true; @@ -1717,12 +1715,12 @@ bool ImpEditView::MouseButtonUp( const MouseEvent& rMouseEvent ) if ( rMouseEvent.IsMiddle() && !bReadOnly && Application::GetSettings().GetMouseSettings().GetMiddleButtonAction() == MouseMiddleButtonAction::PasteSelection ) { -Reference aClipBoard(GetSystemPrimarySelection()); +uno::Reference aClipBoard(GetSystemPrimarySelection()); Paste( aClipBoard ); } else if ( rMouseEvent.IsLeft() && GetEditSelection().HasRange() ) { -Reference aClipBoard(GetSystemPrimarySelection()); +uno::Reference aClipBoard(GetSystemPrimarySelection()); CutCopy( aClipBoard, false ); } @@ -1807,7 +1805,7 @@ OUString ImpEditView::SpellIgnoreWord() if ( !aWord.isEmpty() ) { -Reference< XDictionary > xDic = LinguMgr::GetIgnoreAllList(); +uno::Reference xDic = LinguMgr::GetIgnoreAllList(); if (xDic.is()) xDic->add( aWord, false, OUString() ); EditDoc& rDoc = pEditEngine->GetEditDoc(); @@ -1913,7 +1911,7 @@ bool ImpEditView::IsBulletArea( const Point& rPos, sal_Int32* pPara ) return false; } -void ImpEditView::CutCopy( css::uno::Reference< css::datatransfer::clipboard::XClipboard > const & rxClipboard, bool bCut ) +void ImpEditView::CutCopy(uno::Reference const & rxClipboard, bool bCut ) { if ( !(rxClipboard.is() && HasSelection()) ) return; @@ -1946,12 +1944,12 @@ void ImpEditView::CutCopy( css::uno::Reference< css::datatransfer::clipboard::XC } } -void ImpEditV
core.git: editeng/source
editeng/source/editeng/editdbg.cxx |2 +- editeng/source/editeng/impedit.hxx | 34 +- editeng/source/editeng/impedit2.cxx | 20 ++-- editeng/source/editeng/impedit3.cxx | 18 +- editeng/source/editeng/impedit4.cxx |2 +- 5 files changed, 38 insertions(+), 38 deletions(-) New commits: commit 8530c6a25a9ce258e58eb657a9cdd200ba1a30d2 Author: Tomaž Vajngerl AuthorDate: Fri Dec 8 16:48:18 2023 +0900 Commit: Tomaž Vajngerl CommitDate: Thu Dec 28 08:08:16 2023 +0100 editeng: prefix ImpEditEngine pVirtDev, pRefDev Change-Id: I4e215b374178314a836cfddb0107b8cdbe6c1f82 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161346 Tested-by: Tomaž Vajngerl Reviewed-by: Tomaž Vajngerl diff --git a/editeng/source/editeng/editdbg.cxx b/editeng/source/editeng/editdbg.cxx index 31ec9d09306d..74cd266d8bb8 100644 --- a/editeng/source/editeng/editdbg.cxx +++ b/editeng/source/editeng/editdbg.cxx @@ -464,7 +464,7 @@ void EditEngine::DumpData(const EditEngine* pEE, bool bInfoBox) fprintf( fp, " == EditEngine & Views ==" ); fprintf( fp, " " ); fprintf( fp, " Control: %x", unsigned( pEE->GetControlWord() ) ); -fprintf( fp, " RefMapMode: %i", int( pEE->pImpEditEngine->pRefDev->GetMapMode().GetMapUnit() ) ); +fprintf( fp, " RefMapMode: %i", int( pEE->pImpEditEngine->mpRefDev->GetMapMode().GetMapUnit() ) ); fprintf( fp, " PaperSize: %" SAL_PRIdINT64 " x %" SAL_PRIdINT64, sal_Int64(pEE->GetPaperSize().Width()), sal_Int64(pEE->GetPaperSize().Height()) ); fprintf( fp, " MaxAutoPaperSize: %" SAL_PRIdINT64 " x %" SAL_PRIdINT64, sal_Int64(pEE->GetMaxAutoPaperSize().Width()), sal_Int64(pEE->GetMaxAutoPaperSize().Height()) ); fprintf( fp, " MinAutoPaperSize: %" SAL_PRIdINT64 " x %" SAL_PRIdINT64 , sal_Int64(pEE->GetMinAutoPaperSize().Width()), sal_Int64(pEE->GetMinAutoPaperSize().Height()) ); diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index 57fe8ca0c7eb..89339b11dc3e 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -534,8 +534,8 @@ private: SfxStyleSheetPool* pStylePool; SfxItemPool*pTextObjectPool; -VclPtr< VirtualDevice> pVirtDev; -VclPtr< OutputDevice > pRefDev; +VclPtr mpVirtDev; +VclPtr mpRefDev; VclPtr mpOwnDev; svtools::ColorConfig maColorConfig; @@ -814,24 +814,24 @@ private: VirtualDevice* GetVirtualDevice(const MapMode& rMapMode, DrawModeFlags nDrawMode) { -if ( !pVirtDev ) -pVirtDev = VclPtr::Create(); +if (!mpVirtDev) +mpVirtDev = VclPtr::Create(); -if ( ( pVirtDev->GetMapMode().GetMapUnit() != rMapMode.GetMapUnit() ) || - ( pVirtDev->GetMapMode().GetScaleX() != rMapMode.GetScaleX() ) || - ( pVirtDev->GetMapMode().GetScaleY() != rMapMode.GetScaleY() ) ) +if ((mpVirtDev->GetMapMode().GetMapUnit() != rMapMode.GetMapUnit()) || +(mpVirtDev->GetMapMode().GetScaleX() != rMapMode.GetScaleX()) || +(mpVirtDev->GetMapMode().GetScaleY() != rMapMode.GetScaleY()) ) { -MapMode aMapMode( rMapMode ); -aMapMode.SetOrigin( Point( 0, 0 ) ); -pVirtDev->SetMapMode( aMapMode ); +MapMode aMapMode(rMapMode); +aMapMode.SetOrigin(Point(0, 0)); +mpVirtDev->SetMapMode(aMapMode); } -pVirtDev->SetDrawMode( nDrawMode ); +mpVirtDev->SetDrawMode(nDrawMode); -return pVirtDev; +return mpVirtDev; } -void EraseVirtualDevice() { pVirtDev.disposeAndClear(); } +void EraseVirtualDevice() { mpVirtDev.disposeAndClear(); } DECL_LINK( StatusTimerHdl, Timer *, void); DECL_LINK( IdleFormatHdl, Timer *, void); @@ -1131,11 +1131,11 @@ public: bool isUsedByModel() const override { return true; } -OutputDevice* GetRefDevice() const { return pRefDev.get(); } -voidSetRefDevice( OutputDevice* pRefDef ); +OutputDevice* GetRefDevice() const { return mpRefDev.get(); } +voidSetRefDevice(OutputDevice* mpRefDef); -const MapMode& GetRefMapMode() const { return pRefDev->GetMapMode(); } -voidSetRefMapMode( const MapMode& rMapMode ); +const MapMode& GetRefMapMode() const { return mpRefDev->GetMapMode(); } +voidSetRefMapMode(const MapMode& rMapMode); InternalEditStatus& GetStatus() { return maStatus; } voidCallStatusHdl(); diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 4b8f0a63799a..1f481259cafd 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.
core.git: editeng/source
editeng/source/editeng/impedit.hxx | 262 + 1 file changed, 124 insertions(+), 138 deletions(-) New commits: commit 357ab973db8d33290bde1558af52d4f8d5e065c4 Author: Tomaž Vajngerl AuthorDate: Fri Dec 8 15:42:54 2023 +0900 Commit: Tomaž Vajngerl CommitDate: Thu Dec 28 08:06:36 2023 +0100 editeng: move inline methods into ImpEditEngine class Change-Id: Id9e6e1a4308b7f7d0384a1b28c7279aaa3c716f8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161345 Tested-by: Tomaž Vajngerl Reviewed-by: Tomaž Vajngerl diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index e4352f298fd8..57fe8ca0c7eb 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -404,9 +404,32 @@ public: voidSetSelectionMode( EESelectionMode eMode ); -inline PointerStyle GetPointer(); +PointerStyle GetPointer() +{ +if ( !mxPointer ) +{ +mxPointer = IsVertical() ? PointerStyle::TextVertical : PointerStyle::Text; +return *mxPointer; +} + +if(PointerStyle::Text == *mxPointer && IsVertical()) +{ +mxPointer = PointerStyle::TextVertical; +} +else if(PointerStyle::TextVertical == *mxPointer && !IsVertical()) +{ +mxPointer = PointerStyle::Text; +} + +return *mxPointer; +} -inline vcl::Cursor* GetCursor(); +vcl::Cursor* GetCursor() +{ +if ( !pCursor ) +pCursor.reset( new vcl::Cursor ); +return pCursor.get(); +} voidAddDragAndDropListeners(); voidRemoveDragAndDropListeners(); @@ -789,7 +812,25 @@ private: void ForceAutoColor( bool b ) { mbForceAutoColor = b; } bool IsForceAutoColor() const { return mbForceAutoColor; } -inline VirtualDevice* GetVirtualDevice( const MapMode& rMapMode, DrawModeFlags nDrawMode ); +VirtualDevice* GetVirtualDevice(const MapMode& rMapMode, DrawModeFlags nDrawMode) +{ +if ( !pVirtDev ) +pVirtDev = VclPtr::Create(); + +if ( ( pVirtDev->GetMapMode().GetMapUnit() != rMapMode.GetMapUnit() ) || + ( pVirtDev->GetMapMode().GetScaleX() != rMapMode.GetScaleX() ) || + ( pVirtDev->GetMapMode().GetScaleY() != rMapMode.GetScaleY() ) ) +{ +MapMode aMapMode( rMapMode ); +aMapMode.SetOrigin( Point( 0, 0 ) ); +pVirtDev->SetMapMode( aMapMode ); +} + +pVirtDev->SetDrawMode( nDrawMode ); + +return pVirtDev; +} + void EraseVirtualDevice() { pVirtDev.disposeAndClear(); } DECL_LINK( StatusTimerHdl, Timer *, void); @@ -799,8 +840,19 @@ private: voidCheckIdleFormatter(); -inline const ParaPortion* FindParaPortion( const ContentNode* pNode ) const; -inline ParaPortion* FindParaPortion( ContentNode const * pNode ); +const ParaPortion* FindParaPortion(const ContentNode* pNode) const +{ +sal_Int32 nPos = maEditDoc.GetPos( pNode ); +DBG_ASSERT( nPos < GetParaPortions().Count(), "Portionloser Node?" ); +return GetParaPortions()[ nPos ]; +} + +ParaPortion* FindParaPortion(ContentNode const * pNode) +{ +sal_Int32 nPos = maEditDoc.GetPos( pNode ); +DBG_ASSERT( nPos < GetParaPortions().Count(), "Portionloser Node?" ); +return GetParaPortions()[ nPos ]; +} css::uno::Reference< css::datatransfer::XTransferable > CreateTransferable( const EditSelection& rSelection ); @@ -836,8 +888,34 @@ public: ImpEditEngine(const ImpEditEngine&) = delete; ImpEditEngine& operator=(const ImpEditEngine&) = delete; -inline EditUndoManager& GetUndoManager(); -inline EditUndoManager* SetUndoManager(EditUndoManager* pNew); +EditUndoManager& GetUndoManager() +{ +if ( !pUndoManager ) +{ +pUndoManager = new EditUndoManager(); +pUndoManager->SetEditEngine(pEditEngine); +} +return *pUndoManager; +} + +EditUndoManager* SetUndoManager(EditUndoManager* pNew) +{ +EditUndoManager* pRetval = pUndoManager; + +if(pUndoManager) +{ +pUndoManager->SetEditEngine(nullptr); +} + +pUndoManager = pNew; + +if(pUndoManager) +{ +pUndoManager->SetEditEngine(pEditEngine); +} + +return pRetval; +} // @return the previous bUpdateLayout state boolSetUpdateLayout( bool bUpdate, EditView* pCurView = nullptr, bool bForceUpdate = false ); @@ -1000,10 +1078,45 @@ public: static bool DoVisualCursorTraveling(); EditSelection ConvertSelection( sal_Int32 nStartPara, sal_Int32 nStartPos, sal_Int32 nEndPara, sal_Int32 nEndPos ); -inline EPaM CreateEPa
core.git: editeng/source linguistic/source
editeng/source/misc/unolingu.cxx |6 +- linguistic/source/dlistimp.cxx |6 +- linguistic/source/misc.cxx |6 +- 3 files changed, 15 insertions(+), 3 deletions(-) New commits: commit 0de274e62c0b7154222178de234c504dc916ede4 Author: Mike Kaganski AuthorDate: Fri Dec 22 13:29:01 2023 +0300 Commit: Mike Kaganski CommitDate: Fri Dec 22 13:28:01 2023 +0100 Lok: make Ignore All list name independent on UI language Fixes not working "Ignore All" context menu entry in e.g. German UI in Online. Change-Id: I761c9f65c89fb5c7e929ea20f2db4eff20f7d53d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161170 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/editeng/source/misc/unolingu.cxx b/editeng/source/misc/unolingu.cxx index 1e7b69a25f27..bd1fae50654e 100644 --- a/editeng/source/misc/unolingu.cxx +++ b/editeng/source/misc/unolingu.cxx @@ -29,6 +29,7 @@ #include #include +#include #include #include #include @@ -595,7 +596,10 @@ uno::Reference< XDictionary > LinguMgr::GetIgnoreAll() uno::Reference< XSearchableDictionaryList > xTmpDicList( GetDictionaryList() ); if (xTmpDicList.is()) { -std::locale loc(Translate::Create("svt")); +const LanguageTag tag = comphelper::LibreOfficeKit::isActive() +? LanguageTag("en-US") +: SvtSysLocale().GetUILanguageTag(); +std::locale loc(Translate::Create("svt", tag)); xIgnoreAll = xTmpDicList->getDictionaryByName( Translate::get(STR_DESCRIPTION_IGNOREALLLIST, loc) ); } diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx index 281abce9e11a..ba39271eee0c 100644 --- a/linguistic/source/dlistimp.cxx +++ b/linguistic/source/dlistimp.cxx @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -586,7 +587,10 @@ void DicList::CreateDicList() // create IgnoreAllList dictionary with empty URL (non persistent) // and add it to list -std::locale loc(Translate::Create("svt")); +const LanguageTag tag = comphelper::LibreOfficeKit::isActive() +? LanguageTag("en-US") +: SvtSysLocale().GetUILanguageTag(); +std::locale loc(Translate::Create("svt", tag)); uno::Reference< XDictionary > xIgnAll( createDictionary( Translate::get(STR_DESCRIPTION_IGNOREALLLIST, loc), LinguLanguageToLocale( LANGUAGE_NONE ), DictionaryType_POSITIVE, OUString() ) ); diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx index c315ad1270ee..5c50af6f1946 100644 --- a/linguistic/source/misc.cxx +++ b/linguistic/source/misc.cxx @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -690,7 +691,10 @@ uno::Reference< XDictionary > GetIgnoreAllList() uno::Reference< XSearchableDictionaryList > xDL( GetDictionaryList() ); if (xDL.is()) { -std::locale loc(Translate::Create("svt")); +const LanguageTag tag = comphelper::LibreOfficeKit::isActive() +? LanguageTag("en-US") +: SvtSysLocale().GetUILanguageTag(); +std::locale loc(Translate::Create("svt", tag)); xRes = xDL->getDictionaryByName( Translate::get(STR_DESCRIPTION_IGNOREALLLIST, loc) ); } return xRes;
core.git: editeng/source
editeng/source/uno/unotext.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit 9ca22d44e5293f3335a2b475ccef157d31c60b94 Author: Pranam Lashkari AuthorDate: Fri Dec 15 10:10:12 2023 +0530 Commit: Caolán McNamara CommitDate: Tue Dec 19 17:58:48 2023 +0100 Keep selection as after copying the text This also aligns code with 'else' branch behaviour problem: in online when coping a slide with comment, comment text was never copied in online, it required document to reload to show it correctly Change-Id: I6d444c10808ef23f282370b4b305c41eb5043b76 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160812 Tested-by: Jenkins CollaboraOffice Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara (cherry picked from commit db7faa06762ac902ff56ecbab3fff763951146e1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160943 Tested-by: Jenkins diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx index f74d7f67c328..a10fd66fdf9a 100644 --- a/editeng/source/uno/unotext.cxx +++ b/editeng/source/uno/unotext.cxx @@ -2217,6 +2217,7 @@ void SvxUnoTextBase::copyText( { pTextForwarder->CopyText( *pSourceTextForwarder ); pEditSource->UpdateData(); +SetSelection(pSource->GetSelection()); } } else
core.git: editeng/source include/editeng sw/qa sw/source
editeng/source/misc/svxacorr.cxx | 22 +- include/editeng/svxacorr.hxx |4 +++- sw/qa/extras/uiwriter/data/tdf158703.fodt | 14 ++ sw/qa/extras/uiwriter/uiwriter8.cxx | 15 +++ sw/source/core/edit/autofmt.cxx |7 --- 5 files changed, 49 insertions(+), 13 deletions(-) New commits: commit 1325d66a7f8657aaf9951a0664fbf14cca86905b Author: Mike Kaganski AuthorDate: Mon Dec 18 17:44:41 2023 +0300 Commit: Mike Kaganski CommitDate: Mon Dec 18 18:45:51 2023 +0100 tdf#158703: return updated position from FnAddNonBrkSpace The paragraph text may become shorter after the function succeeds, because it may remove arbitrary number of preceding spaces; since the position may then be used to access data in the string in the caller, we need to update it, to avoid use of old position (which may point beyond the string, and produce a crash; or it may point to a wrong position in it). Change-Id: Ib1b4b63cbd7150e0f69c97032e3410db7dadd4dc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160924 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index f6941d6cc371..ff2c4518aadd 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -667,12 +667,12 @@ bool SvxAutoCorrect::FnChgToEnEmDash( } // Add non-breaking space before specific punctuation marks in French text -bool SvxAutoCorrect::FnAddNonBrkSpace( +sal_Int32 SvxAutoCorrect::FnAddNonBrkSpace( SvxAutoCorrDoc& rDoc, std::u16string_view rTxt, sal_Int32 nEndPos, LanguageType eLang, bool& io_bNbspRunNext ) { -bool bRet = false; +sal_Int32 nRet = -1; CharClass& rCC = GetCharClass( eLang ); @@ -706,7 +706,7 @@ bool SvxAutoCorrect::FnAddNonBrkSpace( if (nIndex + nProtocolLen <= rTxt.size()) { if (INetURLObject::CompareProtocolScheme(rTxt.substr(nIndex, nProtocolLen)) != INetProtocol::NotValid) -return false; +return -1; } // Check the presence of "://" in the word @@ -734,7 +734,7 @@ bool SvxAutoCorrect::FnAddNonBrkSpace( if ( bHasSpace ) rDoc.Insert( nPos, OUString(cNonBreakingSpace) ); io_bNbspRunNext = true; -bRet = true; +nRet = nPos; } else if ( chars.indexOf( cPrevChar ) != -1 ) io_bNbspRunNext = true; @@ -748,12 +748,12 @@ bool SvxAutoCorrect::FnAddNonBrkSpace( if ( cPrevChar == ':' && cMaybeSpaceChar == cNonBreakingSpace ) { rDoc.Delete( nEndPos - 2, nEndPos - 1 ); -bRet = true; +nRet = nEndPos - 1; } } } -return bRet; +return nRet; } // URL recognition @@ -1501,10 +1501,14 @@ void SvxAutoCorrect::DoAutoCorrect( SvxAutoCorrDoc& rDoc, const OUString& rTxt, // Hardspaces autocorrection if ( IsAutoCorrFlag( ACFlags::AddNonBrkSpace ) ) { -if ( NeedsHardspaceAutocorr( cChar ) && -FnAddNonBrkSpace( rDoc, rTxt, nInsPos, GetDocLanguage( rDoc, nInsPos ), io_bNbspRunNext ) ) +// WARNING ATTENTION: rTxt is an alias of the text node's OUString +// and its length may change (even become shorter) if FnAddNonBrkSpace succeeds! +sal_Int32 nUpdatedPos = -1; +if (NeedsHardspaceAutocorr(cChar)) +nUpdatedPos = FnAddNonBrkSpace( rDoc, rTxt, nInsPos, GetDocLanguage( rDoc, nInsPos ), io_bNbspRunNext ); +if (nUpdatedPos >= 0) { -; +nInsPos = nUpdatedPos; } else if ( bIsNextRun && !IsAutoCorrectChar( cChar ) ) { diff --git a/include/editeng/svxacorr.hxx b/include/editeng/svxacorr.hxx index 6fe151449170..96415c20d8b6 100644 --- a/include/editeng/svxacorr.hxx +++ b/include/editeng/svxacorr.hxx @@ -411,7 +411,9 @@ public: bool FnChgToEnEmDash( SvxAutoCorrDoc&, const OUString&, sal_Int32 nSttPos, sal_Int32 nEndPos, LanguageType eLang ); -bool FnAddNonBrkSpace( SvxAutoCorrDoc&, std::u16string_view, +// Returns an updated position, at which the insertion/removal happened. It may be +// a smaller value, if leading spaces were removed. If unsuccessful, returns -1. +sal_Int32 FnAddNonBrkSpace( SvxAutoCorrDoc&, std::u16string_view, sal_Int32 nEndPos, LanguageType eLang, bool& io_bNbspRunNext );
core.git: editeng/source
editeng/source/misc/acorrcfg.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 0a431e89b743bc3b29716b4ef2ae863beff90f80 Author: Samuel Mehrbrodt AuthorDate: Mon Dec 18 14:36:39 2023 +0100 Commit: Samuel Mehrbrodt CommitDate: Mon Dec 18 16:36:37 2023 +0100 tdf#158186 Fix saving ApplyNumberingAfterSpace Change-Id: I6880f75c140f6e800bbdb6c56dd1ff166a3191d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160916 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt diff --git a/editeng/source/misc/acorrcfg.cxx b/editeng/source/misc/acorrcfg.cxx index 47f634d4347f..fcafbfca6f0c 100644 --- a/editeng/source/misc/acorrcfg.cxx +++ b/editeng/source/misc/acorrcfg.cxx @@ -421,9 +421,9 @@ Sequence SvxSwAutoCorrCfg::GetPropertyNames() "Format/ByInput/ApplyNumbering/SpecialCharacter/FontCharset", //45 "Format/ByInput/ApplyNumbering/SpecialCharacter/FontPitch", //46 "Format/Option/SetDOIAttribute",//47 -"Format/ByInput/ApplyNumberingAfterSpace", //48 +"Format/ByInput/ApplyBulletsAfterSpace",//48 }; -const int nCount = 48; +const int nCount = 49; Sequence aNames(nCount); OUString* pNames = aNames.getArray(); for(int i = 0; i < nCount; i++)
[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 +# file
[Libreoffice-commits] core.git: editeng/source
editeng/source/editeng/editview.cxx |4 ++-- editeng/source/editeng/impedit.cxx |4 ++-- editeng/source/items/CustomPropertyField.cxx |2 +- editeng/source/items/flditem.cxx | 16 4 files changed, 13 insertions(+), 13 deletions(-) New commits: commit c860e7cc974c306961c421be1eb034c78c6c244f Author: Stephan Bergmann AuthorDate: Sun Nov 19 22:04:58 2023 +0100 Commit: Stephan Bergmann CommitDate: Mon Nov 20 07:55:09 2023 +0100 Extended loplugin:ostr: editeng Change-Id: I5dbd4047d2b66c12475020abfdd2b8f16d65a8f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159714 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index adf135b8e7f6..df9f193ebfe6 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -535,7 +535,7 @@ void EditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor, bool bActivat static const OString aPayload = OString::boolean(true); pImpEditView->mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, aPayload); - pImpEditView->mpViewShell->NotifyOtherViews(LOK_CALLBACK_VIEW_CURSOR_VISIBLE, "visible", aPayload); + pImpEditView->mpViewShell->NotifyOtherViews(LOK_CALLBACK_VIEW_CURSOR_VISIBLE, "visible"_ostr, aPayload); } } @@ -553,7 +553,7 @@ void EditView::HideCursor(bool bDeactivate) OString aPayload = OString::boolean(false); pImpEditView->mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, aPayload); - pImpEditView->mpViewShell->NotifyOtherViews(LOK_CALLBACK_VIEW_CURSOR_VISIBLE, "visible", aPayload); + pImpEditView->mpViewShell->NotifyOtherViews(LOK_CALLBACK_VIEW_CURSOR_VISIBLE, "visible"_ostr, aPayload); } } diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index 393a208703b4..851e63c0453d 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -439,12 +439,12 @@ void ImpEditView::lokSelectionCallback(const std::optional & { // Another shell wants to know about our existing selection. if (mpViewShell != mpOtherShell) -mpViewShell->NotifyOtherView(mpOtherShell, LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", sRectangle); +mpViewShell->NotifyOtherView(mpOtherShell, LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection"_ostr, sRectangle); } else { mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRectangle); -mpViewShell->NotifyOtherViews(LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", sRectangle); +mpViewShell->NotifyOtherViews(LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection"_ostr, sRectangle); } pOutWin->GetOutDev()->Pop(); diff --git a/editeng/source/items/CustomPropertyField.cxx b/editeng/source/items/CustomPropertyField.cxx index 939a6af0c0d9..eaad4c4c4db8 100644 --- a/editeng/source/items/CustomPropertyField.cxx +++ b/editeng/source/items/CustomPropertyField.cxx @@ -45,7 +45,7 @@ bool CustomPropertyField::operator==(const SvxFieldData& rOther) const MetaAction* CustomPropertyField::createBeginComment() const { -return new MetaCommentAction("FIELD_SEQ_BEGIN"); +return new MetaCommentAction("FIELD_SEQ_BEGIN"_ostr); } OUString CustomPropertyField::GetFormatted(uno::Reference const & xDocumentProperties) diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx index 1f6a9d9cc485..b501d40ba968 100644 --- a/editeng/source/items/flditem.cxx +++ b/editeng/source/items/flditem.cxx @@ -266,12 +266,12 @@ bool SvxFieldData::operator==( const SvxFieldData& rFld ) const MetaAction* SvxFieldData::createBeginComment() const { -return new MetaCommentAction( "FIELD_SEQ_BEGIN" ); +return new MetaCommentAction( "FIELD_SEQ_BEGIN"_ostr ); } MetaAction* SvxFieldData::createEndComment() { -return new MetaCommentAction( "FIELD_SEQ_END" ); +return new MetaCommentAction( "FIELD_SEQ_END"_ostr ); } @@ -428,7 +428,7 @@ OUString SvxDateField::GetFormatted( Date const & aDate, SvxDateFormat eFormat, MetaAction* SvxDateField::createBeginComment() const { -return new MetaCommentAction( "FIELD_SEQ_BEGIN" ); +return new MetaCommentAction( "FIELD_SEQ_BEGIN"_ostr ); } SvxURLField::SvxURLField() @@ -466,7 +466,7 @@ bool SvxURLField::operator==( const SvxFieldData& rOther ) const MetaAction* SvxURLField::createBeginComment() const { // #i46618# Adding target URL to metafile comment -return new MetaCommentAction( "FIELD_SEQ_BEGIN", +return new MetaCommentAction( "FIELD_SEQ_BEGIN"_ostr, 0, reinterpret_cast(aURL.getStr()), 2*aURL.getL
[Libreoffice-commits] core.git: editeng/source include/editeng sc/source sd/source sw/source
editeng/source/outliner/outlvw.cxx |4 ++-- include/editeng/outliner.hxx |2 +- sc/source/ui/drawfunc/drtxtob.cxx|4 +++- sc/source/ui/view/editsh.cxx |4 +++- sd/source/ui/view/drviews2.cxx |4 +++- sw/source/uibase/shells/drwtxtex.cxx |4 +++- 6 files changed, 15 insertions(+), 7 deletions(-) New commits: commit aaca48eb12357fa5cf23054fe77554bcfff74e95 Author: Justin Luth AuthorDate: Mon Nov 6 13:41:05 2023 -0500 Commit: Justin Luth CommitDate: Wed Nov 15 20:04:37 2023 +0100 tdf#158031 editeng SID_COPY_HYPERLINK: use AlsoCheckBeforeCursor This patch depends on prior patches for this bug report. This fixes nothing being copied if the mouse was right-clicked over that second half of the hyperlink (since a "smart" positioning set the cursor after the field instead of before it). Change-Id: I6c933224cd8d36f48f4e1f0aafaa1f4e46d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159015 Reviewed-by: Justin Luth Tested-by: Jenkins diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index adf75cc54afa..2649e865d6d7 100644 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -1340,9 +1340,9 @@ const SvxFieldItem* OutlinerView::GetFieldUnderMousePointer() const return pEditView->GetFieldUnderMousePointer(); } -const SvxFieldItem* OutlinerView::GetFieldAtSelection() const +const SvxFieldItem* OutlinerView::GetFieldAtSelection(bool bAlsoCheckBeforeCursor) const { -return pEditView->GetFieldAtSelection(); +return pEditView->GetFieldAtSelection(bAlsoCheckBeforeCursor); } const SvxFieldData* OutlinerView::GetFieldAtCursor() const diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index cc921f4cd0af..4f8d41e21b9b 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -306,7 +306,7 @@ public: voidInsertField( const SvxFieldItem& rFld ); const SvxFieldItem* GetFieldUnderMousePointer() const; -const SvxFieldItem* GetFieldAtSelection() const; +const SvxFieldItem* GetFieldAtSelection(bool bAlsoCheckBeforeCursor = false) const; /// Return the field at the current cursor position or nullptr if no field found const SvxFieldData* GetFieldAtCursor() const; /// Select the field at the current cursor position diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx index ec527db045ac..65da5aac262c 100644 --- a/sc/source/ui/drawfunc/drtxtob.cxx +++ b/sc/source/ui/drawfunc/drtxtob.cxx @@ -311,7 +311,9 @@ void ScDrawTextObjectBar::Execute( SfxRequest &rReq ) case SID_COPY_HYPERLINK_LOCATION: { -const SvxFieldData* pField = pOutView->GetFieldAtCursor(); +const SvxFieldItem* pFieldItem += pOutView->GetFieldAtSelection(/*AlsoCheckBeforeCursor=*/true); +const SvxFieldData* pField = pFieldItem ? pFieldItem->GetField() : nullptr; if (const SvxURLField* pURLField = dynamic_cast(pField)) { uno::Reference xClipboard diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index 3393ca3ad090..ba76f89c4651 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -655,7 +655,9 @@ void ScEditShell::Execute( SfxRequest& rReq ) break; case SID_COPY_HYPERLINK_LOCATION: { -const SvxFieldData* pField = pEditView->GetFieldAtCursor(); +const SvxFieldItem* pFieldItem += pEditView->GetFieldAtSelection(/*AlsoCheckBeforeCursor=*/true); +const SvxFieldData* pField = pFieldItem ? pFieldItem->GetField() : nullptr; if (const SvxURLField* pURLField = dynamic_cast(pField)) { uno::Reference xClipboard diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index b49e7bfc497a..fab59b59f00a 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -2280,7 +2280,9 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) OutlinerView* pOutView = mpDrawView->GetTextEditOutlinerView(); if ( pOutView ) { -const SvxFieldData* pField = pOutView->GetFieldAtCursor(); +const SvxFieldItem* pFieldItem += pOutView->GetFieldAtSelection(/*AlsoCheckBeforeCursor=*/true); +const SvxFieldData* pField = pFieldItem ? pFieldItem->GetField() : nullptr; if (const SvxURLField* pURLField = dynamic_cast(pField)) { uno::Reference xClipboard diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx index db76755474e4..dc10ba46f143 100644 --- a/sw/source/uibase/shells/drwtxtex.cxx +++ b/s
[Libreoffice-commits] core.git: editeng/source include/editeng sc/source
editeng/source/accessibility/AccessibleContextBase.cxx |9 +++-- include/editeng/AccessibleContextBase.hxx |6 -- sc/source/ui/Accessibility/AccessibleDocument.cxx |4 ++-- 3 files changed, 9 insertions(+), 10 deletions(-) New commits: commit b048814f5eb2ed58c302a880a2eabf69473955e0 Author: Noel Grandin AuthorDate: Wed Nov 8 14:43:47 2023 +0200 Commit: Noel Grandin CommitDate: Fri Nov 10 12:35:58 2023 +0100 loplugin:fieldcast in accessibility::AccessibleContextBase Change-Id: Ibd71c2e809731114d4415754c8fd94110bd5736b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159225 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/editeng/source/accessibility/AccessibleContextBase.cxx b/editeng/source/accessibility/AccessibleContextBase.cxx index 7143b7151bcf..df52b70e78a4 100644 --- a/editeng/source/accessibility/AccessibleContextBase.cxx +++ b/editeng/source/accessibility/AccessibleContextBase.cxx @@ -128,7 +128,7 @@ bool AccessibleContextBase::GetState (sal_Int64 aState) void AccessibleContextBase::SetRelationSet ( -const uno::Reference& rxNewRelationSet) +const rtl::Reference& rxNewRelationSet) { // Try to emit some meaningful events indicating differing relations in // both sets. @@ -268,12 +268,9 @@ uno::Reference SAL_CALL ThrowIfDisposed (); // Create a copy of the relation set and return it. -::utl::AccessibleRelationSetHelper* pRelationSet = -static_cast< ::utl::AccessibleRelationSetHelper*>(mxRelationSet.get()); -if (pRelationSet != nullptr) +if (mxRelationSet) { -return uno::Reference ( -new ::utl::AccessibleRelationSetHelper (*pRelationSet)); +return new ::utl::AccessibleRelationSetHelper(*mxRelationSet); } else return uno::Reference(nullptr); diff --git a/include/editeng/AccessibleContextBase.hxx b/include/editeng/AccessibleContextBase.hxx index d2152a9a4026..25f3ab8ceb55 100644 --- a/include/editeng/AccessibleContextBase.hxx +++ b/include/editeng/AccessibleContextBase.hxx @@ -28,9 +28,11 @@ #include #include #include +#include namespace com::sun::star::accessibility { class XAccessibleRelationSet; } namespace com::sun::star::accessibility { struct AccessibleEventObject; } +namespace utl { class AccessibleRelationSetHelper; } namespace accessibility { @@ -157,7 +159,7 @@ public: @throws css::uno::RuntimeException */ void SetRelationSet ( -const css::uno::Reference< css::accessibility::XAccessibleRelationSet>& rxRelationSet); +const rtl::Reference< utl::AccessibleRelationSetHelper>& rxRelationSet); //= XAccessible = @@ -263,7 +265,7 @@ protected: /** The relation set. Relations can be set or removed by calling the AddRelation and RemoveRelation methods. */ -css::uno::Reference< css::accessibility::XAccessibleRelationSet> mxRelationSet; +rtl::Reference mxRelationSet; // This method is called from the component helper base class while disposing. virtual void SAL_CALL disposing() override; diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx index 3222cc289ed8..c309f1b1fe66 100644 --- a/sc/source/ui/Accessibility/AccessibleDocument.cxx +++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx @@ -267,7 +267,7 @@ private: bool FindSelectedShapesChanges(const css::uno::Reference& xShapes) const; std::optional GetAnchor(const uno::Reference& xShape) const; -uno::Reference GetRelationSet(const ScAccessibleShapeData* pData) const; +rtl::Reference GetRelationSet(const ScAccessibleShapeData* pData) const; void SetAnchor(const uno::Reference& xShape, ScAccessibleShapeData* pData) const; void AddShape(const uno::Reference& xShape, bool bCommitChange) const; void RemoveShape(const uno::Reference& xShape) const; @@ -1125,7 +1125,7 @@ std::optional ScChildrenShapes::GetAnchor(const uno::Reference(); } -uno::Reference ScChildrenShapes::GetRelationSet(const ScAccessibleShapeData* pData) const +rtl::Reference ScChildrenShapes::GetRelationSet(const ScAccessibleShapeData* pData) const { rtl::Reference pRelationSet = new utl::AccessibleRelationSetHelper();
[Libreoffice-commits] core.git: editeng/source include/editeng sc/source sd/source sw/source
editeng/source/editeng/editeng.cxx |4 ++-- editeng/source/editeng/editview.cxx |4 ++-- editeng/source/editeng/impedit.cxx |4 ++-- editeng/source/editeng/impedit.hxx |4 ++-- editeng/source/editeng/impedit2.cxx | 32 +--- editeng/source/outliner/outlvw.cxx |8 include/editeng/editeng.hxx |4 +++- include/editeng/editview.hxx |3 ++- include/editeng/outliner.hxx |5 +++-- sc/source/ui/drawfunc/drtxtob1.cxx |3 ++- sd/source/ui/func/fuinsert.cxx |1 + sd/source/ui/view/sdview3.cxx| 30 ++ sw/source/uibase/shells/drwtxtex.cxx |3 ++- 13 files changed, 84 insertions(+), 21 deletions(-) New commits: commit 87be89ac27023f48f68a873b37df31aa0453d6fa Author: Oliver Specht AuthorDate: Mon Oct 30 13:26:49 2023 +0100 Commit: Thorsten Behrens CommitDate: Fri Nov 10 09:52:28 2023 +0100 tdf#157363 add HTML format when pasting into draw text adds HTML to paste(special) in draw text in impress/draw/calc/writer Change-Id: Iaede82e1b3d48be362b70bd631e7f912b02b9822 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158659 Tested-by: Jenkins Reviewed-by: Thorsten Behrens diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index 6cb28954aedc..728609cd94e2 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -849,9 +849,9 @@ EditSelection EditEngine::InsertText(const EditTextObject& rTextObject, const Ed EditSelection EditEngine::InsertText( uno::Reference const & rxDataObj, -const OUString& rBaseURL, const EditPaM& rPaM, bool bUseSpecial) +const OUString& rBaseURL, const EditPaM& rPaM, bool bUseSpecial, SotClipboardFormatId format) { -return pImpEditEngine->PasteText(rxDataObj, rBaseURL, rPaM, bUseSpecial); +return pImpEditEngine->PasteText(rxDataObj, rBaseURL, rPaM, bUseSpecial, format); } EditPaM EditEngine::EndOfWord(const EditPaM& rPaM) diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index a50dc9ebc6fe..d73cb24ef452 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -685,10 +685,10 @@ void EditView::Paste() pImpEditView->Paste( aClipBoard ); } -void EditView::PasteSpecial() +void EditView::PasteSpecial(SotClipboardFormatId format) { Reference aClipBoard(GetClipboard()); -pImpEditView->Paste(aClipBoard, true ); +pImpEditView->Paste(aClipBoard, true, format ); } Point EditView::GetWindowPosTopLeft( sal_Int32 nParagraph ) diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index 8813376dacdd..393a208703b4 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -1946,7 +1946,7 @@ void ImpEditView::CutCopy( css::uno::Reference< css::datatransfer::clipboard::XC } } -void ImpEditView::Paste( css::uno::Reference< css::datatransfer::clipboard::XClipboard > const & rxClipboard, bool bUseSpecial ) +void ImpEditView::Paste( css::uno::Reference< css::datatransfer::clipboard::XClipboard > const & rxClipboard, bool bUseSpecial, SotClipboardFormatId format) { if ( !rxClipboard.is() ) return; @@ -2006,7 +2006,7 @@ void ImpEditView::Paste( css::uno::Reference< css::datatransfer::clipboard::XCli // paragraphs. Collect and broadcast when done instead. aSel = pEditEngine->InsertText( xDataObj, OUString(), aSel.Min(), -bUseSpecial && pEditEngine->GetInternalEditStatus().AllowPasteSpecial()); +bUseSpecial && pEditEngine->GetInternalEditStatus().AllowPasteSpecial(), format); } aPasteOrDropInfos.nEndPara = pEditEngine->GetEditDoc().GetPos( aSel.Max().GetNode() ); diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index df7a11c97dcb..6fcb58dc 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -377,7 +377,7 @@ public: boolCommand(const CommandEvent& rCEvt); voidCutCopy( css::uno::Reference< css::datatransfer::clipboard::XClipboard > const & rxClipboard, bool bCut ); -voidPaste( css::uno::Reference< css::datatransfer::clipboard::XClipboard > const & rxClipboard, bool bUseSpecial = false ); +voidPaste( css::uno::Reference< css::datatransfer::clipboard::XClipboard > const & rxClipboard, bool bUseSpecial = false, SotClipboardFormatId format = SotClipboardFormatId::NONE); voidSetVisDocStartPos( const Point& rPos ) { aVisDocStartPos = rPos; } @@ -644,7 +644,7 @@ private: std::unique_ptr CreateTextObject(EditSelection aSelection, SfxItemPool*, bool bAllowBigObjects = false, sal_Int32 nBigObjStart = 0); EditSelection InsertTextObject( const EditTextObject&