svx/source/dialog/TableStylesDlg.cxx | 96 ++++++++++++++++++----------------- 1 file changed, 50 insertions(+), 46 deletions(-)
New commits: commit 9c516d4928b2f20d96e1cb0eee6603f934b9ead7 Author: Xisco Fauli <[email protected]> AuthorDate: Thu Feb 5 10:05:39 2026 +0100 Commit: Xisco Fauli <[email protected]> CommitDate: Thu Feb 5 12:15:29 2026 +0100 svx: flatten lcl_GetDefaultFontHeight Change-Id: I09833de48d083c426300ee071e8874f3eb56a56b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198727 Tested-by: Jenkins Reviewed-by: Xisco Fauli <[email protected]> diff --git a/svx/source/dialog/TableStylesDlg.cxx b/svx/source/dialog/TableStylesDlg.cxx index 055c16720c11..9148ac0358ce 100644 --- a/svx/source/dialog/TableStylesDlg.cxx +++ b/svx/source/dialog/TableStylesDlg.cxx @@ -50,63 +50,63 @@ static void lcl_GetDefaultFontHeight(OUString& sName, OUString& sSize) uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(pDocSh->GetModel(), uno::UNO_QUERY); - if (xStyleFamiliesSupplier.is()) + if (!xStyleFamiliesSupplier.is()) + return; + + uno::Reference<container::XNameAccess> xStyleFamilies + = xStyleFamiliesSupplier->getStyleFamilies(); + + // Use CellStyles for Calc and ParagraphStyles for Writer + if (xStyleFamilies->hasByName(u"CellStyles"_ustr)) { - uno::Reference<container::XNameAccess> xStyleFamilies - = xStyleFamiliesSupplier->getStyleFamilies(); + uno::Reference<container::XNameAccess> xCellStyles; + xStyleFamilies->getByName(u"CellStyles"_ustr) >>= xCellStyles; - // Use CellStyles for Calc and ParagraphStyles for Writer - if (xStyleFamilies->hasByName(u"CellStyles"_ustr)) + if (xCellStyles->hasByName(u"Text"_ustr)) { - uno::Reference<container::XNameAccess> xCellStyles; - xStyleFamilies->getByName(u"CellStyles"_ustr) >>= xCellStyles; + uno::Reference<beans::XPropertySet> xProps; + xCellStyles->getByName(u"Text"_ustr) >>= xProps; - if (xCellStyles->hasByName(u"Text"_ustr)) + if (xProps.is()) { - uno::Reference<beans::XPropertySet> xProps; - xCellStyles->getByName(u"Text"_ustr) >>= xProps; - - if (xProps.is()) - { - OUString sFontName; - xProps->getPropertyValue(u"CharFontName"_ustr) >>= sFontName; - if (!sFontName.isEmpty()) - sName = sFontName; - - float fSize = 0; - xProps->getPropertyValue(u"CharHeight"_ustr) >>= fSize; - if (fSize > 0) - sSize = OUString::number(static_cast<int>(fSize)) + u" pt"_ustr; - - return; - } + OUString sFontName; + xProps->getPropertyValue(u"CharFontName"_ustr) >>= sFontName; + if (!sFontName.isEmpty()) + sName = sFontName; + + float fSize = 0; + xProps->getPropertyValue(u"CharHeight"_ustr) >>= fSize; + if (fSize > 0) + sSize = OUString::number(static_cast<int>(fSize)) + u" pt"_ustr; + + return; } } + } + + if (xStyleFamilies->hasByName(u"ParagraphStyles"_ustr)) + { + uno::Reference<container::XNameAccess> xParaStyles; + xStyleFamilies->getByName(u"ParagraphStyles"_ustr) >>= xParaStyles; - if (xStyleFamilies->hasByName(u"ParagraphStyles"_ustr)) + if (xParaStyles->hasByName(u"Table Contents"_ustr)) { - uno::Reference<container::XNameAccess> xParaStyles; - xStyleFamilies->getByName(u"ParagraphStyles"_ustr) >>= xParaStyles; + uno::Reference<beans::XPropertySet> xProps; + xParaStyles->getByName(u"Table Contents"_ustr) >>= xProps; - if (xParaStyles->hasByName(u"Table Contents"_ustr)) + if (xProps.is()) { - uno::Reference<beans::XPropertySet> xProps; - xParaStyles->getByName(u"Table Contents"_ustr) >>= xProps; - - if (xProps.is()) - { - OUString sFontName; - xProps->getPropertyValue(u"CharFontName"_ustr) >>= sFontName; - if (!sFontName.isEmpty()) - sName = sFontName; - - float fSize = 0; - xProps->getPropertyValue(u"CharHeight"_ustr) >>= fSize; - if (fSize > 0) - sSize = OUString::number(static_cast<int>(fSize)) + u" pt"_ustr; - - return; - } + OUString sFontName; + xProps->getPropertyValue(u"CharFontName"_ustr) >>= sFontName; + if (!sFontName.isEmpty()) + sName = sFontName; + + float fSize = 0; + xProps->getPropertyValue(u"CharHeight"_ustr) >>= fSize; + if (fSize > 0) + sSize = OUString::number(static_cast<int>(fSize)) + u" pt"_ustr; + + return; } } } commit 212b58bb0d0e5cf1a69a84807f4411d79f85cf70 Author: Xisco Fauli <[email protected]> AuthorDate: Thu Feb 5 10:04:11 2026 +0100 Commit: Xisco Fauli <[email protected]> CommitDate: Thu Feb 5 12:15:22 2026 +0100 svx: fix warning C6011: Dereferencing NULL pointer 'pDocSh' After commit 4fb31ea85f94c0cffba2282a119811833e584570 Author: Karthik <[email protected]> Date: Wed Aug 20 15:46:47 2025 +0530 tdf#105933 GSoC: New Dialog to Edit Table Styles Change-Id: I84a87407f50a913556ad1f493f53655bb1f689e3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198726 Tested-by: Jenkins Reviewed-by: Xisco Fauli <[email protected]> diff --git a/svx/source/dialog/TableStylesDlg.cxx b/svx/source/dialog/TableStylesDlg.cxx index 5232204f201f..055c16720c11 100644 --- a/svx/source/dialog/TableStylesDlg.cxx +++ b/svx/source/dialog/TableStylesDlg.cxx @@ -43,6 +43,10 @@ static void lcl_GetDefaultFontHeight(OUString& sName, OUString& sSize) { using namespace css; SfxObjectShell* pDocSh = SfxObjectShell::Current(); + + if (!pDocSh) + return; + uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(pDocSh->GetModel(), uno::UNO_QUERY);
