[Libreoffice-commits] core.git: Branch 'distro/mimo/mimo-7-3' - 5 commits - sc/source sw/qa sw/source
sc/source/filter/inc/rtfexp.hxx |8 + sc/source/filter/rtf/rtfexp.cxx | 135 +++- sw/qa/extras/uiwriter/data/tdf62032_apply_style.odt |binary sw/qa/extras/uiwriter/uiwriter4.cxx | 22 +++ sw/source/core/doc/docfmt.cxx |5 5 files changed, 140 insertions(+), 30 deletions(-) New commits: commit 998e5b53478a20ddbda66e92d8fd6ad73412ff57 Author: luigiiucci AuthorDate: Thu Jun 15 23:31:26 2023 +0200 Commit: Aron Budea CommitDate: Fri Aug 4 00:49:01 2023 +0200 tdf#62032 use style list level when changing style If a style S1 has a list level L1, and we change the style to S1 in a text node that has list level L2, the new text node list level must be L1 Change-Id: Ic25b02cb2da3153fc5c3723998c9f7f01247 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153161 Reviewed-by: Ashod Nakashian Tested-by: Jenkins (cherry picked from commit c1cfe85f8bba10d367ef9ef1d6d569f53969dd34) (cherry picked from commit d466d3b4422e6fc6405cf17bbeee48ae52fa1d3e) diff --git a/sw/qa/extras/uiwriter/data/tdf62032_apply_style.odt b/sw/qa/extras/uiwriter/data/tdf62032_apply_style.odt new file mode 100644 index ..86cda167ee8a Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf62032_apply_style.odt differ diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx b/sw/qa/extras/uiwriter/uiwriter4.cxx index fc7bd27e3124..803c4821e4a5 100644 --- a/sw/qa/extras/uiwriter/uiwriter4.cxx +++ b/sw/qa/extras/uiwriter/uiwriter4.cxx @@ -292,6 +292,7 @@ public: void testInsertPdf(); void testTdf143760WrapContourToOff(); void testHatchFill(); +void testTdf62032ApplyStyle(); CPPUNIT_TEST_SUITE(SwUiWriterTest4); CPPUNIT_TEST(testTdf96515); @@ -417,6 +418,7 @@ public: CPPUNIT_TEST(testInsertPdf); CPPUNIT_TEST(testTdf143760WrapContourToOff); CPPUNIT_TEST(testHatchFill); +CPPUNIT_TEST(testTdf62032ApplyStyle); CPPUNIT_TEST_SUITE_END(); }; @@ -4140,6 +4142,26 @@ void SwUiWriterTest4::testHatchFill() CPPUNIT_ASSERT_EQUAL(sal_Int32(30), getProperty(getShape(1), "FillTransparence")); } +void SwUiWriterTest4::testTdf62032ApplyStyle() +{ +SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf62032_apply_style.odt"); +SwWrtShell* pWrtSh = pDoc->GetDocShell()->GetWrtShell(); + +pWrtSh->Down(/*bSelect=*/false); + +uno::Sequence aPropertyValues = comphelper::InitPropertySequence({ +{ "Style", uno::Any(OUString("A 2")) }, +{ "FamilyName", uno::Any(OUString("ParagraphStyles")) }, +}); +dispatchCommand(mxComponent, ".uno:StyleApply", aPropertyValues); + +// Without the fix in place, it fails with: +// - Expected: 1.1 +// - Actual : 2 +CPPUNIT_ASSERT_EQUAL(OUString("1.1"), + getProperty(getParagraph(2), "ListLabelString").trim()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest4); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 42dfd707c556..1dd846cb80e4 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -1067,6 +1067,11 @@ static bool lcl_SetTextFormatColl( SwNode* pNode, void* pArgs ) pCNd->ResetAttr( RES_PARATR_LIST_ISCOUNTED ); pCNd->ResetAttr( RES_PARATR_LIST_ID ); } +else +{ +// forcing reset of list level from parapgaph +pCNd->SetAttr(pFormat->GetFormatAttr(RES_PARATR_LIST_LEVEL)); +} } } commit c3b32a95236edeadd9450c7b989a259e82476b8f Author: Henry Castro AuthorDate: Tue Jul 25 15:36:52 2023 -0400 Commit: Aron Budea CommitDate: Thu Aug 3 22:37:28 2023 +0200 sc: filter: rtf: add method "WriteFontTable" Write the font table while visiting column/row and get the unique index to reference it. "The \fonttbl control word introduces the font table group. Unique \fN control words define each font available in the document, and are used to reference that font throughout the document." Signed-off-by: Henry Castro Change-Id: I20c5d1128972f5ec9b9b2e246f466bdb173ef8a4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154906 Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155261 (cherry picked from commit 2d5732b254134da7942687ea3b1bb04859cc9c34) diff --git a/sc/source/filter/inc/rtfexp.hxx b/sc/source/filter/inc/rtfexp.hxx index 1c9f1bd7a4af..9d0b204540c7 100644 --- a/sc/source/filter/inc/rtfexp.hxx +++ b/sc/source/filter/inc/rtfexp.hxx @@ -28,12 +28,14 @@ class ScRTFExport : public ScExportBase { std::unique_ptr m_pCellX; // cumulative range in a table std::map m_pFontTable; +SvMemoryStream m_aFontStrm; SvMemoryStream m_aDocStrm; int
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - vcl/source
vcl/source/gdi/embeddedfontshelper.cxx | 31 +-- 1 file changed, 29 insertions(+), 2 deletions(-) New commits: commit cc631df53da60b486ececd620064a65c6683a20c Author: luigiiucci AuthorDate: Tue Jun 13 22:10:00 2023 +0200 Commit: Miklos Vajna CommitDate: Wed Jul 19 08:09:23 2023 +0200 tdf#155486 Adding fonts to .odt when there is "no perfect match" Problem does not seem to have any relation with .otf files management. Problem arises when: - we use a font with setting certain family/bold/italic/pitch values - we have this font installed, but we don't have a version with matching family/bold/italic/pitch In this case the "not a perfect match" fonts were not saved in the .odt Change-Id: Ie4e2b9c34b79ac99f03c57bed4fdc5f4d718dcc2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153007 Tested-by: Jenkins Reviewed-by: خالد حسني (cherry picked from commit e7c885389bfb9387acf8a21ea38769e678a76aac) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153606 Reviewed-by: Miklos Vajna diff --git a/vcl/source/gdi/embeddedfontshelper.cxx b/vcl/source/gdi/embeddedfontshelper.cxx index aeb30aa20dee..afddbf41387c 100644 --- a/vcl/source/gdi/embeddedfontshelper.cxx +++ b/vcl/source/gdi/embeddedfontshelper.cxx @@ -261,6 +261,15 @@ OUString EmbeddedFontsHelper::fontFileUrl( std::u16string_view familyName, FontF graphics->GetDevFontList( ); std::unique_ptr< vcl::font::PhysicalFontFaceCollection > fontInfo( fonts.GetFontFaceCollection()); vcl::font::PhysicalFontFace* selected = nullptr; + +// Maybe we don't find the perfect match for the font. E.G. we have fonts with the same family name +// but not same bold or italic etc.. +// In this case we add all the fonts having the family name of tyhe used font: +// - we store all these fonts in familyNameFonts during loop +// - if we haven't found the perfect match we store all fonts in familyNameFonts +typedef std::vector FontList; +FontList familyNameFonts; + for( int i = 0; i < fontInfo->Count(); ++i ) @@ -288,11 +297,29 @@ OUString EmbeddedFontsHelper::fontFileUrl( std::u16string_view familyName, FontF { // Some fonts specify 'DONTKNOW' for some things, still a good match, if we don't find a better one. selected = f; } +// adding "not perfact match" to familyNameFonts vector +familyNameFonts.push_back(f); + } } -if( selected != nullptr ) + +// if we have found a perfect match we will add only "selected", otherwise all familyNameFonts +FontList fontsToAdd = (selected ? FontList(1, selected) : std::move(familyNameFonts)); + +for (vcl::font::PhysicalFontFace* f : fontsToAdd) { -auto aFontData(selected->GetRawFontData(0)); +if (!selected) { // recalculate file not for "not perfect match" +filename = OUString::Concat(familyName) + "_" + OUString::number(f->GetFamilyType()) + "_" + +OUString::number(f->GetItalic()) + "_" + OUString::number(f->GetWeight()) + "_" + +OUString::number(f->GetPitch()) + ".ttf"; // TODO is it always ttf? +url = path + filename; +if (osl::File(url).open(osl_File_OpenFlag_Read) == osl::File::E_None) // = exists() +{ +// File with contents of the font file already exists, assume it's been created by a previous call. +continue; +} +} +auto aFontData(f->GetRawFontData(0)); if (!aFontData.empty()) { auto data = aFontData.data();
[Libreoffice-commits] core.git: sw/qa sw/source
sw/qa/extras/uiwriter/data/tdf62032_apply_style.odt |binary sw/qa/extras/uiwriter/uiwriter8.cxx | 21 sw/source/core/doc/docfmt.cxx |5 3 files changed, 26 insertions(+) New commits: commit c1cfe85f8bba10d367ef9ef1d6d569f53969dd34 Author: luigiiucci AuthorDate: Thu Jun 15 23:31:26 2023 +0200 Commit: Miklos Vajna CommitDate: Mon Jul 10 08:18:51 2023 +0200 tdf#62032 use style list level when changing style If a style S1 has a list level L1, and we change the style to S1 in a text node that has list level L2, the new text node list level must be L1 Change-Id: Ic25b02cb2da3153fc5c3723998c9f7f01247 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153161 Reviewed-by: Ashod Nakashian Tested-by: Jenkins diff --git a/sw/qa/extras/uiwriter/data/tdf62032_apply_style.odt b/sw/qa/extras/uiwriter/data/tdf62032_apply_style.odt new file mode 100644 index ..86cda167ee8a Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf62032_apply_style.odt differ diff --git a/sw/qa/extras/uiwriter/uiwriter8.cxx b/sw/qa/extras/uiwriter/uiwriter8.cxx index 28eaf3e9f1b0..48b17ef211ea 100644 --- a/sw/qa/extras/uiwriter/uiwriter8.cxx +++ b/sw/qa/extras/uiwriter/uiwriter8.cxx @@ -2653,6 +2653,27 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf73483) assertXPath(pXml, para_style_path, "master-page-name", "Right_20_Page"); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf62032ApplyStyle) +{ +createSwDoc("tdf62032_apply_style.odt"); +SwDoc* pDoc = getSwDoc(); +SwWrtShell* pWrtSh = pDoc->GetDocShell()->GetWrtShell(); + +pWrtSh->Down(/*bSelect=*/false); + +uno::Sequence aPropertyValues = comphelper::InitPropertySequence({ +{ "Style", uno::Any(OUString("A 2")) }, +{ "FamilyName", uno::Any(OUString("ParagraphStyles")) }, +}); +dispatchCommand(mxComponent, ".uno:StyleApply", aPropertyValues); + +// Without the fix in place, it fails with: +// - Expected: 1.1 +// - Actual : 2 +CPPUNIT_ASSERT_EQUAL(OUString("1.1"), + getProperty(getParagraph(2), "ListLabelString").trim()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 655925f434ae..3f52628fed21 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -1072,6 +1072,11 @@ static bool lcl_SetTextFormatColl( SwNode* pNode, void* pArgs ) pCNd->ResetAttr( RES_PARATR_LIST_ISCOUNTED ); pCNd->ResetAttr( RES_PARATR_LIST_ID ); } +else +{ +// forcing reset of list level from parapgaph +pCNd->SetAttr(pFormat->GetFormatAttr(RES_PARATR_LIST_LEVEL)); +} } }
[Libreoffice-commits] core.git: Branch 'distro/mimo/mimo-7-4' - vcl/source
vcl/source/gdi/embeddedfontshelper.cxx | 31 +-- 1 file changed, 29 insertions(+), 2 deletions(-) New commits: commit a3a00555d4b0e07ee921f85ac088e7b17047c6cf Author: luigiiucci AuthorDate: Tue Jun 13 22:10:00 2023 +0200 Commit: Aron Budea CommitDate: Thu Jul 6 23:22:09 2023 +0200 tdf#155486 Adding fonts to .odt when there is "no perfect match" Problem does not seem to have any relation with .otf files management. Problem arises when: - we use a font with setting certain family/bold/italic/pitch values - we have this font installed, but we don't have a version with matching family/bold/italic/pitch In this case the "not a perfect match" fonts were not saved in the .odt Change-Id: Ie4e2b9c34b79ac99f03c57bed4fdc5f4d718dcc2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153007 Tested-by: Jenkins Reviewed-by: خالد حسني (cherry picked from commit e7c885389bfb9387acf8a21ea38769e678a76aac) diff --git a/vcl/source/gdi/embeddedfontshelper.cxx b/vcl/source/gdi/embeddedfontshelper.cxx index 34d227e5f5b2..2ca5ccd3c1b7 100644 --- a/vcl/source/gdi/embeddedfontshelper.cxx +++ b/vcl/source/gdi/embeddedfontshelper.cxx @@ -261,6 +261,15 @@ OUString EmbeddedFontsHelper::fontFileUrl( std::u16string_view familyName, FontF graphics->GetDevFontList( ); std::unique_ptr< vcl::font::PhysicalFontFaceCollection > fontInfo( fonts.GetFontFaceCollection()); vcl::font::PhysicalFontFace* selected = nullptr; + +// Maybe we don't find the perfect match for the font. E.G. we have fonts with the same family name +// but not same bold or italic etc.. +// In this case we add all the fonts having the family name of tyhe used font: +// - we store all these fonts in familyNameFonts during loop +// - if we haven't found the perfect match we store all fonts in familyNameFonts +typedef std::vector FontList; +FontList familyNameFonts; + for( int i = 0; i < fontInfo->Count(); ++i ) @@ -288,12 +297,30 @@ OUString EmbeddedFontsHelper::fontFileUrl( std::u16string_view familyName, FontF { // Some fonts specify 'DONTKNOW' for some things, still a good match, if we don't find a better one. selected = f; } +// adding "not perfact match" to familyNameFonts vector +familyNameFonts.push_back(f); + } } -if( selected != nullptr ) + +// if we have found a perfect match we will add only "selected", otherwise all familyNameFonts +FontList fontsToAdd = (selected ? FontList(1, selected) : std::move(familyNameFonts)); + +for (vcl::font::PhysicalFontFace* f : fontsToAdd) { +if (!selected) { // recalculate file not for "not perfect match" +filename = OUString::Concat(familyName) + "_" + OUString::number(f->GetFamilyType()) + "_" + +OUString::number(f->GetItalic()) + "_" + OUString::number(f->GetWeight()) + "_" + +OUString::number(f->GetPitch()) + ".ttf"; // TODO is it always ttf? +url = path + filename; +if (osl::File(url).open(osl_File_OpenFlag_Read) == osl::File::E_None) // = exists() +{ +// File with contents of the font file already exists, assume it's been created by a previous call. +continue; +} +} tools::Long size; -if (const void* data = graphics->GetEmbedFontData(selected, )) +if (const void* data = graphics->GetEmbedFontData(f, )) { if( sufficientTTFRights( data, size, rights )) {
[Libreoffice-commits] core.git: Branch 'distro/mimo/mimo-7-4' - 2 commits - sc/qa sc/source
sc/qa/unit/helper/qahelper.cxx | 38 ++ sc/source/core/data/dpoutput.cxx |6 +- sc/source/ui/view/viewfun3.cxx |2 ++ 3 files changed, 45 insertions(+), 1 deletion(-) New commits: commit 3a51b402f243eb32b544c16813f682617d88c0b9 Author: luigiiucci AuthorDate: Wed May 17 11:02:37 2023 +0200 Commit: Aron Budea CommitDate: Wed Jul 5 01:23:40 2023 +0200 Header columns can disappear with filtered data in pivot tables When we set on a pivot table a filter that filters all the rows, the pivot table showed only the first header columns and computed column, but all the columns headers should still be shown so we can adjust the filter for the column. This fixes this issue. Also add more debug output and prevent a crash when running pivot table tests. Change-Id: I30b4ee72cf8436c4522ab4ba0781462b214816dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151871 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl (cherry picked from commit 3551d18404cb19cdaa8edb170a549f5c5405d0cb) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153686 Tested-by: Jenkins CollaboraOffice diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index 9a5c5124cb08..99a8492ce87d 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -43,6 +43,7 @@ #include #include #include +#include #include @@ -527,6 +528,43 @@ bool checkOutput( svl::GridPrinter printer(e.Row() - s.Row() + 1, e.Col() - s.Col() + 1, CALC_DEBUG_OUTPUT != 0); SCROW nOutRowSize = e.Row() - s.Row() + 1; SCCOL nOutColSize = e.Col() - s.Col() + 1; + +// Check if expected size iz smaller than actual size (and prevent a crash) +if (aCheck.size() < o3tl::make_unsigned(nOutRowSize) || aCheck[0].size() < o3tl::make_unsigned(nOutColSize)) +{ +// Dump the arrays to console, so we can compare +std::cout << "Expected data:" << std::endl; +for (size_t nRow = 0; nRow < aCheck.size(); ++nRow) +{ +for (size_t nCol = 0; nCol < aCheck[nRow].size(); ++nCol) +{ +const char* p = aCheck[nRow][nCol]; +if (p) +{ +OUString aCheckVal = OUString::createFromAscii(p); +std::cout << "'" << aCheckVal << "', "; +} +else +std::cout << "null, "; +} +std::cout << std::endl; +} + +std::cout << "Actual data:" << std::endl; +for (SCROW nRow = 0; nRow < nOutRowSize; ++nRow) +{ +for (SCCOL nCol = 0; nCol < nOutColSize; ++nCol) +{ +OUString aVal = pDoc->GetString(nCol + s.Col(), nRow + s.Row(), s.Tab()); +std::cout << "'" << aVal << "', "; +} +std::cout << std::endl; +} +std::cout << std::endl; + +return false; +} + for (SCROW nRow = 0; nRow < nOutRowSize; ++nRow) { for (SCCOL nCol = 0; nCol < nOutColSize; ++nCol) diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx index bf2109b300a3..b8565852d511 100644 --- a/sc/source/core/data/dpoutput.cxx +++ b/sc/source/core/data/dpoutput.cxx @@ -600,7 +600,11 @@ ScDPOutput::ScDPOutput( ScDocument* pD, const uno::Reference aResult = xLevRes->getResults(); -if (!lcl_MemberEmpty(aResult)) +// We want only to remove the DATA column if it is empty +// and not any other empty columns (to still show the +// header columns) +bool bSkip = lcl_MemberEmpty(aResult) && bIsDataLayout; +if (!bSkip) { ScDPOutLevelData tmp(nDim, nHierarchy, nLev, nDimPos, nNumFmt, aResult, aName, aCaption, bHasHiddenMember, bIsDataLayout, false); commit 0d38ec8443312398f81aa1eac57e97211018022d Author: Luigi Iucci AuthorDate: Wed Jun 21 10:16:16 2023 +0200 Commit: Aron Budea CommitDate: Tue Jul 4 12:52:47 2023 +0200 problem pasting to calc an image copied from firefox (windows) Calc tries to paste the image as html. In case both HTML_SIMPLE and BITMAP flavors are present in the clipboard, we paste as BITMAP Change-Id: I2527bedf11eb6986b58329acaf360a397af03101 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153614 Tested-by: Jenkins Reviewed-by: Henry Castro (cherry picked from commit 46fa17b70db0d543518dde52908f46c85838ac12) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153668 Reviewed-by: Xisco Fauli
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/qa sc/source
sc/qa/unit/helper/qahelper.cxx | 38 ++ sc/source/core/data/dpoutput.cxx |6 +- 2 files changed, 43 insertions(+), 1 deletion(-) New commits: commit 021712f9500910c3433360ec54d35f3564f540ce Author: luigiiucci AuthorDate: Wed May 17 11:02:37 2023 +0200 Commit: Tomaž Vajngerl CommitDate: Thu Jun 29 04:52:40 2023 +0200 Header columns can disappear with filtered data in pivot tables When we set on a pivot table a filter that filters all the rows, the pivot table showed only the first header columns and computed column, but all the columns headers should still be shown so we can adjust the filter for the column. This fixes this issue. Also add more debug output and prevent a crash when running pivot table tests. Change-Id: I30b4ee72cf8436c4522ab4ba0781462b214816dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151871 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl (cherry picked from commit 3551d18404cb19cdaa8edb170a549f5c5405d0cb) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153686 Tested-by: Jenkins CollaboraOffice diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index f9c7af04a813..d21571def5a3 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include @@ -404,6 +405,43 @@ bool checkOutput( svl::GridPrinter printer(e.Row() - s.Row() + 1, e.Col() - s.Col() + 1, CALC_DEBUG_OUTPUT != 0); SCROW nOutRowSize = e.Row() - s.Row() + 1; SCCOL nOutColSize = e.Col() - s.Col() + 1; + +// Check if expected size iz smaller than actual size (and prevent a crash) +if (aCheck.size() < o3tl::make_unsigned(nOutRowSize) || aCheck[0].size() < o3tl::make_unsigned(nOutColSize)) +{ +// Dump the arrays to console, so we can compare +std::cout << "Expected data:" << std::endl; +for (size_t nRow = 0; nRow < aCheck.size(); ++nRow) +{ +for (size_t nCol = 0; nCol < aCheck[nRow].size(); ++nCol) +{ +const char* p = aCheck[nRow][nCol]; +if (p) +{ +OUString aCheckVal = OUString::createFromAscii(p); +std::cout << "'" << aCheckVal << "', "; +} +else +std::cout << "null, "; +} +std::cout << std::endl; +} + +std::cout << "Actual data:" << std::endl; +for (SCROW nRow = 0; nRow < nOutRowSize; ++nRow) +{ +for (SCCOL nCol = 0; nCol < nOutColSize; ++nCol) +{ +OUString aVal = pDoc->GetString(nCol + s.Col(), nRow + s.Row(), s.Tab()); +std::cout << "'" << aVal << "', "; +} +std::cout << std::endl; +} +std::cout << std::endl; + +return false; +} + for (SCROW nRow = 0; nRow < nOutRowSize; ++nRow) { for (SCCOL nCol = 0; nCol < nOutColSize; ++nCol) diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx index 301e2c83ba4f..ff4335a81420 100644 --- a/sc/source/core/data/dpoutput.cxx +++ b/sc/source/core/data/dpoutput.cxx @@ -608,7 +608,11 @@ ScDPOutput::ScDPOutput( ScDocument* pD, uno::Reference aResult = xLevRes->getResults(); ++nRowDims; -if (!lcl_MemberEmpty(aResult)) +// We want only to remove the DATA column if it is empty +// and not any other empty columns (to still show the +// header columns) +bool bSkip = lcl_MemberEmpty(aResult) && bIsDataLayout; +if (!bSkip) { bool bFieldCompact = false; try
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sc/qa sc/source
sc/qa/unit/helper/qahelper.cxx | 38 ++ sc/source/core/data/dpoutput.cxx |6 +- 2 files changed, 43 insertions(+), 1 deletion(-) New commits: commit 09d0898b358b368fbe644eb5acbcfdab4af58751 Author: luigiiucci AuthorDate: Wed May 17 11:02:37 2023 +0200 Commit: Tomaž Vajngerl CommitDate: Wed Jun 28 06:46:05 2023 +0200 Header columns can disappear with filtered data in pivot tables When we set on a pivot table a filter that filters all the rows, the pivot table showed only the first header columns and computed column, but all the columns headers should still be shown so we can adjust the filter for the column. This fixes this issue. Also add more debug output and prevent a crash when running pivot table tests. Change-Id: I30b4ee72cf8436c4522ab4ba0781462b214816dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151871 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl (cherry picked from commit 3551d18404cb19cdaa8edb170a549f5c5405d0cb) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153692 diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index efb2e68c4fbc..82227ec12006 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -38,6 +38,7 @@ #include #include #include +#include #include @@ -481,6 +482,43 @@ bool checkOutput( svl::GridPrinter printer(e.Row() - s.Row() + 1, e.Col() - s.Col() + 1, CALC_DEBUG_OUTPUT != 0); SCROW nOutRowSize = e.Row() - s.Row() + 1; SCCOL nOutColSize = e.Col() - s.Col() + 1; + +// Check if expected size iz smaller than actual size (and prevent a crash) +if (aCheck.size() < o3tl::make_unsigned(nOutRowSize) || aCheck[0].size() < o3tl::make_unsigned(nOutColSize)) +{ +// Dump the arrays to console, so we can compare +std::cout << "Expected data:" << std::endl; +for (size_t nRow = 0; nRow < aCheck.size(); ++nRow) +{ +for (size_t nCol = 0; nCol < aCheck[nRow].size(); ++nCol) +{ +const char* p = aCheck[nRow][nCol]; +if (p) +{ +OUString aCheckVal = OUString::createFromAscii(p); +std::cout << "'" << aCheckVal << "', "; +} +else +std::cout << "null, "; +} +std::cout << std::endl; +} + +std::cout << "Actual data:" << std::endl; +for (SCROW nRow = 0; nRow < nOutRowSize; ++nRow) +{ +for (SCCOL nCol = 0; nCol < nOutColSize; ++nCol) +{ +OUString aVal = pDoc->GetString(nCol + s.Col(), nRow + s.Row(), s.Tab()); +std::cout << "'" << aVal << "', "; +} +std::cout << std::endl; +} +std::cout << std::endl; + +return false; +} + for (SCROW nRow = 0; nRow < nOutRowSize; ++nRow) { for (SCCOL nCol = 0; nCol < nOutColSize; ++nCol) diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx index 00d8f2aabeb4..c964dda14c7a 100644 --- a/sc/source/core/data/dpoutput.cxx +++ b/sc/source/core/data/dpoutput.cxx @@ -608,7 +608,11 @@ ScDPOutput::ScDPOutput( ScDocument* pD, uno::Reference aResult = xLevRes->getResults(); ++nRowDims; -if (!lcl_MemberEmpty(aResult)) +// We want only to remove the DATA column if it is empty +// and not any other empty columns (to still show the +// header columns) +bool bSkip = lcl_MemberEmpty(aResult) && bIsDataLayout; +if (!bSkip) { bool bFieldCompact = false; try
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/helper/qahelper.cxx | 38 ++ sc/source/core/data/dpoutput.cxx |6 +- 2 files changed, 43 insertions(+), 1 deletion(-) New commits: commit 3551d18404cb19cdaa8edb170a549f5c5405d0cb Author: luigiiucci AuthorDate: Wed May 17 11:02:37 2023 +0200 Commit: Tomaž Vajngerl CommitDate: Wed Jun 28 02:07:03 2023 +0200 Header columns can disappear with filtered data in pivot tables When we set on a pivot table a filter that filters all the rows, the pivot table showed only the first header columns and computed column, but all the columns headers should still be shown so we can adjust the filter for the column. This fixes this issue. Also add more debug output and prevent a crash when running pivot table tests. Change-Id: I30b4ee72cf8436c4522ab4ba0781462b214816dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151871 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index 890a330f147d..eff2c62d9aeb 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -38,6 +38,7 @@ #include #include #include +#include #include @@ -481,6 +482,43 @@ bool checkOutput( svl::GridPrinter printer(e.Row() - s.Row() + 1, e.Col() - s.Col() + 1, CALC_DEBUG_OUTPUT != 0); SCROW nOutRowSize = e.Row() - s.Row() + 1; SCCOL nOutColSize = e.Col() - s.Col() + 1; + +// Check if expected size iz smaller than actual size (and prevent a crash) +if (aCheck.size() < o3tl::make_unsigned(nOutRowSize) || aCheck[0].size() < o3tl::make_unsigned(nOutColSize)) +{ +// Dump the arrays to console, so we can compare +std::cout << "Expected data:" << std::endl; +for (size_t nRow = 0; nRow < aCheck.size(); ++nRow) +{ +for (size_t nCol = 0; nCol < aCheck[nRow].size(); ++nCol) +{ +const char* p = aCheck[nRow][nCol]; +if (p) +{ +OUString aCheckVal = OUString::createFromAscii(p); +std::cout << "'" << aCheckVal << "', "; +} +else +std::cout << "null, "; +} +std::cout << std::endl; +} + +std::cout << "Actual data:" << std::endl; +for (SCROW nRow = 0; nRow < nOutRowSize; ++nRow) +{ +for (SCCOL nCol = 0; nCol < nOutColSize; ++nCol) +{ +OUString aVal = pDoc->GetString(nCol + s.Col(), nRow + s.Row(), s.Tab()); +std::cout << "'" << aVal << "', "; +} +std::cout << std::endl; +} +std::cout << std::endl; + +return false; +} + for (SCROW nRow = 0; nRow < nOutRowSize; ++nRow) { for (SCCOL nCol = 0; nCol < nOutColSize; ++nCol) diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx index 00d8f2aabeb4..c964dda14c7a 100644 --- a/sc/source/core/data/dpoutput.cxx +++ b/sc/source/core/data/dpoutput.cxx @@ -608,7 +608,11 @@ ScDPOutput::ScDPOutput( ScDocument* pD, uno::Reference aResult = xLevRes->getResults(); ++nRowDims; -if (!lcl_MemberEmpty(aResult)) +// We want only to remove the DATA column if it is empty +// and not any other empty columns (to still show the +// header columns) +bool bSkip = lcl_MemberEmpty(aResult) && bIsDataLayout; +if (!bSkip) { bool bFieldCompact = false; try
[Libreoffice-commits] core.git: vcl/source
vcl/source/gdi/embeddedfontshelper.cxx | 31 +-- 1 file changed, 29 insertions(+), 2 deletions(-) New commits: commit e7c885389bfb9387acf8a21ea38769e678a76aac Author: luigiiucci AuthorDate: Tue Jun 13 22:10:00 2023 +0200 Commit: خالد حسني CommitDate: Mon Jun 19 15:33:24 2023 +0200 tdf#155486 Adding fonts to .odt when there is "no perfect match" Problem does not seem to have any relation with .otf files management. Problem arises when: - we use a font with setting certain family/bold/italic/pitch values - we have this font installed, but we don't have a version with matching family/bold/italic/pitch In this case the "not a perfect match" fonts were not saved in the .odt Change-Id: Ie4e2b9c34b79ac99f03c57bed4fdc5f4d718dcc2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153007 Tested-by: Jenkins Reviewed-by: خالد حسني diff --git a/vcl/source/gdi/embeddedfontshelper.cxx b/vcl/source/gdi/embeddedfontshelper.cxx index aeb30aa20dee..afddbf41387c 100644 --- a/vcl/source/gdi/embeddedfontshelper.cxx +++ b/vcl/source/gdi/embeddedfontshelper.cxx @@ -261,6 +261,15 @@ OUString EmbeddedFontsHelper::fontFileUrl( std::u16string_view familyName, FontF graphics->GetDevFontList( ); std::unique_ptr< vcl::font::PhysicalFontFaceCollection > fontInfo( fonts.GetFontFaceCollection()); vcl::font::PhysicalFontFace* selected = nullptr; + +// Maybe we don't find the perfect match for the font. E.G. we have fonts with the same family name +// but not same bold or italic etc.. +// In this case we add all the fonts having the family name of tyhe used font: +// - we store all these fonts in familyNameFonts during loop +// - if we haven't found the perfect match we store all fonts in familyNameFonts +typedef std::vector FontList; +FontList familyNameFonts; + for( int i = 0; i < fontInfo->Count(); ++i ) @@ -288,11 +297,29 @@ OUString EmbeddedFontsHelper::fontFileUrl( std::u16string_view familyName, FontF { // Some fonts specify 'DONTKNOW' for some things, still a good match, if we don't find a better one. selected = f; } +// adding "not perfact match" to familyNameFonts vector +familyNameFonts.push_back(f); + } } -if( selected != nullptr ) + +// if we have found a perfect match we will add only "selected", otherwise all familyNameFonts +FontList fontsToAdd = (selected ? FontList(1, selected) : std::move(familyNameFonts)); + +for (vcl::font::PhysicalFontFace* f : fontsToAdd) { -auto aFontData(selected->GetRawFontData(0)); +if (!selected) { // recalculate file not for "not perfect match" +filename = OUString::Concat(familyName) + "_" + OUString::number(f->GetFamilyType()) + "_" + +OUString::number(f->GetItalic()) + "_" + OUString::number(f->GetWeight()) + "_" + +OUString::number(f->GetPitch()) + ".ttf"; // TODO is it always ttf? +url = path + filename; +if (osl::File(url).open(osl_File_OpenFlag_Read) == osl::File::E_None) // = exists() +{ +// File with contents of the font file already exists, assume it's been created by a previous call. +continue; +} +} +auto aFontData(f->GetRawFontData(0)); if (!aFontData.empty()) { auto data = aFontData.data();