[Libreoffice-commits] core.git: sw/qa sw/source
sw/qa/extras/ooxmlexport/ooxmlexport17.cxx |2 -- sw/source/filter/ww8/docxattributeoutput.cxx |4 +++- sw/source/filter/ww8/docxexport.cxx |9 - 3 files changed, 11 insertions(+), 4 deletions(-) New commits: commit a73daa562c82a5c058a217ba80035da08d40451d Author: Justin Luth AuthorDate: Mon Jul 11 15:27:54 2022 -0400 Commit: Justin Luth CommitDate: Tue Jul 12 20:30:42 2022 +0200 tdf#114734 docx export: save comment paragraph properties DocxExport::WriteOutliner is only called for TXT_ATN, so it is safe to change this generic-sounding function. Anything in the future that wants to save "draw" text likely also would want to save paragraph properties as well. Change-Id: Ied37670f2d3d0d6096300dbc9749c8230abfdc44 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136965 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx index 07441a5d9196..496a7cfaed02 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx @@ -174,8 +174,6 @@ DECLARE_OOXMLEXPORT_TEST(testTdf132475_printField, "tdf132475_printField.docx") DECLARE_OOXMLEXPORT_TEST(testTdf114734_commentFormating, "tdf114734_commentFormating.docx") { -if (mbExported) -return; // Get the PostIt/Comment/Annotation uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); auto xFieldsAccess(xTextFieldsSupplier->getTextFields()); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index a3a91a77827e..b834f59e9eea 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -1494,7 +1494,9 @@ void DocxAttributeOutput::EndParagraphProperties(const SfxItemSet& rParagraphMar // RDF metadata for this text node. SwTextNode* pTextNode = m_rExport.m_pCurPam->GetNode().GetTextNode(); -std::map aStatements = SwRDFHelper::getTextNodeStatements("urn:bails", *pTextNode); +std::map aStatements; +if (pTextNode) +aStatements = SwRDFHelper::getTextNodeStatements("urn:bails", *pTextNode); if (!aStatements.empty()) { m_pSerializer->startElementNS(XML_w, XML_smartTag, diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index a31b51edda25..eddb4c2ea147 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -1939,6 +1939,13 @@ sal_Int32 DocxExport::WriteOutliner(const OutlinerParaObject& rParaObj, sal_uInt OUString aStr( rEditObj.GetText( n )); sal_Int32 nCurrentPos = 0; const sal_Int32 nEnd = aStr.getLength(); + +// Write paragraph properties. +AttrOutput().StartParagraphProperties(); +aAttrIter.OutParaAttr(/*bCharAttr=*/false); +SfxItemSet aParagraphMarkerProperties(m_rDoc.GetAttrPool()); +AttrOutput().EndParagraphProperties(aParagraphMarkerProperties, nullptr, nullptr, nullptr); + do { AttrOutput().StartRun( nullptr, 0 ); const sal_Int32 nNextAttr = std::min(aAttrIter.WhereNext(), nEnd); @@ -1966,7 +1973,7 @@ sal_Int32 DocxExport::WriteOutliner(const OutlinerParaObject& rParaObj, sal_uInt AttrOutput().EndRun( nullptr, 0 ); } while( nCurrentPos < nEnd ); -//aAttrIter.OutParaAttr(false); + AttrOutput().EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t()); } return nParaId;
[Libreoffice-commits] core.git: sw/qa sw/source
sw/qa/extras/ooxmlexport/ooxmlexport12.cxx |6 ++ sw/source/filter/ww8/ww8par.cxx| 15 +++ 2 files changed, 21 insertions(+) New commits: commit a7e0a5a6d0054483d3ed5a753bbba2e8ab599e90 Author: Justin Luth AuthorDate: Thu Mar 12 21:00:24 2020 +0300 Commit: Justin Luth CommitDate: Thu Jun 30 00:59:20 2022 +0200 tdf#131304 .doc: provide compatibilityMode value for .docx In case a .doc file will be exported as a .docx format, populate the appropriate compatibilityMode setting. 11: Use features specified in MS-DOC. Change-Id: I5c03d2f7aed9d5fa2577853908d05d88ddf4c122 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90437 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx index 8b4fc39dd02d..24fc6d7f7995 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx @@ -769,6 +769,12 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf79435_legacyInputFields) xParameters.set(xFormField->getParameters()); xParameters->getByName("Type") >>= sTmp; CPPUNIT_ASSERT_EQUAL(OUString("date"), sTmp); + +xmlDocUniquePtr pXmlDoc = parseExport("word/settings.xml"); +assertXPath(pXmlDoc, "/w:settings/w:compat/w:compatSetting[1]", "name", "compatibilityMode"); +assertXPath(pXmlDoc, "/w:settings/w:compat/w:compatSetting[1]", "uri", +"http://schemas.microsoft.com/office/word;); +assertXPath(pXmlDoc, "/w:settings/w:compat/w:compatSetting[1]", "val", "11"); } DECLARE_OOXMLEXPORT_TEST(testTdf120224_textControlCrossRef, "tdf120224_textControlCrossRef.docx") diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 9dab410cd66b..5195e1484de3 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -1906,6 +1906,21 @@ void SwWW8ImplReader::ImportDop() if (xInfo->hasPropertyByName("ApplyFormDesignMode")) xDocProps->setPropertyValue("ApplyFormDesignMode", css::uno::Any(false)); } + +// for the benefit of DOCX - if this is ever saved in that format. +comphelper::SequenceAsHashMap aGrabBag(xDocProps->getPropertyValue("InteropGrabBag")); +uno::Sequence aCompatSetting( comphelper::InitPropertySequence({ +{ "name", uno::Any(OUString("compatibilityMode")) }, +{ "uri", uno::Any(OUString("http://schemas.microsoft.com/office/word;)) }, +{ "val", uno::Any(OUString("11")) } //11: Use features specified in MS-DOC. +})); + +uno::Sequence< beans::PropertyValue > aValue(comphelper::InitPropertySequence({ +{ "compatSetting", uno::Any(aCompatSetting) } +})); + +aGrabBag["CompatSettings"] <<= aValue; +xDocProps->setPropertyValue("InteropGrabBag", uno::Any(aGrabBag.getAsConstPropertyValueList())); } // The password can force read-only, comments-only, fill-in-form-only, or require track-changes.
[Libreoffice-commits] core.git: sw/source
sw/source/core/edit/edfcol.cxx |4 sw/source/core/edit/ednumber.cxx | 27 +-- 2 files changed, 1 insertion(+), 30 deletions(-) New commits: commit fcbd1e8363f14fcbdcef9bb2a6bca8a2cb7644ac Author: Justin Luth AuthorDate: Tue Jun 28 07:25:57 2022 -0400 Commit: Justin Luth CommitDate: Thu Jun 30 00:19:11 2022 +0200 tdf#tdf#93747 tdf#145151 sw IsTableMode: revert obsolete one-offs I started playing whack-a-mole, patching functions for excessively selected cells. But now bug 145151 has fixed the selection process itself, so these avoidance clauses are now obsolete, so revert these 7.3 or 7.4 fixes. This keeps the unit tests in make CppunitTest_sw_uiwriter5 Change-Id: Ie7848b483d495d79c046b9f4293b605d2edea658 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136578 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx index 1d480f293fc5..aade2988c94b 100644 --- a/sw/source/core/edit/edfcol.cxx +++ b/sw/source/core/edit/edfcol.cxx @@ -2199,10 +2199,6 @@ void SwEditShell::SetTextFormatColl(SwTextFormatColl *pFormat, GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::SETFMTCOLL, ); for(SwPaM& rPaM : GetCursor()->GetRingContainer()) { -// If in table cells select mode, ignore the cells that aren't actually selected -if (IsTableMode() && !rPaM.HasMark()) -continue; - if ( !rPaM.HasReadonlySel( GetViewOptions()->IsFormView() ) ) { // store previous paragraph style for track changes diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx index dd21abd149f6..4e9ca59c476b 100644 --- a/sw/source/core/edit/ednumber.cxx +++ b/sw/source/core/edit/ednumber.cxx @@ -152,10 +152,6 @@ bool SwEditShell::SelectionHasNumber() const bool bResult = false; for (SwPaM& rPaM : GetCursor()->GetRingContainer()) { -// If in table cells select mode, ignore the cells that aren't actually selected -if (IsTableMode() && !rPaM.HasMark()) -continue; - SwNodeOffset nStt = rPaM.Start()->nNode.GetIndex(); SwNodeOffset nEnd = rPaM.End()->nNode.GetIndex(); for (SwNodeOffset nPos = nStt; nPos<=nEnd; nPos++) @@ -191,9 +187,6 @@ bool SwEditShell::SelectionHasBullet() const bool bResult = false; for (SwPaM& rPaM : GetCursor()->GetRingContainer()) { -if (IsTableMode() && !rPaM.HasMark()) -continue; - SwNodeOffset nStt = rPaM.Start()->nNode.GetIndex(); SwNodeOffset nEnd = rPaM.End()->nNode.GetIndex(); for (SwNodeOffset nPos = nStt; nPos<=nEnd; nPos++) @@ -265,9 +258,6 @@ void SwEditShell::DelNumRules() GetDoc()->GetIDocumentUndoRedo().StartUndo( SwUndoId::START, nullptr ); for (SwPaM& rPaM : pCursor->GetRingContainer()) { -if (IsTableMode() && !rPaM.HasMark()) -continue; - GetDoc()->DelNumRules(rPaM, GetLayout()); } GetDoc()->GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr ); @@ -705,19 +695,7 @@ sal_uInt8 SwEditShell::GetNumLevel() const const SwNumRule* SwEditShell::GetNumRuleAtCurrCursorPos() const { -SwPaM* pCursor = GetCursor(); -if (IsTableMode() && pCursor->IsMultiSelection() ) -{ -// Find the first valid position -for (SwPaM& rPaM : pCursor->GetRingContainer()) -{ -if (!rPaM.HasMark()) -continue; -pCursor = -break; -} -} -SwPosition pos(*pCursor->GetPoint()); +SwPosition pos(*GetCursor()->GetPoint()); return SwDoc::GetNumRuleAtPos( pos, GetLayout() ); } @@ -774,9 +752,6 @@ void SwEditShell::SetCurNumRule( const SwNumRule& rRule, OUString sContinuedListId(rContinuedListId); for (SwPaM& rPaM : pCursor->GetRingContainer()) { -if (IsTableMode() && !rPaM.HasMark()) -continue; - OUString sListId = GetDoc()->SetNumRule(rPaM, rRule, bCreateNewList, GetLayout(), sContinuedListId, true, bResetIndentAttrs );
[Libreoffice-commits] core.git: sw/qa sw/source
sw/qa/extras/uiwriter/uiwriter5.cxx |9 + sw/source/core/edit/ednumber.cxx| 14 +- 2 files changed, 22 insertions(+), 1 deletion(-) New commits: commit 6b6bedecf61e084e8db6b20a362a231dbac0e70a Author: Justin Luth AuthorDate: Tue May 24 16:00:48 2022 +0200 Commit: Justin Luth CommitDate: Wed Jun 15 19:56:12 2022 +0200 tdf#145151 sw IsTableMode GetNumRuleAtCurrCursorPos: unselected cells ...shouldn't be treated as if the cursor was there. Change-Id: Ida435635aab4442b93f969d6f473aacf3f229e02 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134887 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/qa/extras/uiwriter/uiwriter5.cxx b/sw/qa/extras/uiwriter/uiwriter5.cxx index c88dd905f584..f8bbc0d52624 100644 --- a/sw/qa/extras/uiwriter/uiwriter5.cxx +++ b/sw/qa/extras/uiwriter/uiwriter5.cxx @@ -2920,6 +2920,15 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf145151) getProperty(getParagraphOfText(1, xCellA1->getText()), "NumberingStyleName") .isEmpty()); +// Toggle it back off +dispatchCommand(mxComponent, ".uno:DefaultNumbering", {}); +Scheduler::ProcessEventsToIdle(); + +CPPUNIT_ASSERT_MESSAGE( +"Cell B1 must be able to toggle numbering on and off.", +getProperty(getParagraphOfText(1, xCellB1->getText()), "NumberingStyleName") +.isEmpty()); + // Now test removing numbering/bullets // Add A1 to the current B1 selection pWrtSh->Left(CRSR_SKIP_CHARS, /*bSelect=*/true, 1, /*bBasicCall=*/false); diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx index 93e0de0a4c2c..dd21abd149f6 100644 --- a/sw/source/core/edit/ednumber.cxx +++ b/sw/source/core/edit/ednumber.cxx @@ -705,7 +705,19 @@ sal_uInt8 SwEditShell::GetNumLevel() const const SwNumRule* SwEditShell::GetNumRuleAtCurrCursorPos() const { -SwPosition pos(*GetCursor()->GetPoint()); +SwPaM* pCursor = GetCursor(); +if (IsTableMode() && pCursor->IsMultiSelection() ) +{ +// Find the first valid position +for (SwPaM& rPaM : pCursor->GetRingContainer()) +{ +if (!rPaM.HasMark()) +continue; +pCursor = +break; +} +} +SwPosition pos(*pCursor->GetPoint()); return SwDoc::GetNumRuleAtPos( pos, GetLayout() ); }
[Libreoffice-commits] core.git: sw/qa sw/source
sw/qa/extras/uiwriter/uiwriter5.cxx | 84 sw/source/core/edit/ednumber.cxx| 21 - 2 files changed, 95 insertions(+), 10 deletions(-) New commits: commit 9a2e7bade3aa8b115f1973be532ec86fa0369171 Author: Justin Luth AuthorDate: Mon May 23 18:33:41 2022 +0200 Commit: Miklos Vajna CommitDate: Mon Jun 13 09:51:35 2022 +0200 tdf#145151 sw IsTableMode NumRule: unselected cells ...should not be affected when setting or deleting numbering. This patch depends on follow-up patches to properly detect if numbering is turned on or off in some cases. This patch prevents numbering from "leaking" into the previous cell if the cells were selected backwards. Perhaps it would be better to fix the selection code itself instead of handling all of these edge cases, but doing that might have unintended consequences that I wouldn't have any insight into. So this is safer. Change-Id: I98e18d6056e93a4d89fdbe75b6237daca7832f41 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134885 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna diff --git a/sw/qa/extras/uiwriter/uiwriter5.cxx b/sw/qa/extras/uiwriter/uiwriter5.cxx index 1e9d5a0b7560..6517b7a32557 100644 --- a/sw/qa/extras/uiwriter/uiwriter5.cxx +++ b/sw/qa/extras/uiwriter/uiwriter5.cxx @@ -2870,6 +2870,90 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf93747) getProperty(getParagraphOfText(1, xCellB1->getText()), "ParaStyleName")); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf145151) +{ +SwDoc* pDoc = createSwDoc(); +SwWrtShell* pWrtSh = pDoc->GetDocShell()->GetWrtShell(); + +uno::Sequence aArgs(comphelper::InitPropertySequence( +{ { "Rows", uno::Any(sal_Int32(2)) }, { "Columns", uno::Any(sal_Int32(2)) } })); + +dispatchCommand(mxComponent, ".uno:InsertTable", aArgs); +Scheduler::ProcessEventsToIdle(); + +pWrtSh->Insert("Col1"); + +// Move the cursor to B1 +pWrtSh->Right(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, /*bBasicCall=*/false); + +pWrtSh->Insert("Col2"); + +uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xIndexAccess(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); +uno::Reference xTextTable(xIndexAccess->getByIndex(0), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); +CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTextTable->getRows()->getCount()); +CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTextTable->getColumns()->getCount()); + +uno::Reference xCellA1(xTextTable->getCellByName("A1"), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(OUString("Col1"), xCellA1->getString()); + +uno::Reference xCellB1(xTextTable->getCellByName("B1"), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(OUString("Col2"), xCellB1->getString()); + +// Select backwards B1 and A1 (select "2loC" which ends up selecting both cells) +pWrtSh->Left(CRSR_SKIP_CHARS, /*bSelect=*/true, 5, /*bBasicCall=*/false); + +// Just select the whole B1 +pWrtSh->Right(CRSR_SKIP_CHARS, /*bSelect=*/true, 1, /*bBasicCall=*/false); + +dispatchCommand(mxComponent, ".uno:DefaultNumbering", {}); +Scheduler::ProcessEventsToIdle(); + +// B1 should now have a numbering style, but A1 should not be affected. +OUString sNumStyleB1 += getProperty(getParagraphOfText(1, xCellB1->getText()), "NumberingStyleName"); +CPPUNIT_ASSERT(!sNumStyleB1.isEmpty()); +CPPUNIT_ASSERT_MESSAGE( +"Only cell B1 was selected. A1 should not have any numbering.", +getProperty(getParagraphOfText(1, xCellA1->getText()), "NumberingStyleName") +.isEmpty()); + +// Now test removing numbering/bullets +// Add A1 to the current B1 selection +pWrtSh->Left(CRSR_SKIP_CHARS, /*bSelect=*/true, 1, /*bBasicCall=*/false); + +// Toggle on bullet numbering +dispatchCommand(mxComponent, ".uno:DefaultBullet", {}); +Scheduler::ProcessEventsToIdle(); + +// sanity check - both cells have bullets turned on. +OUString sNumStyleA1 += getProperty(getParagraphOfText(1, xCellA1->getText()), "NumberingStyleName"); +CPPUNIT_ASSERT(!sNumStyleA1.isEmpty()); +CPPUNIT_ASSERT_EQUAL( +sNumStyleA1, +getProperty(getParagraphOfText(1, xCellB1->getText()), "NumberingStyleName")); +CPPUNIT_ASSERT(sNumStyleA1 != sNumStyleB1); // therefore B1 changed from numbering to bullets + +// Just select cell B1 +pWrtSh->Right(CRSR_SKIP_CHARS, /*bSelect=*/true, 1, /*bBasicCall=*/false); + +// Toggle off bullet numberin
[Libreoffice-commits] core.git: sw/inc sw/source
sw/inc/unoprnms.hxx|1 - sw/source/core/unocore/unosett.cxx |3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) New commits: commit 1a57418e2837e7fd07b0619804feed06e1acfe41 Author: Justin Luth AuthorDate: Sat May 21 18:27:45 2022 +0200 Commit: Justin Luth CommitDate: Wed Jun 15 01:44:17 2022 +0200 remove unused sw UNO_NAME_CHARACTER_FORMAT_NONE CharacterFormatNone seems to be orphaned code. Was this ever written out to file? If not, then it should be removable because I don't see anywhere that it can be set. I found this while working on tdf#75297. Change-Id: I3212ab7dcda3c46adfe638ee1ae412a3ede8762c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134889 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Michael Stahl diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx index c3a7d97b32e8..7fcf2850f873 100644 --- a/sw/inc/unoprnms.hxx +++ b/sw/inc/unoprnms.hxx @@ -340,7 +340,6 @@ #define UNO_NAME_WIDTH "Width" #define UNO_NAME_CHAR_WORD_MODE "CharWordMode" #define UNO_NAME_GRAPHIC_CROP "GraphicCrop" -#define UNO_NAME_CHARACTER_FORMAT_NONE "CharacterFormatNone" #define UNO_NAME_DOCUMENT_INDEX_MARK "DocumentIndexMark" #define UNO_NAME_DOCUMENT_INDEX "DocumentIndex" #define UNO_NAME_IS_GLOBAL_DOCUMENT_SECTION "IsGlobalDocumentSection" diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx index c68a4fac048f..648110971c33 100644 --- a/sw/source/core/unocore/unosett.cxx +++ b/sw/source/core/unocore/unosett.cxx @@ -1134,7 +1134,6 @@ void SwXNumberingRules::replaceByIndex(sal_Int32 nIndex, const uno::Any& rElemen { SwNumFormat aFormat(aNumRule.Get( i )); if (!m_sNewCharStyleNames[i].isEmpty() && -m_sNewCharStyleNames[i] != UNO_NAME_CHARACTER_FORMAT_NONE && (!aFormat.GetCharFormat() || aFormat.GetCharFormat()->GetName()!= m_sNewCharStyleNames[i])) { SwCharFormat* pCharFormat = nullptr; @@ -1574,7 +1573,7 @@ void SwXNumberingRules::SetPropertiesToNumFormat( OUString sCharFormatName; SwStyleNameMapper::FillUIName( uTmp, sCharFormatName, SwGetPoolIdFromName::ChrFmt ); SwDoc *const pLocalDoc = pDocShell ? pDocShell->GetDoc() : pDoc; -if (sCharFormatName.isEmpty() || sCharFormatName == UNO_NAME_CHARACTER_FORMAT_NONE) +if (sCharFormatName.isEmpty()) { rCharStyleName = aInvalidStyle; aFormat.SetCharFormat(nullptr);
[Libreoffice-commits] core.git: sw/qa sw/source
sw/qa/extras/uiwriter/uiwriter5.cxx |8 ++ sw/source/core/edit/ednumber.cxx| 99 2 files changed, 52 insertions(+), 55 deletions(-) New commits: commit 5036c5a7afdd043c3fa5c108c985cd0d8ed352fa Author: Justin Luth AuthorDate: Mon May 23 19:05:20 2022 +0200 Commit: Justin Luth CommitDate: Wed Jun 15 01:28:51 2022 +0200 tdf#145151 sw IsTableMode SelectionHasNumber: unselected cells ...shouldn't be checked This followup patch checks the proper cells to see if numbering or bullets are turned on. There is one side effect here. Picture this scenario where you select some paragraphs (_ indicates blank paragraph) _ _ 1. some numbered text _ In this non-empty case, SectionHasNumber is true, showing numbering on in the toolbar. Prior to this patch, the following scenario was "false", showing numbering off in the toolbar. - - 1._ _ and the result was that all the blank lines toggled on. Now it acts just like the non-empty case. Although one can dispute that this is the correct action, consistency is nice... Change-Id: I8a1b8ee0fe947a7bfe7906a0add3aaf2d8e7b232 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134886 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/qa/extras/uiwriter/uiwriter5.cxx b/sw/qa/extras/uiwriter/uiwriter5.cxx index 6517b7a32557..c88dd905f584 100644 --- a/sw/qa/extras/uiwriter/uiwriter5.cxx +++ b/sw/qa/extras/uiwriter/uiwriter5.cxx @@ -2952,6 +2952,14 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf145151) "Only cell B1 was selected. A1 should still have bullets turned on.", !getProperty(getParagraphOfText(1, xCellA1->getText()), "NumberingStyleName") .isEmpty()); + +// Toggle it back on +dispatchCommand(mxComponent, ".uno:DefaultBullet", {}); +Scheduler::ProcessEventsToIdle(); + +CPPUNIT_ASSERT( +!getProperty(getParagraphOfText(1, xCellB1->getText()), "NumberingStyleName") + .isEmpty()); } CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf126735) diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx index 3b35eab94c57..93e0de0a4c2c 100644 --- a/sw/source/core/edit/ednumber.cxx +++ b/sw/source/core/edit/ednumber.cxx @@ -146,45 +146,40 @@ void SwEditShell::NoNum() EndAllAction(); } +// The entire selection is numbered (ignoring unnumbered empty lines) bool SwEditShell::SelectionHasNumber() const { -bool bResult = HasNumber(); -const SwTextNode * pTextNd = sw::GetParaPropsNode(*GetLayout(), GetCursor()->GetPoint()->nNode); -if (!bResult && pTextNd && pTextNd->Len()==0 && !pTextNd->GetNumRule()) { -SwPamRanges aRangeArr( *GetCursor() ); -SwPaM aPam( *GetCursor()->GetPoint() ); -for( size_t n = 0; n < aRangeArr.Count(); ++n ) +bool bResult = false; +for (SwPaM& rPaM : GetCursor()->GetRingContainer()) +{ +// If in table cells select mode, ignore the cells that aren't actually selected +if (IsTableMode() && !rPaM.HasMark()) +continue; + +SwNodeOffset nStt = rPaM.Start()->nNode.GetIndex(); +SwNodeOffset nEnd = rPaM.End()->nNode.GetIndex(); +for (SwNodeOffset nPos = nStt; nPos<=nEnd; nPos++) { -aRangeArr.SetPam( n, aPam ); +SwTextNode* pTextNd = mxDoc->GetNodes()[nPos]->GetTextNode(); +if (pTextNd) { -SwNodeOffset nStt = aPam.Start()->nNode.GetIndex(), - nEnd = aPam.End()->nNode.GetIndex(); -for (SwNodeOffset nPos = nStt; nPos<=nEnd; nPos++) -{ -pTextNd = mxDoc->GetNodes()[nPos]->GetTextNode(); -if (pTextNd) -{ -pTextNd = sw::GetParaPropsNode(*GetLayout(), SwNodeIndex(*pTextNd)); -} -if (pTextNd && pTextNd->Len()!=0) -{ -bResult = pTextNd->HasNumber(); +pTextNd = sw::GetParaPropsNode(*GetLayout(), SwNodeIndex(*pTextNd)); +} +if (pTextNd && (!bResult || pTextNd->Len()!=0)) +{ +bResult = pTextNd->HasNumber(); -// #b6340308# special case: outline numbered, not counted paragraph -if ( bResult && -pTextNd->GetNumRule() == GetDoc()->GetOutlineNumRule() && -!pTextNd->IsCountedInList() ) -{ -bResult = false; -} -if (!bResult) { -
[Libreoffice-commits] core.git: sw/qa sw/source
sw/qa/extras/ooxmlexport/ooxmlexport2.cxx |3 +++ sw/source/filter/ww8/docxsdrexport.cxx| 13 + 2 files changed, 12 insertions(+), 4 deletions(-) New commits: commit 0332ab4bbbad2c4fad08650d62bf7addec0d2dd7 Author: Justin Luth AuthorDate: Sat Jun 11 20:03:35 2022 -0400 Commit: Justin Luth CommitDate: Mon Jun 20 16:03:27 2022 +0200 tdf#140967 docxexport: hairline is default and not a specific value This effectively is treated as a zero, although I didn't find any documentaiton that indicated what is supposed to happen when a:ln has no w=. Otherwise these numbers are normally in the thousands, and not "2". Change-Id: I9dd6a334e88feb9a2bafe29f92229b6cfdff9747 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135674 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx index 48cec2f2cca2..aa6fc8406b96 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx @@ -647,6 +647,9 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo48557) CPPUNIT_ASSERT_EQUAL(sal_Int32(150), getProperty(xFrame, "TextRightDistance")); CPPUNIT_ASSERT_EQUAL(sal_Int32(150), getProperty(xFrame, "TextUpperDistance")); CPPUNIT_ASSERT_EQUAL(sal_Int32(150), getProperty(xFrame, "TextLowerDistance")); + +//tdf#140967 frame border was too small. Expected 0 (hairline), actual was 2 +CPPUNIT_ASSERT_EQUAL(sal_uInt32(0), getProperty(xFrame, "LineWidth")); } DECLARE_OOXMLEXPORT_TEST(testI120928, "i120928.docx") diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx index 69dbd4c29091..c3c5b742e1ed 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexport.cxx @@ -1718,10 +1718,15 @@ void DocxSdrExport::writeBoxItemLine(const SvxBoxItem& rBox) } sax_fastparser::FSHelperPtr pFS = m_pImpl->getSerializer(); -double fConverted(editeng::ConvertBorderWidthToWord(pBorderLine->GetBorderLineStyle(), - pBorderLine->GetWidth())); -OString sWidth(OString::number(TwipsToEMU(fConverted))); -pFS->startElementNS(XML_a, XML_ln, XML_w, sWidth); +if (pBorderLine->GetWidth() == SvxBorderLineWidth::Hairline) +pFS->startElementNS(XML_a, XML_ln); +else +{ +double fConverted(editeng::ConvertBorderWidthToWord(pBorderLine->GetBorderLineStyle(), + pBorderLine->GetWidth())); +OString sWidth(OString::number(TwipsToEMU(fConverted))); +pFS->startElementNS(XML_a, XML_ln, XML_w, sWidth); +} pFS->startElementNS(XML_a, XML_solidFill); OString sColor(msfilter::util::ConvertColor(pBorderLine->GetColor()));
[Libreoffice-commits] core.git: sw/source
sw/source/core/unocore/unosett.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 758945b077220fe151c1565c6d5b0bad02de6d58 Author: Justin Luth AuthorDate: Sat May 21 18:09:59 2022 +0200 Commit: Justin Luth CommitDate: Fri Jun 10 22:27:37 2022 +0200 tdf#75297 sw uno: override default num char style when NONE The problem was during ODT import. When no text:style-name is provided, or if it is an empty string, then the default "Numbering symbols" character style remained active, preventing the ability to round-trip a NONE char style. Since this depends on the built-in name (and that name can easily enough change) there is not much point in creating a unit test. Change-Id: Id942060abd3e024758f93f3d279ef8b561cfc5a9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134888 Reviewed-by: Justin Luth Tested-by: Jenkins diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx index 5a94663ff121..c68a4fac048f 100644 --- a/sw/source/core/unocore/unosett.cxx +++ b/sw/source/core/unocore/unosett.cxx @@ -1574,10 +1574,11 @@ void SwXNumberingRules::SetPropertiesToNumFormat( OUString sCharFormatName; SwStyleNameMapper::FillUIName( uTmp, sCharFormatName, SwGetPoolIdFromName::ChrFmt ); SwDoc *const pLocalDoc = pDocShell ? pDocShell->GetDoc() : pDoc; -if (sCharFormatName == UNO_NAME_CHARACTER_FORMAT_NONE) +if (sCharFormatName.isEmpty() || sCharFormatName == UNO_NAME_CHARACTER_FORMAT_NONE) { rCharStyleName = aInvalidStyle; aFormat.SetCharFormat(nullptr); +aFormat.SetCharFormatName(""); } else if (pLocalDoc) {
[Libreoffice-commits] core.git: Branch 'distro/cib/libreoffice-6-1' - include/svl svl/source sw/source
include/svl/zforlist.hxx |2 ++ svl/source/numbers/zforlist.cxx |8 sw/source/core/table/swtable.cxx | 15 +-- 3 files changed, 23 insertions(+), 2 deletions(-) New commits: commit b6653e577af8e2902dbe2609d14dbbedbc4441f7 Author: Justin Luth AuthorDate: Wed Oct 20 18:09:46 2021 +0200 Commit: Michael Stahl CommitDate: Mon Jun 13 16:59:32 2022 +0200 tdf#131025 swtable: don't apply number format to non-number text Applying a numbering style to text causes export to save that out as a number (valued as zero). That is not good because the ODF spec says that a number overrides a string. So don't accept a numbering format on non-number text. Why is this change good? -the cell previously had no direct formatting (by definition). -the cell's previous old format was text (tested). -any numbering format applied obviously isn't correct (by definition). -any previous formatting has already been overwritten with numformat. -the default numbering is appropriate for text. -empty cells still get the numbering format (tested). -odd human-designed formats are accepted as intentional (tested). What are the concerns? -the scope of this change is HUGE, way beyond this bug. -on both my dev box and patch box I saw occassional crashes. -the bug was "fixed" by a different import commit that ensured different languages were treated consistently. So this patch is no longer critical, just nice to have to avoid exporting out-of-spec content. Change-Id: Id3dc5f803c3cf4875bc0cab52d1019a18679da77 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123904 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Eike Rathke (cherry picked from commit 546e7d14b397cfd1210b891c8dc4a195c25f3876) Conflicts: include/svl/numformat.hxx svl/source/numbers/zforlist.cxx sw/source/core/table/swtable.cxx Change-Id: I94db018babf0323d84809accaaa898a9caf8edbe (cherry picked from commit 66a6cb0e02e5ea9cb4a75258928103f7ecd07f36) diff --git a/include/svl/zforlist.hxx b/include/svl/zforlist.hxx index 8b1574cf8a08..e8afdb225a7b 100644 --- a/include/svl/zforlist.hxx +++ b/include/svl/zforlist.hxx @@ -601,6 +601,8 @@ public: sal_uInt16& nPrecision, sal_uInt16& nLeadingCnt, LanguageType eLnge = LANGUAGE_DONTKNOW ); +bool IsUserDefinedAndNotOverloaded(sal_uInt32 F_Index) const; + /// Check if format code string may be deleted by user bool IsUserDefined( const OUString& sStr, LanguageType eLnge = LANGUAGE_DONTKNOW ); diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index 3da7ab43c449..caa07e5002e9 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -3044,6 +3044,14 @@ OUString SvNumberFormatter::GenerateFormat(sal_uInt32 nIndex, return sString.makeStringAndClear(); } +bool SvNumberFormatter::IsUserDefinedAndNotOverloaded(sal_uInt32 F_Index) const +{ +::osl::MutexGuard aGuard( GetInstanceMutex() ); +const SvNumberformat* pFormat = GetFormatEntry(F_Index); + +return pFormat && (pFormat->GetType() & SvNumFormatType::DEFINED); +} + bool SvNumberFormatter::IsUserDefined(const OUString& sStr, LanguageType eLnge) { diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index fdc1633e7c73..c6a527abdb36 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -2326,6 +2326,7 @@ void SwTableBoxFormat::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew // format contents with the new value assigned and write to paragraph Color* pCol = nullptr; OUString sNewText; +bool bChangeFormat = true; if( DBL_MAX == fVal ) { sNewText = SwViewShell::GetShellRes()->aCalc_Error; @@ -2350,6 +2351,14 @@ void SwTableBoxFormat::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew #else sNewText = aOrigText; #endif +// Remove the newly assigned numbering format as well if text actually exists. +// Exception: assume user-defined formats are always intentional. +if (bChgText && pNumFormatr->IsTextFormat(nOldFormat) +&& !pNumFormatr->IsUserDefinedAndNotOverloaded(nNewFormat)) +{ + pBox->GetFrameFormat()->ResetFormatAttr(RES_BO
[Libreoffice-commits] core.git: officecfg/registry sw/source
officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs |2 +- sw/source/uibase/shells/textfld.cxx |6 -- 2 files changed, 5 insertions(+), 3 deletions(-) New commits: commit d4ea357e3cf1328597716c701adc255ec8f70a2c Author: Justin Luth AuthorDate: Mon Jul 18 20:49:50 2022 -0400 Commit: Justin Luth CommitDate: Tue Jul 19 19:31:29 2022 +0200 tdf#135794 sw: add no-headers to AllowCommentsInFootnotes DOCX also doesn't allow comments in headers / footers so add that situation to the existing option that was attempting to improve DOCX compatibility. By default, comments are still allowed in headers. Change-Id: I5f9ee59cc0292e41e57ba46fa7cf41ac691acabe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137210 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs b/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs index aef3819d9237..db5c7b474ff8 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs @@ -173,7 +173,7 @@ Specifies whether adding comments to footnotes etc. is allowed. These are allowed for ODF but not in OOXML and can result in invalid docx files being saved. -Allow adding comments to footnotes and frames. Disable for better OOXML interoperability. +Allow adding comments to footnotes, headers and frames. Disable for better OOXML interoperability. true diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx index b334e9b5ce95..2d1043d068f4 100644 --- a/sw/source/uibase/shells/textfld.cxx +++ b/sw/source/uibase/shells/textfld.cxx @@ -915,9 +915,11 @@ void SwTextShell::StateField( SfxItemSet ) { rSet.DisableItem(nWhich); } -// tdf#86188 Allow disabling comment insertion on footnote/endnote for better OOXML interoperability +// tdf#86188, tdf#135794: Allow disabling comment insertion +// on footnote/endnote/header/frames for better OOXML interoperability else if (!officecfg::Office::Compatibility::View::AllowCommentsInFootnotes::get() && - (rSh.IsCursorInFootnote() || rSh.GetCurrFlyFrame(/*bCalcFrame=*/false))) + (rSh.IsCursorInFootnote() || rSh.IsInHeaderFooter() || + rSh.GetCurrFlyFrame(/*bCalcFrame=*/false))) { rSet.DisableItem(nWhich); }
[Libreoffice-commits] core.git: sw/qa sw/source
sw/qa/extras/ww8export/ww8export.cxx | 11 +++ sw/source/filter/ww8/ww8graf.cxx |7 ++- 2 files changed, 17 insertions(+), 1 deletion(-) New commits: commit b4c55cb614ae1601d7cae4bc87aca3d5396c1598 Author: Justin Luth AuthorDate: Tue Jul 19 14:46:18 2022 -0400 Commit: Miklos Vajna CommitDate: Wed Jul 20 14:39:24 2022 +0200 tdf#139759 doc import: import comment highlight/shade Round-tripping depends on earlier commits for this bug. These two attributes are SvxColorItems in EditEng, but SvxBrushItems in Writer. So direct mapping doesn't work. Although it might be a highlight, LO doesn't have such a silly duplicate thing in the editeng code. So just map this as the same thing used for normal char background. As of LO 7.x, we default to exporting as char background anyway, so highlight is on the way out in LO. P.S. Highlight is one of 17-ish colors. It is the background button in the Char panel in MS Word. Background is on Word's Para panel (even though it is a character property), and so it can fairly easily be removed in MS Word. Change-Id: Id25879d90ba4a0eeff2d6afed030fc029d1c1039 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137239 Reviewed-by: Justin Luth Tested-by: Justin Luth Reviewed-by: Miklos Vajna diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx index 8351541224bc..998b67971e3f 100644 --- a/sw/qa/extras/ww8export/ww8export.cxx +++ b/sw/qa/extras/ww8export/ww8export.cxx @@ -29,6 +29,8 @@ #include #include #include +#include +#include #include #include #include @@ -1455,6 +1457,15 @@ DECLARE_WW8EXPORT_TEST(testCommentExport, "comment-export.odt") CPPUNIT_ASSERT_EQUAL(sNames[aTextPortions[i].nAnnotationID], xBookmark->getName()); } } + +// tdf#139759 import character highlight and shade for comment text +uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); +auto xFieldsAccess(xTextFieldsSupplier->getTextFields()); +uno::Reference xFields(xFieldsAccess->createEnumeration()); +uno::Reference xField(xFields->nextElement(), uno::UNO_QUERY); +uno::Reference xText = getProperty>(xField, "TextRange"); +uno::Reference xParagraph = getParagraphOfText(1, xText); +CPPUNIT_ASSERT_EQUAL(COL_WHITE, getProperty(getRun(xParagraph, 1), "CharBackColor")); } #if HAVE_MORE_FONTS diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index c10c302cf6c4..01df3d3ea58f 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -732,7 +732,12 @@ void SwWW8ImplReader::InsertAttrsAsDrawingAttrs(WW8_CP nStartCp, WW8_CP nEndCp, nWhich >= RES_FLTRATTR_END ) { sal_uInt16 nSlotId = m_rDoc.GetAttrPool().GetSlotId(nWhich); -if ( +if (nWhich == RES_CHRATR_BACKGROUND || nWhich == RES_CHRATR_HIGHLIGHT) +{ +Color aColor(static_cast(pItem)->GetColor()); +pS->Put(SvxColorItem(aColor, EE_CHAR_BKGCOLOR)); +} +else if ( nSlotId && nWhich != nSlotId && 0 != (nWhich = pEditPool->GetWhich(nSlotId)) && nWhich != nSlotId
[Libreoffice-commits] core.git: officecfg/registry sw/source
officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs |4 ++-- sw/source/uibase/shells/textfld.cxx |3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) New commits: commit e88c41b552ab958579baf3e4bccf941b588a537c Author: Justin Luth AuthorDate: Tue Jul 12 16:46:01 2022 -0400 Commit: Justin Luth CommitDate: Tue Jul 19 02:27:12 2022 +0200 tdf#135794 sw: add no-frames to AllowCommentsInFootnotes DOCX also doesn't allow comments in textboxs / frames, so add that situation to the existing option that was attempting to improve DOCX compatibility. By default, comments are allowed in frames. Although the option name is worded fairly specifically, I don't see any reason for adding a second option. I also didn't want to change the name to be more generic since this has been in existance since 6.4. Change-Id: I3cc8631b4379a0523f2556ff99aed9127016485c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137010 Tested-by: Jenkins Reviewed-by: Gabor Kelemen diff --git a/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs b/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs index 266183469f55..aef3819d9237 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs @@ -172,8 +172,8 @@ -Specifies whether adding comments to footnotes is allowed. This is allowed for ODF but not in OOXML and can result in invalid docx files being saved. -Allow adding comments to footnotes. Disable for better OOXML interoperability. +Specifies whether adding comments to footnotes etc. is allowed. These are allowed for ODF but not in OOXML and can result in invalid docx files being saved. +Allow adding comments to footnotes and frames. Disable for better OOXML interoperability. true diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx index 42ca39769015..b334e9b5ce95 100644 --- a/sw/source/uibase/shells/textfld.cxx +++ b/sw/source/uibase/shells/textfld.cxx @@ -916,7 +916,8 @@ void SwTextShell::StateField( SfxItemSet ) rSet.DisableItem(nWhich); } // tdf#86188 Allow disabling comment insertion on footnote/endnote for better OOXML interoperability -else if ( rSh.IsCursorInFootnote() && !officecfg::Office::Compatibility::View::AllowCommentsInFootnotes::get() ) +else if (!officecfg::Office::Compatibility::View::AllowCommentsInFootnotes::get() && + (rSh.IsCursorInFootnote() || rSh.GetCurrFlyFrame(/*bCalcFrame=*/false))) { rSet.DisableItem(nWhich); }
[Libreoffice-commits] core.git: Branch 'feature/cib_contract57d' - 3 commits - sw/qa sw/source
sw/qa/extras/odfimport/data/tdf149978.fodt | 53 + sw/qa/extras/odfimport/odfimport.cxx | 12 + sw/qa/extras/ooxmlexport/ooxmlexport4.cxx |2 sw/source/core/txtnode/thints.cxx |9 +--- sw/source/uibase/docvw/OverlayRanges.hxx |1 sw/source/uibase/docvw/ShadowOverlayObject.hxx |2 6 files changed, 73 insertions(+), 6 deletions(-) New commits: commit 0fd8c3d842d202f3d9834572c986882ba03a226c Author: Justin Luth AuthorDate: Thu Aug 29 09:43:09 2019 +0300 Commit: Michael Stahl CommitDate: Fri Jul 15 14:38:15 2022 +0200 related tdf#81345: make unit test robust - check last page On KDE Neon 18.04, something was causing page 1 to spill over onto page 2. Checking the last page instead of the second one is fine for testing the problem solved for bug 81345. Confirmed with bibisect53 that same header/page style had been used for the whole document originally. Change-Id: Id85562153d7ce1d570806a611f11d33fa5b83c87 Reviewed-on: https://gerrit.libreoffice.org/78250 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 6fa47ff2ee87bde38719bfaeac022efd966fc8a2) diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx index 18b8c4824e35..66cf57cd6093 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx @@ -1210,7 +1210,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf81345_045Original,"tdf81345.docx") uno::Reference xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY); uno::Reference xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY); -xCursor->jumpToPage(2); +xCursor->jumpToLastPage(); OUString pageStyleName = getProperty(xCursor, "PageStyleName"); CPPUNIT_ASSERT(pageStyleName != "Standard"); commit f6ff1f556df491946198f7fe009b3e8adee58345 Author: Michael Stahl AuthorDate: Fri Jul 15 13:16:46 2022 +0200 Commit: Michael Stahl CommitDate: Fri Jul 15 13:16:46 2022 +0200 missing includes Change-Id: Ib01c8224537448e146ab9dc80f4583f06c9f0c28 diff --git a/sw/source/uibase/docvw/OverlayRanges.hxx b/sw/source/uibase/docvw/OverlayRanges.hxx index 7482deef8f97..f8ea5694b128 100644 --- a/sw/source/uibase/docvw/OverlayRanges.hxx +++ b/sw/source/uibase/docvw/OverlayRanges.hxx @@ -24,6 +24,7 @@ #include #include +#include class SwView; diff --git a/sw/source/uibase/docvw/ShadowOverlayObject.hxx b/sw/source/uibase/docvw/ShadowOverlayObject.hxx index 637d088eab7b..3651bf4e8b8d 100644 --- a/sw/source/uibase/docvw/ShadowOverlayObject.hxx +++ b/sw/source/uibase/docvw/ShadowOverlayObject.hxx @@ -22,6 +22,8 @@ #include +#include + class SwView; namespace sw { namespace sidebarwindows { commit 60c96b4c3e79910cd98af0b764430e889bdd5e51 Author: Michael Stahl AuthorDate: Wed Jul 13 16:11:29 2022 +0200 Commit: Michael Stahl CommitDate: Fri Jul 15 13:16:30 2022 +0200 tdf#149978 sw: ODF import: fix nondeterministic automatic styles The problem is that in SwpHints::TryInsertHint() there is a check for IsInXMLImport() that is presumably an optimization to avoid the potentially expensive call to BuildPortions(). While LO would only produce 1 text:span referencing an automatic style around any given character content, this is not required by ODF, and so other producers may legitimately produce such nested text:span elements. Unfortunately the current SwpHints::Insert() isn't deterministic, the RES_TXTATR_AUTOFMT with same start/end will be compared by address in CompareSwpHtStart() (whereas RES_TXTATR_CHARFMT has a sort number for this), so the result is going to be a random order. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137033 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit d7827f712ddd21a6c1e151f54dc6eba5c12690da) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137057 Reviewed-by: Thorsten Behrens (cherry picked from commit 7a8f2c7e3a16dae6bdc891fb969e673527e45615) Change-Id: Id62a7ff5fb85dbe42b7e1a27b0d8b36b74cf1100 diff --git a/sw/qa/extras/odfimport/data/tdf149978.fodt b/sw/qa/extras/odfimport/data/tdf149978.fodt new file mode 100644 index ..5c4840c258fc --- /dev/null +++ b/sw/qa/extras/odfimport/data/tdf149978.fodt @@ -0,0 +1,53 @@ + +http://openoffice.org/2009/office; xmlns:css3t="http://www.w3.org/TR/css3-text/; xmlns:grddl="http://www.w3.org/2003/g/data-view#; xmlns:xhtml="http://www.w3.org/1999/xhtml; xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xmlns:xsd="http://www.w3.org/2001/XMLSchema; xmlns:chart="urn:oasis:names:tc:o
[Libreoffice-commits] core.git: sw/source
sw/source/core/docnode/ndtbl1.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 97f6fc9f752bc8bb34f2793442922ead59008757 Author: Justin Luth AuthorDate: Sat Jul 16 06:32:04 2022 -0400 Commit: Justin Luth CommitDate: Sat Jul 16 16:01:32 2022 +0200 tdf#64242 sw table: improve Optimal Column Width function logic This affects both Writer's minimze and optimize table functions. Instead of basing equal-width on the current table size, allow each column to have access to an equal portion of the full table size (in case that it can grow wider). This will help to maintain symmetry - one of the two primary intentions of these functions. [This is irrelevant for Draw - since the table size does not grow.] Change-Id: I0e8c499b66c538f06df52eb74374bad3b690e8d2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137120 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx index 35f4b8e7e943..ee030b5f1d4c 100644 --- a/sw/source/core/docnode/ndtbl1.cxx +++ b/sw/source/core/docnode/ndtbl1.cxx @@ -1645,7 +1645,8 @@ void SwDoc::AdjustCellWidth( const SwCursor& rCursor, // only afterwards. // The first column's desired width would be discarded as it would cause // the Table's width to exceed the maximum width. -const sal_uInt16 nEqualWidth = (aTabCols.GetRight() - aTabCols.GetLeft()) / (aTabCols.Count() + 1); +const tools::Long nMaxRight = std::max(aTabCols.GetRightMax(), nOldRight); +const sal_uInt16 nEqualWidth = (nMaxRight - aTabCols.GetLeft()) / (aTabCols.Count() + 1); const sal_Int16 nTablePadding = nSelectedWidth - fTotalWish; for ( int k = 0; k < 2; ++k ) { @@ -1678,7 +1679,6 @@ void SwDoc::AdjustCellWidth( const SwCursor& rCursor, nDiff -= aTabCols[i] - aTabCols[i-1]; tools::Long nTabRight = aTabCols.GetRight() + nDiff; -const tools::Long nMaxRight = std::max(aTabCols.GetRightMax(), nOldRight); // If the Table would become (or is already) too wide, // restrict the column growth to the allowed maximum.
[Libreoffice-commits] core.git: writerfilter/source
writerfilter/source/dmapper/DomainMapper.cxx |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) New commits: commit fc8b757dad5d98f4ba1cd40d03505873128670cd Author: Justin Luth AuthorDate: Wed Jul 13 10:19:23 2022 -0400 Commit: Justin Luth CommitDate: Wed Jul 13 21:09:30 2022 +0200 tdf#139759 writerfilter: import comment highlight Although it is a highlight, LO doesn't have such a silly duplicate thing in the editeng code. So just map this as normal char background instead of char highlight. As of LO 7.x, we default to exporting as char background anyway, so highlight is on the way out in LO. P.S. Highlight is one of 17-ish colors. It is the background button in the Char panel in MS Word. Background is on Word's Para panel (even though it is a character property), and so it can fairly easily be removed in MS Word. I didn't add a unit test because it doesn't round-trip, and an import-only test is basically useless. I'm having a surprisingly hard time finding why it doesn't export. Change-Id: Iad279b503b9f307994f1d9b96e7d984d6d8b44fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137036 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index d940d09ffd34..969578a4e73c 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1714,17 +1714,19 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) break; } +PropertyIds ePropertyId = m_pImpl->IsInComments() ? PROP_CHAR_BACK_COLOR : PROP_CHAR_HIGHLIGHT; + // OOXML import uses an ID if( IsOOXMLImport() ) { sal_Int32 nColor = 0; if( getColorFromId(nIntValue, nColor) ) -rContext->Insert(PROP_CHAR_HIGHLIGHT, uno::Any( nColor )); +rContext->Insert(ePropertyId, uno::Any(nColor)); } // RTF import uses the actual color value else if( IsRTFImport() ) { -rContext->Insert(PROP_CHAR_HIGHLIGHT, uno::Any( nIntValue )); +rContext->Insert(ePropertyId, uno::Any(nIntValue)); } } break;
[Libreoffice-commits] core.git: sw/source
sw/source/filter/ww8/wrtw8esh.cxx |7 +++ 1 file changed, 7 insertions(+) New commits: commit 11937a68aecb8db9aebb1c929d940c5b85a0ecec Author: Justin Luth AuthorDate: Thu Jul 14 09:52:58 2022 -0400 Commit: Justin Luth CommitDate: Thu Jul 14 22:51:36 2022 +0200 tdf#139759 sw ms-formats: export comment char background EditEngine's character background is a SvxColorItem, while Writer uses a SvxBrushItem. Thus we have no automatic transition possible between the two, and during export it was just being ignored as > RES_UNKNOWNATR_BEGIN. A unit test will have to wait until import (of shd) works. P.S. Import of "highlight" was fixed in an earlier commit. Setting Options - Save - MS Office Compat - As Highlighting would fully work now. Change-Id: I8674173a3d1bf1581c09458c3087d6fd39e48a1c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137090 Tested-by: Justin Luth Reviewed-by: Justin Luth diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index bcfc410ffb6e..1d8c99349163 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -1157,6 +1158,12 @@ void MSWord_SdrAttrIter::OutAttr( sal_Int32 nSwPos ) m_rExport.WriteChar(0x9); continue; } +if (nWhich == EE_CHAR_BKGCOLOR) +{ +Color aColor(static_cast(rTextAtr.pAttr)->GetValue()); +m_rExport.AttrOutput().OutputItem(SvxBrushItem(aColor, RES_CHRATR_BACKGROUND)); +continue; +} const sal_uInt16 nSlotId = pSrcPool->GetSlotId(nWhich); if (nSlotId && nWhich != nSlotId)
[Libreoffice-commits] core.git: sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf139759_commentHighlightBackground.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport17.cxx | 12 ++ writerfilter/source/dmapper/DomainMapper.cxx|4 +++ 3 files changed, 16 insertions(+) New commits: commit 386a9fadffa446caf40fd4f40b865c8c9432fa27 Author: Justin Luth AuthorDate: Thu Jul 14 10:02:35 2022 -0400 Commit: Justin Luth CommitDate: Fri Jul 15 13:41:34 2022 +0200 tdf#139759 writerfilter: avoid exception importing w:shd in comments The unit test depends on the two previous fixes in this bug report. -initial load tests highlight import -export tests saving the character background -reload tests this shade import Change-Id: Iceb405841efc6814654061659e5551ac89f3c7b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137091 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/qa/extras/ooxmlexport/data/tdf139759_commentHighlightBackground.docx b/sw/qa/extras/ooxmlexport/data/tdf139759_commentHighlightBackground.docx new file mode 100644 index ..487439a5cff8 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf139759_commentHighlightBackground.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx index 93ad3abf2da6..038dca7cc92b 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx @@ -191,6 +191,18 @@ DECLARE_OOXMLEXPORT_TEST(testTdf114734_commentFormating, "tdf114734_commentForma getProperty(xParagraph, "ParaAdjust")); } +DECLARE_OOXMLEXPORT_TEST(testTdf139759_commentHighlightBackground, "tdf139759_commentHighlightBackground.docx") +{ +uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); +auto xFieldsAccess(xTextFieldsSupplier->getTextFields()); +uno::Reference xFields(xFieldsAccess->createEnumeration()); +uno::Reference xField(xFields->nextElement(), uno::UNO_QUERY); + +uno::Reference xText = getProperty>(xField, "TextRange"); +uno::Reference xParagraph = getParagraphOfText(1, xText); +CPPUNIT_ASSERT_EQUAL(COL_YELLOW, getProperty(getRun(xParagraph, 2), "CharBackColor")); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf135906) { loadAndReload("tdf135906.docx"); diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 969578a4e73c..c3742cdbaa47 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1988,6 +1988,10 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) pProperties->resolve(*pCellColorHandler); rContext->InsertProps(pCellColorHandler->getProperties().get()); m_pImpl->GetTopContext()->Insert(PROP_CHAR_SHADING_MARKER, uno::Any(true), true, CHAR_GRAB_BAG ); + +// EditEng doesn't have a corresponding property for Shading Value, so eliminate it. +if (m_pImpl->IsInComments()) +rContext->Erase(PROP_CHAR_SHADING_VALUE); } break; }
[Libreoffice-commits] core.git: filter/source
filter/source/msfilter/svdfppt.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit fd428245bf180bb4ecc0486110aeeca091aa8403 Author: Justin Luth AuthorDate: Wed Jul 27 20:46:43 2022 -0400 Commit: Justin Luth CommitDate: Fri Jul 29 01:45:55 2022 +0200 tdf#148810 ppt import: Depth set by EE_PARA_OUTLLEVEL It isn't enough to set Paragraph->SetDepth. It must match the property set. Change-Id: I96a22057c57ae869542b4ffbc069a7cd89bb06c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137543 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index 74f8da16fac6..5d86c5e2953c 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -2358,6 +2358,8 @@ SdrObject* SdrPowerPointImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pPara->GetAttrib( PPT_ParaAttr_BulletOn, nIsBullet2, nDestinationInstance ); if ( !nIsBullet2 ) aParagraphAttribs.Put( SfxBoolItem( EE_PARA_BULLETSTATE, false ) ); +else +aParagraphAttribs.Put( SfxInt16Item(EE_PARA_OUTLLEVEL, pPara->mxParaSet->mnDepth)); if ( !aSelection.nStartPos )// in PPT empty paragraphs never gets a bullet {
[Libreoffice-commits] core.git: oox/source sw/qa
dev/null |binary oox/source/drawingml/fillproperties.cxx |5 - sw/qa/extras/ooxmlexport/ooxmlexport6.cxx | 10 -- 3 files changed, 4 insertions(+), 11 deletions(-) New commits: commit be39a3d8c1bf9b134839a90e52ccabb2101421f4 Author: Justin Luth AuthorDate: Thu Jul 28 16:45:41 2022 -0400 Commit: Justin Luth CommitDate: Fri Jul 29 00:08:54 2022 +0200 Revert "tdf#141652 partial revert "Reset ShapeProperty priority..." This reverts 7.4 commit 18cc1240565e697859dd7d17058f91d5e01df929. Someone backported it to 7.3 as well. Change-Id: Ie04595e11dd9d2e15fa940b8ada71714bd434f6a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137581 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index f7dc16bf231b..fef43b0ca238 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -811,7 +811,10 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap, if(bIsCustomShape && bHasCropValues && bNeedCrop) { xGraphic = lclCropGraphic(xGraphic, CropQuotientsFromFillRect(aFillRect)); - rPropMap.setProperty(ShapeProperty::FillBitmap, xGraphic); +if (rPropMap.supportsProperty(ShapeProperty::FillBitmapName)) + rPropMap.setProperty(ShapeProperty::FillBitmapName, xGraphic); +else + rPropMap.setProperty(ShapeProperty::FillBitmap, xGraphic); } } } diff --git a/sw/qa/extras/ooxmlexport/data/tdf141652_fillBitmapName.docx b/sw/qa/extras/ooxmlexport/data/tdf141652_fillBitmapName.docx deleted file mode 100644 index 4a47a544d6bb.. Binary files a/sw/qa/extras/ooxmlexport/data/tdf141652_fillBitmapName.docx and /dev/null differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx index 6c35215f584a..c54580ee766a 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx @@ -274,16 +274,6 @@ DECLARE_OOXMLEXPORT_TEST(testDMLShapeFillBitmapCrop, "dml-shape-fillbitmapcrop.d } -DECLARE_OOXMLEXPORT_TEST(test141652_fillBitmapName, "tdf141652_fillBitmapName.docx") -{ -text::GraphicCrop aGraphicCropStruct = getProperty(getShape(1), "GraphicCrop"); -CPPUNIT_ASSERT_DOUBLES_EQUAL( sal_Int32(-769), aGraphicCropStruct.Right, 10); - -CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), aGraphicCropStruct.Left ); -CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), aGraphicCropStruct.Top ); -CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), aGraphicCropStruct.Bottom ); -} - DECLARE_OOXMLEXPORT_TEST(testDMLShapeFillPattern, "dml-shape-fillpattern.docx") { // Hatching was ignored by the export.
[Libreoffice-commits] core.git: compilerplugins/clang editeng/source include/editeng
compilerplugins/clang/unusedenumconstants.writeonly.results |2 -- editeng/source/outliner/outliner.cxx|6 -- include/editeng/outliner.hxx|1 - 3 files changed, 9 deletions(-) New commits: commit 2b0626e2e9d112280e9d9a296cc7d7ba3022bdc9 Author: Justin Luth AuthorDate: Wed Jul 27 10:54:22 2022 -0400 Commit: Justin Luth CommitDate: Thu Jul 28 13:27:58 2022 +0200 remove unused SETBULLETTEXT flag in editeng Already unused in initial import. Change-Id: I423442a2b036c64727af608fa667f1f8a427391f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137542 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/compilerplugins/clang/unusedenumconstants.writeonly.results b/compilerplugins/clang/unusedenumconstants.writeonly.results index 0d2f68303c8a..b4f02f215137 100644 --- a/compilerplugins/clang/unusedenumconstants.writeonly.results +++ b/compilerplugins/clang/unusedenumconstants.writeonly.results @@ -1492,8 +1492,6 @@ include/editeng/numitem.hxx:247 enum SvxNumRuleType OUTLINE_NUMBERING include/editeng/numitem.hxx:248 enum SvxNumRuleType PRESENTATION_NUMBERING -include/editeng/outliner.hxx:99 -enum ParaFlag SETBULLETTEXT include/editeng/outliner.hxx:190 enum OutlinerView::MouseTarget Outside include/editeng/svxrtf.hxx:207 diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx index 13e490f87b7f..ae4aac401bee 100644 --- a/editeng/source/outliner/outliner.cxx +++ b/editeng/source/outliner/outliner.cxx @@ -123,7 +123,6 @@ void Outliner::ParagraphInserted( sal_Int32 nPara ) pParaList->Insert( std::unique_ptr(pPara), nPara ); if( pEditEngine->IsInUndo() ) { -pPara->nFlags = ParaFlag::SETBULLETTEXT; pPara->bVisible = true; const SfxInt16Item& rLevel = pEditEngine->GetParaAttrib( nPara, EE_PARA_OUTLLEVEL ); pPara->SetDepth( rLevel.GetValue() ); @@ -665,7 +664,6 @@ void Outliner::SetStyleSheet( sal_Int32 nPara, SfxStyleSheet* pStyle ) if (pPara) { pEditEngine->SetStyleSheet( nPara, pStyle ); -pPara->nFlags |= ParaFlag::SETBULLETTEXT; ImplCheckNumBulletItem( nPara ); } } @@ -1837,8 +1835,6 @@ void Outliner::ImplCalcBulletText( sal_Int32 nPara, bool bRecalcLevel, bool bRec if (pPara->GetText() != aBulletText) pPara->SetText( aBulletText ); -pPara->nFlags &= ~ParaFlag::SETBULLETTEXT; - if ( bRecalcLevel ) { sal_Int16 nDepth = pPara->GetDepth(); @@ -1897,8 +1893,6 @@ OUString Outliner::ImplGetBulletText( sal_Int32 nPara ) Paragraph* pPara = pParaList->GetParagraph( nPara ); if (pPara) { -// Enable optimization again ... -// if( pPara->nFlags & ParaFlag::SETBULLETTEXT ) ImplCalcBulletText( nPara, false, false ); aRes = pPara->GetText(); } diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index ab24be0b1e0e..6e19aa129a78 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -96,7 +96,6 @@ enum class ParaFlag { NONE = 0x, HOLDDEPTH = 0x4000, -SETBULLETTEXT = 0x8000, ISPAGE = 0x0100, }; namespace o3tl
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - oox/source sw/qa
dev/null |binary oox/source/drawingml/fillproperties.cxx |5 - sw/qa/extras/ooxmlexport/ooxmlexport6.cxx | 10 -- 3 files changed, 4 insertions(+), 11 deletions(-) New commits: commit a0f38b84a0156b0e00ccf3067d65f495c1780c95 Author: Justin Luth AuthorDate: Thu Jul 28 16:45:41 2022 -0400 Commit: Xisco Fauli CommitDate: Fri Jul 29 10:24:57 2022 +0200 Revert "tdf#141652 partial revert "Reset ShapeProperty priority..." This reverts 7.4 commit 18cc1240565e697859dd7d17058f91d5e01df929. Someone backported it to 7.3 as well. Reverting fixes regression report tdf#150061. Change-Id: Ie04595e11dd9d2e15fa940b8ada71714bd434f6a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137581 Tested-by: Jenkins Reviewed-by: Justin Luth (cherry picked from commit 84b719e41c3a5f1e3dba112508721d69c1b3185e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137530 Reviewed-by: Xisco Fauli diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index a5dbc84fb377..c2f4eaad4e03 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -811,7 +811,10 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap, if(bIsCustomShape && bHasCropValues && bNeedCrop) { xGraphic = lclCropGraphic(xGraphic, CropQuotientsFromFillRect(aFillRect)); - rPropMap.setProperty(ShapeProperty::FillBitmap, xGraphic); +if (rPropMap.supportsProperty(ShapeProperty::FillBitmapName)) + rPropMap.setProperty(ShapeProperty::FillBitmapName, xGraphic); +else + rPropMap.setProperty(ShapeProperty::FillBitmap, xGraphic); } } } diff --git a/sw/qa/extras/ooxmlexport/data/tdf141652_fillBitmapName.docx b/sw/qa/extras/ooxmlexport/data/tdf141652_fillBitmapName.docx deleted file mode 100644 index 4a47a544d6bb.. Binary files a/sw/qa/extras/ooxmlexport/data/tdf141652_fillBitmapName.docx and /dev/null differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx index 6c35215f584a..c54580ee766a 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx @@ -274,16 +274,6 @@ DECLARE_OOXMLEXPORT_TEST(testDMLShapeFillBitmapCrop, "dml-shape-fillbitmapcrop.d } -DECLARE_OOXMLEXPORT_TEST(test141652_fillBitmapName, "tdf141652_fillBitmapName.docx") -{ -text::GraphicCrop aGraphicCropStruct = getProperty(getShape(1), "GraphicCrop"); -CPPUNIT_ASSERT_DOUBLES_EQUAL( sal_Int32(-769), aGraphicCropStruct.Right, 10); - -CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), aGraphicCropStruct.Left ); -CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), aGraphicCropStruct.Top ); -CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), aGraphicCropStruct.Bottom ); -} - DECLARE_OOXMLEXPORT_TEST(testDMLShapeFillPattern, "dml-shape-fillpattern.docx") { // Hatching was ignored by the export.
[Libreoffice-commits] core.git: sw/qa sw/source
sw/qa/extras/ooxmlexport/ooxmlexport15.cxx |2 ++ sw/source/filter/ww8/docxexport.cxx| 29 ++--- 2 files changed, 16 insertions(+), 15 deletions(-) New commits: commit fa5d80106080fa305479758dd43d0defb684376a Author: Justin Luth AuthorDate: Fri Jul 22 13:31:33 2022 -0400 Commit: Justin Luth CommitDate: Sat Jul 23 04:45:23 2022 +0200 related tdf#145998 docx export: fix writing blank headers/footers That perpetual m_bHasHdr variable was really confusing, and it was completely misused (by me). This change should make it much easier to understand the purpose. To do this completely efficiently would require multiple variables for each type, but this is good enough. (It just means we might create a few more empty headers than is absolutely necessary.) Change-Id: I0686fe2af81203021ff1bd58d79d9cd3bc81a89f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137375 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx index d1c565e1fbc4..5838f8dcb93e 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx @@ -493,6 +493,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf145998_unnecessaryPageStyles) CPPUNIT_ASSERT_EQUAL(uno::Any(), xPara->getPropertyValue("PageDescName")); // CPPUNIT_ASSERT_EQUAL(OUString("Default page style - first page style"), // parseDump("/root/page[3]/header/txt")); +CPPUNIT_ASSERT_EQUAL(OUString(), parseDump("/root/page[3]/footer/txt")); // Page Style is converted into a page break instead. Shows the "normal" header. xPara.set(getParagraph(5, "4"), uno::UNO_QUERY_THROW); @@ -503,6 +504,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf145998_unnecessaryPageStyles) // Page Style is retained (with wrong header) in order to preserve page re-numbering. xPara.set(getParagraph(7, "1"), uno::UNO_QUERY_THROW); CPPUNIT_ASSERT(uno::Any() != xPara->getPropertyValue("PageDescName")); +CPPUNIT_ASSERT_EQUAL(OUString(), parseDump("/root/page[5]/footer/txt")); } CPPUNIT_TEST_FIXTURE(Test, testTdf135216_evenOddFooter) diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index eddb4c2ea147..88f397026ff7 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -263,6 +263,10 @@ void DocxExport::WriteHeadersFooters( sal_uInt8 nHeadFootFlags, // Turn ON flag for 'Writing Headers \ Footers' m_pAttrOutput->SetWritingHeaderFooter( true ); +const bool bPrevSectionHadHeader = m_bHasHdr; +const bool bPrevSectionHadFooter = m_bHasFtr; +m_bHasHdr = m_bHasFtr = false; + // headers if ( nHeadFootFlags & nsHdFtFlags::WW8_HEADER_EVEN ) WriteHeaderFooter( , true, "even" ); @@ -270,22 +274,19 @@ void DocxExport::WriteHeadersFooters( sal_uInt8 nHeadFootFlags, { if ( nHeadFootFlags & nsHdFtFlags::WW8_HEADER_ODD ) WriteHeaderFooter( , true, "even" ); -else if ( m_bHasHdr && nBreakCode == 2 ) +else if (bPrevSectionHadHeader && nBreakCode == 2) WriteHeaderFooter( nullptr, true, "even" ); } if ( nHeadFootFlags & nsHdFtFlags::WW8_HEADER_ODD ) WriteHeaderFooter( , true, "default" ); +else if (bPrevSectionHadHeader && nBreakCode == 2) // 2: nextPage +WriteHeaderFooter(nullptr, true, "default"); if ( nHeadFootFlags & nsHdFtFlags::WW8_HEADER_FIRST ) WriteHeaderFooter( , true, "first" ); - -if( (nHeadFootFlags & (nsHdFtFlags::WW8_HEADER_EVEN - | nsHdFtFlags::WW8_HEADER_ODD - | nsHdFtFlags::WW8_HEADER_FIRST)) == 0 -&& m_bHasHdr && nBreakCode == 2 ) // 2: nexPage -WriteHeaderFooter( nullptr, true, "default" ); - +else if (bPrevSectionHadHeader && nBreakCode == 2) +WriteHeaderFooter(nullptr, true, "first"); // footers if ( nHeadFootFlags & nsHdFtFlags::WW8_FOOTER_EVEN ) @@ -294,21 +295,19 @@ void DocxExport::WriteHeadersFooters( sal_uInt8 nHeadFootFlags, { if ( nHeadFootFlags & nsHdFtFlags::WW8_FOOTER_ODD ) WriteHeaderFooter( , false, "even" ); -else if ( m_bHasFtr && nBreakCode == 2 ) +else if (bPrevSectionHadFooter && nBreakCode == 2) WriteHeaderFooter( nullptr, false, "even"); } if ( nHeadFootFlags & nsHdFtFlags::WW8_FOOTER_ODD ) WriteHeaderFooter( , false, "default" ); +else if (bPrevSectionHadFooter && nBreakCode == 2) +
[Libreoffice-commits] core.git: sw/qa sw/source
sw/qa/extras/ooxmlexport/data/tdf145998_firstHeader.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport15.cxx | 13 + sw/source/filter/ww8/wrtw8sty.cxx |7 +++ sw/source/filter/ww8/wrtww8.cxx |1 + sw/source/filter/ww8/wrtww8.hxx |1 + 5 files changed, 22 insertions(+) New commits: commit 28a947c8ceae8bb4b9306801ff4503970e9b1e76 Author: Justin Luth AuthorDate: Fri Jul 22 20:14:05 2022 -0400 Commit: Justin Luth CommitDate: Sat Jul 23 12:28:32 2022 +0200 related tdf#145998 sw ms export: smarter first header Possibly I should only set m_pPreviousSectionPageDesc when nBreakType is 2. However, this is export and LO doesn't have continuous sections, so it should be fine. The need for this should be VERY minimal now that a simple page break is usually utilized in this situation. As this unit test shows, it can still be valuable if a page renumber occurs. To push this idea much farther would require analysis of the actual layout, since a page chain can't be known whether we have seen a follow or not. Change-Id: I7dc37779ffebbf6649a10b08d561a14b0588c5c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137376 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/qa/extras/ooxmlexport/data/tdf145998_firstHeader.odt b/sw/qa/extras/ooxmlexport/data/tdf145998_firstHeader.odt new file mode 100644 index ..ad5e4c3e0320 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf145998_firstHeader.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx index 5838f8dcb93e..b1cb59bff766 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx @@ -507,6 +507,19 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf145998_unnecessaryPageStyles) CPPUNIT_ASSERT_EQUAL(OUString(), parseDump("/root/page[5]/footer/txt")); } +CPPUNIT_TEST_FIXTURE(Test, testTdf145998_firstHeader) +{ +loadAndReload("tdf145998_firstHeader.odt"); + +// Sanity check - always good to test when dealing with page styles and breaks. +CPPUNIT_ASSERT_EQUAL(2, getPages()); + +CPPUNIT_ASSERT_EQUAL(OUString("Very first header"), parseDump("/root/page[1]/header/txt")); + +// Page Style is already used in prior section - this can't be the first-header +CPPUNIT_ASSERT_EQUAL(OUString("Normal Header"), parseDump("/root/page[2]/header/txt")); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf135216_evenOddFooter) { loadAndReload("tdf135216_evenOddFooter.odt"); diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index 3175894c26a6..d166b5d885c9 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -1609,6 +1609,7 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt bool bOldPg = m_bOutPageDescs; m_bOutPageDescs = true; +const SwPageDesc* pSavedPageDesc = pPd; AttrOutput().StartSection(); @@ -1746,6 +1747,11 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt titlePage = true; } } +else if (nBreakCode == 2 && pPd == m_pPreviousSectionPageDesc && pPd->GetFollow() == pPd) +{ +// The first title page has already been displayed in the previous section. Drop it. +titlePage = false; +} const SfxItemSet* pOldI = m_pISet; @@ -1958,6 +1964,7 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt // outside of the section properties again m_bOutPageDescs = bOldPg; +m_pPreviousSectionPageDesc = pSavedPageDesc; } bool WW8_WrPlcSepx::WriteKFText( WW8Export& rWrt ) diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 33228cb93d08..a57ffb9fc093 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -3863,6 +3863,7 @@ MSWordExportBase::MSWordExportBase( SwDoc& rDocument, std::shared_ptr m_TOXMarkBookmarksByTOXMark; ww8::Frames m_aFrames; // The floating frames in this document const SwPageDesc *m_pCurrentPageDesc; +const SwPageDesc* m_pPreviousSectionPageDesc; bool m_bFirstTOCNodeWithSection; std::unique_ptr m_pPapPlc; std::unique_ptr m_pChpPlc;
[Libreoffice-commits] core.git: sw/qa sw/source
sw/qa/extras/ooxmlexport/data/tdf145998_unnecessaryPageStyles.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport15.cxx| 30 ++ sw/source/filter/ww8/ww8atr.cxx | 18 +- 3 files changed, 47 insertions(+), 1 deletion(-) New commits: commit c37f62b71fa59917ef85ff98480dff18aa936e41 Author: Justin Luth AuthorDate: Wed Jul 20 13:03:13 2022 -0400 Commit: Justin Luth CommitDate: Fri Jul 22 20:12:19 2022 +0200 tdf#145998 sw ms export: use page break, not section break If possible, use a simple page break instead of a section break. Eliminate unnecessary "page style" changes. If the page will become that style anyway, then a simple page break will suffice. The benefit is primarily for LO import, since it is virtually impossible on import to know if a section is identical to the previous section. Thus we have previously multiplied page styles - often redundantly. This also starts to fix a real problem with first headers showing up on an unnecessary new page style. Unit test deals with this. Change-Id: Ib9e24bbd579b29aa21efb2b85750ecfcb8c7e5cb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137273 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/qa/extras/ooxmlexport/data/tdf145998_unnecessaryPageStyles.odt b/sw/qa/extras/ooxmlexport/data/tdf145998_unnecessaryPageStyles.odt new file mode 100644 index ..82087eb6919f Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf145998_unnecessaryPageStyles.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx index 1537739acd1c..d1c565e1fbc4 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx @@ -475,6 +475,36 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf98000_changePageStyle) CPPUNIT_ASSERT_MESSAGE("Different page1/page2 styles", sPageOneStyle != sPageTwoStyle); } +CPPUNIT_TEST_FIXTURE(Test, testTdf145998_unnecessaryPageStyles) +{ +loadAndReload("tdf145998_unnecessaryPageStyles.odt"); + +// Sanity check - always good to test when dealing with page styles and breaks. +CPPUNIT_ASSERT_EQUAL(5, getPages()); + +// Page Style should be explicitly mentioned - otherwise it would be a "follow" style +uno::Reference xPara(getParagraph(2, "2"), uno::UNO_QUERY_THROW); +CPPUNIT_ASSERT(uno::Any() != xPara->getPropertyValue("PageDescName")); +// CPPUNIT_ASSERT_EQUAL(OUString("First Page header"), +// parseDump("/root/page[2]/header/txt")); + +// Page Style is converted into a page break instead. Still shows "first" header. +xPara.set(getParagraph(3, "3"), uno::UNO_QUERY_THROW); +CPPUNIT_ASSERT_EQUAL(uno::Any(), xPara->getPropertyValue("PageDescName")); +// CPPUNIT_ASSERT_EQUAL(OUString("Default page style - first page style"), +// parseDump("/root/page[3]/header/txt")); + +// Page Style is converted into a page break instead. Shows the "normal" header. +xPara.set(getParagraph(5, "4"), uno::UNO_QUERY_THROW); +CPPUNIT_ASSERT_EQUAL(uno::Any(), xPara->getPropertyValue("PageDescName")); +CPPUNIT_ASSERT_EQUAL(OUString("Default page style"), + parseDump("/root/page[4]/header/txt")); + +// Page Style is retained (with wrong header) in order to preserve page re-numbering. +xPara.set(getParagraph(7, "1"), uno::UNO_QUERY_THROW); +CPPUNIT_ASSERT(uno::Any() != xPara->getPropertyValue("PageDescName")); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf135216_evenOddFooter) { loadAndReload("tdf135216_evenOddFooter.odt"); diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 3ee28ea30140..cb86dd31973e 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -520,7 +520,23 @@ void MSWordExportBase::OutputSectionBreaks( const SfxItemSet *pSet, const SwNode if ( pItem && pItem->GetRegisteredIn() != nullptr) { bBreakSet = true; -bNewPageDesc = true; +// Avoid unnecessary section breaks if possible. LO can't notice identical +// sections during import, so minimize unnecessary duplication +// by substituting a simple page break when the resulting section is identical, +// unless this is needed to re-number the page. +if (!bNewPageDesc && !pItem->GetNumOffset() && m_pCurrentPageDesc +&& m_pCurrentPageDesc->GetFollow() == pItem->GetPageDesc()) +{ +// A section break on
[Libreoffice-commits] core.git: sw/qa sw/source
sw/qa/extras/ooxmlexport/ooxmlexport5.cxx|5 - sw/source/filter/ww8/docxattributeoutput.cxx |2 +- 2 files changed, 5 insertions(+), 2 deletions(-) New commits: commit c136249982345b205da83d1907e21da0c7bab7dd Author: Justin Luth AuthorDate: Thu Apr 7 09:28:42 2022 +0200 Commit: Justin Luth CommitDate: Mon Apr 18 05:18:48 2022 +0200 tdf#148380 docx export: use content of unknown fields, not name This used to be GetCntnt, but then out of the blue in a huge squashed commit, it changed to GetFieldName. So I assume that was just debugging code that got accidentally committed. It just doesn't make any sense to export the field name as the plain text content instead of the field's value. commit ed40f62e64564d2b22c9285cfdc6778aeac8fd68 Author: Michael Meeks on Mon Mar 14 16:51:14 2011 + Merge commit 'ooo/DEV300_m101' into integration/dev300_m101 NOTE: DOC also does a .replace(0x0A, 0x0B), //replace LF 0x0A with VT 0x0B //#i19604# convert hard line breaks inside fields to word equivalent After taking care of SAVEDATE, PRINTDATE, I tested this with assert(rInfos.pField->GetFieldName() == "Sender"); and found no other examples. Change-Id: Ie24b8c176fe6df4015be221c87aa249fe9b8ce92 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132666 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx index c4bcd2b23da1..2cf70462cbe9 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx @@ -319,9 +319,12 @@ CPPUNIT_TEST_FIXTURE(Test, testOldComplexMergeTableInTable) CPPUNIT_TEST_FIXTURE(Test, testHyperlinkContainingPlaceholderField) { -loadAndSave("hyperlink-field.odt"); +loadAndReload("hyperlink-field.odt"); CPPUNIT_ASSERT_EQUAL(1, getShapes()); parseExport("word/document.xml"); + +// tdf#148380 output unknown field's contents("") instead of field name("Sender" aka e-mail) +CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getParagraph(1)->getString().indexOf("Sender")); } CPPUNIT_TEST_FIXTURE(Test, testTablePreferredWidth) diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 6daca466f1ff..88df3b95f46d 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -2403,7 +2403,7 @@ void DocxAttributeOutput::StartField_Impl( const SwTextNode* pNode, sal_Int32 nP if ( rInfos.pField && rInfos.eType == ww::eUNKNOWN ) { // Expand unsupported fields -RunText( rInfos.pField->GetFieldName() ); +RunText(rInfos.pField->ExpandField(/*bCached=*/true, nullptr)); return; } else if ( rInfos.eType == ww::eFORMDATE )
[Libreoffice-commits] core.git: sw/uiconfig
sw/uiconfig/swriter/ui/conditionpage.ui |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit f82644fed3e9266ab21114a2266277059cd5ccb9 Author: Justin Luth AuthorDate: Thu May 5 21:03:35 2022 +0200 Commit: Mike Kaganski CommitDate: Fri May 6 09:36:51 2022 +0200 tdf#148920 sw page-style UI: make conditional filter usable In windows, and SAL_USE_VCLPLUGIN=gen ./instdir/program/soffice the style filter on the conditional tab was disabled. It worked fine in gtk3 though. This fixes a 7.2 regression from tdf#82802's commit 1f066313218449cac494a887eb209311efbaa405 Change-Id: I1e6bb8d589224e4ad51ae0057d5278e3888cc3b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133910 Tested-by: Justin Luth Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/uiconfig/swriter/ui/conditionpage.ui b/sw/uiconfig/swriter/ui/conditionpage.ui index 64e70ce81951..47e6b414e5fb 100644 --- a/sw/uiconfig/swriter/ui/conditionpage.ui +++ b/sw/uiconfig/swriter/ui/conditionpage.ui @@ -219,7 +219,7 @@ True -False +True False Table Header
[Libreoffice-commits] core.git: sw/source
sw/source/ui/chrdlg/swuiccoll.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 3a79bd968869f782b8540aea6598c1f8ee14cced Author: Justin Luth AuthorDate: Thu May 5 21:08:24 2022 +0200 Commit: Justin Luth CommitDate: Fri May 6 13:15:56 2022 +0200 tdf#91035 sw page-style UI: All styles shown, not hidden The first entry in the list (All styles) is what is shown by default, so that means that the 0th entry should be pre-selected, not the 1st. Change-Id: I4c204fda41a0551b9f30724df361e4f797a87325 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133911 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/source/ui/chrdlg/swuiccoll.cxx b/sw/source/ui/chrdlg/swuiccoll.cxx index c0953f830ff5..2b1aca870165 100644 --- a/sw/source/ui/chrdlg/swuiccoll.cxx +++ b/sw/source/ui/chrdlg/swuiccoll.cxx @@ -86,7 +86,7 @@ SwCondCollPage::SwCondCollPage(weld::Container* pPage, weld::DialogController* p } } -m_xFilterLB->set_active(1); +m_xFilterLB->set_active(0); m_xTbLinks->show(); }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/uiconfig
sw/uiconfig/swriter/ui/conditionpage.ui |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 699cd04295bf25c6dd6c2be8bef9f065a772548f Author: Justin Luth AuthorDate: Thu May 5 21:03:35 2022 +0200 Commit: Justin Luth CommitDate: Fri May 6 13:00:21 2022 +0200 tdf#148920 sw page-style UI: make conditional filter usable In windows, and SAL_USE_VCLPLUGIN=gen ./instdir/program/soffice the style filter on the conditional tab was disabled. It worked fine in gtk3 though. This fixes a 7.2 regression from tdf#82802's commit 1f066313218449cac494a887eb209311efbaa405 Change-Id: I1e6bb8d589224e4ad51ae0057d5278e3888cc3b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133910 Tested-by: Justin Luth Tested-by: Jenkins Reviewed-by: Justin Luth (cherry picked from commit 397fbda8c31e931f68a6c0072f6051f68481fc9e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133860 Reviewed-by: Adolfo Jayme Barrientos diff --git a/sw/uiconfig/swriter/ui/conditionpage.ui b/sw/uiconfig/swriter/ui/conditionpage.ui index fd825ab25dc6..d6e4bb7fb728 100644 --- a/sw/uiconfig/swriter/ui/conditionpage.ui +++ b/sw/uiconfig/swriter/ui/conditionpage.ui @@ -219,7 +219,7 @@ True -False +True False Table Header
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/ui/chrdlg/swuiccoll.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit ba9e78e00fda5438fa743dd44f4a3b2f854cf61f Author: Justin Luth AuthorDate: Thu May 5 21:08:24 2022 +0200 Commit: Xisco Fauli CommitDate: Fri May 6 15:55:45 2022 +0200 tdf#91035 sw page-style UI: All styles shown, not hidden The first entry in the list (All styles) is what is shown by default, so that means that the 0th entry should be pre-selected, not the 1st. Change-Id: I4c204fda41a0551b9f30724df361e4f797a87325 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133911 Tested-by: Jenkins Reviewed-by: Justin Luth (cherry picked from commit 3a79bd968869f782b8540aea6598c1f8ee14cced) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133862 Reviewed-by: Xisco Fauli diff --git a/sw/source/ui/chrdlg/swuiccoll.cxx b/sw/source/ui/chrdlg/swuiccoll.cxx index c0953f830ff5..2b1aca870165 100644 --- a/sw/source/ui/chrdlg/swuiccoll.cxx +++ b/sw/source/ui/chrdlg/swuiccoll.cxx @@ -86,7 +86,7 @@ SwCondCollPage::SwCondCollPage(weld::Container* pPage, weld::DialogController* p } } -m_xFilterLB->set_active(1); +m_xFilterLB->set_active(0); m_xTbLinks->show(); }
[Libreoffice-commits] core.git: sc/source
sc/source/ui/view/tabcont.cxx |5 + 1 file changed, 5 insertions(+) New commits: commit 83d0f2eebae41d431d9a5bfd1a918523977752d0 Author: Justin Luth AuthorDate: Wed Dec 8 07:06:45 2021 +0200 Commit: Eike Rathke CommitDate: Thu Apr 28 23:50:39 2022 +0200 tdf#137899 sc: accept any unfinished editing before adding sheet There might be a more general place where this belongs, to cover other similar kinds of situations. However, putting it here is very targetted, and shouldn't get me into unanticipated trouble. Any changes made in the "top view" need to be accepted before they are committed. In this case, the user switched gears and added a new sheet while in the process of editing. So what should happen here? Should we commit the change before changing task? Perhaps. Certainly it should NOT show up on the new sheet - but that is what was happening. Accepting the change when the user gets side-tracked is the norm in cases like print-preview, switching to another soffice app, or simply clicking on a different cell or switching tabs. So auto-accepting in this situation is consistent behaviour. Change-Id: I4f3f0103ad4fcc1aa8a0c6118383b63ace07ff5e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126501 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Eike Rathke diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx index a95df55b98d8..a15b1c20e54b 100644 --- a/sc/source/ui/view/tabcont.cxx +++ b/sc/source/ui/view/tabcont.cxx @@ -234,6 +234,11 @@ void ScTabControl::AddTabClick() ScModule* pScMod = SC_MOD(); if (!rDoc.IsDocEditable() || pScMod->IsTableLocked()) return; + +// auto-accept any in-process input - which would otherwise end up on the new sheet +if (!pScMod->IsFormulaMode()) +pScMod->InputEnterHandler(); + OUString aName; rDoc.CreateValidTabName(aName); SCTAB nTabCount = rDoc.GetTableCount();
[Libreoffice-commits] core.git: sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf148380_usernameField.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport17.cxx | 13 + writerfilter/source/dmapper/DomainMapper_Impl.cxx |6 -- 3 files changed, 17 insertions(+), 2 deletions(-) New commits: commit f56f8be65b26cb3c8e83af05f10ba9f717ff76b2 Author: Justin Luth AuthorDate: Fri Apr 22 19:46:16 2022 +0200 Commit: Miklos Vajna CommitDate: Fri Apr 29 12:25:01 2022 +0200 tdf#126636 writerfilter: import USERNAME field as fixed This depends on and mimics some of the fixes for tdf#148380. Microsoft Word doesn't immediately/automatically update field contents like LO does. Instead, the user needs to press F9 on each field. So, these USERNAME or USERINITIALS fields just show the when-last-updated text that was saved in the document instead of the actual current value of the field. Although LO doesn't have that ability, we can flag them as FIXED and achieve a very similar result. Doing so fixes this bug report which might be quite common since USERNAME might be mistaken for AUTHOR or LASTSAVEDBY by the user - since in practice they tend to be the same thing. We already did this for AUTHOR (which is extremely safe since that can never change). I almost hate to do it with this one because even this bug shows it is too often a case of mis-use, but that is the way it is, and this seems to be the best solution. Change-Id: I48dc6d45992aff740023e80f619b56ad01231782 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133346 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna diff --git a/sw/qa/extras/ooxmlexport/data/tdf148380_usernameField.docx b/sw/qa/extras/ooxmlexport/data/tdf148380_usernameField.docx new file mode 100644 index ..241632bc80e9 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf148380_usernameField.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx index f03901f5180d..bbbc8e7cfb73 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx @@ -104,6 +104,19 @@ DECLARE_OOXMLEXPORT_TEST(testTdf148380_fldLocked, "tdf148380_fldLocked.docx") CPPUNIT_ASSERT_EQUAL(OUString("DocInformation:Last printed (fixed)"), xField->getPresentation(true)); } +DECLARE_OOXMLEXPORT_TEST(testTdf148380_usernameField, "tdf148380_usernameField.docx") +{ +// Verify that these are fields, and not just plain text +uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); +auto xFieldsAccess(xTextFieldsSupplier->getTextFields()); +uno::Reference xFields(xFieldsAccess->createEnumeration()); +uno::Reference xField(xFields->nextElement(), uno::UNO_QUERY); +// These should match the as-last-seen-in-the-text name, and not the application's user name +CPPUNIT_ASSERT_EQUAL(OUString("Charlie Brown"), xField->getPresentation(false)); +xField.set(xFields->nextElement(), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(OUString("CB"), xField->getPresentation(false)); +} + DECLARE_OOXMLEXPORT_TEST(testTdf148380_modifiedField, "tdf148380_modifiedField.docx") { getParagraph(2, "4/5/2022 3:29:00 PM"); // default (unspecified) date format diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 2d956b5ab09c..b59b9eac066f 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -5547,7 +5547,7 @@ void DomainMapper_Impl::handleAutoNum } void DomainMapper_Impl::handleAuthor -(std::u16string_view rFirstParam, +(std::u16string_view, uno::Reference< beans::XPropertySet > const& xFieldProperties, FieldId eFieldId ) { @@ -,7 +,9 @@ void DomainMapper_Impl::handleAuthor xFieldProperties->setPropertyValue ( getPropertyName(PROP_FULL_NAME), uno::makeAny( true )); -if (!rFirstParam.empty() || eFieldId == FIELD_AUTHOR) +// Always set as FIXED b/c MS Word only updates these fields via user intervention (F9) +// AUTHOR of course never changes and USERNAME is easily mis-used as an original author field. +// Additionally, this was forced as fixed if any special case-formatting was provided. { xFieldProperties->setPropertyValue( getPropertyName( PROP_IS_FIXED ),
[Libreoffice-commits] core.git: sw/source
sw/source/uibase/wrtsh/wrtsh1.cxx |6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) New commits: commit f306d601a1eab561815a0a1e6dc2cd3d857d4f05 Author: Justin Luth AuthorDate: Mon Aug 1 15:10:40 2022 -0400 Commit: Justin Luth CommitDate: Mon Aug 1 22:53:17 2022 +0200 related tdf#150197: SwWrtShell::NumOrBulletOn should SetListFormat sw code should all use the ne ListFormat behaviour instead of the legacy Prefix/Suffix numbering format. There is another case in sd - but I'm a little leery about whether SD really supports the new ListFormat for numbering... Change-Id: I8dc0e14f5bc24d448a2551dba70b3dcce18273b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137682 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx index 2e885ef49c39..d5b04b087fc2 100644 --- a/sw/source/uibase/wrtsh/wrtsh1.cxx +++ b/sw/source/uibase/wrtsh/wrtsh1.cxx @@ -1511,8 +1511,7 @@ void SwWrtShell::NumOrBulletOn(bool bNum) aFormat.SetBulletChar( numfunc::GetBulletChar(static_cast(nLevel))); aFormat.SetNumberingType(SVX_NUM_CHAR_SPECIAL); // #i93908# clear suffix for bullet lists -aFormat.SetPrefix(OUString()); -aFormat.SetSuffix(OUString()); +aFormat.SetListFormat("", "", nLevel); } aNumRule.Set(o3tl::narrowing(nLevel), aFormat); } @@ -1570,8 +1569,7 @@ void SwWrtShell::NumOrBulletOn(bool bNum) aFormat.SetBulletChar( numfunc::GetBulletChar(nLvl) ); aFormat.SetNumberingType(SVX_NUM_CHAR_SPECIAL); // #i93908# clear suffix for bullet lists -aFormat.SetPrefix(OUString()); -aFormat.SetSuffix(OUString()); +aFormat.SetListFormat("", "", nLvl); } // #i95907#
[Libreoffice-commits] core.git: editeng/source
editeng/source/items/numitem.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 654454a32bd6dc40d131861fab5dbe0a9111a7c3 Author: Justin Luth AuthorDate: Mon Aug 1 09:29:10 2022 -0400 Commit: Justin Luth CommitDate: Mon Aug 1 23:41:54 2022 +0200 related tdf#150197 editeng: clear oListFormat on SetListFormat() Although a pre=existing prefix/suffix was cleared, a non-existing oListFormat should replace an earlier one if it is being reset. The hasValue only applies to setting backward compatiblity stuff. No real-world impact noticed - just cleaning up after a code read. I ALMOST needed this in my prior patch, but then I changed to use the other SetListFormat function call. Change-Id: I39eed26b7720f0f9a0d982a1cd1703a55c5ab986 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137675 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx index cbbd7efb9dc4..1239ea529126 100644 --- a/editeng/source/items/numitem.cxx +++ b/editeng/source/items/numitem.cxx @@ -589,13 +589,13 @@ void SvxNumberFormat::SetListFormat(std::optional oSet) sPrefix.clear(); sSuffix.clear(); +sListFormat = oSet; + if (!oSet.has_value()) { return; } -sListFormat = 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
[Libreoffice-commits] core.git: sd/source
sd/source/core/stlpool.cxx |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) New commits: commit 5c68399e6bea3aa18477487400f8bb143d6ed84e Author: Justin Luth AuthorDate: Mon Aug 1 15:18:13 2022 -0400 Commit: Justin Luth CommitDate: Tue Aug 2 02:01:10 2022 +0200 related tdf#150197: sd should SetListFormat sd code should all use the new ListFormat behaviour instead of the legacy Prefix/Suffix numbering format. At this point I don't think any SD code is using the new ListFormat, but SetListFormat has code to SetPrefix and SetSuffix, so it shouldn't hurt to do this. Change-Id: I91f9816161676d3444533481cbb616a2f5b069e6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137686 Tested-by: Justin Luth Reviewed-by: Justin Luth diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx index 12891698a19f..fb9abbf88221 100644 --- a/sd/source/core/stlpool.cxx +++ b/sd/source/core/stlpool.cxx @@ -1118,8 +1118,7 @@ void SdStyleSheetPool::PutNumBulletItem( SfxStyleSheetBase* pSheet, SvxNumberFormat aFrmt( pDefaultRule->GetLevel(i) ); aFrmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL); // #i93908# clear suffix for bullet lists -aFrmt.SetPrefix(OUString()); -aFrmt.SetSuffix(OUString()); +aFrmt.SetListFormat("", "", i); aFrmt.SetStart(1); aFrmt.SetBulletRelSize(45); aFrmt.SetBulletChar( 0x25CF ); // StarBats: 0xF000 + 34
[Libreoffice-commits] core.git: editeng/source include/editeng sd/qa
editeng/source/uno/unotext.cxx | 33 +++--- include/editeng/unotext.hxx |3 - sd/qa/uitest/data/tdf148810_PARA_OUTLLEVEL.pptx |binary sd/qa/uitest/impress_tests/tdf148810.py | 55 4 files changed, 63 insertions(+), 28 deletions(-) New commits: commit f7b5eefc36f6a7627e867651bafe38bdeb2f9c00 Author: Justin Luth AuthorDate: Thu Jul 28 09:03:13 2022 -0400 Commit: Miklos Vajna CommitDate: Tue Aug 2 08:15:26 2022 +0200 tdf#148810 pptx import: Depth set by EE_PARA_OUTLLEVEL It isn't enough to do Paragraph->SetDepth(). It must match the property EE_PARA_OUTLLEVEL. So I was hoping that the only thing I needed was the "set property" helper. But unit tests showed that I also needed "get property" to return an empty aAny instead of a -1. My confidence level on this one is fairly low. This code is way too tangled and weird. I'm sure the concept is right (that the property is the most important thing) but all of the wonkiness around the level means any changes to the implementation will be fragile. make UITest_impress_tests \ UITEST_TEST_NAME=tdf148810.Tdf148810.test_Tdf148810 Change-Id: I4aa62fe28ecbc483d5df0d1532fecd172afc54b9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137569 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx index e0ca965c5d3f..4f831a70a30f 100644 --- a/editeng/source/uno/unotext.cxx +++ b/editeng/source/uno/unotext.cxx @@ -507,7 +507,7 @@ bool SvxUnoTextRangeBase::SetPropertyValueHelper( const SfxItemPropertyMapEntry* return !aValue.hasValue() || ((aValue >>= xRule) && !xRule.is()); } -case WID_NUMLEVEL: +case EE_PARA_OUTLLEVEL: { SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : nullptr; if(pForwarder && pSelection) @@ -519,7 +519,8 @@ bool SvxUnoTextRangeBase::SetPropertyValueHelper( const SfxItemPropertyMapEntry* if(! pForwarder->SetDepth( pSelection->nStartPara, nLevel ) ) throw lang::IllegalArgumentException(); -return true; +// If valid, then not yet finished. Also needs to be added to paragraph props. +return nLevel < -1 || nLevel > 9; } } } @@ -684,7 +685,7 @@ bool SvxUnoTextRangeBase::GetPropertyValueHelper( SfxItemSet const & rSet, cons } break; -case WID_NUMLEVEL: +case EE_PARA_OUTLLEVEL: { SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : nullptr; if(pForwarder && pSelection) @@ -976,7 +977,6 @@ beans::PropertyState SvxUnoTextRangeBase::_getPropertyState(const SfxItemPropert } break; -case WID_NUMLEVEL: case WID_NUMBERINGSTARTVALUE: case WID_PARAISNUMBERINGRESTART: eItemState = SfxItemState::SET; @@ -1110,7 +1110,6 @@ bool SvxUnoTextRangeBase::_getOnePropertyStates(const SfxItemSet* pSet, const Sf } break; -case WID_NUMLEVEL: case WID_NUMBERINGSTARTVALUE: case WID_PARAISNUMBERINGRESTART: eItemState = SfxItemState::SET; @@ -1215,12 +1214,6 @@ void SvxUnoTextRangeBase::_setPropertyToDefault(SvxTextForwarder* pForwarder, co { SvxUnoFontDescriptor::setPropertyToDefault( aSet ); } -else if( pMap->nWID == WID_NUMLEVEL ) -{ -// #101004# Call interface method instead of unsafe cast -pForwarder->SetDepth( maSelection.nStartPara, -1 ); -return; -} else if( pMap->nWID == WID_NUMBERINGSTARTVALUE ) { pForwarder->SetNumberingStartValue( maSelection.nStartPara, -1 ); @@ -1263,7 +1256,7 @@ uno::Any SAL_CALL SvxUnoTextRangeBase::getPropertyDefault( const OUString& aProp case WID_FONTDESC: return SvxUnoFontDescriptor::getPropertyDefault( pPool ); -case WID_NUMLEVEL: +case EE_PARA_OUTLLEVEL: { uno::Any aAny; return aAny; @@ -1969,8 +1962,8 @@ static void SvxPropertyValuesToItemSet( SfxItemSet , const uno::Sequence< beans::PropertyValue >& rPropertyValues, const SfxItemPropertySet *pPropSet, -SvxTextForwarder *pForwarder /*needed for WID_NUMLEVEL*/, -sal_Int32 nPara /*needed for WID_NUMLEVEL*/) +SvxTextForwarder *pForwarder, +sal_Int32 nPara) { for (const beans::PropertyValue& rProp : rPropertyValues)
[Libreoffice-commits] core.git: sw/qa sw/source
sw/qa/extras/ww8export/data/tdf150197_anlv2ListFormat.doc |binary sw/qa/extras/ww8export/ww8export4.cxx |7 +++ sw/source/filter/ww8/ww8par2.cxx |2 ++ 3 files changed, 9 insertions(+) New commits: commit 285f5306d75892963707b64a3782850c80d4a315 Author: Justin Luth AuthorDate: Tue Aug 23 09:20:01 2022 -0400 Commit: Justin Luth CommitDate: Tue Aug 23 17:52:36 2022 +0200 related tdf#150197 doc import: ANLV2 - always SetListFormat Any time there is numbering, we expect to see an optional sListFormat set. This solves another case found by: assert(false && "depricated format still exists and is unhandled. Inform Vasily or Justin"); Change-Id: Ie88d6ea6feaaebaae8a0953668a2801f6f1a139a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138734 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/qa/extras/ww8export/data/tdf150197_anlv2ListFormat.doc b/sw/qa/extras/ww8export/data/tdf150197_anlv2ListFormat.doc new file mode 100644 index ..93d21046d607 Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf150197_anlv2ListFormat.doc differ diff --git a/sw/qa/extras/ww8export/ww8export4.cxx b/sw/qa/extras/ww8export/ww8export4.cxx index bc0d51ff529e..e6d1d27f53a4 100644 --- a/sw/qa/extras/ww8export/ww8export4.cxx +++ b/sw/qa/extras/ww8export/ww8export4.cxx @@ -56,6 +56,13 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf77964) CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER, getProperty(getShapeByName(u"Image2"), "AnchorType")); } +DECLARE_WW8EXPORT_TEST(testTdf150197_anlv2ListFormat, "tdf150197_anlv2ListFormat.doc") +{ +CPPUNIT_ASSERT_EQUAL(OUString("1."), getProperty(getParagraph(2), "ListLabelString")); +CPPUNIT_ASSERT_EQUAL(OUString("2."), getProperty(getParagraph(3), "ListLabelString")); +CPPUNIT_ASSERT_EQUAL_MESSAGE("Did you fix me? I should be 2.1", OUString("4.1"), + getProperty(getParagraph(4), "ListLabelString")); +} CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index ecb757c0b89d..d075cd1d8d93 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -592,6 +592,8 @@ static void SetBaseAnlv(SwNumFormat , WW8_ANLV const , sal_uInt8 nSwLev OUString sP = "." + rNum.GetSuffix(); rNum.SetListFormat("", sP, nSwLevel); // ordinal number } +else +rNum.SetListFormat("", "", nSwLevel); } void SwWW8ImplReader::SetAnlvStrings(SwNumFormat , int nLevel, WW8_ANLV const ,
[Libreoffice-commits] core.git: svx/source sw/source
svx/source/tbxctrls/tbcontrl.cxx|4 sw/source/uibase/docvw/edtwin.cxx |2 +- sw/source/uibase/shells/textsh1.cxx | 12 +--- 3 files changed, 10 insertions(+), 8 deletions(-) New commits: commit e93b7f6a5c5f9ee86546d95d7fe70ecc26b71b91 Author: Justin Luth AuthorDate: Wed Aug 10 14:00:47 2022 -0400 Commit: Justin Luth CommitDate: Wed Aug 24 01:07:07 2022 +0200 NFC related tdf#85592: simplify SID_ATTR_CHAR_COLOR_BACKGROUND_EXT I am tring to replace Writer-only uno:BackColor with uno:CharBackColor. The problem is this template flag which gets calls in svx and then does nothing in editeng. But I don't see any reason why this call should be transformed into a template (_ext) call. We can easily just keep the same call and do the state-checking only slightly different. All this other stuff makes _EXT seem much more complicated than it is. If I am right that this is a Non-Functional-Change, then I am well on my way to fixing this bug report. Change-Id: Idc08117217837f217ea5ca390005802c2fad392b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138101 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index db147949c306..a97bc0b12d31 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -3749,10 +3749,6 @@ void SvxColorToolBoxControl::execute(sal_Int16 /*nSelectModifier*/) case SID_ATTR_CHAR_COLOR2 : aCommand= ".uno:CharColorExt"; break; - -case SID_ATTR_CHAR_COLOR_BACKGROUND : -aCommand= ".uno:CharBackgroundExt"; -break; } auto aArgs( comphelper::InitPropertySequence( { diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 2f166579a27c..bfa5d91db8ee 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -5094,7 +5094,7 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) case SID_ATTR_CHAR_COLOR_EXT: nId = RES_CHRATR_COLOR; break; -case SID_ATTR_CHAR_COLOR_BACKGROUND_EXT: +case SID_ATTR_CHAR_COLOR_BACKGROUND: nId = RES_CHRATR_BACKGROUND; break; } diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 647ef76ade64..7e4247118526 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -1284,11 +1284,11 @@ void SwTextShell::Execute(SfxRequest ) rWrtSh.SetAttrItem( SvxColorItem(aSet, RES_CHRATR_COLOR) ); } -else if (nSlot == SID_ATTR_CHAR_COLOR_BACKGROUND) +else if (nSlot == SID_ATTR_CHAR_COLOR_BACKGROUND_EXT) { -if (!pApply || pApply->nColor != SID_ATTR_CHAR_COLOR_BACKGROUND_EXT) +if (!pApply || pApply->nColor != SID_ATTR_CHAR_COLOR_BACKGROUND) { -aTempl.nColor = SID_ATTR_CHAR_COLOR_BACKGROUND_EXT; +aTempl.nColor = SID_ATTR_CHAR_COLOR_BACKGROUND; rEdtWin.SetApplyTemplate(aTempl); } } @@ -1856,6 +1856,12 @@ void SwTextShell::GetState( SfxItemSet ) } break; case SID_ATTR_CHAR_COLOR_BACKGROUND_EXT: +{ +SwEditWin& rEdtWin = GetView().GetEditWin(); +SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate(); +rSet.Put(SfxBoolItem(nWhich, pApply && pApply->nColor == SID_ATTR_CHAR_COLOR_BACKGROUND)); +} +break; case SID_ATTR_CHAR_COLOR_EXT: { SwEditWin& rEdtWin = GetView().GetEditWin();
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - solenv/clang-format sw/CppunitTest_sw_ooxmlexport18.mk sw/Module_sw.mk sw/qa sw/source
solenv/clang-format/excludelist |1 sw/CppunitTest_sw_ooxmlexport18.mk | 18 +++ sw/Module_sw.mk |1 sw/qa/extras/ooxmlexport/ooxmlexport18.cxx | 61 sw/source/core/doc/DocumentStylePoolManager.cxx | 16 +++--- 5 files changed, 89 insertions(+), 8 deletions(-) New commits: commit 42e953a59cdcace9c631867a6deecacb76450678 Author: Justin Luth AuthorDate: Sat Jul 30 09:38:09 2022 -0400 Commit: Andras Timar CommitDate: Sat Aug 27 08:52:47 2022 +0200 tdf#150197 sw: convert pre-defined num styles to ListFormat Early in 7.x, allotropia introduced a generic list format string instead of prefix/suffix. Convert the pre-defined numbering formats to use that syntax as well. The problem was that ms export wasn't able to handle the old way of doing things any more. For example, if a user added numbering via the numbering style "Numbering 123", then on export the numbering string was lost. Change-Id: I11cd00280da2b464a9b00a5f0a8d72080f14e44c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137632 Reviewed-by: Justin Luth Tested-by: Justin Luth (cherry picked from commit a106d5f75acc4a955f21583f58604ea2e7b4ce1a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137606 Tested-by: Jenkins Reviewed-by: Vasily Melenchuk (cherry picked from commit 5d72a000a0f9d127d1263a6df628898af08f14f9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137899 Reviewed-by: Andras Timar Tested-by: Jenkins CollaboraOffice diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index ab778b3b09cb..b6672e28d890 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -12309,6 +12309,7 @@ sw/qa/extras/ooxmlexport/ooxmlexport14.cxx sw/qa/extras/ooxmlexport/ooxmlexport15.cxx sw/qa/extras/ooxmlexport/ooxmlexport16.cxx sw/qa/extras/ooxmlexport/ooxmlexport17.cxx +sw/qa/extras/ooxmlexport/ooxmlexport18.cxx sw/qa/extras/ooxmlexport/ooxmlexport2.cxx sw/qa/extras/ooxmlexport/ooxmlexport3.cxx sw/qa/extras/ooxmlexport/ooxmlexport4.cxx diff --git a/sw/CppunitTest_sw_ooxmlexport18.mk b/sw/CppunitTest_sw_ooxmlexport18.mk new file mode 100644 index ..cf085f8eb0f6 --- /dev/null +++ b/sw/CppunitTest_sw_ooxmlexport18.mk @@ -0,0 +1,18 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +#* +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +#* + +$(eval $(call sw_ooxmlexport_test,18)) + +$(eval $(call gb_CppunitTest_use_custom_headers,sw_ooxmlexport18,\ +officecfg/registry \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk index e624630187b7..b676070783b5 100644 --- a/sw/Module_sw.mk +++ b/sw/Module_sw.mk @@ -89,6 +89,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sw,\ CppunitTest_sw_ooxmlexport15 \ CppunitTest_sw_ooxmlexport16 \ CppunitTest_sw_ooxmlexport17 \ +CppunitTest_sw_ooxmlexport18 \ CppunitTest_sw_ooxmlexport_template \ CppunitTest_sw_ooxmlfieldexport \ CppunitTest_sw_ooxmllinks \ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx new file mode 100644 index ..40a3a0d80c45 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx @@ -0,0 +1,61 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + + +#include +#include +#include +#include +#include + +#include +#include + +constexpr OUStringLiteral DATA_DIRECTORY = u"/sw/qa/extras/ooxmlexport/data/"; + +class Test : public SwModelTestBase +{ +public: +Test() : SwModelTestBase(DATA_DIRECTORY, "Office Open XML Text") {} +}; + +CPPUNIT_TEST_FIXTURE(Test, testTdf150197_predefinedNumbering) +{ +createSwDoc(); + +// The exact numbering style doesn't matter - just any non-bullet pre-defined numbering style. +uno::Sequence aPropertyValues = comphelper::InitPropertySequence({ +{ "Style", uno::Any(OUString("Numbering 123")) }, +{ "FamilyName", uno::Any(OUString("NumberingStyles")) }, +})
[Libreoffice-commits] core.git: sw/source
sw/source/filter/ww8/ww8par2.cxx |8 1 file changed, 4 insertions(+), 4 deletions(-) New commits: commit 1ad2d1336a3f82e13e2bdfe979154c3a8c936ed6 Author: Justin Luth AuthorDate: Wed Aug 17 14:01:44 2022 -0400 Commit: Justin Luth CommitDate: Thu Aug 18 15:34:07 2022 +0200 related tdf#150197 doc import: ANLV - always SetListFormat Any time there is numbering, we expect to see an optional sListFormat set. This solves a few different cases found by: assert(false && "depricated format still exists and is unhandled. Inform Vasily or Justin"); Change-Id: I127e100a003c46c7a9dfa681014ffc11ceda24ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138452 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index c05447b4b1c8..5e00e059700d 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -701,10 +701,9 @@ void SwWW8ImplReader::SetAnlvStrings(SwNumFormat , int nLevel, WW8_ANLV con { sSuffix = rNum.GetSuffix() + sText.subView( rAV.cbTextBefore, rAV.cbTextAfter); } -if (rAV.cbTextBefore || rAV.cbTextAfter) -{ -rNum.SetListFormat(sPrefix, sSuffix, nLevel); -} + +rNum.SetListFormat(sPrefix, sSuffix, nLevel); + // The characters before and after multiple digits do not apply because // those are handled differently by the writer and the result is in most // cases worse than without. @@ -717,6 +716,7 @@ void SwWW8ImplReader::SetAnld(SwNumRule* pNumR, WW8_ANLD const * pAD, sal_uInt8 bool bOutLine) { SwNumFormat aNF; +aNF.SetListFormat("", "", nSwLevel); if (pAD) { // there is an Anld-Sprm m_bCurrentAND_fNumberAcross = 0 != pAD->fNumberAcross;
[Libreoffice-commits] core.git: sw/qa sw/source
sw/qa/extras/odfexport/odfexport2.cxx |3 +++ sw/source/core/unocore/unosett.cxx|2 +- 2 files changed, 4 insertions(+), 1 deletion(-) New commits: commit c24fe44064c6624fefe642508086c8562c372fba Author: Justin Luth AuthorDate: Wed Sep 7 07:00:59 2022 -0400 Commit: Justin Luth CommitDate: Wed Sep 7 16:41:47 2022 +0200 tdf#149547 fix "tdf#75297 sw uno: override default num char style" The problem was that things like chapter numbering were creating this style on import. Interesting that it didn't do it for my use case. This fixes 7.5 commit 758945b077220fe151c1565c6d5b0bad02de6d58. Originally I left this clause "as is" because I had not yet removed the obsolete part of the condition. But now I can change anything in that .isEmpty() clause since commit 1a57418e2837e7fd07b0619804feed06e1acfe41 remove unused sw UNO_NAME_CHARACTER_FORMAT_NONE Change-Id: Ie52a0d1392d49ba6ae8a5620ab453ff7129bce7b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139584 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/qa/extras/odfexport/odfexport2.cxx b/sw/qa/extras/odfexport/odfexport2.cxx index 5d2f91b92d5d..018f7afd0cb6 100644 --- a/sw/qa/extras/odfexport/odfexport2.cxx +++ b/sw/qa/extras/odfexport/odfexport2.cxx @@ -36,6 +36,9 @@ DECLARE_ODFEXPORT_TEST(testTdf52065_centerTabs, "testTdf52065_centerTabs.odt") CPPUNIT_ASSERT(nTabStop < 4000); CPPUNIT_ASSERT(3000 < nTabStop); CPPUNIT_ASSERT_EQUAL(OUString(u"Pečiatka zamestnávateľa"), parseDump("//body/txt[4]/SwParaPortion/SwLineLayout/child::*[4]", "portion")); + +// tdf#149547: __XXX___invalid CharacterStyles should not be imported/exported + CPPUNIT_ASSERT(!getStyles("CharacterStyles")->hasByName("__XXX___invalid")); } DECLARE_ODFEXPORT_TEST(testTdf104254_noHeaderWrapping, "tdf104254_noHeaderWrapping.odt") diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx index 064f23b30a48..e92bade7875f 100644 --- a/sw/source/core/unocore/unosett.cxx +++ b/sw/source/core/unocore/unosett.cxx @@ -1567,7 +1567,7 @@ void SwXNumberingRules::SetPropertiesToNumFormat( SwDoc *const pLocalDoc = pDocShell ? pDocShell->GetDoc() : pDoc; if (sCharFormatName.isEmpty()) { -rCharStyleName = aInvalidStyle; +rCharStyleName.clear(); aFormat.SetCharFormat(nullptr); aFormat.SetCharFormatName(""); }
[Libreoffice-commits] core.git: sw/source
sw/source/filter/ww8/wrtw8nds.cxx | 13 +++-- sw/source/filter/ww8/ww8atr.cxx |2 ++ 2 files changed, 9 insertions(+), 6 deletions(-) New commits: commit 449317473740d98338a61aca1e4ffb8821681c8e Author: Justin Luth AuthorDate: Sat Sep 3 13:38:59 2022 -0400 Commit: Justin Luth CommitDate: Sun Sep 4 03:16:40 2022 +0200 tdf#117994 doc: Revert "tdf#99474 close direct char fmt at end of para" This reverts 5.1.4 commit 817c3b17fa57a7c4c4f80569bc00a21001fb6807 which fixes regression bug 17994 (in the summary line). Another reason for reverting it is tdf#150613 whose fix depends on getting this fixed first. Making any export changes based on the formatting of numbering is extremely dangerous, especially in this time period after LO 4.1 when a wonky patch made wild assumptions about what was best. Well, that patch was reverted in LO 7.3 for tdf#108518, and apparently obsoletes the usefulness this patch provided.. This patch that I'm reverting caused some visible regressions SEEN ONLY IN WORD which further confirms that we still have lots of wrong assumptions in regards to numbering formatting. I'm happy to see it reverts without causing any unit test failures even before I make any changes. I confirmed that reverting the 4.1 patch with 7.3 commit 343d4d32f00053bd72cfe240125835fe25ce264f was what allowed testTdf99474 to still pass. Change-Id: I4cf6fbfb3a4a2d483d9a500f13686ad4305742b3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139334 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 185b01aead79..54a59b16e7f9 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -2386,6 +2386,7 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode ) const OUString& aStr( rNode.GetText() ); sal_Int32 const nEnd = bNeedParaSplit ? *aBreakIt : aStr.getLength(); +bool bIsEndOfCell = false; bool bIncludeEndOfParaCRInRedlineProperties = false; sal_Int32 nOpenAttrWithRange = 0; @@ -2393,6 +2394,8 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode ) if ( pTextNodeInfo ) { pTextNodeInfoInner = pTextNodeInfo->getFirstInner(); +if (pTextNodeInfoInner && pTextNodeInfoInner->isEndOfCell()) +bIsEndOfCell = true; } do { @@ -2702,6 +2705,9 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode ) } WriteCR( pTextNodeInfoInner ); + +if (0 != nEnd && bIsEndOfCell) +AttrOutput().OutputFKP(/*bforce=*/true); } } } @@ -2729,12 +2735,7 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode ) "odd to see this happening, expected 0"); } -// !bIncludeEndOfParaCRInRedlineProperties implies we have just -// emitted a CR, in which case we want to pass force=true to -// OutputFKP to ensure that an FKP entry for direct character -// formatting is written even if empty, so that the next one will -// start after the CR. - AttrOutput().OutputFKP(!bIncludeEndOfParaCRInRedlineProperties); +AttrOutput().OutputFKP(/*bForce=*/false); if (bTextAtr || bAttrWithRange || bIncludeEndOfParaCRInRedlineProperties) { diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index ae0a53e8056a..5afd5b0c8de2 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -1054,6 +1054,8 @@ void WW8AttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pTe TableInfoRow( pTextNodeInfoInner ); m_rWW8Export.m_pPapPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(), m_rWW8Export.m_pO->size(), m_rWW8Export.m_pO->data()); m_rWW8Export.m_pO->clear(); +//For Bug 119650, should break the properties of CHP PLC after a paragraph end. +m_rWW8Export.m_pChpPlc->AppendFkpEntry(m_rWW8Export.Strm().Tell(), m_rWW8Export.m_pO->size(), m_rWW8Export.m_pO->data()); } }
[Libreoffice-commits] core.git: include/xmloff sw/qa xmloff/source
include/xmloff/xmlnume.hxx|4 -- sw/qa/extras/odfexport/data/tdf57317_autoListName.odt |binary sw/qa/extras/odfexport/odfexport2.cxx | 31 ++ xmloff/source/style/xmlnume.cxx |9 + xmloff/source/text/XMLTextListAutoStylePool.cxx | 20 +++ xmloff/source/text/txtstyle.cxx |2 - 6 files changed, 55 insertions(+), 11 deletions(-) New commits: commit 46dc9f3bbac67e9240adc44ab017f905482ef786 Author: Justin Luth AuthorDate: Mon Aug 22 12:52:22 2022 -0400 Commit: Justin Luth CommitDate: Tue Aug 23 04:09:04 2022 +0200 tdf#57317 odf export: avoid autolist conflict with NumberingStyles Somehow you can have autoStyles writing into the styles.xml. Well, the code to prevent duplicates for that needs to exist for autoStyles written into document.xml as well. Change-Id: I9602b7023a1ef009ad644374dc5081afb8a76916 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138703 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/include/xmloff/xmlnume.hxx b/include/xmloff/xmlnume.hxx index 68818f1076ff..85f78047ee80 100644 --- a/include/xmloff/xmlnume.hxx +++ b/include/xmloff/xmlnume.hxx @@ -63,9 +63,7 @@ public: const css::uno::Reference< css::container::XIndexReplace > & xNumRule, bool bOutline=false ); -void exportStyles( bool bUsed, - XMLTextListAutoStylePool *pPool, - bool bExportChapterNumbering ); +void exportStyles(bool bUsed, bool bExportChapterNumbering); void exportNumberingRule( const OUString& rName, bool bIsHidden, const css::uno::Reference< css::container::XIndexReplace > & xNumRule ); diff --git a/sw/qa/extras/odfexport/data/tdf57317_autoListName.odt b/sw/qa/extras/odfexport/data/tdf57317_autoListName.odt new file mode 100644 index ..3aafbc519387 Binary files /dev/null and b/sw/qa/extras/odfexport/data/tdf57317_autoListName.odt differ diff --git a/sw/qa/extras/odfexport/odfexport2.cxx b/sw/qa/extras/odfexport/odfexport2.cxx index 2a2f015f6b84..5d2f91b92d5d 100644 --- a/sw/qa/extras/odfexport/odfexport2.cxx +++ b/sw/qa/extras/odfexport/odfexport2.cxx @@ -94,6 +94,37 @@ DECLARE_ODFEXPORT_TEST(testTdf143605, "tdf143605.odt") CPPUNIT_ASSERT_EQUAL(OUString("."), getProperty(getParagraph(1), "ListLabelString")); } +CPPUNIT_TEST_FIXTURE(Test, testTdf57317_autoListName) +{ +load(mpTestDocumentPath, "tdf57317_autoListName.odt"); +// The list style (from styles.xml) overrides a duplicate named auto-style +//uno::Any aNumStyle = getStyles("NumberingStyles")->getByName("L1"); +//CPPUNIT_ASSERT(aNumStyle.hasValue()); +uno::Reference xPara(getParagraph(1), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(OUString(">1<"), getProperty(xPara, "ListLabelString")); +CPPUNIT_ASSERT_EQUAL(OUString("L1"), getProperty(xPara, "NumberingStyleName")); + +dispatchCommand(mxComponent, ".uno:SelectAll", {}); +dispatchCommand(mxComponent, ".uno:DefaultBullet", {}); + +// This was failing with a duplicate auto numbering style name of L1 instead of a unique name, +// thus it was showing the same info as before the bullet modification. +reload(mpFilter, ""); +xPara.set(getParagraph(1), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty(xPara, "ListLabelString")); + +uno::Reference xLevels(xPara->getPropertyValue("NumberingRules"), +uno::UNO_QUERY); +uno::Sequence aProps; +xLevels->getByIndex(0) >>= aProps; +for (beans::PropertyValue const& rProp : std::as_const(aProps)) +{ +if (rProp.Name == "BulletChar") +return; +} +CPPUNIT_FAIL("no BulletChar property"); +} + CPPUNIT_TEST_FIXTURE(Test, testListFormatDocx) { loadAndReload("listformat.docx"); diff --git a/xmloff/source/style/xmlnume.cxx b/xmloff/source/style/xmlnume.cxx index 682fc648af41..9ec9350374db 100644 --- a/xmloff/source/style/xmlnume.cxx +++ b/xmloff/source/style/xmlnume.cxx @@ -782,9 +782,7 @@ void SvxXMLNumRuleExport::exportOutline() } } -void SvxXMLNumRuleExport::exportStyles( bool bUsed, -XMLTextListAutoStylePool *pPool, -bool bExportChapterNumbering ) +void SvxXMLNumRuleExport::exportStyles( bool bUsed, bool bExportChapterNumbering ) { if( bExportChapterNumbering ) exportOutline(); @@ -821,11 +819,8 @@ void SvxXMLNumRuleExport::exportStyles( bool bUsed, xStyles->getByIndex( i ) >>= xStyle; if( !bUsed || xStyle->
[Libreoffice-commits] core.git: sw/inc sw/qa sw/source
sw/inc/IDocumentContentOperations.hxx |1 + sw/qa/extras/uiwriter/uiwriter3.cxx | 11 --- sw/source/core/doc/DocumentContentOperationsManager.cxx | 11 +++ sw/source/core/inc/DocumentContentOperationsManager.hxx |1 + sw/source/uibase/wrtsh/wrtsh1.cxx |2 +- 5 files changed, 22 insertions(+), 4 deletions(-) New commits: commit 3e3328987b69a2a549d24c79ee71b353b9a3e288 Author: Justin Luth AuthorDate: Thu Aug 25 05:51:11 2022 -0400 Commit: Justin Luth CommitDate: Thu Aug 25 21:04:38 2022 +0200 tdf#109285 sw numbering: RemoveLeadingWhiteSpace from all paras Change-Id: Ie834b9c10c9a6cfd7971c7713c5684157477acc4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138807 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/inc/IDocumentContentOperations.hxx b/sw/inc/IDocumentContentOperations.hxx index bac97d685927..94bb7102dee0 100644 --- a/sw/inc/IDocumentContentOperations.hxx +++ b/sw/inc/IDocumentContentOperations.hxx @@ -250,6 +250,7 @@ public: /** Removes any leading white space from the paragraph */ virtual void RemoveLeadingWhiteSpace(const SwPosition & rPos ) = 0; +virtual void RemoveLeadingWhiteSpace(SwPaM& rPaM) = 0; protected: virtual ~IDocumentContentOperations() {}; diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index 8b661082e8ba..062fb0acc195 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -4587,15 +4587,20 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf97899) IDocumentContentOperations& rIDCO(pDoc->getIDocumentContentOperations()); // Create an Ordered List -rIDCO.InsertString(*pCursor, "a"); +rIDCO.InsertString(*pCursor, "\ta"); pWrtShell->SplitNode(); -rIDCO.InsertString(*pCursor, "b"); +rIDCO.InsertString(*pCursor, " b"); pWrtShell->SplitNode(); -rIDCO.InsertString(*pCursor, "c"); +rIDCO.InsertString(*pCursor, " \t c"); dispatchCommand(mxComponent, ".uno:SelectAll", {}); dispatchCommand(mxComponent, ".uno:DefaultNumbering", {}); +// tdf#109285: RemoveLeadingWhiteSpace from all numbered paragraphs +getParagraph(1, "a"); +getParagraph(2, "b"); +getParagraph(3, "c"); + // Save it as DOCX & load it again reload("Office Open XML Text", "tdf97899-tmp.docx"); uno::Reference xNumberingRules diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index d751ac3d19f9..59bfafb5d313 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -3616,6 +3616,17 @@ void DocumentContentOperationsManager::RemoveLeadingWhiteSpace(const SwPosition } } +void DocumentContentOperationsManager::RemoveLeadingWhiteSpace(SwPaM& rPaM ) +{ +for (SwPaM& rSel :rPaM.GetRingContainer()) +{ +SwNodeOffset nStt = rSel.Start()->nNode.GetIndex(); +SwNodeOffset nEnd = rSel.End()->nNode.GetIndex(); +for (SwNodeOffset nPos = nStt; nPos<=nEnd; nPos++) +RemoveLeadingWhiteSpace(SwPosition(rSel.GetBound().GetNodes(), nPos)); +} +} + // Copy method from SwDoc - "copy Flys in Flys" /// note: rRg/rInsPos *exclude* a partially selected start text node; /// pCopiedPaM *includes* a partially selected start text node diff --git a/sw/source/core/inc/DocumentContentOperationsManager.hxx b/sw/source/core/inc/DocumentContentOperationsManager.hxx index decc16c14648..6b45e6ca01ae 100644 --- a/sw/source/core/inc/DocumentContentOperationsManager.hxx +++ b/sw/source/core/inc/DocumentContentOperationsManager.hxx @@ -96,6 +96,7 @@ public: SwRootFrame const* pLayout = nullptr) override; void RemoveLeadingWhiteSpace(const SwPosition & rPos ) override; +void RemoveLeadingWhiteSpace(SwPaM& rPaM) override; //Non-Interface methods diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx index 6606b65ff49f..5b6649861a74 100644 --- a/sw/source/uibase/wrtsh/wrtsh1.cxx +++ b/sw/source/uibase/wrtsh/wrtsh1.cxx @@ -1549,7 +1549,7 @@ void SwWrtShell::NumOrBulletOn(bool bNum) const SwTwips nWidthOfTabs = pTextNode ? pTextNode->GetWidthOfLeadingTabs() : 0; -GetDoc()->getIDocumentContentOperations().RemoveLeadingWhiteSpace( *GetCursor()->GetPoint() ); + GetDoc()->getIDocumentContentOperations().RemoveLeadingWhiteSpace(*GetCursor()); const bool bHtml = dynamic_cast( pDocSh ) != nullptr; const bool bRightToLeft = IsInRightToLeftText();
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source
sw/source/filter/ww8/ww8par.cxx |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) New commits: commit ef5a7ab81cdee4c1e861d49ea79b6924a01a8792 Author: Justin Luth AuthorDate: Mon Aug 15 07:33:50 2022 -0400 Commit: Michael Stahl CommitDate: Fri Aug 19 11:31:49 2022 +0200 fix tdf#77964 patch: don't change DefaultFormat I was actually making a chnage to the default frameformat instead of using a copy of it. Not at all intended. Change-Id: Idcb27eacd5b536914bc14d6086e730a42105ced3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138429 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index dd8484a389a8..a48893e8cc7a 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -3715,10 +3715,12 @@ bool SwWW8ImplReader::ReadChar(tools::Long nPosCp, tools::Long nCpOfs) pResult = ImportOle(); else if (m_bSpec) { -SwFrameFormat* pAsCharFlyFormat = m_rDoc.GetDfltFrameFormat(); +SwFrameFormat* pAsCharFlyFormat = +m_rDoc.MakeFrameFormat(OUString(), m_rDoc.GetDfltFrameFormat()); SwFormatAnchor aAnchor(RndStdIds::FLY_AS_CHAR); pAsCharFlyFormat->SetFormatAttr(aAnchor); pResult = ImportGraf(nullptr, pAsCharFlyFormat); +m_rDoc.DelFrameFormat(pAsCharFlyFormat); }
[Libreoffice-commits] core.git: sw/source
sw/source/filter/ww8/ww8par.cxx |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) New commits: commit eb8252f738bfd1689edee205c6a5e13643f89c29 Author: Justin Luth AuthorDate: Mon Aug 15 07:33:50 2022 -0400 Commit: Caolán McNamara CommitDate: Fri Aug 19 13:34:42 2022 +0200 fix tdf#77964 patch: don't change DefaultFormat I was actually making a chnage to the default frameformat instead of using a copy of it. Not at all intended. Change-Id: Idcb27eacd5b536914bc14d6086e730a42105ced3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138302 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 0a6b7604a490..078d2aae5ddc 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -3728,10 +3728,12 @@ bool SwWW8ImplReader::ReadChar(tools::Long nPosCp, tools::Long nCpOfs) pResult = ImportOle(); else if (m_bSpec) { -SwFrameFormat* pAsCharFlyFormat = m_rDoc.GetDfltFrameFormat(); +SwFrameFormat* pAsCharFlyFormat = +m_rDoc.MakeFrameFormat(OUString(), m_rDoc.GetDfltFrameFormat()); SwFormatAnchor aAnchor(RndStdIds::FLY_AS_CHAR); pAsCharFlyFormat->SetFormatAttr(aAnchor); pResult = ImportGraf(nullptr, pAsCharFlyFormat); +m_rDoc.DelFrameFormat(pAsCharFlyFormat); }
[Libreoffice-commits] core.git: sw/qa sw/source
sw/qa/extras/ww8import/ww8import.cxx |2 +- sw/source/ui/uno/swdetect.cxx| 25 ++--- 2 files changed, 19 insertions(+), 8 deletions(-) New commits: commit 6cec8ba33a28de7248861b2eecfc5034cbde9d37 Author: Justin Luth AuthorDate: Tue Sep 27 22:08:48 2022 -0400 Commit: Justin Luth CommitDate: Wed Sep 28 12:10:36 2022 +0200 tdf#125216 import filter: allow .doc renamed as .dot A LO 6.2.2 regression prevented .doc-as-.dot files to load, giving a "Read Error. This is not a valid WinWord6 file." Well, it is not a valid .dot file (because of some bit differences), but it is a valid .doc file. Since it was renamed to be treated as a template (requiring a save-as), we should treat it as that. Change-Id: I308375797e9dae3ca6d203fab520e91ee788325e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140687 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/qa/extras/ww8import/data/tdf120761_zOrder.doc b/sw/qa/extras/ww8import/data/tdf120761_zOrder.dot similarity index 100% rename from sw/qa/extras/ww8import/data/tdf120761_zOrder.doc rename to sw/qa/extras/ww8import/data/tdf120761_zOrder.dot diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx index c41b86d2f8e2..0687138654f1 100644 --- a/sw/qa/extras/ww8import/ww8import.cxx +++ b/sw/qa/extras/ww8import/ww8import.cxx @@ -275,7 +275,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf110987) CPPUNIT_TEST_FIXTURE(Test, testTdf120761_zOrder) { -load(mpTestDocumentPath, "tdf120761_zOrder.doc"); +load(mpTestDocumentPath, "tdf120761_zOrder.dot"); //The blue shape was covering everything (highest zorder = 2) instead of the lowest(0) uno::Reference xShape(getShapeByName(u"Picture 2"), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_uInt32(0), getProperty(xShape, "ZOrder")); diff --git a/sw/source/ui/uno/swdetect.cxx b/sw/source/ui/uno/swdetect.cxx index 9e354dedaf6b..83b7162ae2a0 100644 --- a/sw/source/ui/uno/swdetect.cxx +++ b/sw/source/ui/uno/swdetect.cxx @@ -24,6 +24,7 @@ #include #include #include +#include #include using namespace ::com::sun::star; @@ -102,19 +103,29 @@ OUString SAL_CALL SwFilterDetect::detect( Sequence< PropertyValue >& lDescriptor // mis-detect it. if ( bIsDetected && aTypeName == "writer_MS_Word_97_Vorlage" ) { +// It is common practice to rename a .doc to .dot to make it a template. +// Since we have detected a.doc-ish format, always accept .dot-named-files +// as valid templates to avoid flagging this as an invalid .dot format.. +INetURLObject aParser(aMediaDesc.getUnpackedValueOrDefault( +utl::MediaDescriptor::PROP_URL, OUString())); + // Super ugly hack, but we don't want to use the whole WW8Fib thing here in // the swd library, apparently. We know (do we?) that the "aBits1" byte, as // the variable is called in WW8Fib::WW8Fib(SvStream&,sal_uInt8,sal_uInt32), // is at offset 10 in the WordDocument stream. The fDot bit is bit 0x01 of // that byte. -tools::SvRef xWordDocument = aStorage->OpenSotStream("WordDocument", StreamMode::STD_READ); -xWordDocument->Seek( 10 ); -if ( xWordDocument->Tell() == 10 ) +if (aParser.getExtension().toAsciiLowerCase() != "dot") { -sal_uInt8 aBits1; -xWordDocument->ReadUChar( aBits1 ); -// Check fDot bit -bIsDetected = ((aBits1 & 0x01) == 0x01); +tools::SvRef xWordDocument += aStorage->OpenSotStream("WordDocument", StreamMode::STD_READ); +xWordDocument->Seek(10); +if (xWordDocument->Tell() == 10) +{ +sal_uInt8 aBits1; +xWordDocument->ReadUChar(aBits1); +// Check fDot bit +bIsDetected = ((aBits1 & 0x01) == 0x01); +} } } }
[Libreoffice-commits] core.git: include/unotools sc/source unotools/source
include/unotools/collatorwrapper.hxx |3 --- sc/source/core/data/conditio.cxx | 27 --- unotools/source/i18n/collatorwrapper.cxx | 17 - 3 files changed, 12 insertions(+), 35 deletions(-) New commits: commit 27c22bac5439908ecdd1aa05580d75998a5eb058 Author: Justin Luth AuthorDate: Mon Sep 26 18:15:03 2022 -0400 Commit: Eike Rathke CommitDate: Tue Sep 27 21:55:02 2022 +0200 tdf#123990 sc condition: use GetTransliteration, not GetCollator Thanks Eike Eike said "This should not use collation (which should only be used in sorting context) but ignore case transliteration instead." I had just copied ancient code from commit 952c2b02c73b30b011306faf2f0d6f2b4a935955 Author: Eike Rathke on Date: Wed Mar 14 14:57:39 2001 + use CollatorWrapper instead of International Apparently that code should also be changed in a follow-up commit. Interestingly, a \x000 - \x008 etc must be isEqual(""), so an attempt to ScGlobal::getCharClass().lowercase all variables at the beginning and use regular OUString comparisons didn't work. Also, a "" startsWith and endsWith each string. In Excel, a "" is also contained in every string, but not (yet) in Calc. Change-Id: I44a07c482d2d67a76a939ba2d593a003398d52c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140633 Tested-by: Justin Luth Reviewed-by: Justin Luth Reviewed-by: Eike Rathke diff --git a/include/unotools/collatorwrapper.hxx b/include/unotools/collatorwrapper.hxx index 1552a7ce9b36..595d9ccf4f41 100644 --- a/include/unotools/collatorwrapper.hxx +++ b/include/unotools/collatorwrapper.hxx @@ -45,9 +45,6 @@ class UNOTOOLS_DLLPUBLIC CollatorWrapper compareString ( const OUString& s1, const OUString& s2) const; -sal_Int32 compareSubstring (const OUString& s1, sal_Int32 off1, sal_Int32 len1, -const OUString& s2, sal_Int32 off2, sal_Int32 len2) const; - css::uno::Sequence< OUString > listCollatorAlgorithms ( const css::lang::Locale& rLocale) const; diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 834c4a78f5e8..d126357dc38a 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -1175,36 +1175,33 @@ bool ScConditionEntry::IsValidStr( const OUString& rArg, const ScAddress& rPos ) bValid = !bValid; break; case ScConditionMode::BeginsWith: -{ -const sal_Int32 nLen = aUpVal1.getLength(); -if (!nLen || nLen > rArg.getLength()) -bValid = false; -else -{ -bValid = (ScGlobal::GetCollator().compareSubstring(rArg, 0, nLen, - aUpVal1, 0, nLen) == 0); -} -} - break; +bValid = ScGlobal::GetTransliteration().isMatch(aUpVal1, rArg); +break; case ScConditionMode::EndsWith: { sal_Int32 nStart = rArg.getLength(); const sal_Int32 nLen = aUpVal1.getLength(); -if (!nLen || nLen > nStart) +if (nLen > nStart) bValid = false; else { nStart = nStart - nLen; -bValid = (ScGlobal::GetCollator().compareSubstring(rArg, nStart, nLen, - aUpVal1, 0, nLen) == 0); +sal_Int32 nMatch1(0), nMatch2(0); +bValid = ScGlobal::GetTransliteration().equals(rArg, nStart, nLen, nMatch1, + aUpVal1, 0, nLen, nMatch2); } } break; case ScConditionMode::ContainsText: case ScConditionMode::NotContainsText: -bValid = rArg.toAsciiLowerCase().indexOf(aUpVal1.toAsciiLowerCase()) != -1; +{ +const OUString aArgStr(ScGlobal::getCharClass().lowercase(rArg)); +const OUString aValStr(ScGlobal::getCharClass().lowercase(aUpVal1)); +bValid = aArgStr.indexOf(aValStr) != -1; + if(eOp == ScConditionMode::NotContainsText) bValid = !bValid; +} break; default: { diff --git a/unotools/source/i18n/collatorwrapper.cxx b/unotools/source/i18n/collatorwrapper.cxx index ce85de11df7e..4da1398e0636 100644 --- a/unotools/source/i18n/collatorwrapper.cxx +++ b/unotools/source/i18n/collatorwrapper.cxx @@ -46,23 +46,6 @@ CollatorWrapper::compareString (const OUString& s1, const OUString& s2) const return 0; } -sal_Int32 -CollatorWrapper::compareSubstring (const OUString&a
[Libreoffice-commits] core.git: sw/source
sw/source/core/crsr/bookmark.cxx |9 + sw/source/core/inc/bookmark.hxx |1 + sw/source/uibase/docvw/edtwin.cxx |8 3 files changed, 18 insertions(+) New commits: commit 0bf8a781ffec13b4fbcb96a2e9349b423a92cb1d Author: Justin Luth AuthorDate: Mon Oct 17 22:24:06 2022 -0400 Commit: Justin Luth CommitDate: Tue Oct 18 12:43:59 2022 +0200 related tdf#151548 sw: KEY_DOWN access to FieldmarkWithDropDownButton There was no way to use only a keyboard to access dropdown formfields. (This should also work for LO's unique DateFieldMark - however you get one of those.) Change-Id: I2b0b2bd38a43817bbbf1801910815ebe87614f94 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141488 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/source/core/crsr/bookmark.cxx b/sw/source/core/crsr/bookmark.cxx index 0d61d684914c..cebe18788537 100644 --- a/sw/source/core/crsr/bookmark.cxx +++ b/sw/source/core/crsr/bookmark.cxx @@ -661,6 +661,15 @@ namespace sw::mark m_pButton.disposeAndClear(); } +void FieldmarkWithDropDownButton::LaunchPopup() +{ +if (!m_pButton) +return + +m_pButton->Invalidate(); +m_pButton->LaunchPopup(); +} + DropDownFieldmark::DropDownFieldmark(const SwPaM& rPaM, const OUString& rName) : FieldmarkWithDropDownButton(rPaM) { diff --git a/sw/source/core/inc/bookmark.hxx b/sw/source/core/inc/bookmark.hxx index bc77ccd8ab91..431f643da9c5 100644 --- a/sw/source/core/inc/bookmark.hxx +++ b/sw/source/core/inc/bookmark.hxx @@ -274,6 +274,7 @@ namespace sw::mark { virtual void ShowButton(SwEditWin* pEditWin) = 0; virtual void RemoveButton(); +virtual void LaunchPopup(); protected: VclPtr m_pButton; diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 35628a0ce50a..3b9a556e6912 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -70,6 +70,7 @@ #include #include +#include #include #include #include @@ -1888,6 +1889,13 @@ KEYINPUT_CHECKTABLE: bool bMod1 = 0 != (rKeyCode.GetModifier() & KEY_MOD1); if(!bMod1) { +::sw::mark::IFieldmark* pMark = rSh.GetCurrentFieldmark(); +if (auto pDropDown = dynamic_cast(pMark)) +{ +pDropDown->LaunchPopup(); +eKeyState = SwKeyState::End; +break; +} eFlyState = SwKeyState::Fly_Change; nDir = MOVE_DOWN_BIG; }
[Libreoffice-commits] core.git: sw/source
sw/source/core/crsr/bookmark.cxx | 11 --- sw/source/core/doc/docbm.cxx |4 ++-- sw/source/core/inc/bookmark.hxx |4 ++-- 3 files changed, 12 insertions(+), 7 deletions(-) New commits: commit 8ad39b6f2aff3ca37aeff5373991e853c329 Author: Justin Luth AuthorDate: Sat Oct 15 14:54:11 2022 -0400 Commit: Miklos Vajna CommitDate: Tue Oct 18 11:37:26 2022 +0200 tdf#151548 sw: use provided name for formfields This was already aded for TextFieldmark in 2018 via tdf#120225. (A unique name is created if that mark already exists.) Added it to the other formfield items. This is needed for DOC/DOCX import, and is critical for connecting macros to the control. mstahl said that DateFieldmark is not a valid MS formfield, and miklosv indicated no likely value in preserving a name there. There is also NonTextFieldmark and FieldmarkWithDropDownButton, but they just look like implementation gadgets to me so I didn't give them the same treatment. No need for a unit test here. This is super foundational - anything else building on it will be the unit test. Change-Id: Ide49d6efb8391fea17e7a61c9e99b30532bb2014 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141423 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna diff --git a/sw/source/core/crsr/bookmark.cxx b/sw/source/core/crsr/bookmark.cxx index 95b545102bc1..0d61d684914c 100644 --- a/sw/source/core/crsr/bookmark.cxx +++ b/sw/source/core/crsr/bookmark.cxx @@ -617,9 +617,12 @@ namespace sw::mark } -CheckboxFieldmark::CheckboxFieldmark(const SwPaM& rPaM) +CheckboxFieldmark::CheckboxFieldmark(const SwPaM& rPaM, const OUString& rName) : NonTextFieldmark(rPaM) -{ } +{ +if (!rName.isEmpty()) +m_aName = rName; +} void CheckboxFieldmark::SetChecked(bool checked) { @@ -658,9 +661,11 @@ namespace sw::mark m_pButton.disposeAndClear(); } -DropDownFieldmark::DropDownFieldmark(const SwPaM& rPaM) +DropDownFieldmark::DropDownFieldmark(const SwPaM& rPaM, const OUString& rName) : FieldmarkWithDropDownButton(rPaM) { +if (!rName.isEmpty()) +m_aName = rName; } DropDownFieldmark::~DropDownFieldmark() diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx index c19d182c3f7a..65b9de1ebc13 100644 --- a/sw/source/core/doc/docbm.cxx +++ b/sw/source/core/doc/docbm.cxx @@ -619,10 +619,10 @@ namespace sw::mark pMark = std::make_unique(rPaM, rName); break; case IDocumentMarkAccess::MarkType::CHECKBOX_FIELDMARK: -pMark = std::make_unique(rPaM); +pMark = std::make_unique(rPaM, rName); break; case IDocumentMarkAccess::MarkType::DROPDOWN_FIELDMARK: -pMark = std::make_unique(rPaM); +pMark = std::make_unique(rPaM, rName); break; case IDocumentMarkAccess::MarkType::DATE_FIELDMARK: pMark = std::make_unique(rPaM); diff --git a/sw/source/core/inc/bookmark.hxx b/sw/source/core/inc/bookmark.hxx index bf2e98488f3e..bc77ccd8ab91 100644 --- a/sw/source/core/inc/bookmark.hxx +++ b/sw/source/core/inc/bookmark.hxx @@ -259,7 +259,7 @@ namespace sw::mark { , public NonTextFieldmark { public: -CheckboxFieldmark(const SwPaM& rPaM); +CheckboxFieldmark(const SwPaM& rPaM, const OUString& rName); bool IsChecked() const override; void SetChecked(bool checked) override; }; @@ -284,7 +284,7 @@ namespace sw::mark { : public FieldmarkWithDropDownButton { public: -DropDownFieldmark(const SwPaM& rPaM); +DropDownFieldmark(const SwPaM& rPaM, const OUString& rName); virtual ~DropDownFieldmark() override; virtual void ShowButton(SwEditWin* pEditWin) override;
[Libreoffice-commits] core.git: include/vbahelper oovbaapi/ooo sw/qa sw/source vbahelper/source
include/vbahelper/vbahelper.hxx |4 oovbaapi/ooo/vba/word/XWordBasic.idl |1 + sw/qa/core/data/docm/testVBA.docm|binary sw/source/ui/vba/vbawordbasic.cxx| 13 + sw/source/ui/vba/vbawordbasic.hxx|1 + vbahelper/source/vbahelper/vbahelper.cxx | 21 + 6 files changed, 40 insertions(+) New commits: commit 55628d6b258f77eac8a34a1a8f6bbcbf09fd97cc Author: Justin Luth AuthorDate: Thu Oct 13 17:22:52 2022 -0400 Commit: Miklos Vajna CommitDate: Mon Oct 17 14:14:53 2022 +0200 sw vba: add WordBasic.MsgBox The unit test just consists of adding a "WordBasic.MsgBox()" to the vba code in testVBA.docm. make CppunitTest_sw_macros_test or just open the file manually for an easy-to-run experience. Change-Id: I38edfee42649fcc85f0f535a2c9861c45038fa0e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141347 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna diff --git a/include/vbahelper/vbahelper.hxx b/include/vbahelper/vbahelper.hxx index 533d5e3698b6..9be2b900a019 100644 --- a/include/vbahelper/vbahelper.hxx +++ b/include/vbahelper/vbahelper.hxx @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -131,6 +132,9 @@ namespace ooo::vba VBAHELPER_DLLPUBLIC bool setPropertyValue( css::uno::Sequence< css::beans::PropertyValue >& aProp, const OUString& aName, const css::uno::Any& aValue ); VBAHELPER_DLLPUBLIC void setOrAppendPropertyValue( css::uno::Sequence< css::beans::PropertyValue >& aProp, const OUString& aName, const css::uno::Any& aValue ); +VBAHELPER_DLLPUBLIC bool executeRunTimeLibrary(const std::u16string_view& rSbRtl_command, + SbxArray* pParameters); + class VBAHELPER_DLLPUBLIC Millimeter { //Factor to translate between points and hundredths of millimeters: diff --git a/oovbaapi/ooo/vba/word/XWordBasic.idl b/oovbaapi/ooo/vba/word/XWordBasic.idl index 66c867f09364..7cc1efe8bd56 100644 --- a/oovbaapi/ooo/vba/word/XWordBasic.idl +++ b/oovbaapi/ooo/vba/word/XWordBasic.idl @@ -42,6 +42,7 @@ interface XWordBasic any DocMaximize( [in] any State ); void AppShow( [in] any WindowName ); any AppCount(); +void MsgBox( [in] string Prompt ); void ScreenUpdating( [in] /*optional*/ any On ); }; diff --git a/sw/qa/core/data/docm/testVBA.docm b/sw/qa/core/data/docm/testVBA.docm index c02e353c3c3e..a2609feb6cd0 100644 Binary files a/sw/qa/core/data/docm/testVBA.docm and b/sw/qa/core/data/docm/testVBA.docm differ diff --git a/sw/source/ui/vba/vbawordbasic.cxx b/sw/source/ui/vba/vbawordbasic.cxx index ae59cf245f55..f08ed4e0daa8 100644 --- a/sw/source/ui/vba/vbawordbasic.cxx +++ b/sw/source/ui/vba/vbawordbasic.cxx @@ -22,6 +22,8 @@ #include "vbamailmerge.hxx" #include "vbawordbasic.hxx" +#include +#include #include #include #include @@ -242,6 +244,17 @@ css::uno::Any SAL_CALL SwWordBasic::AppCount() return css::uno::Any(sal_Int32(2)); } +void SAL_CALL SwWordBasic::MsgBox(const OUString& sPrompt) +{ +SbxArrayRef pArgs = new SbxArray; +SbxVariable* pVar = new SbxVariable(); +pVar->PutString(sPrompt); +pArgs->Put(pVar, 1); + +if (!executeRunTimeLibrary(u"MsgBox", pArgs.get())) +SAL_WARN("sw.vba", "failed to execute runtime library function MsgBox (" << sPrompt << ")"); +} + void SAL_CALL SwWordBasic::ScreenUpdating(const uno::Any& On) { sal_Int32 nOn; diff --git a/sw/source/ui/vba/vbawordbasic.hxx b/sw/source/ui/vba/vbawordbasic.hxx index 75f8a05a3210..05589f0c58c5 100644 --- a/sw/source/ui/vba/vbawordbasic.hxx +++ b/sw/source/ui/vba/vbawordbasic.hxx @@ -86,6 +86,7 @@ public: virtual css::uno::Any SAL_CALL DocMaximize(const css::uno::Any& State) override; virtual void SAL_CALL AppShow(const css::uno::Any& WindowName) override; virtual css::uno::Any SAL_CALL AppCount() override; +virtual void SAL_CALL MsgBox(const OUString& sPrompt) override; virtual void SAL_CALL ScreenUpdating(const css::uno::Any& On) override; }; diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx index 4e71cb582565..2722f627e9ba 100644 --- a/vbahelper/source/vbahelper/vbahelper.cxx +++ b/vbahelper/source/vbahelper/vbahelper.cxx @@ -746,6 +746,27 @@ void setOrAppendPropertyValue( uno::Sequence< beans::PropertyValue >& aProp, con pProp[ nLength ].Value = aValue; } +bool executeRunTimeLibrary(const std::u16string_view& rSbRtl_command, SbxArray* pParameters) +{ +StarBASIC* pBasic = dynamic_cast< StarBASIC* >(StarBASIC::GetActiveModule()->GetParent()); +if (!pBasic) +return false; + +SbxObject* p
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - oovbaapi/ooo sw/qa sw/source
oovbaapi/ooo/vba/word/XWordBasic.idl |1 + sw/qa/core/data/docm/testVBA.docm|binary sw/qa/core/macros-test.cxx |4 sw/source/ui/vba/vbawordbasic.cxx|7 +++ sw/source/ui/vba/vbawordbasic.hxx|1 + 5 files changed, 13 insertions(+) New commits: commit 8312e6f2ef5ea4fca7f2c9a08bee2984176f8628 Author: Justin Luth AuthorDate: Wed Oct 12 13:08:59 2022 -0400 Commit: Miklos Vajna CommitDate: Mon Oct 24 15:05:26 2022 +0200 sw vba: add WordBasic.ScreenUpdating Cherry-pick of a8209c52d6daeb00ed85d5c705ec84c9603e2f3e Change-Id: I3d074c224b77eff9f4ab1ea6bade6d66828fc88c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141273 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141574 Tested-by: Jenkins CollaboraOffice diff --git a/oovbaapi/ooo/vba/word/XWordBasic.idl b/oovbaapi/ooo/vba/word/XWordBasic.idl index 5a381daf3867..124b0809234d 100644 --- a/oovbaapi/ooo/vba/word/XWordBasic.idl +++ b/oovbaapi/ooo/vba/word/XWordBasic.idl @@ -44,6 +44,7 @@ interface XWordBasic any DocMaximize( [in] any State ); void AppShow( [in] any WindowName ); any AppCount(); +void ScreenUpdating( [in] /*optional*/ any On ); }; }; }; }; diff --git a/sw/qa/core/data/docm/testVBA.docm b/sw/qa/core/data/docm/testVBA.docm new file mode 100644 index ..c02e353c3c3e Binary files /dev/null and b/sw/qa/core/data/docm/testVBA.docm differ diff --git a/sw/qa/core/macros-test.cxx b/sw/qa/core/macros-test.cxx index f3b10af8a30d..dc571ed928af 100644 --- a/sw/qa/core/macros-test.cxx +++ b/sw/qa/core/macros-test.cxx @@ -109,6 +109,10 @@ void SwMacrosTest::testVba() { OUString("testVba.doc"), OUString("vnd.sun.Star.script:Project.NewMacros.Macro1?language=Basic=document") +}, +{ +OUString("testVBA.docm"), + OUString("vnd.sun.Star.script:Project.ThisDocument.testAll?language=Basic=document") } }; for ( size_t i=0; i>= nOn) +mpApp->setScreenUpdating(nOn != 0); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/vba/vbawordbasic.hxx b/sw/source/ui/vba/vbawordbasic.hxx index 5933f104eb49..57b3c735f1df 100644 --- a/sw/source/ui/vba/vbawordbasic.hxx +++ b/sw/source/ui/vba/vbawordbasic.hxx @@ -74,6 +74,7 @@ public: virtual css::uno::Any SAL_CALL DocMaximize(const css::uno::Any& State) override; virtual void SAL_CALL AppShow(const css::uno::Any& WindowName) override; virtual css::uno::Any SAL_CALL AppCount() override; +virtual void SAL_CALL ScreenUpdating(const css::uno::Any& On) override; }; #endif // INCLUDED_SW_SOURCE_UI_VBA_VBAWORDBASIC_HXX
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sw/source
sw/source/core/crsr/crbm.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 9e2c13f6e569f821b629c056e6e282ccd7f38a1f Author: Justin Luth AuthorDate: Sat Oct 15 18:15:47 2022 -0400 Commit: Miklos Vajna CommitDate: Mon Oct 24 17:13:17 2022 +0200 related tdf#151548 sw: use start of selection for GetCurrentFieldmark When walking through a form, the current formfield is highlighted, and pressing space should toggle a checkmarkField. Well, GetPoint was pointing at the end of the selection, and so we were getting a "sw/source/uibase/docvw/edtwin.cxx:2499: Where is my FieldMark??". My attempt at a unit test caused random crashing (I assume it was the protection-editing dialog box) and I never did succeed in getting the checkbox to report an unchecked status anyway. Change-Id: I0f28fb117a84cb5e56463a65d5bb72bbac174865 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141424 Reviewed-by: Justin Luth Tested-by: Jenkins (cherry picked from commit 7d260761702a5a172f3554bbf44d0e810c441a51) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141587 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/sw/source/core/crsr/crbm.cxx b/sw/source/core/crsr/crbm.cxx index 02f554014568..bb17940a01d6 100644 --- a/sw/source/core/crsr/crbm.cxx +++ b/sw/source/core/crsr/crbm.cxx @@ -286,7 +286,7 @@ bool SwCursorShell::IsFormProtected() ::sw::mark::IFieldmark* SwCursorShell::GetCurrentFieldmark() { // TODO: Refactor -SwPosition pos(*GetCursor()->GetPoint()); +SwPosition pos(*GetCursor()->Start()); return getIDocumentMarkAccess()->getFieldmarkFor(pos); }
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - include/vbahelper oovbaapi/ooo sw/qa sw/source vbahelper/source
include/vbahelper/vbahelper.hxx |4 oovbaapi/ooo/vba/word/XWordBasic.idl |1 + sw/qa/core/data/docm/testVBA.docm|binary sw/source/ui/vba/vbawordbasic.cxx| 13 + sw/source/ui/vba/vbawordbasic.hxx|1 + vbahelper/source/vbahelper/vbahelper.cxx | 21 + 6 files changed, 40 insertions(+) New commits: commit 4f355ba5dee253c5ffc12fa8cc20f2ddf96e8b52 Author: Justin Luth AuthorDate: Thu Oct 13 17:22:52 2022 -0400 Commit: Miklos Vajna CommitDate: Mon Oct 24 15:05:47 2022 +0200 sw vba: add WordBasic.MsgBox The unit test just consists of adding a "WordBasic.MsgBox()" to the vba code in testVBA.docm. make CppunitTest_sw_macros_test or just open the file manually for an easy-to-run experience. Cherry-pick of 55628d6b258f77eac8a34a1a8f6bbcbf09fd97cc Change-Id: I38edfee42649fcc85f0f535a2c9861c45038fa0e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141347 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141595 Tested-by: Jenkins CollaboraOffice diff --git a/include/vbahelper/vbahelper.hxx b/include/vbahelper/vbahelper.hxx index fd4549cf99a8..bf8998755baa 100644 --- a/include/vbahelper/vbahelper.hxx +++ b/include/vbahelper/vbahelper.hxx @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -134,6 +135,9 @@ namespace ooo::vba VBAHELPER_DLLPUBLIC bool setPropertyValue( css::uno::Sequence< css::beans::PropertyValue >& aProp, const OUString& aName, const css::uno::Any& aValue ); VBAHELPER_DLLPUBLIC void setOrAppendPropertyValue( css::uno::Sequence< css::beans::PropertyValue >& aProp, const OUString& aName, const css::uno::Any& aValue ); +VBAHELPER_DLLPUBLIC bool executeRunTimeLibrary(const std::u16string_view& rSbRtl_command, + SbxArray* pParameters); + class VBAHELPER_DLLPUBLIC Millimeter { //Factor to translate between points and hundredths of millimeters: diff --git a/oovbaapi/ooo/vba/word/XWordBasic.idl b/oovbaapi/ooo/vba/word/XWordBasic.idl index 124b0809234d..7a4d8881049d 100644 --- a/oovbaapi/ooo/vba/word/XWordBasic.idl +++ b/oovbaapi/ooo/vba/word/XWordBasic.idl @@ -44,6 +44,7 @@ interface XWordBasic any DocMaximize( [in] any State ); void AppShow( [in] any WindowName ); any AppCount(); +void MsgBox( [in] string Prompt ); void ScreenUpdating( [in] /*optional*/ any On ); }; diff --git a/sw/qa/core/data/docm/testVBA.docm b/sw/qa/core/data/docm/testVBA.docm index c02e353c3c3e..a2609feb6cd0 100644 Binary files a/sw/qa/core/data/docm/testVBA.docm and b/sw/qa/core/data/docm/testVBA.docm differ diff --git a/sw/source/ui/vba/vbawordbasic.cxx b/sw/source/ui/vba/vbawordbasic.cxx index ae59cf245f55..f08ed4e0daa8 100644 --- a/sw/source/ui/vba/vbawordbasic.cxx +++ b/sw/source/ui/vba/vbawordbasic.cxx @@ -22,6 +22,8 @@ #include "vbamailmerge.hxx" #include "vbawordbasic.hxx" +#include +#include #include #include #include @@ -242,6 +244,17 @@ css::uno::Any SAL_CALL SwWordBasic::AppCount() return css::uno::Any(sal_Int32(2)); } +void SAL_CALL SwWordBasic::MsgBox(const OUString& sPrompt) +{ +SbxArrayRef pArgs = new SbxArray; +SbxVariable* pVar = new SbxVariable(); +pVar->PutString(sPrompt); +pArgs->Put(pVar, 1); + +if (!executeRunTimeLibrary(u"MsgBox", pArgs.get())) +SAL_WARN("sw.vba", "failed to execute runtime library function MsgBox (" << sPrompt << ")"); +} + void SAL_CALL SwWordBasic::ScreenUpdating(const uno::Any& On) { sal_Int32 nOn; diff --git a/sw/source/ui/vba/vbawordbasic.hxx b/sw/source/ui/vba/vbawordbasic.hxx index 57b3c735f1df..8c63bee3619b 100644 --- a/sw/source/ui/vba/vbawordbasic.hxx +++ b/sw/source/ui/vba/vbawordbasic.hxx @@ -74,6 +74,7 @@ public: virtual css::uno::Any SAL_CALL DocMaximize(const css::uno::Any& State) override; virtual void SAL_CALL AppShow(const css::uno::Any& WindowName) override; virtual css::uno::Any SAL_CALL AppCount() override; +virtual void SAL_CALL MsgBox(const OUString& sPrompt) override; virtual void SAL_CALL ScreenUpdating(const css::uno::Any& On) override; }; diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx index 25da3beca4d4..195bbcca7d53 100644 --- a/vbahelper/source/vbahelper/vbahelper.cxx +++ b/vbahelper/source/vbahelper/vbahelper.cxx @@ -757,6 +757,27 @@ void setOrAppendPropertyValue( uno::Sequence< beans::PropertyValue >& aProp, con pProp[ nLength ].Value = aValue; } +bool executeRunTimeLibrary(const std::u16string_view& rSbRtl_command, SbxArray* pPar
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sw/source
sw/source/core/crsr/bookmark.cxx | 11 --- sw/source/core/doc/docbm.cxx |4 ++-- sw/source/core/inc/bookmark.hxx |4 ++-- 3 files changed, 12 insertions(+), 7 deletions(-) New commits: commit cd8baac3c114fabeb593b59d3c8f4ee5243df36c Author: Justin Luth AuthorDate: Sat Oct 15 14:54:11 2022 -0400 Commit: Miklos Vajna CommitDate: Mon Oct 24 15:06:04 2022 +0200 tdf#151548 sw: use provided name for formfields This was already aded for TextFieldmark in 2018 via tdf#120225. (A unique name is created if that mark already exists.) Added it to the other formfield items. This is needed for DOC/DOCX import, and is critical for connecting macros to the control. mstahl said that DateFieldmark is not a valid MS formfield, and miklosv indicated no likely value in preserving a name there. There is also NonTextFieldmark and FieldmarkWithDropDownButton, but they just look like implementation gadgets to me so I didn't give them the same treatment. No need for a unit test here. This is super foundational - anything else building on it will be the unit test. Cherry-pick of 8ad39b6f2aff3ca37aeff5373991e853c329 Change-Id: Ide49d6efb8391fea17e7a61c9e99b30532bb2014 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141423 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141596 Tested-by: Jenkins CollaboraOffice diff --git a/sw/source/core/crsr/bookmark.cxx b/sw/source/core/crsr/bookmark.cxx index 417558aad130..ecbd5dab2d56 100644 --- a/sw/source/core/crsr/bookmark.cxx +++ b/sw/source/core/crsr/bookmark.cxx @@ -621,9 +621,12 @@ namespace sw::mark } -CheckboxFieldmark::CheckboxFieldmark(const SwPaM& rPaM) +CheckboxFieldmark::CheckboxFieldmark(const SwPaM& rPaM, const OUString& rName) : NonTextFieldmark(rPaM) -{ } +{ +if (!rName.isEmpty()) +m_aName = rName; +} void CheckboxFieldmark::SetChecked(bool checked) { @@ -662,9 +665,11 @@ namespace sw::mark m_pButton.disposeAndClear(); } -DropDownFieldmark::DropDownFieldmark(const SwPaM& rPaM) +DropDownFieldmark::DropDownFieldmark(const SwPaM& rPaM, const OUString& rName) : FieldmarkWithDropDownButton(rPaM) { +if (!rName.isEmpty()) +m_aName = rName; } DropDownFieldmark::~DropDownFieldmark() diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx index 0b8f5a39d158..bc9884c2829e 100644 --- a/sw/source/core/doc/docbm.cxx +++ b/sw/source/core/doc/docbm.cxx @@ -621,10 +621,10 @@ namespace sw::mark pMark = std::make_unique(rPaM, rName); break; case IDocumentMarkAccess::MarkType::CHECKBOX_FIELDMARK: -pMark = std::make_unique(rPaM); +pMark = std::make_unique(rPaM, rName); break; case IDocumentMarkAccess::MarkType::DROPDOWN_FIELDMARK: -pMark = std::make_unique(rPaM); +pMark = std::make_unique(rPaM, rName); break; case IDocumentMarkAccess::MarkType::DATE_FIELDMARK: pMark = std::make_unique(rPaM); diff --git a/sw/source/core/inc/bookmark.hxx b/sw/source/core/inc/bookmark.hxx index ed7d5ad82180..39afc6e70271 100644 --- a/sw/source/core/inc/bookmark.hxx +++ b/sw/source/core/inc/bookmark.hxx @@ -259,7 +259,7 @@ namespace sw::mark { , public NonTextFieldmark { public: -CheckboxFieldmark(const SwPaM& rPaM); +CheckboxFieldmark(const SwPaM& rPaM, const OUString& rName); bool IsChecked() const override; void SetChecked(bool checked) override; }; @@ -284,7 +284,7 @@ namespace sw::mark { : public FieldmarkWithDropDownButton { public: -DropDownFieldmark(const SwPaM& rPaM); +DropDownFieldmark(const SwPaM& rPaM, const OUString& rName); virtual ~DropDownFieldmark() override; virtual void ShowButton(SwEditWin* pEditWin) override;
[Libreoffice-commits] core.git: sc/source
sc/source/ui/view/gridwin.cxx | 16 +++- 1 file changed, 11 insertions(+), 5 deletions(-) New commits: commit 4c8b1fa44d4f49510d3910981e649dcb08bceb36 Author: Justin Luth AuthorDate: Fri Oct 28 13:15:00 2022 -0400 Commit: Justin Luth CommitDate: Sat Oct 29 00:11:38 2022 +0200 tdf#151794 sc validate: honor NO_BLANK in Cell range dropdown This fixes LO 6.0 regression 3567d00b5e1168affd067330037e062e10b05b2d Not really a regression - it never let any blanks before then, regardless of the "Allow empty cells" setting in the Data - Validity rule. The default in LO is to allow empty cells. Change-Id: I2d6fb4d7be3622c81b28f5d30985cdb5e6b2fe11 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142002 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 4e620c2c4f12..69a1daf6f9ce 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -1376,12 +1376,12 @@ void ScGridWindow::DoScenarioMenu( const ScRange& rScenRange ) mpFilterBox->EndInit(); } -void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow ) +void ScGridWindow::LaunchDataSelectMenu(const SCCOL nCol, const SCROW nRow) { mpFilterBox.reset(); ScDocument& rDoc = mrViewData.GetDocument(); -SCTAB nTab = mrViewData.GetTabNo(); +const SCTAB nTab = mrViewData.GetTabNo(); bool bLayoutRTL = rDoc.IsLayoutRTL( nTab ); tools::Long nSizeX = 0; @@ -1417,6 +1417,9 @@ void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow ) // SetSize later +const sal_uInt32 nIndex = rDoc.GetAttr(nCol, nRow, nTab, ATTR_VALIDDATA)->GetValue(); +const ScValidationData* pData = nIndex ? rDoc.GetValidationEntry(nIndex) : nullptr; + bool bEmpty = false; std::vector aStrings; // case sensitive // Fill List @@ -1435,7 +1438,12 @@ void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow ) EnterWait(); for (const auto& rString : aStrings) -rFilterBox.append_text(rString.GetString()); +{ +// IsIgnoreBlank allows blank values. Don't add empty string unless "Allow Empty Cells" +const OUString& rFilterString = rString.GetString(); +if (!rFilterString.isEmpty() || !pData || pData->IsIgnoreBlank()) +rFilterBox.append_text(rFilterString); +} if (bWait) LeaveWait(); @@ -1447,10 +1455,8 @@ void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow ) sal_Int32 nSelPos = -1; -sal_uInt32 nIndex = rDoc.GetAttr( nCol, nRow, nTab, ATTR_VALIDDATA )->GetValue(); if ( nIndex ) { -const ScValidationData* pData = rDoc.GetValidationEntry( nIndex ); if (pData) { std::unique_ptr pNew;
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - oovbaapi/ooo sw/source
oovbaapi/ooo/vba/word/XGlobals.idl |1 + sw/source/ui/vba/vbaglobals.cxx|9 + sw/source/ui/vba/vbaglobals.hxx|1 + 3 files changed, 11 insertions(+) New commits: commit fbcde15089977ca8354c981fc8794a026fceea1e Author: Justin Luth AuthorDate: Mon Oct 10 20:40:30 2022 -0400 Commit: Miklos Vajna CommitDate: Thu Oct 20 15:29:10 2022 +0200 sw vba: tie WordBasic to VBAGlobals This allows WordBasic to also be run directly, instead of only working with Application.WordBasic.*. Change-Id: I60c3beaa1fce9a8bf25786cc0b2ed6ef6deda2f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141200 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141355 Tested-by: Jenkins CollaboraOffice diff --git a/oovbaapi/ooo/vba/word/XGlobals.idl b/oovbaapi/ooo/vba/word/XGlobals.idl index b76ef8f62d82..13dda8d384e1 100644 --- a/oovbaapi/ooo/vba/word/XGlobals.idl +++ b/oovbaapi/ooo/vba/word/XGlobals.idl @@ -35,6 +35,7 @@ interface XGlobals : com::sun::star::uno::XInterface [attribute, readonly] ooo::vba::word::XSystem System; [attribute, readonly] ooo::vba::word::XOptions Options; [attribute, readonly] ooo::vba::word::XSelection Selection; +[attribute, readonly] ooo::vba::word::XWordBasic WordBasic; any CommandBars( [in] any Index ); any Documents( [in] any Index ); any Addins( [in] any Index ); diff --git a/sw/source/ui/vba/vbaglobals.cxx b/sw/source/ui/vba/vbaglobals.cxx index 0e5db3802895..457cefb56462 100644 --- a/sw/source/ui/vba/vbaglobals.cxx +++ b/sw/source/ui/vba/vbaglobals.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #include "vbaglobals.hxx" +#include "vbawordbasic.hxx" #include #include @@ -124,6 +125,14 @@ SwVbaGlobals::getSelection() return getApplication()->getSelection(); } +uno::Reference SAL_CALL SwVbaGlobals::getWordBasic() +{ +assert(dynamic_cast(getApplication().get())); +SwVbaApplication* pVbaApp = static_cast(getApplication().get()); +uno::Reference xWB(new SwWordBasic(pVbaApp)); +return xWB; +} + float SAL_CALL SwVbaGlobals::CentimetersToPoints( float Centimeters ) { return getApplication()->CentimetersToPoints( Centimeters ); diff --git a/sw/source/ui/vba/vbaglobals.hxx b/sw/source/ui/vba/vbaglobals.hxx index 1d8c0b4f8a2a..ad39de12f765 100644 --- a/sw/source/ui/vba/vbaglobals.hxx +++ b/sw/source/ui/vba/vbaglobals.hxx @@ -50,6 +50,7 @@ public: virtual css::uno::Reference SAL_CALL getActiveWindow() override; virtual css::uno::Reference SAL_CALL getOptions() override; virtual css::uno::Reference SAL_CALL getSelection() override; +virtual css::uno::Reference SAL_CALL getWordBasic() override; virtual css::uno::Any SAL_CALL CommandBars(const css::uno::Any& aIndex) override; virtual css::uno::Any SAL_CALL Documents(const css::uno::Any& aIndex) override; virtual css::uno::Any SAL_CALL Addins(const css::uno::Any& aIndex) override;
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sw/Library_vbaswobj.mk sw/source
sw/Library_vbaswobj.mk |1 sw/source/ui/vba/vbaapplication.cxx | 315 sw/source/ui/vba/vbawordbasic.cxx | 245 sw/source/ui/vba/vbawordbasic.hxx | 81 + 4 files changed, 332 insertions(+), 310 deletions(-) New commits: commit df91cad99056f78496a611bcd9e5227503088adc Author: Justin Luth AuthorDate: Thu Oct 13 21:21:08 2022 -0400 Commit: Miklos Vajna CommitDate: Thu Oct 20 15:23:11 2022 +0200 sw vba: move SwWordBasic to its own file We had implemented Application.WordBasic.*, but it can also run as a global WordBasic.*. This patch just separates it from vbaapplication. It was just a copy/paste, and then I ran opt/lo/bin/clang-format -i on the new files and did some minor cleanup. I just guessed at the includes I needed, and then commented the remaining ones out one by one to verifiy they were needed to compile. Not very scientific, but I don't know any other way. (running \bin\find-unneedded-includes afterwards didn't show anything - perhaps that would have helped.) A followup patch will add the VBAGlobal connection. For a clean backport, I first ran 1,$s/makeAny(/Any(/g in order to accomplish what was done with commit ca734f7cfa55814a85d5940e5f64d7c53638f6a7 Author: Stephan Bergmann on Tue May 3 16:22:03 2022 +0200 Just use Any ctor instead of makeAny in sw Change-Id: I2c9023ba8d07314d23ae7a65e670e8748c5e9322 Change-Id: Id29ee582a5ed6186150bb41a1ab98d6c466676e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141354 Reviewed-by: Justin Luth Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/sw/Library_vbaswobj.mk b/sw/Library_vbaswobj.mk index 8867fcf5ede4..bcebe38b912a 100644 --- a/sw/Library_vbaswobj.mk +++ b/sw/Library_vbaswobj.mk @@ -130,6 +130,7 @@ $(eval $(call gb_Library_add_exception_objects,vbaswobj,\ sw/source/ui/vba/vbatableofcontents \ sw/source/ui/vba/vbatablesofcontents \ sw/source/ui/vba/vbavariable \ +sw/source/ui/vba/vbawordbasic \ sw/source/ui/vba/vbadocuments \ sw/source/ui/vba/vbaparagraphformat \ sw/source/ui/vba/vbaborders \ diff --git a/sw/source/ui/vba/vbaapplication.cxx b/sw/source/ui/vba/vbaapplication.cxx index 7aa61e93cef2..a9e4231f3eec 100644 --- a/sw/source/ui/vba/vbaapplication.cxx +++ b/sw/source/ui/vba/vbaapplication.cxx @@ -36,6 +36,7 @@ #include "vbaaddins.hxx" #include "vbamailmerge.hxx" #include "vbadialogs.hxx" +#include "vbawordbasic.hxx" #include #include #include @@ -68,69 +69,6 @@ public: void SAL_CALL Unadvise( sal_uInt32 Cookie ) override; }; -class SwWordBasic : public cppu::WeakImplHelper -{ -private: -SwVbaApplication* mpApp; - -public: -SwWordBasic( SwVbaApplication* pApp ); - -// XWordBasic -virtual sal_Int32 SAL_CALL getMailMergeMainDocumentType() override; -virtual void SAL_CALL setMailMergeMainDocumentType( sal_Int32 _mailmergemaindocumenttype ) override; - -virtual void SAL_CALL FileOpen( const OUString& Name, const uno::Any& ConfirmConversions, const uno::Any& ReadOnly, const uno::Any& AddToMru, const uno::Any& PasswordDoc, const uno::Any& PasswordDot, const uno::Any& Revert, const uno::Any& WritePasswordDoc, const uno::Any& WritePasswordDot ) override; -virtual void SAL_CALL FileSave() override; -virtual void SAL_CALL FileSaveAs( const css::uno::Any& Name, - const css::uno::Any& Format, - const css::uno::Any& LockAnnot, - const css::uno::Any& Password, - const css::uno::Any& AddToMru, - const css::uno::Any& WritePassword, - const css::uno::Any& RecommendReadOnly, - const css::uno::Any& EmbedFonts, - const css::uno::Any& NativePictureFormat, - const css::uno::Any& FormsData, - const css::uno::Any& SaveAsAOCELetter ) override; -virtual void SAL_CALL FileClose( const css::uno::Any& Save ) override; -virtual void SAL_CALL ToolsOptionsView( const css::uno::Any& DraftFont, -const css::uno::Any& WrapToWindow, -const css::uno::Any& PicturePlaceHolders, -const css::uno::Any& FieldCodes, -const css::uno::Any& BookMarks, -const css::uno::Any& FieldShading, -
[Libreoffice-commits] core.git: sw/source
sw/source/core/crsr/crbm.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 7d260761702a5a172f3554bbf44d0e810c441a51 Author: Justin Luth AuthorDate: Sat Oct 15 18:15:47 2022 -0400 Commit: Justin Luth CommitDate: Tue Oct 18 00:33:04 2022 +0200 related tdf#151548 sw: use start of selection for GetCurrentFieldmark When walking through a form, the current formfield is highlighted, and pressing space should toggle a checkmarkField. Well, GetPoint was pointing at the end of the selection, and so we were getting a "sw/source/uibase/docvw/edtwin.cxx:2499: Where is my FieldMark??". My attempt at a unit test caused random crashing (I assume it was the protection-editing dialog box) and I never did succeed in getting the checkbox to report an unchecked status anyway. Change-Id: I0f28fb117a84cb5e56463a65d5bb72bbac174865 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141424 Reviewed-by: Justin Luth Tested-by: Jenkins diff --git a/sw/source/core/crsr/crbm.cxx b/sw/source/core/crsr/crbm.cxx index 113fd96e4e5a..4e0b808c7fba 100644 --- a/sw/source/core/crsr/crbm.cxx +++ b/sw/source/core/crsr/crbm.cxx @@ -286,7 +286,7 @@ bool SwCursorShell::IsFormProtected() ::sw::mark::IFieldmark* SwCursorShell::GetCurrentFieldmark() { // TODO: Refactor -SwPosition pos(*GetCursor()->GetPoint()); +SwPosition pos(*GetCursor()->Start()); return getIDocumentMarkAccess()->getFieldmarkFor(pos); }
[Libreoffice-commits] core.git: sc/qa
sc/qa/unit/data/ods/tdf75702_textLineBreak.ods |binary sc/qa/unit/subsequent_export_test2.cxx | 21 - 2 files changed, 20 insertions(+), 1 deletion(-) New commits: commit 60585bb65330ad703b5683aece1564dfc6301436 Author: Justin Luth AuthorDate: Mon Sep 19 10:57:41 2022 -0400 Commit: Justin Luth CommitDate: Mon Sep 19 21:10:39 2022 +0200 tdf#75702 sc: unit test for preserving text:line-break Change-Id: Id61e46ba4e0b3e2b534cf9f8bafe03fba10cd355 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140182 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sc/qa/unit/data/ods/tdf75702_textLineBreak.ods b/sc/qa/unit/data/ods/tdf75702_textLineBreak.ods new file mode 100644 index ..b2e47b8f6ff6 Binary files /dev/null and b/sc/qa/unit/data/ods/tdf75702_textLineBreak.ods differ diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index b722137934fa..7bbb908a96fb 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -125,6 +125,7 @@ public: void testTdf91634XLSX(); void testTdf115159(); void testTdf112567(); +void testTdf75702(); void testTdf103829(); void testTdf122191(); void testTdf142881(); @@ -249,6 +250,7 @@ public: CPPUNIT_TEST(testTdf91634XLSX); CPPUNIT_TEST(testTdf115159); CPPUNIT_TEST(testTdf112567); +CPPUNIT_TEST(testTdf75702); CPPUNIT_TEST(testTdf103829); CPPUNIT_TEST(testTdf122191); CPPUNIT_TEST(testTdf142881); @@ -1439,6 +1441,24 @@ void ScExportTest2::testTdf112567() xDocSh->DoClose(); } +void ScExportTest2::testTdf75702() +{ +// The problem was that line breaks were not imported. +const OUString sA1("line1\nline2"); + +ScDocShellRef xShell = loadDoc(u"tdf75702_textLineBreak.", FORMAT_ODS); +ScDocument& rDoc = xShell->GetDocument(); +CPPUNIT_ASSERT_EQUAL_MESSAGE("load a1", sA1, rDoc.GetString(0, 0, 0)); + +xShell = saveAndReload(*xShell, FORMAT_ODS); +ScDocument& rDoc2 = xShell->GetDocument(); +CPPUNIT_ASSERT_EQUAL_MESSAGE("reload a1", sA1, rDoc2.GetString(0, 0, 0)); + +xmlDocUniquePtr pContent += XPathHelper::parseExport2(*this, *xShell, m_xSFactory, "content.xml", FORMAT_ODS); +assertXPath(pContent, "//table:table-row[1]/table:table-cell/text:p/text:line-break"); +} + void ScExportTest2::testTdf103829() { // The problem was that tabspaces were not imported or exported at all. @@ -1453,7 +1473,6 @@ void ScExportTest2::testTdf103829() xShell = saveAndReload(*xShell, FORMAT_ODS); ScDocument& rDoc2 = xShell->GetDocument(); -//CPPUNIT_ASSERT_EQUAL_MESSAGE("reload a1", sA1.getLength(), rDoc2.GetString(0, 0, 0).getLength()); CPPUNIT_ASSERT_EQUAL_MESSAGE("reload a1", sA1, rDoc2.GetString(0, 0, 0)); CPPUNIT_ASSERT_EQUAL_MESSAGE("reload a2", sA2, rDoc2.GetString(0, 1, 0)); }
[Libreoffice-commits] core.git: sc/source
sc/source/filter/xml/celltextparacontext.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit 648f06e583cf2cd878580c587afb5813c3db4e33 Author: Justin Luth AuthorDate: Mon Sep 19 12:26:22 2022 -0400 Commit: Justin Luth CommitDate: Mon Sep 19 21:22:39 2022 +0200 crashtesting: "unknown cell text: element" assert for text:bookmark #2 since... commit 690a35680adad07c4ab79d82cd1531bb82fe4bc1 Date: Sat Sep 10 16:32:46 2022 -0400 tdf#103829 ods import: parse From documentation, it looks like we can also have bookmark-start and bookmark-end, so adding these even though no examples found. I looked for how to insert bookmarks in calc - basically no UI or menu (except one notebookbar, no calc documentation, no abandoned bookmark code removal, no bookmark import code. IIUC, in writer a bookmark is basically a field. Perhaps it is similar in Calc? In any case, with this limited wealth of information, I don't plan on trying to fix the LO 4.1 loss of bookmark. Change-Id: I44708a5c7d69ce37f688ec7beb243e08844dbfa8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140197 Tested-by: Justin Luth Reviewed-by: Justin Luth diff --git a/sc/source/filter/xml/celltextparacontext.cxx b/sc/source/filter/xml/celltextparacontext.cxx index 88316798ee5f..5274a36f0599 100644 --- a/sc/source/filter/xml/celltextparacontext.cxx +++ b/sc/source/filter/xml/celltextparacontext.cxx @@ -70,6 +70,8 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLCellTextParaContex maContent += "\x0a"; break; case XML_ELEMENT(TEXT, XML_BOOKMARK): +case XML_ELEMENT(TEXT, XML_BOOKMARK_START): +case XML_ELEMENT(TEXT, XML_BOOKMARK_END): // TODO: ooo95423-1 [file.ods] and tdf#116079-3 have these bookmarks. // Is this valid, and how can we prevent losing these? break;
[Libreoffice-commits] core.git: sw/inc sw/qa sw/source
sw/inc/fmtautofmt.hxx |2 - sw/qa/extras/ww8export/data/tdf117994_CRnumformatting.doc |binary sw/qa/extras/ww8export/ww8export4.cxx |7 sw/source/core/text/txtfld.cxx|5 +-- sw/source/filter/ww8/ww8par.cxx | 23 ++ 5 files changed, 34 insertions(+), 3 deletions(-) New commits: commit 6e1c8bcec511444d2d51c5c5143be56d1900e5e6 Author: Justin Luth AuthorDate: Sat Sep 3 08:37:19 2022 -0400 Commit: Michael Stahl CommitDate: Tue Sep 20 10:53:01 2022 +0200 tdf#150613 sw: better DOC import of paragraph marker formatting Following the lead of LO 6.4 commit 5ba30f588d6e41a13d68b1461345fca7a7ca61ac. This fixes a LO 7.2 regression from tdf#108518. This patch depends on tdf#117994 being fixed in order for ww8export3's testTdf108518_CRnumformatting to round-trip. The problem here is that Word allows formatting the paragraph end marker, and applies the same formatting to the generated numbering string; Writer has no such marker thing. On m_xCtrlStck, the rPos is pointing to the end of the paragraph. GetStackAttr looks for char properties that are still m_bOpen or else where the Point (Mark is the Start, Point is the End) is greater than aPos. Well, at the end of the paragraph I don't think there can be any empty (point==mark) hints in .DOC, so this should only pick up properties that are spilling over onto the CR - just like we want. Change-Id: I06cab075f102d40f93d33fedf5ae0ce8e165e9fa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139329 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Michael Stahl diff --git a/sw/inc/fmtautofmt.hxx b/sw/inc/fmtautofmt.hxx index 5773bffd5329..f4ac2fae7035 100644 --- a/sw/inc/fmtautofmt.hxx +++ b/sw/inc/fmtautofmt.hxx @@ -23,7 +23,7 @@ #include #include -class SAL_DLLPUBLIC_RTTI SwFormatAutoFormat final : public SfxPoolItem +class SW_DLLPUBLIC SwFormatAutoFormat final : public SfxPoolItem { std::shared_ptr mpHandle; diff --git a/sw/qa/extras/ww8export/data/tdf117994_CRnumformatting.doc b/sw/qa/extras/ww8export/data/tdf117994_CRnumformatting.doc new file mode 100644 index ..99744382a82b Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf117994_CRnumformatting.doc differ diff --git a/sw/qa/extras/ww8export/ww8export4.cxx b/sw/qa/extras/ww8export/ww8export4.cxx index e6d1d27f53a4..22ed17e6f849 100644 --- a/sw/qa/extras/ww8export/ww8export4.cxx +++ b/sw/qa/extras/ww8export/ww8export4.cxx @@ -64,6 +64,13 @@ DECLARE_WW8EXPORT_TEST(testTdf150197_anlv2ListFormat, "tdf150197_anlv2ListFormat getProperty(getParagraph(4), "ListLabelString")); } +DECLARE_WW8EXPORT_TEST(testTdf117994_CRnumformatting, "tdf117994_CRnumformatting.doc") +{ +CPPUNIT_ASSERT_EQUAL(OUString("1."), parseDump("//body/txt[1]/Special[@nType='PortionType::Number']", "rText")); +//Without this fix in place, it would become 200 (and non-bold). +CPPUNIT_ASSERT_EQUAL(OUString("160"), parseDump("//body/txt[1]/Special[@nType='PortionType::Number']", "nHeight")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx index 22875f247210..22127dd30e21 100644 --- a/sw/source/core/text/txtfld.cxx +++ b/sw/source/core/text/txtfld.cxx @@ -432,9 +432,10 @@ static void checkApplyParagraphMarkFormatToNumbering(SwFont* pNumFnt, SwTextForm SwFormatAutoFormat const& rListAutoFormat(rInf.GetTextFrame()->GetTextNodeForParaProps()->GetAttr(RES_PARATR_LIST_AUTOFMT)); std::shared_ptr pSet(rListAutoFormat.GetStyleHandle()); -// TODO remove this fallback (for WW8/RTF) +// TODO remove this fallback for RTF +bool isDOC = pIDSA->get(DocumentSettingId::ADD_FLY_OFFSETS); bool isDOCX = pIDSA->get(DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS); -if (!isDOCX && !pSet) +if (!isDOC && !isDOCX && !pSet) { TextFrameIndex const nTextLen(rInf.GetTextFrame()->GetText().getLength()); SwTextNode const* pNode(nullptr); diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 77805814fc46..82dec7f3105d 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -103,6 +103,7 @@ #include #include #include +#include #include #include "sprmids.hxx" @@ -121,6 +122,7 @@ #include #include +#include #include #include @@ -2423,6 +2425,27 @@ void SwWW8ImplReader::AppendTextNode(SwPosition& rPos) if (pText != nullptr) pRule = sw::util::GetNumRuleFromTextNode(*pText); +// tdf#64222 / tdf#150613 filter out th
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/subsequent_export_test2.cxx |2 +- sc/source/filter/xml/xmlcelli.cxx |3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) New commits: commit 8f5f0c754222425af019a9fdc1ba47d72c541d9e Author: Justin Luth AuthorDate: Tue Sep 20 14:28:19 2022 -0400 Commit: Justin Luth CommitDate: Wed Sep 21 19:27:44 2022 +0200 tdf#75702 ODS import: send text:line-break to editeng A cell with a line-break specified is no longer a simple string, so send the string to editeng where it can be properly displayed. This already works fine for XLS and XLSX. This change effectively means that text:line-break will disappear, and become two separate paragraphs. Given the nature of spreadsheets, the precidence in various other patches and the failure to properly display without this, I think I'm fine with unilaterally changing one paragraph into two. Change-Id: I7abcbc6f698a4cb319aea5465a8b0393cf63f31f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140262 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index 7bbb908a96fb..cadc2da0d595 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -1456,7 +1456,7 @@ void ScExportTest2::testTdf75702() xmlDocUniquePtr pContent = XPathHelper::parseExport2(*this, *xShell, m_xSFactory, "content.xml", FORMAT_ODS); -assertXPath(pContent, "//table:table-row[1]/table:table-cell/text:p/text:line-break"); +assertXPath(pContent, "//table:table-row[1]/table:table-cell/text:p", 2); } void ScExportTest2::testTdf103829() diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index e7a8037cd7eb..29450409e608 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -47,6 +47,7 @@ #include "editattributemap.hxx" #include #include +#include #include #include @@ -612,7 +613,7 @@ void ScXMLTableRowCellContext::PushParagraphEnd() } mpEditEngine->InsertParagraph(mpEditEngine->GetParagraphCount(), maParagraph.makeStringAndClear()); } -else if (mbHasFormatRuns) +else if (mbHasFormatRuns || ScStringUtil::isMultiline(maParagraph)) { mpEditEngine->Clear(); mpEditEngine->SetTextCurrentDefaults(maParagraph.makeStringAndClear());
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/ods/tdf103829_textTab.ods|binary sc/qa/unit/subsequent_export_test2.cxx | 22 ++ sc/source/filter/xml/celltextparacontext.cxx |4 3 files changed, 26 insertions(+) New commits: commit 690a35680adad07c4ab79d82cd1531bb82fe4bc1 Author: Justin Luth AuthorDate: Sat Sep 10 16:32:46 2022 -0400 Commit: Justin Luth CommitDate: Tue Sep 13 01:42:54 2022 +0200 tdf#103829 ods import: parse regression since LO 4.1 Change-Id: I65e847a45b8b233c558bf7bc90b554ba8b4b7763 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139757 Tested-by: Justin Luth Reviewed-by: Justin Luth diff --git a/sc/qa/unit/data/ods/tdf103829_textTab.ods b/sc/qa/unit/data/ods/tdf103829_textTab.ods new file mode 100644 index ..7f5256ebe739 Binary files /dev/null and b/sc/qa/unit/data/ods/tdf103829_textTab.ods differ diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index 11d069c632b1..2d1ecb212ae6 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -125,6 +125,7 @@ public: void testTdf91634XLSX(); void testTdf115159(); void testTdf112567(); +void testTdf103829(); void testTdf122191(); void testTdf142881(); void testTdf112567b(); @@ -248,6 +249,7 @@ public: CPPUNIT_TEST(testTdf91634XLSX); CPPUNIT_TEST(testTdf115159); CPPUNIT_TEST(testTdf112567); +CPPUNIT_TEST(testTdf103829); CPPUNIT_TEST(testTdf122191); CPPUNIT_TEST(testTdf142881); CPPUNIT_TEST(testTdf112567b); @@ -1437,6 +1439,26 @@ void ScExportTest2::testTdf112567() xDocSh->DoClose(); } +void ScExportTest2::testTdf103829() +{ +// The problem was that tabspaces were not imported or exported at all. +// These strings match the current implementations of CELLTYPE_EDIT and CELLTYPE_STRING. +const OUString sA1("\x001Leading tab\nTHREE tabs inside: [\x001\x001\x001]"); +const OUString sA2("\tLeading tab. THREE tabs inside: [\t\t\t]"); + +ScDocShellRef xShell = loadDoc(u"tdf103829_textTab.", FORMAT_ODS); +ScDocument& rDoc = xShell->GetDocument(); +CPPUNIT_ASSERT_EQUAL_MESSAGE("load a1", sA1, rDoc.GetString(0, 0, 0)); +CPPUNIT_ASSERT_EQUAL_MESSAGE("load a1", sA1, rDoc.GetString(0, 0, 0)); +CPPUNIT_ASSERT_EQUAL_MESSAGE("load a2", sA2, rDoc.GetString(0, 1, 0)); + +xShell = saveAndReload(*xShell, FORMAT_ODS); +ScDocument& rDoc2 = xShell->GetDocument(); +//CPPUNIT_ASSERT_EQUAL_MESSAGE("reload a1", sA1.getLength(), rDoc2.GetString(0, 0, 0).getLength()); +//CPPUNIT_ASSERT_EQUAL_MESSAGE("reload a1", sA1, rDoc2.GetString(0, 0, 0)); +CPPUNIT_ASSERT_EQUAL_MESSAGE("reload a2", sA2, rDoc2.GetString(0, 1, 0)); +} + void ScExportTest2::testTdf122191() { // Set the system locale to Hungarian diff --git a/sc/source/filter/xml/celltextparacontext.cxx b/sc/source/filter/xml/celltextparacontext.cxx index 5bbe5f20dea2..ff36a99cae92 100644 --- a/sc/source/filter/xml/celltextparacontext.cxx +++ b/sc/source/filter/xml/celltextparacontext.cxx @@ -63,7 +63,11 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLCellTextParaContex return new ScXMLCellFieldURLContext(GetScImport(), *this); case XML_ELEMENT( TEXT, XML_RUBY ): return new ScXMLCellTextRubyContext(GetScImport(), *this); +case XML_ELEMENT(TEXT, XML_TAB): +maContent += "\t"; +break; default: +assert(false && "unknown cell text: element"); ; }
[Libreoffice-commits] core.git: sc/source
sc/source/filter/xml/celltextparacontext.cxx |5 + 1 file changed, 5 insertions(+) New commits: commit e66606a3334a575a183e57360c7a4696b73393c8 Author: Justin Luth AuthorDate: Sat Sep 17 21:08:22 2022 -0400 Commit: Caolán McNamara CommitDate: Sun Sep 18 16:07:30 2022 +0200 crashtesting: "unknown cell text: element" assert for text:bookmark since... commit 690a35680adad07c4ab79d82cd1531bb82fe4bc1 Date: Sat Sep 10 16:32:46 2022 -0400 tdf#103829 ods import: parse Change-Id: Ia157c3503b119f2fa8daf31870894344e0313204 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140112 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/source/filter/xml/celltextparacontext.cxx b/sc/source/filter/xml/celltextparacontext.cxx index c82a048bb717..88316798ee5f 100644 --- a/sc/source/filter/xml/celltextparacontext.cxx +++ b/sc/source/filter/xml/celltextparacontext.cxx @@ -69,7 +69,12 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLCellTextParaContex case XML_ELEMENT(TEXT, XML_LINE_BREAK): maContent += "\x0a"; break; +case XML_ELEMENT(TEXT, XML_BOOKMARK): +// TODO: ooo95423-1 [file.ods] and tdf#116079-3 have these bookmarks. +// Is this valid, and how can we prevent losing these? +break; default: +SAL_WARN("sc","unknown text element["<
[Libreoffice-commits] core.git: sc/source
sc/source/filter/xml/celltextparacontext.cxx |2 -- 1 file changed, 2 deletions(-) New commits: commit f24841da29adb8c0b4a8ec1b29367ee63998d440 Author: Justin Luth AuthorDate: Thu Sep 22 12:47:28 2022 -0400 Commit: Justin Luth CommitDate: Thu Sep 22 19:49:36 2022 +0200 crashtesting: "unknown cell text: element" assert on broken xml Three invalid files are hitting this assert. They had invalid XML, so I couldn't even xmllint --format --recover content.xml Removing the assert - it has outlived its usefulness. Change-Id: I93d6d6e1d5ce53f9dd1ee46ce3881183993827c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140447 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sc/source/filter/xml/celltextparacontext.cxx b/sc/source/filter/xml/celltextparacontext.cxx index 5274a36f0599..b8c204dbe2d4 100644 --- a/sc/source/filter/xml/celltextparacontext.cxx +++ b/sc/source/filter/xml/celltextparacontext.cxx @@ -77,8 +77,6 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLCellTextParaContex break; default: SAL_WARN("sc","unknown text element["<
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/subsequent_export_test2.cxx |3 +-- sc/source/filter/xml/xmlexprt.cxx |3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) New commits: commit eab9015d1e17950ee5a49f93a6ad40e7726f5050 Author: Justin Luth AuthorDate: Mon Sep 12 11:51:07 2022 -0400 Commit: Justin Luth CommitDate: Fri Sep 16 00:54:20 2022 +0200 tdf#103829 ods export: don't output invalid office:string-value If the formatted (i.e. \t) string was different from the raw string (i.e. \x001 EE_FEATURE_TAB marker), then export was outputing office:string-value with IsInvalidChar \x001. The impact on import is that the cell wants to display this string-value, which is missing all of the "invalid char" stuff. So, just don't export a wrong string at all. Change-Id: Ib98e58d0c6e1186d199a4dcf294b56403b710f48 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139816 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index 2d1ecb212ae6..b722137934fa 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -1449,13 +1449,12 @@ void ScExportTest2::testTdf103829() ScDocShellRef xShell = loadDoc(u"tdf103829_textTab.", FORMAT_ODS); ScDocument& rDoc = xShell->GetDocument(); CPPUNIT_ASSERT_EQUAL_MESSAGE("load a1", sA1, rDoc.GetString(0, 0, 0)); -CPPUNIT_ASSERT_EQUAL_MESSAGE("load a1", sA1, rDoc.GetString(0, 0, 0)); CPPUNIT_ASSERT_EQUAL_MESSAGE("load a2", sA2, rDoc.GetString(0, 1, 0)); xShell = saveAndReload(*xShell, FORMAT_ODS); ScDocument& rDoc2 = xShell->GetDocument(); //CPPUNIT_ASSERT_EQUAL_MESSAGE("reload a1", sA1.getLength(), rDoc2.GetString(0, 0, 0).getLength()); -//CPPUNIT_ASSERT_EQUAL_MESSAGE("reload a1", sA1, rDoc2.GetString(0, 0, 0)); +CPPUNIT_ASSERT_EQUAL_MESSAGE("reload a1", sA1, rDoc2.GetString(0, 0, 0)); CPPUNIT_ASSERT_EQUAL_MESSAGE("reload a2", sA2, rDoc2.GetString(0, 1, 0)); } diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index 3f88b3c88acb..579b04623aec 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -3170,8 +3170,9 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount) { OUString sFormattedString(lcl_GetFormattedString(pDoc, aCell.maBaseCell, aCell.maCellAddress)); OUString sCellString = aCell.maBaseCell.getString(pDoc); +bool bExportValue = sCellString.indexOf('\x001') == -1; GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes( -sCellString, sFormattedString); +sCellString, sFormattedString, bExportValue); if (getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED) GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes( sCellString, sFormattedString, false, XML_NAMESPACE_CALC_EXT);
[Libreoffice-commits] core.git: sc/source
sc/source/filter/xml/xmlexprt.cxx | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) New commits: commit a7589f621fcbe6305335730d2dd86b9230a18594 Author: Justin Luth AuthorDate: Sat Sep 10 21:04:48 2022 -0400 Commit: Justin Luth CommitDate: Thu Sep 15 01:47:29 2022 +0200 tdf#103829 ods export: output when CELLTYPE_EDIT regression since LO 4.2 Change-Id: Ic9b6c00af9f1cccdb58ac3eede59268d1c83c767 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139761 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index 77a45ab9b284..3f88b3c88acb 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -3114,7 +3114,19 @@ void flushParagraph( std::vector aPropStates; const SvxFieldData* pField = toXMLPropertyStates(rExport, aPropStates, rSec.maAttributes, xMapper, rAttrMap); OUString aStyleName = xStylePool->Find(XmlStyleFamily::TEXT_TEXT, OUString(), aPropStates); -writeContent(rExport, aStyleName, aContent, pField); +if (aContent == "\x001" && !pField) +{ +for (const SfxPoolItem* p : rSec.maAttributes) +{ +if (p->Which() == EE_FEATURE_TAB) +{ +SvXMLElementExport Tab(rExport, XML_NAMESPACE_TEXT, XML_TAB, false, false); +break; +} +} +} +else +writeContent(rExport, aStyleName, aContent, pField); } }
[Libreoffice-commits] core.git: sw/qa
sw/qa/extras/ooxmlexport/ooxmlexport10.cxx |3 +++ 1 file changed, 3 insertions(+) New commits: commit 77689ceb8171943bfea272ce3c875b061e76e23b Author: Justin Luth AuthorDate: Wed Sep 7 19:50:47 2022 -0400 Commit: Justin Luth CommitDate: Thu Sep 8 04:24:00 2022 +0200 tdf#149292 docx: pre-emptive unit test This document has floating tables. However, these tables should not get the page style property, so make sure that paragraph 1 contains RES_PAGEDESC. Change-Id: Ia7506907ce192a0ecbf2c57b4fc63b14882e93b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139619 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx index cf5877ea873d..6eca75bf9087 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx @@ -473,6 +473,9 @@ DECLARE_OOXMLEXPORT_TEST(testFloatingTablesAnchor, "floating-tables-anchor.docx" xRange = xTextContent->getAnchor(); xText = xRange->getText(); CPPUNIT_ASSERT_EQUAL(OUString("Anchor point"), xText->getString()); + +// tdf#149292 pre-emptive test - ensure "First Page" page style +CPPUNIT_ASSERT_EQUAL(OUString("First Page"), getProperty(getParagraph(1), "PageDescName")); } DECLARE_OOXMLEXPORT_TEST(testAnnotationFormatting, "annotation-formatting.docx")
[Libreoffice-commits] core.git: sw/source
sw/source/core/frmedt/fetab.cxx | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) New commits: commit bb47ffbc9d36e83695aa0d01767d3f83533c04e0 Author: Justin Luth AuthorDate: Thu Sep 22 10:33:43 2022 -0400 Commit: Justin Luth CommitDate: Fri Sep 23 16:05:08 2022 +0200 tdf#46733 sw: don't double-select column during deleteCol The problem here was that under IsNewModel tables were selecting the entire column (including merged cells) and then using THAT selection to ExpandColumnSelection. Well, that ends in disaster. Since NewModel already expands to catch the cells that are contained inside the selected cells, there is no need to expand the selection of GetTableCell. Change-Id: I43089d912cdd17b2599619a43e40fecc2f5dd3b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140455 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx index 6268a9794b04..66300afddc58 100644 --- a/sw/source/core/frmedt/fetab.cxx +++ b/sw/source/core/frmedt/fetab.cxx @@ -281,7 +281,15 @@ bool SwFEShell::DeleteCol() // search boxes via the layout bool bRet; SwSelBoxes aBoxes; -GetTableSel( *this, aBoxes, SwTableSearchType::Col ); +SwTableSearchType eSearchType = SwTableSearchType::Col; + +// NewModel tables already ExpandColumnSelection, so don't do it here also. +const SwContentNode* pContentNd = getShellCursor(false)->GetPointNode().GetContentNode(); +const SwTableNode* pTableNd = pContentNd ? pContentNd->FindTableNode() : nullptr; +if (pTableNd && pTableNd->GetTable().IsNewModel()) +eSearchType = SwTableSearchType::NONE; + +GetTableSel(*this, aBoxes, eSearchType); if ( !aBoxes.empty() ) { TableWait aWait( aBoxes.size(), pFrame, *GetDoc()->GetDocShell() );
[Libreoffice-commits] core.git: include/unotools sc/qa sc/source unotools/source
include/unotools/collatorwrapper.hxx |3 +++ sc/qa/unit/ucalc_condformat.cxx |3 ++- sc/source/core/data/conditio.cxx | 28 unotools/source/i18n/collatorwrapper.cxx | 17 + 4 files changed, 46 insertions(+), 5 deletions(-) New commits: commit 3bfed17b047422a8c4e98ab80001f3158afb227e Author: Justin Luth AuthorDate: Fri Sep 23 07:41:23 2022 -0400 Commit: Justin Luth CommitDate: Fri Sep 23 17:38:15 2022 +0200 tdf#123990 sc condformat: case insensitive begins/ends/contains This is how Excel handles these. At first I was afraid that this would upset LibreOffice users, but then I realized that equals already is case insensitive, so this change ought to be more consistent, and thus there should be fewer outcrys. Change-Id: Ia3de78d5888672ba8b774866d41ecd65293397c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140484 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/include/unotools/collatorwrapper.hxx b/include/unotools/collatorwrapper.hxx index 595d9ccf4f41..1552a7ce9b36 100644 --- a/include/unotools/collatorwrapper.hxx +++ b/include/unotools/collatorwrapper.hxx @@ -45,6 +45,9 @@ class UNOTOOLS_DLLPUBLIC CollatorWrapper compareString ( const OUString& s1, const OUString& s2) const; +sal_Int32 compareSubstring (const OUString& s1, sal_Int32 off1, sal_Int32 len1, +const OUString& s2, sal_Int32 off2, sal_Int32 len2) const; + css::uno::Sequence< OUString > listCollatorAlgorithms ( const css::lang::Locale& rLocale) const; diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx index 652ca8b059c6..35a8a02b0802 100644 --- a/sc/qa/unit/ucalc_condformat.cxx +++ b/sc/qa/unit/ucalc_condformat.cxx @@ -818,7 +818,8 @@ void TestCondformat::testCondFormatEndsWithStr() { m_pDoc->InsertTab(0, "Test"); -ScConditionEntry aEntry(ScConditionMode::EndsWith, "\"TestString\"", "", *m_pDoc, ScAddress(), +// case insnsitive matching +ScConditionEntry aEntry(ScConditionMode::EndsWith, "\"teststring\"", "", *m_pDoc, ScAddress(), "", "", formula::FormulaGrammar::GRAM_DEFAULT, formula::FormulaGrammar::GRAM_DEFAULT); svl::SharedStringPool& rStringPool = m_pDoc->GetSharedStringPool(); diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 46e51cf9f297..834c4a78f5e8 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -1175,14 +1175,34 @@ bool ScConditionEntry::IsValidStr( const OUString& rArg, const ScAddress& rPos ) bValid = !bValid; break; case ScConditionMode::BeginsWith: -bValid = rArg.startsWith(aUpVal1); -break; +{ +const sal_Int32 nLen = aUpVal1.getLength(); +if (!nLen || nLen > rArg.getLength()) +bValid = false; +else +{ +bValid = (ScGlobal::GetCollator().compareSubstring(rArg, 0, nLen, + aUpVal1, 0, nLen) == 0); +} +} + break; case ScConditionMode::EndsWith: -bValid = rArg.endsWith(aUpVal1); +{ +sal_Int32 nStart = rArg.getLength(); +const sal_Int32 nLen = aUpVal1.getLength(); +if (!nLen || nLen > nStart) +bValid = false; +else +{ +nStart = nStart - nLen; +bValid = (ScGlobal::GetCollator().compareSubstring(rArg, nStart, nLen, + aUpVal1, 0, nLen) == 0); +} +} break; case ScConditionMode::ContainsText: case ScConditionMode::NotContainsText: -bValid = rArg.indexOf(aUpVal1) != -1; +bValid = rArg.toAsciiLowerCase().indexOf(aUpVal1.toAsciiLowerCase()) != -1; if(eOp == ScConditionMode::NotContainsText) bValid = !bValid; break; diff --git a/unotools/source/i18n/collatorwrapper.cxx b/unotools/source/i18n/collatorwrapper.cxx index 4da1398e0636..ce85de11df7e 100644 --- a/unotools/source/i18n/collatorwrapper.cxx +++ b/unotools/source/i18n/collatorwrapper.cxx @@ -46,6 +46,23 @@ CollatorWrapper::compareString (const OUString& s1, const OUString& s2) const return 0; } +sal_Int32 +CollatorWrapper::compareSubstring (const OUString& s1, sal_Int32 off1, sal_Int32 len1, + const OUString& s2, sal_Int32 off2, sal_Int32 len2) const +{ +try +{ +if (mxInternationalCollator.is()) +r
[Libreoffice-commits] core.git: sw/inc sw/source sw/util
sw/inc/doc.hxx |1 + sw/source/core/doc/doc.cxx |8 ++-- sw/source/ui/vba/vbadocument.cxx |5 - sw/source/ui/vba/vbaeventshelper.cxx |2 +- sw/source/ui/vba/vbaglobals.cxx | 17 - sw/util/vbaswobj.component |2 +- 6 files changed, 21 insertions(+), 14 deletions(-) New commits: commit acc71c3e502f23daaf2489d102dda3b00a45960a Author: Justin Luth AuthorDate: Fri Sep 30 10:33:00 2022 -0400 Commit: Miklos Vajna CommitDate: Sat Oct 1 08:56:13 2022 +0200 tdf#148806 sw vba: fix GetVbaEventProcessor I've decided this is not an API change because there exists offapi/com/sun/star/script/vba/VBATextEventProcessor.idl This patch allows New, Open, and Close events to be sent to VBA macro event handlers. I tested with DOCUMENT_OPEN. Amazing - all this stuff is here in place, but isn't properly wired up. How can so much ground-work be done without it ever being functional? I don't think this has ever worked, and the same problem/code is seen in OpenOffice. The service names were already mismatched in the initial patch: commit fc135411fa926f4d89e98378d113f597af79e2a2 Author: Daniel Rentz on Tue Jul 6 19:34:53 2010 +0200 mib17: #i112634# add VBA sheet event handling, based on a patch from Noel Power https://bz.apache.org/ooo/show_bug.cgi?id=112634 says "Additionally I added the hooks for vba for word ( but they are compiled out for now )" Enabling this will open up the doors to a lot of untested code I think. I had to move initialization of mxVbaEvents because it was being set without a VBA project, but it didn't work to put it in VbaGlobals like Calc does. Change-Id: I08cc0e33444dc7dfaac82cf6cebb1a89dbb69faa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140801 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 4ee71e762d30..5e552cfcadc9 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -1628,6 +1628,7 @@ public: const css::uno::Reference< ooo::vba::word::XFind >& getVbaFind() const { return mxVbaFind; } void setVbaFind( const css::uno::Reference< ooo::vba::word::XFind > ) { mxVbaFind = xFind; } css::uno::Reference< css::script::vba::XVBAEventProcessor > const & GetVbaEventProcessor(); +void SetVbaEventProcessor(); void SetVBATemplateToProjectCache( css::uno::Reference< css::container::XNameContainer > const & xCache ) { m_xTemplateToProjectCache = xCache; }; const css::uno::Reference< css::container::XNameContainer >& GetVBATemplateToProjectCache() const { return m_xTemplateToProjectCache; }; ::sfx2::IXmlIdRegistry& GetXmlIdRegistry(); diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 3d2cbcae2796..62064507114b 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1795,9 +1795,14 @@ void SwDoc::ChkCondColls() uno::Reference< script::vba::XVBAEventProcessor > const & SwDoc::GetVbaEventProcessor() +{ +return mxVbaEvents; +} + +void SwDoc::SetVbaEventProcessor() { #if HAVE_FEATURE_SCRIPTING -if( !mxVbaEvents.is() && mpDocShell && ooo::vba::isAlienWordDoc( *mpDocShell ) ) +if (mpDocShell && ooo::vba::isAlienWordDoc(*mpDocShell)) { try { @@ -1810,7 +1815,6 @@ SwDoc::GetVbaEventProcessor() } } #endif -return mxVbaEvents; } void SwDoc::SetMissingDictionaries( bool bIsMissing ) diff --git a/sw/source/ui/vba/vbadocument.cxx b/sw/source/ui/vba/vbadocument.cxx index 79faf58fe4ab..969b893e5130 100644 --- a/sw/source/ui/vba/vbadocument.cxx +++ b/sw/source/ui/vba/vbadocument.cxx @@ -46,6 +46,7 @@ #include #include "wordvbahelper.hxx" +#include #include #include "vbatemplate.hxx" #include "vbaparagraph.hxx" @@ -99,7 +100,9 @@ SwVbaDocument::~SwVbaDocument() void SwVbaDocument::Initialize() { mxTextDocument.set( getModel(), uno::UNO_QUERY_THROW ); -word::getDocShell( mxModel )->RegisterAutomationDocumentObject( this ); +SwDocShell& rDocSh = *word::getDocShell(mxModel); +rDocSh.RegisterAutomationDocumentObject(this); +rDocSh.GetDoc()->SetVbaEventProcessor(); } sal_uInt32 diff --git a/sw/source/ui/vba/vbaeventshelper.cxx b/sw/source/ui/vba/vbaeventshelper.cxx index c1273b5038bf..6e9e510973af 100644 --- a/sw/source/ui/vba/vbaeventshelper.cxx +++ b/sw/source/ui/vba/vbaeventshelper.cxx @@ -92,7 +92,7 @@ sal_Bool SwVbaEventsHelper::supportsService( const OUString& ServiceName ) } css::uno::Sequence< OUString > SwVbaEventsHelper::getSupportedServiceNames() { -return { "com.sun.star.document.vba.VBATextEventProcessor" }; +return { &
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sc/qa sc/source
sc/qa/unit/ucalc_condformat.cxx |3 ++- sc/source/core/data/conditio.cxx | 23 --- 2 files changed, 22 insertions(+), 4 deletions(-) New commits: commit 080b2e56300865782ae65978ed9e510d667672a6 Author: Justin Luth AuthorDate: Fri Sep 23 07:41:23 2022 -0400 Commit: Eike Rathke CommitDate: Sat Oct 1 12:18:54 2022 +0200 tdf#123990 sc condformat: case insensitive begins/ends/contains squashed commit This is how Excel handles these. At first I was afraid that this would upset LibreOffice users, but then I realized that equals already is case insensitive, so this change ought to be more consistent, and thus there should be fewer outcrys. Change-Id: Ia3de78d5888672ba8b774866d41ecd65293397c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140484 Tested-by: Jenkins Reviewed-by: Justin Luth (cherry picked from commit 3bfed17b047422a8c4e98ab80001f3158afb227e) Change-Id: I44a07c482d2d67a76a939ba2d593a003398d52c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140633 Tested-by: Justin Luth Reviewed-by: Justin Luth Reviewed-by: Eike Rathke Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140685 Tested-by: Jenkins diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx index c783b8808c46..5f71f27c1726 100644 --- a/sc/qa/unit/ucalc_condformat.cxx +++ b/sc/qa/unit/ucalc_condformat.cxx @@ -817,7 +817,8 @@ void TestCondformat::testCondFormatEndsWithStr() { m_pDoc->InsertTab(0, "Test"); -ScConditionEntry aEntry(ScConditionMode::EndsWith, "\"TestString\"", "", *m_pDoc, ScAddress(), +// case insnsitive matching +ScConditionEntry aEntry(ScConditionMode::EndsWith, "\"teststring\"", "", *m_pDoc, ScAddress(), "", "", formula::FormulaGrammar::GRAM_DEFAULT, formula::FormulaGrammar::GRAM_DEFAULT); svl::SharedStringPool& rStringPool = m_pDoc->GetSharedStringPool(); diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index ab5bfce9814a..dae08455b0e9 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -1171,16 +1171,33 @@ bool ScConditionEntry::IsValidStr( const OUString& rArg, const ScAddress& rPos ) bValid = !bValid; break; case ScConditionMode::BeginsWith: -bValid = rArg.startsWith(aUpVal1); +bValid = ScGlobal::GetTransliteration().isMatch(aUpVal1, rArg); break; case ScConditionMode::EndsWith: -bValid = rArg.endsWith(aUpVal1); +{ +sal_Int32 nStart = rArg.getLength(); +const sal_Int32 nLen = aUpVal1.getLength(); +if (nLen > nStart) +bValid = false; +else +{ +nStart = nStart - nLen; +sal_Int32 nMatch1(0), nMatch2(0); +bValid = ScGlobal::GetTransliteration().equals(rArg, nStart, nLen, nMatch1, + aUpVal1, 0, nLen, nMatch2); +} +} break; case ScConditionMode::ContainsText: case ScConditionMode::NotContainsText: -bValid = rArg.indexOf(aUpVal1) != -1; +{ +const OUString aArgStr(ScGlobal::getCharClass().lowercase(rArg)); +const OUString aValStr(ScGlobal::getCharClass().lowercase(aUpVal1)); +bValid = aArgStr.indexOf(aValStr) != -1; + if(eOp == ScConditionMode::NotContainsText) bValid = !bValid; +} break; default: {
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sw/source
sw/source/core/frmedt/fetab.cxx | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) New commits: commit 6d1fda2be75adbbb4a47b16aa6ef68cea98f7ece Author: Justin Luth AuthorDate: Thu Sep 22 10:33:43 2022 -0400 Commit: Miklos Vajna CommitDate: Sat Oct 1 08:53:52 2022 +0200 tdf#46733 sw: don't double-select column during deleteCol The problem here was that under IsNewModel tables were selecting the entire column (including merged cells) and then using THAT selection to ExpandColumnSelection. Well, that ends in disaster. Since NewModel already expands to catch the cells that are contained inside the selected cells, there is no need to expand the selection of GetTableCell. Change-Id: I43089d912cdd17b2599619a43e40fecc2f5dd3b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140455 Tested-by: Jenkins Reviewed-by: Justin Luth (cherry picked from commit bb47ffbc9d36e83695aa0d01767d3f83533c04e0) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140609 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx index 678ebfc2fac7..a87e79affbc6 100644 --- a/sw/source/core/frmedt/fetab.cxx +++ b/sw/source/core/frmedt/fetab.cxx @@ -282,7 +282,15 @@ bool SwFEShell::DeleteCol() // search boxes via the layout bool bRet; SwSelBoxes aBoxes; -GetTableSel( *this, aBoxes, SwTableSearchType::Col ); +SwTableSearchType eSearchType = SwTableSearchType::Col; + +// NewModel tables already ExpandColumnSelection, so don't do it here also. +const SwContentNode* pContentNd = getShellCursor(false)->GetNode().GetContentNode(); +const SwTableNode* pTableNd = pContentNd ? pContentNd->FindTableNode() : nullptr; +if (pTableNd && pTableNd->GetTable().IsNewModel()) +eSearchType = SwTableSearchType::NONE; + +GetTableSel(*this, aBoxes, eSearchType); if ( !aBoxes.empty() ) { TableWait aWait( aBoxes.size(), pFrame, *GetDoc()->GetDocShell() );
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - filter/source
filter/source/msfilter/msvbahelper.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit c33fa7b932f26ef690fd238b3fed2b4a63c30bf7 Author: Justin Luth AuthorDate: Thu Sep 29 15:27:47 2022 -0400 Commit: Miklos Vajna CommitDate: Sat Oct 1 08:54:24 2022 +0200 tdf#148806 docm: fix vba macro events without ScriptCodes Prior to this, none of the DOCM ActiveX macros were called. Now, just like magic, it all works. Already broken at commit c5fc57de562850a7d2f708e3936296d24677012d Author: npower Developer on Tue Mar 2 15:04:15 2010 + npower14miscfixes: #i109706# move back msvbahelper to the filter module Change-Id: I25b25850b12609e5e00dd4bd5189a734abcbddd6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140750 Tested-by: Jenkins Reviewed-by: Justin Luth (cherry picked from commit c001aa7e9bc2b97ee6385dfd4e9f3010139297b2) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140754 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx index 872b7b863942..baedcc32b95c 100644 --- a/filter/source/msfilter/msvbahelper.cxx +++ b/filter/source/msfilter/msvbahelper.cxx @@ -246,7 +246,7 @@ static void parseMacro( const OUString& sMacro, OUString& sContainer, OUString& { sProcedure = sMacro.copy( nMacroDot + 1 ); -sal_Int32 nContainerDot = sMacro.lastIndexOf( '.', nMacroDot - 1 ); +const sal_Int32 nContainerDot = sMacro.lastIndexOf('.', nMacroDot); if ( nContainerDot != -1 ) { sModule = sMacro.copy( nContainerDot + 1, nMacroDot - nContainerDot - 1 );
[Libreoffice-commits] core.git: sc/source
sc/source/core/data/conditio.cxx | 19 --- 1 file changed, 8 insertions(+), 11 deletions(-) New commits: commit dd8775b051b40309d7d7e5730a3c5304d931f594 Author: Justin Luth AuthorDate: Tue Sep 27 07:41:16 2022 -0400 Commit: Eike Rathke CommitDate: Sat Oct 1 12:23:48 2022 +0200 related tdf#123990 sc condition: GetCollator -> GetTransliteration In the content of Equals/notEquals, Eike said, "This should not use collation (which should only be used in sorting context) but ignore case transliteration instead." "I'm undecided about replacing this (and the Between|NotBetween) collator with transliteration. Locale sensitive collators have a different comparison than transliteration and order characters differently." I also added a few code clean-ups. Change-Id: I94f73d99b36f8995c4e80fd2f317f1b5bca4f165 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140676 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Eike Rathke diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index d126357dc38a..461a606e3ae2 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -1134,8 +1134,13 @@ bool ScConditionEntry::IsValidStr( const OUString& rArg, const ScAddress& rPos ) } } +if (eOp == ScConditionMode::Error) +return IsError(rPos); +if (eOp == ScConditionMode::NoError) +return !IsError(rPos); + // If number contains condition, always false, except for "not equal". -if ( !bIsStr1 && (eOp != ScConditionMode::Error && eOp != ScConditionMode::NoError) ) +if (!bIsStr1) return ( eOp == ScConditionMode::NotEqual ); if ( eOp == ScConditionMode::Between || eOp == ScConditionMode::NotBetween ) if ( !bIsStr2 ) @@ -1154,12 +1159,10 @@ bool ScConditionEntry::IsValidStr( const OUString& rArg, const ScAddress& rPos ) switch ( eOp ) { case ScConditionMode::Equal: -bValid = (ScGlobal::GetCollator().compareString( -rArg, aUpVal1 ) == 0); +bValid = ScGlobal::GetTransliteration().isEqual(aUpVal1, rArg); break; case ScConditionMode::NotEqual: -bValid = (ScGlobal::GetCollator().compareString( -rArg, aUpVal1 ) != 0); +bValid = !ScGlobal::GetTransliteration().isEqual(aUpVal1, rArg); break; case ScConditionMode::TopPercent: case ScConditionMode::BottomPercent: @@ -1168,12 +1171,6 @@ bool ScConditionEntry::IsValidStr( const OUString& rArg, const ScAddress& rPos ) case ScConditionMode::AboveAverage: case ScConditionMode::BelowAverage: return false; -case ScConditionMode::Error: -case ScConditionMode::NoError: -bValid = IsError( rPos ); -if(eOp == ScConditionMode::NoError) -bValid = !bValid; -break; case ScConditionMode::BeginsWith: bValid = ScGlobal::GetTransliteration().isMatch(aUpVal1, rArg); break;
[Libreoffice-commits] core.git: sc/source
sc/source/core/data/conditio.cxx | 15 --- 1 file changed, 4 insertions(+), 11 deletions(-) New commits: commit cf805848ed5be4ba46eef9a8d3999d9b06848c60 Author: Justin Luth AuthorDate: Wed Sep 28 10:39:20 2022 -0400 Commit: Eike Rathke CommitDate: Sat Oct 1 18:05:22 2022 +0200 related tdf#123990 sc condition: cleanup ScConditionMode::Between Change-Id: I6bec0af1c7fe109b81b5392c06f795eed03df061 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140716 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Eike Rathke diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 461a606e3ae2..8da18a4a0471 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -1149,13 +1149,6 @@ bool ScConditionEntry::IsValidStr( const OUString& rArg, const ScAddress& rPos ) OUString aUpVal1( aStrVal1 ); //TODO: As a member? (Also set in Interpret) OUString aUpVal2( aStrVal2 ); -if ( eOp == ScConditionMode::Between || eOp == ScConditionMode::NotBetween ) -if (ScGlobal::GetCollator().compareString( aUpVal1, aUpVal2 ) > 0) -{ -// Right order for value range -OUString aTemp( aUpVal1 ); aUpVal1 = aUpVal2; aUpVal2 = aTemp; -} - switch ( eOp ) { case ScConditionMode::Equal: @@ -1220,14 +1213,14 @@ bool ScConditionEntry::IsValidStr( const OUString& rArg, const ScAddress& rPos ) break; case ScConditionMode::Between: case ScConditionMode::NotBetween: +{ +const sal_Int32 nCompare2 = ScGlobal::GetCollator().compareString(rArg, aUpVal2); // Test for NOTBETWEEN: -bValid = ( nCompare < 0 || -ScGlobal::GetCollator().compareString( rArg, -aUpVal2 ) > 0 ); +bValid = (nCompare > 0 && nCompare2 > 0) || (nCompare < 0 && nCompare2 < 0); if ( eOp == ScConditionMode::Between ) bValid = !bValid; break; -// ScConditionMode::Direct already handled above +} default: SAL_WARN("sc", "unknown operation in ScConditionEntry"); bValid = false;
[Libreoffice-commits] core.git: filter/source
filter/source/msfilter/msvbahelper.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 8253b8d6f1efb7fc3e2928d543c21a79c2cdc13f Author: Justin Luth AuthorDate: Thu Sep 29 15:27:47 2022 -0400 Commit: Justin Luth CommitDate: Fri Sep 30 00:10:41 2022 +0200 tdf#148806 docm: fix vba macro events without ScriptCodes Prior to this, none of the DOCM ActiveX macros were called. Now, just like magic, it all works. Already broken at commit c5fc57de562850a7d2f708e3936296d24677012d Author: npower Developer on Tue Mar 2 15:04:15 2010 + npower14miscfixes: #i109706# move back msvbahelper to the filter module Change-Id: I25b25850b12609e5e00dd4bd5189a734abcbddd6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140750 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx index f43b121ecb67..95144adb6094 100644 --- a/filter/source/msfilter/msvbahelper.cxx +++ b/filter/source/msfilter/msvbahelper.cxx @@ -243,7 +243,7 @@ static void parseMacro( const OUString& sMacro, OUString& sContainer, OUString& { sProcedure = sMacro.copy( nMacroDot + 1 ); -sal_Int32 nContainerDot = sMacro.lastIndexOf( '.', nMacroDot - 1 ); +const sal_Int32 nContainerDot = sMacro.lastIndexOf('.', nMacroDot); if ( nContainerDot != -1 ) { sModule = sMacro.copy( nContainerDot + 1, nMacroDot - nContainerDot - 1 );
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/ww8import/ww8import.cxx |2 +- sw/source/ui/uno/swdetect.cxx| 25 ++--- 2 files changed, 19 insertions(+), 8 deletions(-) New commits: commit a814eecea816a00b1e1d796381c8f33bb51bdfc5 Author: Justin Luth AuthorDate: Tue Sep 27 22:08:48 2022 -0400 Commit: Xisco Fauli CommitDate: Tue Oct 4 11:11:14 2022 +0200 tdf#125216 import filter: allow .doc renamed as .dot A LO 6.2.2 regression prevented .doc-as-.dot files to load, giving a "Read Error. This is not a valid WinWord6 file." Well, it is not a valid .dot file (because of some bit differences), but it is a valid .doc file. Since it was renamed to be treated as a template (requiring a save-as), we should treat it as that. Change-Id: I308375797e9dae3ca6d203fab520e91ee788325e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140687 Tested-by: Jenkins Reviewed-by: Justin Luth (cherry picked from commit 6cec8ba33a28de7248861b2eecfc5034cbde9d37) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140881 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ww8import/data/tdf120761_zOrder.doc b/sw/qa/extras/ww8import/data/tdf120761_zOrder.dot similarity index 100% rename from sw/qa/extras/ww8import/data/tdf120761_zOrder.doc rename to sw/qa/extras/ww8import/data/tdf120761_zOrder.dot diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx index ab35fa9d7346..47a31eb650b5 100644 --- a/sw/qa/extras/ww8import/ww8import.cxx +++ b/sw/qa/extras/ww8import/ww8import.cxx @@ -275,7 +275,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf110987) CPPUNIT_TEST_FIXTURE(Test, testTdf120761_zOrder) { -load(mpTestDocumentPath, "tdf120761_zOrder.doc"); +load(mpTestDocumentPath, "tdf120761_zOrder.dot"); //The blue shape was covering everything (highest zorder = 2) instead of the lowest(0) uno::Reference xShape(getShapeByName(u"Picture 2"), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_uInt32(0), getProperty(xShape, "ZOrder")); diff --git a/sw/source/ui/uno/swdetect.cxx b/sw/source/ui/uno/swdetect.cxx index 9e354dedaf6b..83b7162ae2a0 100644 --- a/sw/source/ui/uno/swdetect.cxx +++ b/sw/source/ui/uno/swdetect.cxx @@ -24,6 +24,7 @@ #include #include #include +#include #include using namespace ::com::sun::star; @@ -102,19 +103,29 @@ OUString SAL_CALL SwFilterDetect::detect( Sequence< PropertyValue >& lDescriptor // mis-detect it. if ( bIsDetected && aTypeName == "writer_MS_Word_97_Vorlage" ) { +// It is common practice to rename a .doc to .dot to make it a template. +// Since we have detected a.doc-ish format, always accept .dot-named-files +// as valid templates to avoid flagging this as an invalid .dot format.. +INetURLObject aParser(aMediaDesc.getUnpackedValueOrDefault( +utl::MediaDescriptor::PROP_URL, OUString())); + // Super ugly hack, but we don't want to use the whole WW8Fib thing here in // the swd library, apparently. We know (do we?) that the "aBits1" byte, as // the variable is called in WW8Fib::WW8Fib(SvStream&,sal_uInt8,sal_uInt32), // is at offset 10 in the WordDocument stream. The fDot bit is bit 0x01 of // that byte. -tools::SvRef xWordDocument = aStorage->OpenSotStream("WordDocument", StreamMode::STD_READ); -xWordDocument->Seek( 10 ); -if ( xWordDocument->Tell() == 10 ) +if (aParser.getExtension().toAsciiLowerCase() != "dot") { -sal_uInt8 aBits1; -xWordDocument->ReadUChar( aBits1 ); -// Check fDot bit -bIsDetected = ((aBits1 & 0x01) == 0x01); +tools::SvRef xWordDocument += aStorage->OpenSotStream("WordDocument", StreamMode::STD_READ); +xWordDocument->Seek(10); +if (xWordDocument->Tell() == 10) +{ +sal_uInt8 aBits1; +xWordDocument->ReadUChar(aBits1); +// Check fDot bit +bIsDetected = ((aBits1 & 0x01) == 0x01); +} } } }
[Libreoffice-commits] core.git: chart2/uiconfig dbaccess/uiconfig extensions/uiconfig reportdesign/uiconfig sc/uiconfig sd/uiconfig starmath/uiconfig sw/uiconfig
chart2/uiconfig/menubar/menubar.xml |3 +-- dbaccess/uiconfig/dbapp/menubar/menubar.xml |3 +-- dbaccess/uiconfig/dbquery/menubar/menubar.xml |3 +-- dbaccess/uiconfig/dbrelation/menubar/menubar.xml |3 +-- dbaccess/uiconfig/dbtable/menubar/menubar.xml |3 +-- dbaccess/uiconfig/dbtdata/menubar/menubar.xml |3 +-- extensions/uiconfig/sbibliography/menubar/menubar.xml |3 +-- reportdesign/uiconfig/dbreport/menubar/menubar.xml|3 +-- sc/uiconfig/scalc/menubar/menubar.xml |3 +-- sd/uiconfig/sdraw/menubar/menubar.xml |5 ++--- sd/uiconfig/simpress/menubar/menubar.xml |3 +-- starmath/uiconfig/smath/menubar/menubar.xml |3 +-- sw/uiconfig/sglobal/menubar/menubar.xml |3 +-- sw/uiconfig/sweb/menubar/menubar.xml |3 +-- sw/uiconfig/swform/menubar/menubar.xml|3 +-- sw/uiconfig/swreport/menubar/menubar.xml |3 +-- sw/uiconfig/swriter/menubar/menubar.xml |3 +-- sw/uiconfig/swxform/menubar/menubar.xml |3 +-- 18 files changed, 19 insertions(+), 37 deletions(-) New commits: commit 0ab5a5ee6e7cafa0c0d3e5ffee809e6b77af3796 Author: Justin Luth AuthorDate: Thu Sep 29 09:08:37 2022 -0400 Commit: Adolfo Jayme Barrientos CommitDate: Wed Oct 5 06:59:36 2022 +0200 tdf#126917 menu: OpenXMLFilterSettings != Macros OpenXMLFilterSettings has nothing to do with macros, but was moved there in LO 6.3. In 6.2 it was placed just before Extension Manager, so that is where I returned it. Change-Id: Id80b5984c785dc66e66aeb3215d8f1ef8c837442 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140739 Tested-by: Justin Luth Reviewed-by: Justin Luth Reviewed-by: Adolfo Jayme Barrientos diff --git a/chart2/uiconfig/menubar/menubar.xml b/chart2/uiconfig/menubar/menubar.xml index a48cd77d47de..58c84d6cbc33 100644 --- a/chart2/uiconfig/menubar/menubar.xml +++ b/chart2/uiconfig/menubar/menubar.xml @@ -140,10 +140,9 @@ - - + diff --git a/dbaccess/uiconfig/dbapp/menubar/menubar.xml b/dbaccess/uiconfig/dbapp/menubar/menubar.xml index 7038a63608a7..29e65762524c 100644 --- a/dbaccess/uiconfig/dbapp/menubar/menubar.xml +++ b/dbaccess/uiconfig/dbapp/menubar/menubar.xml @@ -127,10 +127,9 @@ - - + diff --git a/dbaccess/uiconfig/dbquery/menubar/menubar.xml b/dbaccess/uiconfig/dbquery/menubar/menubar.xml index 8227446b4b89..762a5533de74 100644 --- a/dbaccess/uiconfig/dbquery/menubar/menubar.xml +++ b/dbaccess/uiconfig/dbquery/menubar/menubar.xml @@ -82,10 +82,9 @@ - - + diff --git a/dbaccess/uiconfig/dbrelation/menubar/menubar.xml b/dbaccess/uiconfig/dbrelation/menubar/menubar.xml index 6e3df781eca9..0c2a73ec31d5 100644 --- a/dbaccess/uiconfig/dbrelation/menubar/menubar.xml +++ b/dbaccess/uiconfig/dbrelation/menubar/menubar.xml @@ -66,10 +66,9 @@ - - + diff --git a/dbaccess/uiconfig/dbtable/menubar/menubar.xml b/dbaccess/uiconfig/dbtable/menubar/menubar.xml index bbd4a7428f74..80511e8ea4d6 100644 --- a/dbaccess/uiconfig/dbtable/menubar/menubar.xml +++ b/dbaccess/uiconfig/dbtable/menubar/menubar.xml @@ -66,10 +66,9 @@ - - + diff --git a/dbaccess/uiconfig/dbtdata/menubar/menubar.xml b/dbaccess/uiconfig/dbtdata/menubar/menubar.xml index bbf379953e85..e787d60d7355 100644 --- a/dbaccess/uiconfig/dbtdata/menubar/menubar.xml +++ b/dbaccess/uiconfig/dbtdata/menubar/menubar.xml @@ -91,10 +91,9 @@ - - + diff --git a/extensions/uiconfig/sbibliography/menubar/menubar.xml b/extensions/uiconfig/sbibliography/menubar/menubar.xml index 3604c1b760a1..9b449072ac32 100644 --- a/extensions/uiconfig/sbibliography/menubar/menubar.xml +++ b/extensions/uiconfig/sbibliography/menubar/menubar.xml @@ -39,10 +39,9 @@ - - + diff --git a/reportdesign/uiconfig/dbreport/menubar/menubar.xml b/reportdesign/uiconfig/dbreport/menubar/menubar.xml index 2ca14f363a5d..e95054ed7889 100644 --- a/reportdesign/uiconfig/dbreport/menubar/menubar.xml +++ b/reportdesign/uiconfig/dbreport/menubar/menubar.xml @@ -256,10 +256,9
[Libreoffice-commits] core.git: filter/source
filter/source/msfilter/msvbahelper.cxx | 17 +++-- 1 file changed, 15 insertions(+), 2 deletions(-) New commits: commit 1e0306be6c3a3bc50f11e7c7814aa8a029f8928d Author: Justin Luth AuthorDate: Tue Oct 11 21:42:21 2022 -0400 Commit: Justin Luth CommitDate: Wed Oct 12 15:24:28 2022 +0200 tdf#148806 vba: IsCompiled is required for SbxFlagBits::Private Two step approach: -putting this here where I need it - fairly targeted. -put it in FindMethod before returning, so that everything gets it in a valid state. Of course the second will probably cause consternations, but then when it gets reverted at least this will still work. Change-Id: I8772f85c9b9ae6ed9a25ba7966b50519afe0d6ef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141243 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx index c7e84138f8dd..923aecb9c3dd 100644 --- a/filter/source/msfilter/msvbahelper.cxx +++ b/filter/source/msfilter/msvbahelper.cxx @@ -205,6 +205,11 @@ static bool hasMacro(SfxObjectShell const* pShell, const OUString& sLibrary, OUS if (!pModule) return false; SbMethod* pMeth = pModule->FindMethod(sMacro, SbxClassType::Method); + +// Must be compiled before we can trust SbxFlagBits::Private +if (pMeth && bOnlyPublic && !pModule->IsCompiled()) +pModule->Compile(); + return pMeth && (!bOnlyPublic || !pMeth->IsSet(SbxFlagBits::Private)); } @@ -213,9 +218,17 @@ static bool hasMacro(SfxObjectShell const* pShell, const OUString& sLibrary, OUS SbMethod* pMeth = rModuleRef->FindMethod(sMacro, SbxClassType::Method); if (pMeth) { -if ((bOnlyPublic && pMeth->IsSet(SbxFlagBits::Private)) -|| rModuleRef->GetName() == sSkipModule) +if (rModuleRef->GetName() == sSkipModule) continue; + +if (bOnlyPublic) +{ +if (!rModuleRef->IsCompiled()) +rModuleRef->Compile(); + +if (pMeth->IsSet(SbxFlagBits::Private)) +continue; +} sMod = rModuleRef->GetName(); return true; }
[Libreoffice-commits] core.git: sw/Library_vbaswobj.mk sw/source
sw/Library_vbaswobj.mk |1 sw/source/ui/vba/vbaapplication.cxx | 307 sw/source/ui/vba/vbawordbasic.cxx | 245 sw/source/ui/vba/vbawordbasic.hxx | 81 + 4 files changed, 328 insertions(+), 306 deletions(-) New commits: commit 8ac97a8cb4f5657b7601f30fc9ca6b0cecc1e429 Author: Justin Luth AuthorDate: Mon Oct 10 18:46:24 2022 -0400 Commit: Miklos Vajna CommitDate: Thu Oct 13 09:02:24 2022 +0200 sw vba: move SwWordBasic to its own file We had implemented Application.WordBasic.*, but it can also run as a global WordBasic.*. This patch just separates it from vbaapplication. It was just a copy/paste, and then I ran opt/lo/bin/clang-format -i on the new files and did some minor cleanup. I just guessed at the includes I needed, and then commented the remaining ones out one by one to verifiy they were needed to compile. Not very scientific, but I don't know any other way. (running \bin\find-unneedded-includes afterwards didn't show anything - perhaps that would have helped.) A followup patch will add the VBAGlobal connection. Change-Id: Id29ee582a5ed6186150bb41a1ab98d6c466676e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141199 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna diff --git a/sw/Library_vbaswobj.mk b/sw/Library_vbaswobj.mk index 434e1af4a506..6e9f3539c816 100644 --- a/sw/Library_vbaswobj.mk +++ b/sw/Library_vbaswobj.mk @@ -130,6 +130,7 @@ $(eval $(call gb_Library_add_exception_objects,vbaswobj,\ sw/source/ui/vba/vbatableofcontents \ sw/source/ui/vba/vbatablesofcontents \ sw/source/ui/vba/vbavariable \ +sw/source/ui/vba/vbawordbasic \ sw/source/ui/vba/vbadocuments \ sw/source/ui/vba/vbaparagraphformat \ sw/source/ui/vba/vbaborders \ diff --git a/sw/source/ui/vba/vbaapplication.cxx b/sw/source/ui/vba/vbaapplication.cxx index 1a25116448ea..448ad8626445 100644 --- a/sw/source/ui/vba/vbaapplication.cxx +++ b/sw/source/ui/vba/vbaapplication.cxx @@ -37,6 +37,7 @@ #include "vbaaddins.hxx" #include "vbamailmerge.hxx" #include "vbadialogs.hxx" +#include "vbawordbasic.hxx" #include #include #include @@ -69,69 +70,6 @@ public: void SAL_CALL Unadvise( sal_uInt32 Cookie ) override; }; -class SwWordBasic : public cppu::WeakImplHelper -{ -private: -SwVbaApplication* mpApp; - -public: -SwWordBasic( SwVbaApplication* pApp ); - -// XWordBasic -virtual sal_Int32 SAL_CALL getMailMergeMainDocumentType() override; -virtual void SAL_CALL setMailMergeMainDocumentType( sal_Int32 _mailmergemaindocumenttype ) override; - -virtual void SAL_CALL FileOpen( const OUString& Name, const uno::Any& ConfirmConversions, const uno::Any& ReadOnly, const uno::Any& AddToMru, const uno::Any& PasswordDoc, const uno::Any& PasswordDot, const uno::Any& Revert, const uno::Any& WritePasswordDoc, const uno::Any& WritePasswordDot ) override; -virtual void SAL_CALL FileSave() override; -virtual void SAL_CALL FileSaveAs( const css::uno::Any& Name, - const css::uno::Any& Format, - const css::uno::Any& LockAnnot, - const css::uno::Any& Password, - const css::uno::Any& AddToMru, - const css::uno::Any& WritePassword, - const css::uno::Any& RecommendReadOnly, - const css::uno::Any& EmbedFonts, - const css::uno::Any& NativePictureFormat, - const css::uno::Any& FormsData, - const css::uno::Any& SaveAsAOCELetter ) override; -virtual void SAL_CALL FileClose( const css::uno::Any& Save ) override; -virtual void SAL_CALL ToolsOptionsView( const css::uno::Any& DraftFont, -const css::uno::Any& WrapToWindow, -const css::uno::Any& PicturePlaceHolders, -const css::uno::Any& FieldCodes, -const css::uno::Any& BookMarks, -const css::uno::Any& FieldShading, -const css::uno::Any& StatusBar, -const css::uno::Any& HScroll, -const css::uno::Any& VScroll, -const css::uno::Any& StyleAreaWidth, -
[Libreoffice-commits] core.git: oovbaapi/ooo sw/source
oovbaapi/ooo/vba/word/XGlobals.idl |1 + sw/source/ui/vba/vbaglobals.cxx|9 + sw/source/ui/vba/vbaglobals.hxx|1 + 3 files changed, 11 insertions(+) New commits: commit 3aebb45d18116926dc8edb268c205c6f4ff06f05 Author: Justin Luth AuthorDate: Mon Oct 10 20:40:30 2022 -0400 Commit: Miklos Vajna CommitDate: Thu Oct 13 09:03:27 2022 +0200 sw vba: tie WordBasic to VBAGlobals This allows WordBasic to also be run directly, instead of only working with Application.WordBasic.*. Change-Id: I60c3beaa1fce9a8bf25786cc0b2ed6ef6deda2f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141200 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna diff --git a/oovbaapi/ooo/vba/word/XGlobals.idl b/oovbaapi/ooo/vba/word/XGlobals.idl index 8d2ee3900fcc..0e16bcb08d4e 100644 --- a/oovbaapi/ooo/vba/word/XGlobals.idl +++ b/oovbaapi/ooo/vba/word/XGlobals.idl @@ -31,6 +31,7 @@ interface XGlobals : com::sun::star::uno::XInterface [attribute, readonly] ooo::vba::word::XSystem System; [attribute, readonly] ooo::vba::word::XOptions Options; [attribute, readonly] ooo::vba::word::XSelection Selection; +[attribute, readonly] ooo::vba::word::XWordBasic WordBasic; any CommandBars( [in] any Index ); any Documents( [in] any Index ); any Addins( [in] any Index ); diff --git a/sw/source/ui/vba/vbaglobals.cxx b/sw/source/ui/vba/vbaglobals.cxx index f1c948c6cb5f..a319a4aea13d 100644 --- a/sw/source/ui/vba/vbaglobals.cxx +++ b/sw/source/ui/vba/vbaglobals.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #include "vbaglobals.hxx" +#include "vbawordbasic.hxx" #include #include @@ -126,6 +127,14 @@ SwVbaGlobals::getSelection() return getApplication()->getSelection(); } +uno::Reference SAL_CALL SwVbaGlobals::getWordBasic() +{ +assert(dynamic_cast(getApplication().get())); +SwVbaApplication* pVbaApp = static_cast(getApplication().get()); +uno::Reference xWB(new SwWordBasic(pVbaApp)); +return xWB; +} + float SAL_CALL SwVbaGlobals::CentimetersToPoints( float Centimeters ) { return getApplication()->CentimetersToPoints( Centimeters ); diff --git a/sw/source/ui/vba/vbaglobals.hxx b/sw/source/ui/vba/vbaglobals.hxx index af26f1b6256d..72f4ca07829c 100644 --- a/sw/source/ui/vba/vbaglobals.hxx +++ b/sw/source/ui/vba/vbaglobals.hxx @@ -50,6 +50,7 @@ public: virtual css::uno::Reference SAL_CALL getActiveWindow() override; virtual css::uno::Reference SAL_CALL getOptions() override; virtual css::uno::Reference SAL_CALL getSelection() override; +virtual css::uno::Reference SAL_CALL getWordBasic() override; virtual css::uno::Any SAL_CALL CommandBars(const css::uno::Any& aIndex) override; virtual css::uno::Any SAL_CALL Documents(const css::uno::Any& aIndex) override; virtual css::uno::Any SAL_CALL Addins(const css::uno::Any& aIndex) override;
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/qa sc/source
sc/qa/unit/ucalc_condformat.cxx |3 ++- sc/source/core/data/conditio.cxx | 23 --- 2 files changed, 22 insertions(+), 4 deletions(-) New commits: commit 62d4d51f9244ac45802ca7a1735bca552503a349 Author: Justin Luth AuthorDate: Fri Sep 23 07:41:23 2022 -0400 Commit: Miklos Vajna CommitDate: Thu Oct 13 08:58:21 2022 +0200 tdf#123990 sc condformat: case insensitive begins/ends/contains squashed commit This is how Excel handles these. At first I was afraid that this would upset LibreOffice users, but then I realized that equals already is case insensitive, so this change ought to be more consistent, and thus there should be fewer outcrys. Change-Id: Ia3de78d5888672ba8b774866d41ecd65293397c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140484 Tested-by: Jenkins Reviewed-by: Justin Luth (cherry picked from commit 3bfed17b047422a8c4e98ab80001f3158afb227e) Change-Id: I44a07c482d2d67a76a939ba2d593a003398d52c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140633 Tested-by: Justin Luth Reviewed-by: Justin Luth Reviewed-by: Eike Rathke Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140685 Tested-by: Jenkins Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140914 Tested-by: Miklos Vajna Reviewed-by: Miklos Vajna diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx index 6ba9079c0d79..1c3e810fb838 100644 --- a/sc/qa/unit/ucalc_condformat.cxx +++ b/sc/qa/unit/ucalc_condformat.cxx @@ -822,7 +822,8 @@ void TestCondformat::testCondFormatEndsWithStr() { m_pDoc->InsertTab(0, "Test"); -ScConditionEntry aEntry(ScConditionMode::EndsWith, "\"TestString\"", "", *m_pDoc, ScAddress(), +// case insnsitive matching +ScConditionEntry aEntry(ScConditionMode::EndsWith, "\"teststring\"", "", *m_pDoc, ScAddress(), "", "", formula::FormulaGrammar::GRAM_DEFAULT, formula::FormulaGrammar::GRAM_DEFAULT); svl::SharedStringPool& rStringPool = m_pDoc->GetSharedStringPool(); diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index bf78d7987b12..3634a5b07c0a 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -1177,16 +1177,33 @@ bool ScConditionEntry::IsValidStr( const OUString& rArg, const ScAddress& rPos ) bValid = !bValid; break; case ScConditionMode::BeginsWith: -bValid = rArg.startsWith(aUpVal1); +bValid = ScGlobal::GetTransliteration().isMatch(aUpVal1, rArg); break; case ScConditionMode::EndsWith: -bValid = rArg.endsWith(aUpVal1); +{ +sal_Int32 nStart = rArg.getLength(); +const sal_Int32 nLen = aUpVal1.getLength(); +if (nLen > nStart) +bValid = false; +else +{ +nStart = nStart - nLen; +sal_Int32 nMatch1(0), nMatch2(0); +bValid = ScGlobal::GetTransliteration().equals(rArg, nStart, nLen, nMatch1, + aUpVal1, 0, nLen, nMatch2); +} +} break; case ScConditionMode::ContainsText: case ScConditionMode::NotContainsText: -bValid = rArg.indexOf(aUpVal1) != -1; +{ +const OUString aArgStr(ScGlobal::getCharClass().lowercase(rArg)); +const OUString aValStr(ScGlobal::getCharClass().lowercase(aUpVal1)); +bValid = aArgStr.indexOf(aValStr) != -1; + if(eOp == ScConditionMode::NotContainsText) bValid = !bValid; +} break; default: {
[Libreoffice-commits] core.git: include/vbahelper sc/source vbahelper/source
include/vbahelper/vbaeventshelperbase.hxx |2 ++ sc/source/ui/vba/vbaeventshelper.cxx |5 +++-- vbahelper/source/vbahelper/vbaeventshelperbase.cxx | 17 + 3 files changed, 22 insertions(+), 2 deletions(-) New commits: commit 6834fda784f3066a89838cd6cda4fe945f4c7904 Author: Justin Luth AuthorDate: Thu Oct 6 20:00:07 2022 -0400 Commit: Justin Luth CommitDate: Fri Oct 7 23:48:36 2022 +0200 related tdf#148806 xls/x vba: no auto_open if Auto_Open module The presence of an Auto_Close module prevents any auto_close subroutines from running. Interestingly, Word is different. It doesn't care at all if such a module is present. (In fact, it uses that module's main() as an AutoClose if there is no Sub AutoClose.) Change-Id: I83a80b7f016dcf2ad3b7fd931acacb6f788241a1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141036 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/include/vbahelper/vbaeventshelperbase.hxx b/include/vbahelper/vbaeventshelperbase.hxx index 0126db442ee8..e7038da7ab75 100644 --- a/include/vbahelper/vbaeventshelperbase.hxx +++ b/include/vbahelper/vbaeventshelperbase.hxx @@ -78,6 +78,8 @@ public: // little helpers - +bool hasModule(const OUString& rModuleName); + /** Helper to execute event handlers without throwing any exceptions. */ void processVbaEventNoThrow( sal_Int32 nEventId, const css::uno::Sequence< css::uno::Any >& rArgs ); diff --git a/sc/source/ui/vba/vbaeventshelper.cxx b/sc/source/ui/vba/vbaeventshelper.cxx index bd00fdcac3bd..d412af36b466 100644 --- a/sc/source/ui/vba/vbaeventshelper.cxx +++ b/sc/source/ui/vba/vbaeventshelper.cxx @@ -659,7 +659,8 @@ bool ScVbaEventsHelper::implPrepareEvent( EventQueue& rEventQueue, rEventQueue.emplace_back(WORKBOOK_ACTIVATE ); uno::Sequence< uno::Any > aArgs{ uno::Any(mxModel->getCurrentController()) }; rEventQueue.emplace_back( WORKBOOK_WINDOWACTIVATE, aArgs ); -rEventQueue.emplace_back(AUTO_OPEN ); +if (!hasModule("Auto_Open")) +rEventQueue.emplace_back(AUTO_OPEN ); // remember initial selection maOldSelection <<= mxModel->getCurrentSelection(); } @@ -779,7 +780,7 @@ void ScVbaEventsHelper::implPostProcessEvent( EventQueue& rEventQueue, case WORKBOOK_BEFORECLOSE: /* Execute Auto_Close only if not cancelled by event handler, but before UI asks user whether to cancel closing the document. */ -if( !bCancel ) +if (!bCancel && !hasModule("Auto_Close")) rEventQueue.emplace_back(AUTO_CLOSE ); break; } diff --git a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx index 1f92e449a156..dbd345c9bac7 100644 --- a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx +++ b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx @@ -320,6 +320,23 @@ void VbaEventsHelperBase::ensureVBALibrary() } } +bool VbaEventsHelperBase::hasModule(const OUString& rModuleName) +{ +if (rModuleName.isEmpty()) +return false; + +bool bRet = false; +try +{ +ensureVBALibrary(); +bRet = mxModuleInfos->hasModuleInfo(rModuleName); +} +catch (uno::Exception&) +{} + +return bRet; +} + sal_Int32 VbaEventsHelperBase::getModuleType( const OUString& rModuleName ) { // make sure the VBA library exists
[Libreoffice-commits] core.git: sw/source
sw/source/ui/vba/vbaeventshelper.cxx | 12 ++-- sw/source/uibase/app/docsh2.cxx |6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) New commits: commit 21c0b368a3e7150fc5d18af5d568d5683a7a6a3a Author: Justin Luth AuthorDate: Fri Oct 7 11:20:20 2022 -0400 Commit: Justin Luth CommitDate: Sat Oct 8 12:07:35 2022 +0200 tdf#148806 doc vba: AutoOpen runs before Document_Open The same is true for AutoClose and AutoNew. I tested in Word 2003, and DOCX with Word 2010. Change-Id: I7243573be0fee529494f1ab6031d89ec57805695 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141093 Tested-by: Justin Luth Reviewed-by: Justin Luth diff --git a/sw/source/ui/vba/vbaeventshelper.cxx b/sw/source/ui/vba/vbaeventshelper.cxx index 6e9e510973af..ccdb10548ca2 100644 --- a/sw/source/ui/vba/vbaeventshelper.cxx +++ b/sw/source/ui/vba/vbaeventshelper.cxx @@ -48,14 +48,14 @@ bool SwVbaEventsHelper::implPrepareEvent( EventQueue& rEventQueue, { switch( rInfo.mnEventId ) { -case DOCUMENT_NEW: -rEventQueue.emplace_back(AUTO_NEW ); +case AUTO_NEW: +rEventQueue.emplace_back(DOCUMENT_NEW); break; -case DOCUMENT_OPEN: -rEventQueue.emplace_back(AUTO_OPEN ); +case AUTO_OPEN: +rEventQueue.emplace_back(DOCUMENT_OPEN); break; -case DOCUMENT_CLOSE: -rEventQueue.emplace_back(AUTO_CLOSE ); +case AUTO_CLOSE: +rEventQueue.emplace_back(DOCUMENT_CLOSE); break; } return true; diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index 8813828b5969..d9e1486e0e3a 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -221,10 +221,10 @@ static void lcl_processCompatibleSfxHint( const uno::Reference< script::vba::XVB switch( pSfxEventHint->GetEventId() ) { case SfxEventHintId::CreateDoc: -xVbaEvents->processVbaEvent( DOCUMENT_NEW, aArgs ); +xVbaEvents->processVbaEvent(AUTO_NEW, aArgs); break; case SfxEventHintId::OpenDoc: -xVbaEvents->processVbaEvent( DOCUMENT_OPEN, aArgs ); +xVbaEvents->processVbaEvent(AUTO_OPEN, aArgs); break; default: break; } @@ -385,7 +385,7 @@ bool SwDocShell::PrepareClose( bool bUI ) { using namespace com::sun::star::script::vba::VBAEventId; uno::Sequence< uno::Any > aNoArgs; -xVbaEvents->processVbaEvent( DOCUMENT_CLOSE, aNoArgs ); +xVbaEvents->processVbaEvent(AUTO_CLOSE, aNoArgs); } } return bRet;
[Libreoffice-commits] core.git: offapi/com sw/source vbahelper/source
offapi/com/sun/star/script/vba/VBAEventId.idl |5 -- sw/source/ui/vba/vbaeventshelper.cxx | 23 - sw/source/uibase/app/docsh2.cxx|6 +- vbahelper/source/vbahelper/vbaeventshelperbase.cxx | 50 + 4 files changed, 37 insertions(+), 47 deletions(-) New commits: commit 73911ed8d35294a9e15771d8aaa1e9121ef10309 Author: Justin Luth AuthorDate: Tue Oct 11 12:14:34 2022 -0400 Commit: Justin Luth CommitDate: Wed Oct 12 01:12:17 2022 +0200 tdf#148806 doc vba: highest priority is ThisDocument AutoOpen V2 A review by Stephan Bergmann made me re-think adding a separate event for this. It really is only one event and not two (or three as I initially imagined). In the end, I like this better because it highlights the difference between Excel and Word by keeping all the differentiating logic in one place. The inability to properly document the purpose of these new events was the impetus to redesign this. Thanks Stephan for the prompt. Change-Id: Ic2d461c13c4a52e279224cb485d2b6c4a3c57b54 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141233 Tested-by: Justin Luth Reviewed-by: Justin Luth diff --git a/offapi/com/sun/star/script/vba/VBAEventId.idl b/offapi/com/sun/star/script/vba/VBAEventId.idl index 00a524a1ef3b..00989fccd053 100644 --- a/offapi/com/sun/star/script/vba/VBAEventId.idl +++ b/offapi/com/sun/star/script/vba/VBAEventId.idl @@ -58,11 +58,6 @@ constants VBAEventId const long DOCUMENT_OPEN= 1002; /** Document about to be closed. No arguments. */ const long DOCUMENT_CLOSE = 1003; -// auto* subroutines in ThisDocument have highest priority -const long DOCUMENT_AUTO_NEW = 1004; -const long DOCUMENT_AUTO_OPEN = 1005; -const long DOCUMENT_AUTO_CLOSE = 1006; - // MS Excel (identifiers from 2001 to 2999) diff --git a/sw/source/ui/vba/vbaeventshelper.cxx b/sw/source/ui/vba/vbaeventshelper.cxx index d083940106b5..d928eaba16f2 100644 --- a/sw/source/ui/vba/vbaeventshelper.cxx +++ b/sw/source/ui/vba/vbaeventshelper.cxx @@ -32,13 +32,10 @@ SwVbaEventsHelper::SwVbaEventsHelper( uno::Sequence< css::uno::Any > const& aArg { using namespace ::com::sun::star::script::ModuleType; registerEventHandler( DOCUMENT_NEW, DOCUMENT, "Document_New" ); -registerEventHandler(DOCUMENT_AUTO_NEW, DOCUMENT, "AutoNew"); registerEventHandler( AUTO_NEW, NORMAL, "AutoNew" ); registerEventHandler( DOCUMENT_OPEN,DOCUMENT, "Document_Open" ); -registerEventHandler(DOCUMENT_AUTO_OPEN, DOCUMENT, "AutoOpen"); registerEventHandler( AUTO_OPEN,NORMAL, "AutoOpen" ); registerEventHandler( DOCUMENT_CLOSE, DOCUMENT, "Document_Close" ); -registerEventHandler(DOCUMENT_AUTO_CLOSE, DOCUMENT, "AutoClose"); registerEventHandler( AUTO_CLOSE, NORMAL, "AutoClose" ); } @@ -46,25 +43,9 @@ SwVbaEventsHelper::~SwVbaEventsHelper() { } -bool SwVbaEventsHelper::implPrepareEvent( EventQueue& rEventQueue, -const EventHandlerInfo& rInfo, const uno::Sequence< uno::Any >& rArgs) +bool SwVbaEventsHelper::implPrepareEvent(EventQueue& /*rEventQueue*/, +const EventHandlerInfo& /*rInfo*/, const uno::Sequence& /*rArgs*/) { -switch( rInfo.mnEventId ) -{ -case DOCUMENT_AUTO_NEW: -// Only one "AutoNew" subroutine can run. ThisDocument is highest priority. -if (!hasVbaEventHandler(rInfo.mnEventId, rArgs)) -rEventQueue.emplace_back(AUTO_NEW); -break; -case DOCUMENT_AUTO_OPEN: -if (!hasVbaEventHandler(rInfo.mnEventId, rArgs)) -rEventQueue.emplace_back(AUTO_OPEN); -break; -case DOCUMENT_AUTO_CLOSE: -if (!hasVbaEventHandler(rInfo.mnEventId, rArgs)) -rEventQueue.emplace_back(AUTO_CLOSE); -break; -} return true; } diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index 51082a682c2d..a5e79881e342 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -221,11 +221,11 @@ static void lcl_processCompatibleSfxHint( const uno::Reference< script::vba::XVB switch( pSfxEventHint->GetEventId() ) { case SfxEventHintId::CreateDoc: -xVbaEvents->processVbaEvent(DOCUMENT_AUTO_NEW, aArgs); +xVbaEvents->processVbaEvent(AUTO_NEW, aArgs); xVbaEvents->processVbaEvent(DOCUMENT_NEW, aArgs); break; case SfxEventHintId::OpenDoc: -xVbaEvents->processVbaEvent(DOCUMENT_AUTO_OPEN, aArgs); +xVbaEvents->processVbaEvent(AUTO_OPEN, aArgs); xVbaEvents->processVbaEvent(DOCUM
[Libreoffice-commits] core.git: filter/source include/filter vbahelper/source
filter/source/msfilter/msvbahelper.cxx | 16 +++- include/filter/msfilter/msvbahelper.hxx|4 +++- vbahelper/source/vbahelper/vbaeventshelperbase.cxx | 15 +-- 3 files changed, 27 insertions(+), 8 deletions(-) New commits: commit eaa38b0f9d672793af500222348a6cacd28910b0 Author: Justin Luth AuthorDate: Sat Oct 8 09:07:53 2022 -0400 Commit: Justin Luth CommitDate: Tue Oct 11 03:08:13 2022 +0200 tdf#148806 doc vba: only autoOpen PUBLIC macros Note: this should NOT apply to Document_Open which normally is a private subroutine and runs fine as private. I tested and it DOES apply to all three version of AutoOpen: -ThisDocument.AutoOpen, -.AutoOpen, -AutoOpen.Main Note: this is different from Excel. Private Auto_Open runs just fine there. Change-Id: If10c8c90c35275c2b14dc2e15fb357674fc580b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141114 Tested-by: Justin Luth Reviewed-by: Justin Luth diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx index 674530d1cbb1..a4e954531155 100644 --- a/filter/source/msfilter/msvbahelper.cxx +++ b/filter/source/msfilter/msvbahelper.cxx @@ -171,13 +171,15 @@ static SfxObjectShell* findShellForUrl( const OUString& sMacroURLOrPath ) // sMod can be empty ( but we really need the library to search in ) // if sMod is empty and a macro is found then sMod is updated // if sMod is empty, only standard modules will be searched (no class, document, form modules) -static bool hasMacro( SfxObjectShell const * pShell, const OUString& sLibrary, OUString& sMod, const OUString& sMacro ) +static bool hasMacro(SfxObjectShell const* pShell, const OUString& sLibrary, OUString& sMod, + const OUString& sMacro, bool bOnlyPublic) { #if !HAVE_FEATURE_SCRIPTING (void) pShell; (void) sLibrary; (void) sMod; (void) sMacro; +(void) bOnlyPublic; #else if (sLibrary.isEmpty() || sMacro.isEmpty()) return false; @@ -202,7 +204,7 @@ static bool hasMacro( SfxObjectShell const * pShell, const OUString& sLibrary, O if (!pModule) return false; SbMethod* pMeth = pModule->FindMethod(sMacro, SbxClassType::Method); -return pMeth; +return pMeth && (!bOnlyPublic || !pMeth->IsSet(SbxFlagBits::Private)); } for (auto const& rModuleRef : pBasic->GetModules()) @@ -210,6 +212,8 @@ static bool hasMacro( SfxObjectShell const * pShell, const OUString& sLibrary, O SbMethod* pMeth = rModuleRef->FindMethod(sMacro, SbxClassType::Method); if (pMeth) { +if (bOnlyPublic && pMeth->IsSet(SbxFlagBits::Private)) +continue; sMod = rModuleRef->GetName(); return true; } @@ -257,7 +261,9 @@ static void parseMacro( const OUString& sMacro, OUString& sContainer, OUString& #endif -OUString resolveVBAMacro( SfxObjectShell const * pShell, const OUString& rLibName, const OUString& rModuleName, const OUString& rMacroName ) +OUString resolveVBAMacro(SfxObjectShell const* pShell, const OUString& rLibName, + const OUString& rModuleName, const OUString& rMacroName, + bool bOnlyPublic) { #if !HAVE_FEATURE_SCRIPTING (void) pShell; @@ -269,7 +275,7 @@ OUString resolveVBAMacro( SfxObjectShell const * pShell, const OUString& rLibNam { OUString aLibName = rLibName.isEmpty() ? getDefaultProjectName( pShell ) : rLibName ; OUString aModuleName = rModuleName; -if( hasMacro( pShell, aLibName, aModuleName, rMacroName ) ) +if (hasMacro( pShell, aLibName, aModuleName, rMacroName, bOnlyPublic)) return aLibName + "." + aModuleName + "." + rMacroName; } #endif @@ -440,7 +446,7 @@ MacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const OUString& Macro for (auto const& search : sSearchList) { -aRes.mbFound = hasMacro( pShell, search, sModule, sProcedure ); +aRes.mbFound = hasMacro(pShell, search, sModule, sProcedure, /*bOnlyPublic=*/false); if ( aRes.mbFound ) { sContainer = search; diff --git a/include/filter/msfilter/msvbahelper.hxx b/include/filter/msfilter/msvbahelper.hxx index 1568970eb697..c1ad7fdae3a2 100644 --- a/include/filter/msfilter/msvbahelper.hxx +++ b/include/filter/msfilter/msvbahelper.hxx @@ -58,7 +58,9 @@ struct MSFILTER_DLLPUBLIC MacroResolvedInfo MSFILTER_DLLPUBLIC OUString makeMacroURL( std::u16string_view sMacroName ); MSFILTER_DLLPUBLIC OUString extractMacroName( std::u16string_view rMacroUrl ); MSFILTER_DLLPUBLIC OUString getDefaultProjectName( SfxObjectShell const * pShell ); -MSFILTER_DLLPUBLIC OUString resolveVBAMa
[Libreoffice-commits] core.git: filter/source
filter/source/msfilter/msvbahelper.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit 195cb01573cbc92545cbc84cbb7dd09bbb4ae692 Author: Justin Luth AuthorDate: Mon Oct 10 22:39:27 2022 -0400 Commit: Justin Luth CommitDate: Tue Oct 11 16:44:39 2022 +0200 tdf#148806 fix build for !HAVE_FEATURE_SCRIPTING I noticed this on one function, but completely missed it on the second one. Change-Id: I6ca74485b0c40cec2b04003fe894159198186ebf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141220 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx index a4e954531155..59d34ca5cec1 100644 --- a/filter/source/msfilter/msvbahelper.cxx +++ b/filter/source/msfilter/msvbahelper.cxx @@ -270,6 +270,7 @@ OUString resolveVBAMacro(SfxObjectShell const* pShell, const OUString& rLibName, (void) rLibName; (void) rModuleName; (void) rMacroName; +(void) bOnlyPublic; #else if( pShell ) {
[Libreoffice-commits] core.git: filter/source include/filter vbahelper/source
filter/source/msfilter/msvbahelper.cxx | 13 ++ include/filter/msfilter/msvbahelper.hxx|3 +- vbahelper/source/vbahelper/vbaeventshelperbase.cxx | 25 +++-- 3 files changed, 33 insertions(+), 8 deletions(-) New commits: commit ffc15725b58d0988b4e2ed836c5751223ad00984 Author: Justin Luth AuthorDate: Sat Oct 8 12:15:35 2022 -0400 Commit: Justin Luth CommitDate: Tue Oct 11 20:39:04 2022 +0200 tdf#148806 tdf#151393 xls vba: no Auto_Open from ThisWorksheet Unlike Word, ThisWorksheet cannot hold auto-running subroutines for Open/Close/New. This fixes a LO 7.4 regression caused by commit beb6c62e990599d91ac5d9183164c94d269027d3. Change-Id: Idb8f72775d9392b306cb924ee776821272b12f3b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141127 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx index 59d34ca5cec1..c7e84138f8dd 100644 --- a/filter/source/msfilter/msvbahelper.cxx +++ b/filter/source/msfilter/msvbahelper.cxx @@ -172,7 +172,7 @@ static SfxObjectShell* findShellForUrl( const OUString& sMacroURLOrPath ) // if sMod is empty and a macro is found then sMod is updated // if sMod is empty, only standard modules will be searched (no class, document, form modules) static bool hasMacro(SfxObjectShell const* pShell, const OUString& sLibrary, OUString& sMod, - const OUString& sMacro, bool bOnlyPublic) + const OUString& sMacro, bool bOnlyPublic, const OUString& sSkipModule) { #if !HAVE_FEATURE_SCRIPTING (void) pShell; @@ -180,6 +180,7 @@ static bool hasMacro(SfxObjectShell const* pShell, const OUString& sLibrary, OUS (void) sMod; (void) sMacro; (void) bOnlyPublic; +(void) sSkipModule; #else if (sLibrary.isEmpty() || sMacro.isEmpty()) return false; @@ -212,7 +213,8 @@ static bool hasMacro(SfxObjectShell const* pShell, const OUString& sLibrary, OUS SbMethod* pMeth = rModuleRef->FindMethod(sMacro, SbxClassType::Method); if (pMeth) { -if (bOnlyPublic && pMeth->IsSet(SbxFlagBits::Private)) +if ((bOnlyPublic && pMeth->IsSet(SbxFlagBits::Private)) +|| rModuleRef->GetName() == sSkipModule) continue; sMod = rModuleRef->GetName(); return true; @@ -263,7 +265,7 @@ static void parseMacro( const OUString& sMacro, OUString& sContainer, OUString& OUString resolveVBAMacro(SfxObjectShell const* pShell, const OUString& rLibName, const OUString& rModuleName, const OUString& rMacroName, - bool bOnlyPublic) + bool bOnlyPublic, const OUString& sSkipModule) { #if !HAVE_FEATURE_SCRIPTING (void) pShell; @@ -271,12 +273,13 @@ OUString resolveVBAMacro(SfxObjectShell const* pShell, const OUString& rLibName, (void) rModuleName; (void) rMacroName; (void) bOnlyPublic; +(void) sSkipModule; #else if( pShell ) { OUString aLibName = rLibName.isEmpty() ? getDefaultProjectName( pShell ) : rLibName ; OUString aModuleName = rModuleName; -if (hasMacro( pShell, aLibName, aModuleName, rMacroName, bOnlyPublic)) +if (hasMacro(pShell, aLibName, aModuleName, rMacroName, bOnlyPublic, sSkipModule)) return aLibName + "." + aModuleName + "." + rMacroName; } #endif @@ -447,7 +450,7 @@ MacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const OUString& Macro for (auto const& search : sSearchList) { -aRes.mbFound = hasMacro(pShell, search, sModule, sProcedure, /*bOnlyPublic=*/false); +aRes.mbFound = hasMacro(pShell, search, sModule, sProcedure, /*bOnlyPublic=*/false, ""); if ( aRes.mbFound ) { sContainer = search; diff --git a/include/filter/msfilter/msvbahelper.hxx b/include/filter/msfilter/msvbahelper.hxx index c1ad7fdae3a2..90f1f8a2b90f 100644 --- a/include/filter/msfilter/msvbahelper.hxx +++ b/include/filter/msfilter/msvbahelper.hxx @@ -60,7 +60,8 @@ MSFILTER_DLLPUBLIC OUString extractMacroName( std::u16string_view rMacroUrl ); MSFILTER_DLLPUBLIC OUString getDefaultProjectName( SfxObjectShell const * pShell ); MSFILTER_DLLPUBLIC OUString resolveVBAMacro(SfxObjectShell const* pShell, const OUString& rLibName, const OUString& rModuleName, -const OUString& rMacroName, bool bOnlyPublic); +const OUString& rMacroName, bool bOnlyPublic, +const OUString& sSkipModule); MSFILTER_DLLPUBLIC MacroResolv
[Libreoffice-commits] core.git: sc/source
sc/source/core/data/documen2.cxx |6 ++ 1 file changed, 6 insertions(+) New commits: commit 55ee3ede2bb0211e895053ed3a54bb1c99cc94ca Author: Justin Luth AuthorDate: Mon Oct 3 20:12:19 2022 -0400 Commit: Justin Luth CommitDate: Tue Oct 4 04:26:48 2022 +0200 tdf#139480 sc: Un/Track changes now marks spreadsheet as unsaved It makes it consistent with SW, which is why I went ahead with this without asking any questions. Change-Id: Ibb8f4149bfb3bd785c35772d0ff399f60c0d1c72 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140933 Tested-by: Justin Luth Reviewed-by: Justin Luth diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index 124089bd7139..f784d510fe6c 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -277,11 +277,17 @@ sal_uInt32 ScDocument::GetDocumentID() const void ScDocument::StartChangeTracking() { if (!pChangeTrack) +{ pChangeTrack.reset( new ScChangeTrack( *this ) ); +if (mpShell) +mpShell->SetModified(); +} } void ScDocument::EndChangeTracking() { +if (pChangeTrack && mpShell) +mpShell->SetModified(); pChangeTrack.reset(); }
[Libreoffice-commits] core.git: sc/source
sc/source/ui/view/tabview.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit 545523f5624c959b2208001cd9d191a8464d2a32 Author: Justin Luth AuthorDate: Mon Oct 3 18:59:19 2022 -0400 Commit: Justin Luth CommitDate: Tue Oct 4 02:19:33 2022 +0200 tdf$131937 tdf#61060 sc: UnFreezing now marks spreadsheet as unsaved Freezing was done in LO 4.0.4 with 2013-05-09 10:55:44 UTC Sameer Deshmukh commit 07a14c901025722bcc0a06c76e83c40985ca01a6 fdo#61060 - Freezing now marks spreadsheet as unsaved. Now Unfreezing does the same thing. TODO: should the same thing be done for splitting? It will be available in LibreOffice 4.0.4. Change-Id: I3d1d3563c5c62ccfe2dece64a26862db0380ec34 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140932 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index 2aeb3d5fff69..53e312b508d1 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -2075,6 +2075,8 @@ void ScTabView::FreezeSplitters( bool bFreeze, SplitMethod eSplitMethod, SCCOLRO void ScTabView::RemoveSplit() { +if (aViewData.GetHSplitMode() == SC_SPLIT_FIX || aViewData.GetVSplitMode() == SC_SPLIT_FIX) +aViewData.GetDocShell()->SetDocumentModified(); DoHSplit( 0 ); DoVSplit( 0 ); RepeatResize();
[Libreoffice-commits] core.git: filter/source
filter/source/msfilter/msvbahelper.cxx | 63 - 1 file changed, 31 insertions(+), 32 deletions(-) New commits: commit d72571fdd47c627efcd0dff92fbe8a9747f92932 Author: Justin Luth AuthorDate: Sat Oct 8 08:36:57 2022 -0400 Commit: Justin Luth CommitDate: Sun Oct 9 01:10:59 2022 +0200 related tdf#148806 flatten filter/source/msfilter/msvbahelper.cxx I don't like mixing big formatting changes with logic changes. Change-Id: Id2dbdfd751ac86918fe39d6627aa9ce15c794323 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141113 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx index 95144adb6094..674530d1cbb1 100644 --- a/filter/source/msfilter/msvbahelper.cxx +++ b/filter/source/msfilter/msvbahelper.cxx @@ -179,40 +179,39 @@ static bool hasMacro( SfxObjectShell const * pShell, const OUString& sLibrary, O (void) sMod; (void) sMacro; #else -if ( !sLibrary.isEmpty() && !sMacro.isEmpty() ) +if (sLibrary.isEmpty() || sMacro.isEmpty()) +return false; + +BasicManager* pBasicMgr = pShell->GetBasicManager(); +if (!pBasicMgr) +return false; + +StarBASIC* pBasic = pBasicMgr->GetLib(sLibrary); +if (!pBasic) +{ +sal_uInt16 nId = pBasicMgr->GetLibId(sLibrary); +pBasicMgr->LoadLib(nId); +pBasic = pBasicMgr->GetLib(sLibrary); +} +if (!pBasic) +return false; + +if (!sMod.isEmpty()) // we wish to find the macro is a specific module +{ +SbModule* pModule = pBasic->FindModule(sMod); +if (!pModule) +return false; +SbMethod* pMeth = pModule->FindMethod(sMacro, SbxClassType::Method); +return pMeth; +} + +for (auto const& rModuleRef : pBasic->GetModules()) { -BasicManager* pBasicMgr = pShell-> GetBasicManager(); -if ( pBasicMgr ) +SbMethod* pMeth = rModuleRef->FindMethod(sMacro, SbxClassType::Method); +if (pMeth) { -StarBASIC* pBasic = pBasicMgr->GetLib( sLibrary ); -if ( !pBasic ) -{ -sal_uInt16 nId = pBasicMgr->GetLibId( sLibrary ); -pBasicMgr->LoadLib( nId ); -pBasic = pBasicMgr->GetLib( sLibrary ); -} -if ( pBasic ) -{ -if ( !sMod.isEmpty() ) // we wish to find the macro is a specific module -{ -SbModule* pModule = pBasic->FindModule( sMod ); -if ( pModule && pModule->FindMethod( sMacro, SbxClassType::Method )) -{ -return true; -} -} -else -{ -for (auto const& rModuleRef : pBasic->GetModules()) -{ -if (rModuleRef && rModuleRef->FindMethod(sMacro, SbxClassType::Method)) -{ -sMod = rModuleRef->GetName(); -return true; -} -} -} -} +sMod = rModuleRef->GetName(); +return true; } } #endif
[Libreoffice-commits] core.git: vbahelper/source
vbahelper/source/vbahelper/vbaeventshelperbase.cxx | 18 +- 1 file changed, 17 insertions(+), 1 deletion(-) New commits: commit e2abb5bbc03cca884fa89345003d013688f0d94d Author: Justin Luth AuthorDate: Fri Oct 7 19:35:59 2022 -0400 Commit: Justin Luth CommitDate: Sun Oct 9 01:07:23 2022 +0200 tdf#148806 doc vba: accept module AutoOpen.Main This is the lowest priority way of running AutoOpen, and it only applies to Word, not Excel. There is some code in basic/source/classes/sb.cxx that was somewhat finding this before it got lost in LO 7.4 with commit beb6c62e990599d91ac5d9183164c94d269027d3. TODO: these AutoOpens should only run with a public sub, not a private one. Change-Id: I8a733cde13f96636942d84a0b05520692aac3e52 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141094 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx index dbd345c9bac7..cbe8ca79bad7 100644 --- a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx +++ b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -367,7 +368,22 @@ VbaEventsHelperBase::ModulePathMap& VbaEventsHelperBase::updateModulePathMap( co { const EventHandlerInfo& rInfo = rEventInfo.second; if( rInfo.mnModuleType == nModuleType ) -rPathMap[ rInfo.mnEventId ] = resolveVBAMacro( mpShell, maLibraryName, rModuleName, rInfo.maMacroName ); +{ +OUString sName = resolveVBAMacro(mpShell, maLibraryName, rModuleName, + rInfo.maMacroName); +// Only in Word (with lowest priority), an Auto* module can execute a "Public Sub Main" +if (sName.isEmpty() && rModuleName.isEmpty() +&& getImplementationName() == "SwVbaEventsHelper") +{ +if (rInfo.mnEventId == css::script::vba::VBAEventId::AUTO_NEW +|| rInfo.mnEventId == css::script::vba::VBAEventId::AUTO_OPEN +|| rInfo.mnEventId == css::script::vba::VBAEventId::AUTO_CLOSE) +{ +sName = resolveVBAMacro(mpShell, maLibraryName, rInfo.maMacroName, "Main"); +} +} +rPathMap[rInfo.mnEventId] = sName; +} } return rPathMap; }
[Libreoffice-commits] core.git: offapi/com sw/source
offapi/com/sun/star/script/vba/VBAEventId.idl |5 + sw/source/ui/vba/vbaeventshelper.cxx | 21 ++--- sw/source/uibase/app/docsh2.cxx |9 ++--- 3 files changed, 25 insertions(+), 10 deletions(-) New commits: commit 3d77fe0af515830001448fde0d394ef20a89002b Author: Justin Luth AuthorDate: Thu Oct 6 19:35:21 2022 -0400 Commit: Justin Luth CommitDate: Sat Oct 8 16:14:05 2022 +0200 tdf#148806 doc vba: highest priority is ThisDocument AutoOpen Word has three ways of running events at doc open, although the two AutoOpen methods are exclusive. One is the special ThisDocument Document_open subroutine. Another is the AutoOpen subroutine, which is what this patch is about. It can exist in any module - first come first served (alphabetically) in doc - except that ThisDocument is checked first. [This is very different from Calc - which IGNORES these functions in ThisWorksheet.] //TODO: The subroutine must be public And finally, there can be an AutoOpen module with a Main subroutine. It is ignored if there is any AutoOpen subroutine. //TODO: fix the third way. I tried to create a unit test, but LO's Selection.TypeText always starts at position 0 for each call, unlike Word which also starts at position 0 for the first call, but then remembers where it left off. Change-Id: I4caf29eefd432c320b5acaf6210222f50a111e89 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141037 Tested-by: Justin Luth Reviewed-by: Justin Luth diff --git a/offapi/com/sun/star/script/vba/VBAEventId.idl b/offapi/com/sun/star/script/vba/VBAEventId.idl index 00989fccd053..00a524a1ef3b 100644 --- a/offapi/com/sun/star/script/vba/VBAEventId.idl +++ b/offapi/com/sun/star/script/vba/VBAEventId.idl @@ -58,6 +58,11 @@ constants VBAEventId const long DOCUMENT_OPEN= 1002; /** Document about to be closed. No arguments. */ const long DOCUMENT_CLOSE = 1003; +// auto* subroutines in ThisDocument have highest priority +const long DOCUMENT_AUTO_NEW = 1004; +const long DOCUMENT_AUTO_OPEN = 1005; +const long DOCUMENT_AUTO_CLOSE = 1006; + // MS Excel (identifiers from 2001 to 2999) diff --git a/sw/source/ui/vba/vbaeventshelper.cxx b/sw/source/ui/vba/vbaeventshelper.cxx index ccdb10548ca2..d083940106b5 100644 --- a/sw/source/ui/vba/vbaeventshelper.cxx +++ b/sw/source/ui/vba/vbaeventshelper.cxx @@ -32,10 +32,13 @@ SwVbaEventsHelper::SwVbaEventsHelper( uno::Sequence< css::uno::Any > const& aArg { using namespace ::com::sun::star::script::ModuleType; registerEventHandler( DOCUMENT_NEW, DOCUMENT, "Document_New" ); +registerEventHandler(DOCUMENT_AUTO_NEW, DOCUMENT, "AutoNew"); registerEventHandler( AUTO_NEW, NORMAL, "AutoNew" ); registerEventHandler( DOCUMENT_OPEN,DOCUMENT, "Document_Open" ); +registerEventHandler(DOCUMENT_AUTO_OPEN, DOCUMENT, "AutoOpen"); registerEventHandler( AUTO_OPEN,NORMAL, "AutoOpen" ); registerEventHandler( DOCUMENT_CLOSE, DOCUMENT, "Document_Close" ); +registerEventHandler(DOCUMENT_AUTO_CLOSE, DOCUMENT, "AutoClose"); registerEventHandler( AUTO_CLOSE, NORMAL, "AutoClose" ); } @@ -44,18 +47,22 @@ SwVbaEventsHelper::~SwVbaEventsHelper() } bool SwVbaEventsHelper::implPrepareEvent( EventQueue& rEventQueue, -const EventHandlerInfo& rInfo, const uno::Sequence< uno::Any >& /*rArgs*/ ) +const EventHandlerInfo& rInfo, const uno::Sequence< uno::Any >& rArgs) { switch( rInfo.mnEventId ) { -case AUTO_NEW: -rEventQueue.emplace_back(DOCUMENT_NEW); +case DOCUMENT_AUTO_NEW: +// Only one "AutoNew" subroutine can run. ThisDocument is highest priority. +if (!hasVbaEventHandler(rInfo.mnEventId, rArgs)) +rEventQueue.emplace_back(AUTO_NEW); break; -case AUTO_OPEN: -rEventQueue.emplace_back(DOCUMENT_OPEN); +case DOCUMENT_AUTO_OPEN: +if (!hasVbaEventHandler(rInfo.mnEventId, rArgs)) +rEventQueue.emplace_back(AUTO_OPEN); break; -case AUTO_CLOSE: -rEventQueue.emplace_back(DOCUMENT_CLOSE); +case DOCUMENT_AUTO_CLOSE: +if (!hasVbaEventHandler(rInfo.mnEventId, rArgs)) +rEventQueue.emplace_back(AUTO_CLOSE); break; } return true; diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index d9e1486e0e3a..51082a682c2d 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -221,10 +221,12 @@ static void lcl_processCompatibleSfxHint( const uno::Reference< script::vba:
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sw/qa sw/source
sw/qa/extras/ww8import/ww8import.cxx |2 +- sw/source/ui/uno/swdetect.cxx| 25 ++--- 2 files changed, 19 insertions(+), 8 deletions(-) New commits: commit f657983a6ec7f79482efc3a0f70510e15b527670 Author: Justin Luth AuthorDate: Tue Sep 27 22:08:48 2022 -0400 Commit: Miklos Vajna CommitDate: Fri Oct 14 09:33:18 2022 +0200 tdf#125216 import filter: allow .doc renamed as .dot A LO 6.2.2 regression prevented .doc-as-.dot files to load, giving a "Read Error. This is not a valid WinWord6 file." Well, it is not a valid .dot file (because of some bit differences), but it is a valid .doc file. Since it was renamed to be treated as a template (requiring a save-as), we should treat it as that. Change-Id: I308375797e9dae3ca6d203fab520e91ee788325e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140687 Tested-by: Jenkins Reviewed-by: Justin Luth (cherry picked from commit 6cec8ba33a28de7248861b2eecfc5034cbde9d37) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140608 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/sw/qa/extras/ww8import/data/tdf120761_zOrder.doc b/sw/qa/extras/ww8import/data/tdf120761_zOrder.dot similarity index 100% rename from sw/qa/extras/ww8import/data/tdf120761_zOrder.doc rename to sw/qa/extras/ww8import/data/tdf120761_zOrder.dot diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx index 7eb0c9f6b221..8c77217c7610 100644 --- a/sw/qa/extras/ww8import/ww8import.cxx +++ b/sw/qa/extras/ww8import/ww8import.cxx @@ -275,7 +275,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf110987) CPPUNIT_TEST_FIXTURE(Test, testTdf120761_zOrder) { -load(mpTestDocumentPath, "tdf120761_zOrder.doc"); +load(mpTestDocumentPath, "tdf120761_zOrder.dot"); //The blue shape was covering everything (highest zorder = 2) instead of the lowest(0) uno::Reference xShape(getShapeByName(u"Picture 2"), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_uInt32(0), getProperty(xShape, "ZOrder")); diff --git a/sw/source/ui/uno/swdetect.cxx b/sw/source/ui/uno/swdetect.cxx index 9e354dedaf6b..83b7162ae2a0 100644 --- a/sw/source/ui/uno/swdetect.cxx +++ b/sw/source/ui/uno/swdetect.cxx @@ -24,6 +24,7 @@ #include #include #include +#include #include using namespace ::com::sun::star; @@ -102,19 +103,29 @@ OUString SAL_CALL SwFilterDetect::detect( Sequence< PropertyValue >& lDescriptor // mis-detect it. if ( bIsDetected && aTypeName == "writer_MS_Word_97_Vorlage" ) { +// It is common practice to rename a .doc to .dot to make it a template. +// Since we have detected a.doc-ish format, always accept .dot-named-files +// as valid templates to avoid flagging this as an invalid .dot format.. +INetURLObject aParser(aMediaDesc.getUnpackedValueOrDefault( +utl::MediaDescriptor::PROP_URL, OUString())); + // Super ugly hack, but we don't want to use the whole WW8Fib thing here in // the swd library, apparently. We know (do we?) that the "aBits1" byte, as // the variable is called in WW8Fib::WW8Fib(SvStream&,sal_uInt8,sal_uInt32), // is at offset 10 in the WordDocument stream. The fDot bit is bit 0x01 of // that byte. -tools::SvRef xWordDocument = aStorage->OpenSotStream("WordDocument", StreamMode::STD_READ); -xWordDocument->Seek( 10 ); -if ( xWordDocument->Tell() == 10 ) +if (aParser.getExtension().toAsciiLowerCase() != "dot") { -sal_uInt8 aBits1; -xWordDocument->ReadUChar( aBits1 ); -// Check fDot bit -bIsDetected = ((aBits1 & 0x01) == 0x01); +tools::SvRef xWordDocument += aStorage->OpenSotStream("WordDocument", StreamMode::STD_READ); +xWordDocument->Seek(10); +if (xWordDocument->Tell() == 10) +{ +sal_uInt8 aBits1; +xWordDocument->ReadUChar(aBits1); +// Check fDot bit +bIsDetected = ((aBits1 & 0x01) == 0x01); +} } } }
[Libreoffice-commits] core.git: oovbaapi/ooo sw/qa sw/source
oovbaapi/ooo/vba/word/XWordBasic.idl |1 + sw/qa/core/data/docm/testVBA.docm|binary sw/qa/core/macros-test.cxx |4 sw/source/ui/vba/vbawordbasic.cxx|7 +++ sw/source/ui/vba/vbawordbasic.hxx|1 + 5 files changed, 13 insertions(+) New commits: commit a8209c52d6daeb00ed85d5c705ec84c9603e2f3e Author: Justin Luth AuthorDate: Wed Oct 12 13:08:59 2022 -0400 Commit: Miklos Vajna CommitDate: Fri Oct 14 09:40:30 2022 +0200 sw vba: add WordBasic.ScreenUpdating Change-Id: I3d074c224b77eff9f4ab1ea6bade6d66828fc88c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141273 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna diff --git a/oovbaapi/ooo/vba/word/XWordBasic.idl b/oovbaapi/ooo/vba/word/XWordBasic.idl index 7c694703a843..66c867f09364 100644 --- a/oovbaapi/ooo/vba/word/XWordBasic.idl +++ b/oovbaapi/ooo/vba/word/XWordBasic.idl @@ -42,6 +42,7 @@ interface XWordBasic any DocMaximize( [in] any State ); void AppShow( [in] any WindowName ); any AppCount(); +void ScreenUpdating( [in] /*optional*/ any On ); }; }; }; }; diff --git a/sw/qa/core/data/docm/testVBA.docm b/sw/qa/core/data/docm/testVBA.docm new file mode 100644 index ..c02e353c3c3e Binary files /dev/null and b/sw/qa/core/data/docm/testVBA.docm differ diff --git a/sw/qa/core/macros-test.cxx b/sw/qa/core/macros-test.cxx index f02bd34d91be..23a489517b11 100644 --- a/sw/qa/core/macros-test.cxx +++ b/sw/qa/core/macros-test.cxx @@ -106,6 +106,10 @@ void SwMacrosTest::createFileURL(std::u16string_view aFile, OUString& rFilePath) void SwMacrosTest::testVba() { TestMacroInfo testInfo[] = { +{ +OUString("testVBA.docm"), + OUString("vnd.sun.Star.script:Project.ThisDocument.testAll?language=Basic=document") +}, { OUString("testFind.docm"), OUString("vnd.sun.Star.script:Project.Module1.testAll?language=Basic=document") diff --git a/sw/source/ui/vba/vbawordbasic.cxx b/sw/source/ui/vba/vbawordbasic.cxx index c5fe14289832..ae59cf245f55 100644 --- a/sw/source/ui/vba/vbawordbasic.cxx +++ b/sw/source/ui/vba/vbawordbasic.cxx @@ -242,4 +242,11 @@ css::uno::Any SAL_CALL SwWordBasic::AppCount() return css::uno::Any(sal_Int32(2)); } +void SAL_CALL SwWordBasic::ScreenUpdating(const uno::Any& On) +{ +sal_Int32 nOn; +if (On >>= nOn) +mpApp->setScreenUpdating(nOn != 0); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/vba/vbawordbasic.hxx b/sw/source/ui/vba/vbawordbasic.hxx index eb9ce5d500c2..75f8a05a3210 100644 --- a/sw/source/ui/vba/vbawordbasic.hxx +++ b/sw/source/ui/vba/vbawordbasic.hxx @@ -86,6 +86,7 @@ public: virtual css::uno::Any SAL_CALL DocMaximize(const css::uno::Any& State) override; virtual void SAL_CALL AppShow(const css::uno::Any& WindowName) override; virtual css::uno::Any SAL_CALL AppCount() override; +virtual void SAL_CALL ScreenUpdating(const css::uno::Any& On) override; }; #endif // INCLUDED_SW_SOURCE_UI_VBA_VBAWORDBASIC_HXX
[Libreoffice-commits] core.git: sw/source
sw/source/ui/vba/vbawordbasic.hxx | 12 1 file changed, 12 insertions(+) New commits: commit 8717a700e847330897b44aa40d1787c65dfa64be Author: Justin Luth AuthorDate: Thu Oct 13 07:10:17 2022 -0400 Commit: Miklos Vajna CommitDate: Fri Oct 14 09:38:54 2022 +0200 sw vba: add doxygen comment for class SwWordBasic Change-Id: I8b12845341e8754c0882411c19a57b7a46e05e98 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141290 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna diff --git a/sw/source/ui/vba/vbawordbasic.hxx b/sw/source/ui/vba/vbawordbasic.hxx index 5933f104eb49..eb9ce5d500c2 100644 --- a/sw/source/ui/vba/vbawordbasic.hxx +++ b/sw/source/ui/vba/vbawordbasic.hxx @@ -21,6 +21,18 @@ class SwVbaApplication; +/** + * This is a representation of the WordBasic statements and functions + * that were available in Word version 6.0 and Word for Windows 95. + * + * It can be specified as "Application.WordBasic." or "WordBasic.". + * + * Starting with Word 2000, old macros were automatically converted + * into Visual Basic modules, and the WordBasic prefix was added where + * no VBA methods precisely corresponded. + * + * In other words, it is a compatibility shim. + */ class SwWordBasic : public cppu::WeakImplHelper { private:
[Libreoffice-commits] core.git: sw/source
sw/source/filter/ww8/ww8graf.cxx | 10 -- 1 file changed, 10 deletions(-) New commits: commit d02962cb2ca4e691634abb1bf6ff30b9b366d2e3 Author: Justin Luth AuthorDate: Tue Oct 4 10:39:38 2022 -0400 Commit: Miklos Vajna CommitDate: Wed Oct 5 17:38:25 2022 +0200 tdf#148806 doc import: remove 2003 SetObjectShell(nullptr) hack This was preventing doc event-macros from round-tripping. Its original purpose was to "fix" doc->sxw export. We no longer export to sxw, and the OOo bug doc exports fine to ODT. Change-Id: I3a22db1b3bf9eaa2d64ac963f0c41892ba604e8d --- https://bz.apache.org/ooo/show_bug.cgi?id=20540 --- caolanm 2003-10-20 14:43:31 UTC Setting a target for this bug, fixed for 2.0 in portlaoisefilterteam16, and for 1.1.1 in droghedafilterteam15 MIB->CMC: The document contains a Draw 4.0 OLE object, and the problem is the import of that object in the Word filter. During the import, the object's storage is copied into the document storage (in SvxMSDffManager::CreateSdrOLEFromStorage, msdffimp.cxx, 5117). It now is contained in the document storage in the 3.o format, but it is not in the child list of SvPersist. Some time later, SvxMSDffManager::ImportGraphic calls a SdrOLE2Obj::SetModel, that again calls SdrOLE2Obj::Connect. This method notices that the object is not in the persist child list, and for that reasdon call SvPersist::Move to add it to the list (svdoole2.cxx, 374). Move converts the object into the OOo 1.0 format. The destination storage is the object's storage, so the 1.0 format is added to the existing 3.0 format, and the object storage remains an OLE strorage and does not get a package. This situation is not permitted and cannot be saved in the SXW format. Change-Id: I24e55e5d47c3a7d10d6609ddbf9cc2374a47a37b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140950 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index e3482a290a2f..d803e5619614 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -2563,19 +2563,9 @@ SwFrameFormat* SwWW8ImplReader::Read_GrafLayer( tools::Long nGrafAnchorCp ) tools::Rectangle aRect(aFSFA.nXaLeft, aFSFA.nYaTop, aFSFA.nXaRight, aFSFA.nYaBottom); SvxMSDffImportData aData( aRect ); -/* -#i20540# -The SdrOle2Obj will try and manage any ole objects it finds, causing all -sorts of trouble later on -*/ -SwDocShell* pPersist = m_rDoc.GetDocShell(); -m_rDoc.SetDocShell(nullptr); // #i20540# Persist guard - rtl::Reference pObject; bool bOk = (m_xMSDffManager->GetShape(aFSFA.nSpId, pObject, aData) && pObject); -m_rDoc.SetDocShell(pPersist); // #i20540# Persist guard - if (!bOk) { OSL_ENSURE( false, "Where is the Shape ?" );
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - oox/source sw/qa
dev/null |binary oox/source/drawingml/fillproperties.cxx |5 - sw/qa/extras/ooxmlexport/ooxmlexport6.cxx | 10 -- 3 files changed, 4 insertions(+), 11 deletions(-) New commits: commit 5397ff649deadc301d9c3f1187814c91f8e7f77b Author: Justin Luth AuthorDate: Thu Jul 28 16:45:41 2022 -0400 Commit: Michael Stahl CommitDate: Wed Aug 3 12:32:45 2022 +0200 Revert "tdf#141652 partial revert "Reset ShapeProperty priority..." This reverts 7.4 commit 18cc1240565e697859dd7d17058f91d5e01df929. Someone backported it to 7.3 as well. Reverting fixes regression report tdf#150061. Change-Id: Ie04595e11dd9d2e15fa940b8ada71714bd434f6a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137581 Tested-by: Jenkins Reviewed-by: Justin Luth (cherry picked from commit 84b719e41c3a5f1e3dba112508721d69c1b3185e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137530 Reviewed-by: Xisco Fauli (cherry picked from commit aaf6070682dd99bed9e172a6f27a9801237b9c3e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137532 Reviewed-by: Michael Stahl diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index 7cb497767c93..319a0337700b 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -792,7 +792,10 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap, if(bIsCustomShape && bHasCropValues && bNeedCrop) { xGraphic = lclCropGraphic(xGraphic, CropQuotientsFromFillRect(aFillRect)); - rPropMap.setProperty(ShapeProperty::FillBitmap, xGraphic); +if (rPropMap.supportsProperty(ShapeProperty::FillBitmapName)) + rPropMap.setProperty(ShapeProperty::FillBitmapName, xGraphic); +else + rPropMap.setProperty(ShapeProperty::FillBitmap, xGraphic); } } } diff --git a/sw/qa/extras/ooxmlexport/data/tdf141652_fillBitmapName.docx b/sw/qa/extras/ooxmlexport/data/tdf141652_fillBitmapName.docx deleted file mode 100644 index 4a47a544d6bb.. Binary files a/sw/qa/extras/ooxmlexport/data/tdf141652_fillBitmapName.docx and /dev/null differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx index 4429aa58a70d..61372e9e803e 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx @@ -282,16 +282,6 @@ DECLARE_OOXMLEXPORT_TEST(testDMLShapeFillBitmapCrop, "dml-shape-fillbitmapcrop.d } -DECLARE_OOXMLEXPORT_TEST(test141652_fillBitmapName, "tdf141652_fillBitmapName.docx") -{ -text::GraphicCrop aGraphicCropStruct = getProperty(getShape(1), "GraphicCrop"); -CPPUNIT_ASSERT_DOUBLES_EQUAL( sal_Int32(-769), aGraphicCropStruct.Right, 10); - -CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), aGraphicCropStruct.Left ); -CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), aGraphicCropStruct.Top ); -CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), aGraphicCropStruct.Bottom ); -} - DECLARE_OOXMLEXPORT_TEST(testDMLShapeFillPattern, "dml-shape-fillpattern.docx") { // Hatching was ignored by the export.