cui/source/options/optchart.cxx | 11 -- sc/qa/unit/data/xlsx/tdf138601.xlsx |binary sc/qa/unit/subsequent_filters_test.cxx | 26 +++++ sc/source/filter/oox/condformatbuffer.cxx | 20 ++++ sc/source/ui/view/gridwin.cxx | 12 ++ sd/qa/unit/export-tests.cxx | 11 ++ svtools/source/control/valueset.cxx | 33 ++----- sw/source/core/access/accselectionhelper.cxx | 13 +- sw/source/core/doc/tblrwcl.cxx | 6 - sw/source/core/docnode/ndtbl.cxx | 22 +++- sw/source/core/undo/untbl.cxx | 3 sw/source/core/unocore/unotbl.cxx | 3 sw/source/ui/vba/vbadocumentproperties.cxx | 5 - sw/source/ui/vba/vbaselection.cxx | 5 - sw/source/uibase/app/docst.cxx | 7 + sw/source/uibase/shells/textsh1.cxx | 3 writerfilter/qa/cppunittests/dmapper/DomainMapper_Impl.cxx | 23 +++++ writerfilter/qa/cppunittests/dmapper/data/content-control-data-binding-color.docx |binary writerfilter/source/dmapper/DomainMapper_Impl.cxx | 7 + xmloff/source/draw/shapeexport.cxx | 45 ++++++++++ 20 files changed, 189 insertions(+), 66 deletions(-)
New commits: commit e53463191c851e81fd0798718c03e5ec7f56f2f5 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Wed Feb 15 17:06:33 2023 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Feb 16 13:18:08 2023 +0100 check GetFEShell() Similar to 24889135773204c6e3002dcb417c75ff1a99ccd0 "check GetEditShell()" These two crash reports might be related: - https://crashreport.libreoffice.org/stats/signature/SwView::GetDocShell() - https://crashreport.libreoffice.org/stats/signature/SwFEShell::UpdateTableStyleFormatting(SwTableNode%20*,bool,rtl::OUString%20const%20*) Change-Id: I7ce286f7be933b34af270abd11a4c9c4c58fe4a8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147114 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/source/core/access/accselectionhelper.cxx b/sw/source/core/access/accselectionhelper.cxx index 6bced3eaa053..fb56e71e35dd 100644 --- a/sw/source/core/access/accselectionhelper.cxx +++ b/sw/source/core/access/accselectionhelper.cxx @@ -89,8 +89,7 @@ void SwAccessibleSelectionHelper::selectAccessibleChild( // we can only select fly frames, so we ignore (should: return // false) all other attempts at child selection - SwFEShell* pFEShell = GetFEShell(); - if( pFEShell != nullptr ) + if (GetFEShell()) { const SdrObject *pObj = aChild.GetDrawObject(); if( pObj ) @@ -142,8 +141,7 @@ bool SwAccessibleSelectionHelper::isAccessibleChildSelected( // ... and compare to the currently selected frame bool bRet = false; - const SwFEShell* pFEShell = GetFEShell(); - if( pFEShell ) + if (const SwFEShell* pFEShell = GetFEShell()) { if ( aChild.GetSwFrame() != nullptr ) { @@ -172,7 +170,7 @@ void SwAccessibleSelectionHelper::selectAllAccessibleChildren( ) // the first we can select, and select it. SwFEShell* pFEShell = GetFEShell(); - if( !pFEShell ) + if (!pFEShell) return; std::list< SwAccessibleChild > aChildren; @@ -198,8 +196,7 @@ sal_Int64 SwAccessibleSelectionHelper::getSelectedAccessibleChildCount( ) sal_Int64 nCount = 0; // Only one frame can be selected at a time, and we only frames // for selectable children. - const SwFEShell* pFEShell = GetFEShell(); - if( pFEShell != nullptr ) + if (const SwFEShell* pFEShell = GetFEShell()) { const SwFlyFrame* pFlyFrame = pFEShell->GetSelectedFlyFrame(); if( pFlyFrame ) @@ -251,7 +248,7 @@ Reference<XAccessible> SwAccessibleSelectionHelper::getSelectedAccessibleChild( // be 0, and a selection must exist, otherwise we have to throw an // lang::IndexOutOfBoundsException SwFEShell* pFEShell = GetFEShell(); - if( nullptr == pFEShell ) + if (!pFEShell) throwIndexOutOfBoundsException(); SwAccessibleChild aChild; diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index d45457e138d7..3f8e46ea7fb0 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -506,7 +506,8 @@ bool SwTable::InsertCol( SwDoc& rDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, pPCD->AddRowCols( *this, rBoxes, nCnt, bBehind ); rDoc.UpdateCharts( GetFrameFormat()->GetName() ); - rDoc.GetDocShell()->GetFEShell()->UpdateTableStyleFormatting(); + if (SwFEShell* pFEShell = rDoc.GetDocShell()->GetFEShell()) + pFEShell->UpdateTableStyleFormatting(); return bRes; } @@ -624,7 +625,8 @@ bool SwTable::InsertRow_( SwDoc* pDoc, const SwSelBoxes& rBoxes, pPCD->AddRowCols( *this, rBoxes, nCnt, bBehind ); pDoc->UpdateCharts( GetFrameFormat()->GetName() ); - pDoc->GetDocShell()->GetFEShell()->UpdateTableStyleFormatting(pTableNd); + if (SwFEShell* pFEShell = pDoc->GetDocShell()->GetFEShell()) + pFEShell->UpdateTableStyleFormatting(pTableNd); return true; } diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 77f7a4d3e97c..55f47b780554 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -2081,7 +2081,8 @@ bool SwDoc::DeleteRowCol(const SwSelBoxes& rBoxes, RowColMode const eMode) getIDocumentContentOperations().DeleteSection( pTableNd ); } - GetDocShell()->GetFEShell()->UpdateTableStyleFormatting(); + if (SwFEShell* pFEShell = GetDocShell()->GetFEShell()) + pFEShell->UpdateTableStyleFormatting(); getIDocumentState().SetModified(); getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, SwNodeOffset(0) ); @@ -2115,7 +2116,8 @@ bool SwDoc::DeleteRowCol(const SwSelBoxes& rBoxes, RowColMode const eMode) bRet = rTable.DeleteSel( this, aSelBoxes, nullptr, pUndo.get(), true, true ); if (bRet) { - GetDocShell()->GetFEShell()->UpdateTableStyleFormatting(); + if (SwFEShell* pFEShell = GetDocShell()->GetFEShell()) + pFEShell->UpdateTableStyleFormatting(); getIDocumentState().SetModified(); getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, SwNodeOffset(0) ); @@ -2180,7 +2182,8 @@ bool SwDoc::SplitTable( const SwSelBoxes& rBoxes, bool bVert, sal_uInt16 nCnt, if (bRet) { - GetDocShell()->GetFEShell()->UpdateTableStyleFormatting(); + if (SwFEShell* pFEShell = GetDocShell()->GetFEShell()) + pFEShell->UpdateTableStyleFormatting(); getIDocumentState().SetModified(); getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, SwNodeOffset(0) ); @@ -3227,8 +3230,11 @@ void SwDoc::SplitTable( const SwPosition& rPos, SplitTable_HeadlineOption eHdlnM UpdateCharts( rTable.GetFrameFormat()->GetName() ); // update table style formatting of both the tables - GetDocShell()->GetFEShell()->UpdateTableStyleFormatting(pTNd); - GetDocShell()->GetFEShell()->UpdateTableStyleFormatting(pNew); + if (SwFEShell* pFEShell = GetDocShell()->GetFEShell()) + { + pFEShell->UpdateTableStyleFormatting(pTNd); + pFEShell->UpdateTableStyleFormatting(pNew); + } getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, SwNodeOffset(0) ); } @@ -3504,7 +3510,8 @@ bool SwDoc::MergeTable( const SwPosition& rPos, bool bWithPrev ) } if( bRet ) { - GetDocShell()->GetFEShell()->UpdateTableStyleFormatting(); + if (SwFEShell* pFEShell = GetDocShell()->GetFEShell()) + pFEShell->UpdateTableStyleFormatting(); getIDocumentState().SetModified(); getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, SwNodeOffset(0) ); @@ -4628,7 +4635,8 @@ void SwDoc::ChgTableStyle(const OUString& rName, const SwTableAutoFormat& rNewFo SwFrameFormat* pFrameFormat = &GetTableFrameFormat(i, true); SwTable* pTable = SwTable::FindTable(pFrameFormat); if (pTable->GetTableStyleName() == rName) - GetDocShell()->GetFEShell()->UpdateTableStyleFormatting(pTable->GetTableNode()); + if (SwFEShell* pFEShell = GetDocShell()->GetFEShell()) + pFEShell->UpdateTableStyleFormatting(pTable->GetTableNode()); } getIDocumentState().SetModified(); diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index 4621bb8d6e75..d1f8c380ccf9 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -1783,7 +1783,8 @@ void SwUndoTableNdsChg::UndoImpl(::sw::UndoRedoContext & rContext) // TL_CHART2: need to inform chart of probably changed cell names rDoc.UpdateCharts( pTableNd->GetTable().GetFrameFormat()->GetName() ); - rDoc.GetDocShell()->GetFEShell()->UpdateTableStyleFormatting(pTableNd); + if (SwFEShell* pFEShell = rDoc.GetDocShell()->GetFEShell()) + pFEShell->UpdateTableStyleFormatting(pTableNd); if( IsDelBox() ) m_nSttNode = pTableNd->GetIndex(); ClearFEShellTabCols(rDoc, nullptr); diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index f1d697a36c81..882251965686 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -2703,7 +2703,8 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName, const uno::An SwStyleNameMapper::FillUIName(sName, sName, SwGetPoolIdFromName::TabStyle); pTable->SetTableStyleName(sName); SwDoc* pDoc = pFormat->GetDoc(); - pDoc->GetDocShell()->GetFEShell()->UpdateTableStyleFormatting(pTable->GetTableNode()); + if (SwFEShell* pFEShell = pDoc->GetDocShell()->GetFEShell()) + pFEShell->UpdateTableStyleFormatting(pTable->GetTableNode()); } break; diff --git a/sw/source/ui/vba/vbadocumentproperties.cxx b/sw/source/ui/vba/vbadocumentproperties.cxx index 7b7c265591c5..6d5f06830f47 100644 --- a/sw/source/ui/vba/vbadocumentproperties.cxx +++ b/sw/source/ui/vba/vbadocumentproperties.cxx @@ -312,11 +312,8 @@ public: { if ( mpDocShell ) { - SwFEShell* pFEShell = mpDocShell->GetFEShell(); - if(pFEShell) - { + if (SwFEShell* pFEShell = mpDocShell->GetFEShell()) aReturn <<= pFEShell->GetLineCount(); - } } } else diff --git a/sw/source/ui/vba/vbaselection.cxx b/sw/source/ui/vba/vbaselection.cxx index 4a1e783dec34..d983bd2bd2a3 100644 --- a/sw/source/ui/vba/vbaselection.cxx +++ b/sw/source/ui/vba/vbaselection.cxx @@ -1115,11 +1115,8 @@ void SAL_CALL SwVbaSelection::SplitTable() SwDocShell* pDocShell = word::getDocShell( mxModel ); if( pDocShell ) { - SwFEShell* pFEShell = pDocShell->GetFEShell(); - if( pFEShell ) - { + if (SwFEShell* pFEShell = pDocShell->GetFEShell()) pFEShell->SplitTable( SplitTable_HeadlineOption::ContentCopy ); - } } } diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index b11599e576d5..436335302c7e 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -1346,9 +1346,12 @@ void SwDocShell::UpdateStyle(const OUString &rName, SfxStyleFamily nFamily, SwWr break; case SfxStyleFamily::Table: { - if(GetFEShell()->IsTableMode()) + if (SwFEShell* pFEShell = GetFEShell()) { - GetFEShell()->TableCursorToCursor(); + if(pFEShell->IsTableMode()) + { + pFEShell->TableCursorToCursor(); + } } SwTableAutoFormat aFormat(rName); if (pCurrWrtShell->GetTableAutoFormat(aFormat)) diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index e77f4c9893da..24e033c4aa32 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -1015,7 +1015,8 @@ void SwTextShell::Execute(SfxRequest &rReq) rWrtSh.ResetAttr( aAttribs ); // also clear the direct formatting flag inside SwTableBox(es) - GetView().GetDocShell()->GetFEShell()->UpdateTableStyleFormatting(nullptr, true); + if (SwFEShell* pFEShell = GetView().GetDocShell()->GetFEShell()) + pFEShell->UpdateTableStyleFormatting(nullptr, true); rReq.Done(); break; commit 2fc240967e2ec5cebd802b301f70215b6071ab01 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Wed Feb 15 14:20:02 2023 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Feb 16 13:18:07 2023 +0100 tdf#147258 DOCX import: fix bad char format w/ inline <w:sdt> and data binding The bugdoc had an inline SDT in placeholder mode, where the placeholder had a char style to define a red text color. This red color is not in Word, but it was in Writer. This went wrong with commit de90c192cb8f1f03a4028493d8bfe9a127a76b2a (sw content controls, plain text: enable DOCX filter with data binding, 2022-09-19), because previously we didn't map <w:sdt> to Writer content controls for plain text with data binding. Fix the problem by resetting the char style back to default when the value of the content control comes from data binding. Interestingly office.com renders the document the way Writer did previously, but let's try to match what desktop Word does, that's probably the reference for DOCX files. Change-Id: I7eccdb843d5ab63ccf573644c61832e2ef7dae14 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147088 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins (cherry picked from commit 1c45e1971cdd88f54a3cfb89622fdfa6fa8fcf31) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147073 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/writerfilter/qa/cppunittests/dmapper/DomainMapper_Impl.cxx b/writerfilter/qa/cppunittests/dmapper/DomainMapper_Impl.cxx index 728dd218cb65..359c051fb0df 100644 --- a/writerfilter/qa/cppunittests/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/qa/cppunittests/dmapper/DomainMapper_Impl.cxx @@ -301,6 +301,29 @@ CPPUNIT_TEST_FIXTURE(Test, testContentControlDateDataBinding) // i.e. the date was from document.xml, which is considered outdated. CPPUNIT_ASSERT_EQUAL(OUString("4/26/2012"), xParagraph->getString()); } + +CPPUNIT_TEST_FIXTURE(Test, testContentControlDataBindingColor) +{ + // Given a document with an inline content control with data binding, placeholder char color is + // set to red, when loading that document: + loadFromURL(u"content-control-data-binding-color.docx"); + + // Then make sure that the placeholder char color is not in the document, since data binding is + // active: + uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference<text::XText> xText = xTextDocument->getText(); + uno::Reference<text::XTextCursor> xCursor = xText->createTextCursor(); + xCursor->gotoEnd(/*bExpand=*/false); + xCursor->goLeft(/*nCount=*/1, /*bExpand=*/false); + uno::Reference<beans::XPropertySet> xCursorProps(xCursor, uno::UNO_QUERY); + Color nColor; + CPPUNIT_ASSERT(xCursorProps->getPropertyValue("CharColor") >>= nColor); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: rgba[ffffff00] + // - Actual : rgba[ff0000ff] + // i.e. the char color was red, not the default / automatic. + CPPUNIT_ASSERT_EQUAL(COL_AUTO, nColor); +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/qa/cppunittests/dmapper/data/content-control-data-binding-color.docx b/writerfilter/qa/cppunittests/dmapper/data/content-control-data-binding-color.docx new file mode 100644 index 000000000000..0aae9439209b Binary files /dev/null and b/writerfilter/qa/cppunittests/dmapper/data/content-control-data-binding-color.docx differ diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 655bb65ea13f..89208dbbfc78 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -910,6 +910,13 @@ void DomainMapper_Impl::PopSdt() { // Data binding has a value for us, prefer that over the in-document value. xCursor->setString(*oData); + + // Such value is always a plain text string, remove the char style of the placeholder. + uno::Reference<beans::XPropertyState> xPropertyState(xCursor, uno::UNO_QUERY); + if (xPropertyState.is()) + { + xPropertyState->setPropertyToDefault("CharStyleName"); + } } uno::Reference<text::XTextContent> xContentControl( commit c26ffec193fdec94fad73db748f4a36ab88923d7 Author: Tünde Tóth <toth.tu...@nisz.hu> AuthorDate: Fri Jan 27 09:55:40 2023 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Feb 16 13:18:07 2023 +0100 tdf#153179 ODP export regression: fix lost shape at missing object If the object is missing, it's still possible to keep its shape by exporting its preview graphic, as before the regression. Regression from commit adc042f95d3dbd65b778260025d59283146916e5 "tdf#124333 PPTX import: fix Z-order of embedded OLE objects". See also commit 907da02bf8b33c080538731864225b3c44251328 "tdf#152436 PPTX export regression: fix lost shape at missing object" Change-Id: I614730435a857c6cdf01d4cdfc525fc452dffa29 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146247 Tested-by: Jenkins Tested-by: László Németh <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> (cherry picked from commit da725dfe07f2cf10349772d1667591c4d6a6fe8a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146990 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index 9b5c73bd43f3..029ee7267054 100644 --- a/sd/qa/unit/export-tests.cxx +++ b/sd/qa/unit/export-tests.cxx @@ -102,6 +102,7 @@ public: void testTdf112126(); void testCellProperties(); void testUserTableStyles(); + void testTdf153179(); CPPUNIT_TEST_SUITE(SdExportTest); @@ -154,6 +155,7 @@ public: CPPUNIT_TEST(testTdf112126); CPPUNIT_TEST(testCellProperties); CPPUNIT_TEST(testUserTableStyles); + CPPUNIT_TEST(testTdf153179); CPPUNIT_TEST_SUITE_END(); virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override @@ -1847,6 +1849,15 @@ void SdExportTest::testUserTableStyles() CPPUNIT_ASSERT(xTableStyle->isUserDefined()); } +void SdExportTest::testTdf153179() +{ + createSdImpressDoc("pptx/ole-emf_min.pptx"); + saveAndReload("impress8"); + + // Check number of shapes after export. + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getPage(0)->getCount()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index 6e687e746ba4..c8d513d4e724 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -3011,6 +3011,51 @@ void XMLShapeExport::ImpExportOLE2Shape( mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED ); mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD ); } + else + { + // tdf#153179 Export the preview graphic of the object if the object is missing. + uno::Reference<graphic::XGraphic> xGraphic; + xPropSet->getPropertyValue("Graphic") >>= xGraphic; + + if (xGraphic.is()) + { + OUString aMimeType; + const OUString aHref = mrExport.AddEmbeddedXGraphic(xGraphic, aMimeType); + + if (aMimeType.isEmpty()) + mrExport.GetGraphicMimeTypeFromStream(xGraphic, aMimeType); + + if (!aHref.isEmpty()) + { + mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, aHref); + mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE); + mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED); + mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD); + } + + if (!aMimeType.isEmpty() + && GetExport().getSaneDefaultVersion() > SvtSaveOptions::ODFSVER_012) + { // ODF 1.3 OFFICE-3943 + mrExport.AddAttribute(SvtSaveOptions::ODFSVER_013 + <= GetExport().getSaneDefaultVersion() + ? XML_NAMESPACE_DRAW + : XML_NAMESPACE_LO_EXT, + "mime-type", aMimeType); + } + + SvXMLElementExport aImageElem(mrExport, XML_NAMESPACE_DRAW, XML_IMAGE, true, + true); + + // optional office:binary-data + mrExport.AddEmbeddedXGraphicAsBase64(xGraphic); + + ImpExportEvents(xShape); + ImpExportGluePoints(xShape); + ImpExportDescription(xShape); + + return; + } + } } } commit 5dcf614748fcd4f12a12ee3eaba7a705b961bb8d Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Wed Feb 15 13:18:06 2023 +0000 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Feb 16 13:18:07 2023 +0100 tdf#153633 color description in chart colors options always black even in dark mode. There are some other visual glitches here, just erase the rendercontext before drawing to it. Change-Id: I487375614c654124e116c3e9f28d78bf7f87da4e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147072 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index 069379779d61..96f940555965 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -255,16 +255,8 @@ IMPL_LINK(ValueSet, ImplScrollHdl, weld::ScrolledWindow&, rScrollWin, void) void ValueSet::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) { - if (GetStyle() & WB_FLATVALUESET) - { - const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); - rRenderContext.SetLineColor(); - rRenderContext.SetFillColor(rStyleSettings.GetFaceColor()); - tools::Long nOffY = maVirDev->GetOutputSizePixel().Height(); - Size aWinSize(GetOutputSizePixel()); - rRenderContext.DrawRect(tools::Rectangle(Point(0, nOffY ), Point( aWinSize.Width(), aWinSize.Height()))); - } - + rRenderContext.SetBackground(Application::GetSettings().GetStyleSettings().GetFaceColor()); + rRenderContext.Erase(); ImplDraw(rRenderContext); } @@ -1515,22 +1507,17 @@ void ValueSet::ImplDrawItemText(vcl::RenderContext& rRenderContext, const OUStri tools::Long nTxtWidth = rRenderContext.GetTextWidth(rText); tools::Long nTxtOffset = mnTextOffset; + rRenderContext.Push(vcl::PushFlags::TEXTCOLOR); + // delete rectangle and show text - if (GetStyle() & WB_FLATVALUESET) - { - const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); - rRenderContext.SetLineColor(); - rRenderContext.SetFillColor(rStyleSettings.GetFaceColor()); - rRenderContext.DrawRect(tools::Rectangle(Point(0, nTxtOffset), Point(aWinSize.Width(), aWinSize.Height()))); - rRenderContext.SetTextColor(rStyleSettings.GetButtonTextColor()); - } - else - { + const bool bFlat(GetStyle() & WB_FLATVALUESET); + if (!bFlat) nTxtOffset += NAME_LINE_HEIGHT+NAME_LINE_OFF_Y; - rRenderContext.SetBackground(Application::GetSettings().GetStyleSettings().GetFaceColor()); - rRenderContext.Erase(tools::Rectangle(Point(0, nTxtOffset), Point(aWinSize.Width(), aWinSize.Height()))); - } + + rRenderContext.SetTextColor(Application::GetSettings().GetStyleSettings().GetButtonTextColor()); rRenderContext.DrawText(Point((aWinSize.Width() - nTxtWidth) / 2, nTxtOffset + (NAME_OFFSET / 2)), rText); + + rRenderContext.Pop(); } void ValueSet::StyleUpdated() commit 3656bf8d701e3712b8ce294d1ba571c8ea983701 Author: Tibor Nagy <nagy.tib...@nisz.hu> AuthorDate: Thu Feb 2 20:16:04 2023 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Feb 16 13:18:07 2023 +0100 tdf#138601 XLSX import: fix priority of conditional formatting rules Multiple conditional formattings can intersect or have the same range of cell with different rules. Without sorting the rules by their priority, the cells got bad formatting, e.g. different colors than what was set in MSO. Change-Id: I619359877f1a3e55fc8f895d5ba6f0f4f30e07f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146513 Tested-by: Jenkins Tested-by: László Németh <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> (cherry picked from commit 8c9a6abf30e9ff1ebd5647f7c271e0d64643860a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147057 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sc/qa/unit/data/xlsx/tdf138601.xlsx b/sc/qa/unit/data/xlsx/tdf138601.xlsx new file mode 100644 index 000000000000..81107ee09c30 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf138601.xlsx differ diff --git a/sc/qa/unit/subsequent_filters_test.cxx b/sc/qa/unit/subsequent_filters_test.cxx index fd0aa159467b..c080942d486d 100644 --- a/sc/qa/unit/subsequent_filters_test.cxx +++ b/sc/qa/unit/subsequent_filters_test.cxx @@ -78,6 +78,7 @@ public: ScFiltersTest(); //ods, xls, xlsx filter tests + void testTdf138601_CondFormatXLSX(); void testContentODS(); void testContentXLS(); void testContentXLSX(); @@ -209,6 +210,7 @@ public: void testForcepoint107(); CPPUNIT_TEST_SUITE(ScFiltersTest); + CPPUNIT_TEST(testTdf138601_CondFormatXLSX); CPPUNIT_TEST(testContentODS); CPPUNIT_TEST(testContentXLS); CPPUNIT_TEST(testContentXLSX); @@ -419,6 +421,30 @@ void testContentImpl(ScDocument& rDoc, bool bCheckMergedCells) } } +void ScFiltersTest::testTdf138601_CondFormatXLSX() +{ + createScDoc("xlsx/tdf138601.xlsx"); + + ScDocument* pDoc = getScDoc(); + ScConditionalFormat* pFormat1 = pDoc->GetCondFormat(0, 0, 0); + const ScFormatEntry* pEntry1 = pFormat1->GetEntry(0); + const ScColorScaleFormat* pColorScale1 = static_cast<const ScColorScaleFormat*>(pEntry1); + const ScColorScaleEntry* pColorScaleEntry1 = pColorScale1->GetEntry(0); + CPPUNIT_ASSERT_EQUAL(Color(255, 255, 201), pColorScaleEntry1->GetColor()); + + ScConditionalFormat* pFormat2 = pDoc->GetCondFormat(1, 0, 0); + const ScFormatEntry* pEntry2 = pFormat2->GetEntry(0); + const ScColorScaleFormat* pColorScale2 = static_cast<const ScColorScaleFormat*>(pEntry2); + const ScColorScaleEntry* pColorScaleEntry2 = pColorScale2->GetEntry(0); + CPPUNIT_ASSERT_EQUAL(Color(255, 139, 139), pColorScaleEntry2->GetColor()); + + ScConditionalFormat* pFormat3 = pDoc->GetCondFormat(0, 1, 0); + const ScFormatEntry* pEntry3 = pFormat3->GetEntry(0); + const ScColorScaleFormat* pColorScale3 = static_cast<const ScColorScaleFormat*>(pEntry3); + const ScColorScaleEntry* pColorScaleEntry3 = pColorScale3->GetEntry(0); + CPPUNIT_ASSERT_EQUAL(Color(255, 255, 201), pColorScaleEntry3->GetColor()); +} + void ScFiltersTest::testContentODS() { createScDoc("ods/universal-content.ods"); diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx index 87b47456ab97..1abb3bf91938 100644 --- a/sc/source/filter/oox/condformatbuffer.cxx +++ b/sc/source/filter/oox/condformatbuffer.cxx @@ -1163,6 +1163,26 @@ void CondFormatBuffer::finalizeImport() ++nExtCFIndex; } + // tdf#138601 sort conditional formatting rules by their priority + if (maCondFormats.size() > 1) + { + size_t minIndex; + for (size_t i = 0; i < maCondFormats.size() - 1; ++i) + { + minIndex = i; + for (size_t j = i + 1; j < maCondFormats.size(); ++j) + { + if (maCondFormats[j]->maRules.begin()->first + < maCondFormats[minIndex]->maRules.begin()->first) + { + minIndex = j; + } + } + if (i != minIndex) + std::swap(maCondFormats[i], maCondFormats[minIndex]); + } + } + for( const auto& rxCondFormat : maCondFormats ) { if ( rxCondFormat) commit 7715d9a36f85217aecf5eecf1624be4dd53e8002 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Feb 15 11:30:01 2023 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Feb 16 13:18:07 2023 +0100 tdf#153172 Options > Charts > Default Colors no longer persistent regression from commit b95142c11e80c58b70dff68bfd7f3792657b9ee2 Author: Noel Grandin <noelgran...@gmail.com> Date: Mon Jun 20 19:17:00 2022 +0200 tdf#58134 Reset Button in Options Dialogs Change-Id: Idef9880e29c322ae2d11641354baf8a241fc7fb0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147049 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> (cherry picked from commit 9d6c5f13ff031c18d3c117e4de212e2550d24e8c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147061 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/cui/source/options/optchart.cxx b/cui/source/options/optchart.cxx index 9b1e6c9c92f2..af9b92322802 100644 --- a/cui/source/options/optchart.cxx +++ b/cui/source/options/optchart.cxx @@ -157,16 +157,7 @@ bool SvxDefaultColorOptPage::FillItemSet( SfxItemSet* rOutAttrs ) void SvxDefaultColorOptPage::Reset( const SfxItemSet* ) { - if( m_SvxChartColorTableUniquePtr ) - { - m_SvxChartColorTableUniquePtr->useDefault(); - - FillBoxChartColorLB(); - - m_xLbChartColors->grab_focus(); - m_xLbChartColors->select( 0 ); - m_xPBRemove->set_sensitive(true); - } + m_xLbChartColors->select( 0 ); } void SvxDefaultColorOptPage::FillPaletteLB() commit 28e71446d75e583ba128261731a19cacd33720d6 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Feb 14 21:25:45 2023 +0000 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Feb 16 13:18:06 2023 +0100 Resolves: tdf#153622 crash in SvListView::SelectListEntry probably since: commit 4c8b1fa44d4f49510d3910981e649dcb08bceb36 Date: Fri Oct 28 13:15:00 2022 -0400 tdf#151794 sc validate: honor NO_BLANK in Cell range dropdown Change-Id: Id6752126c0c8df8d813bc862e5533d05bba1b622 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146992 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index ca863a848a38..1ec9d1ac45f2 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -1432,6 +1432,14 @@ void ScGridWindow::LaunchDataSelectMenu(const SCCOL nCol, const SCROW nRow) std::vector<ScTypedStrData> aStrings; // case sensitive // Fill List rDoc.GetDataEntries(nCol, nRow, nTab, aStrings, true /* bValidation */); + + // IsIgnoreBlank allows blank values. Don't add empty string unless "Allow Empty Cells" + if (pData && !pData->IsIgnoreBlank()) + { + auto lambda = [](const ScTypedStrData& rStr) { return rStr.GetString().isEmpty(); }; + aStrings.erase(std::remove_if(aStrings.begin(), aStrings.end(), lambda), aStrings.end()); + } + if (aStrings.empty()) bEmpty = true; @@ -1447,10 +1455,8 @@ void ScGridWindow::LaunchDataSelectMenu(const SCCOL nCol, const SCROW nRow) for (const auto& rString : aStrings) { - // 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); + rFilterBox.append_text(rFilterString); } if (bWait)