oox/source/drawingml/table/tableproperties.cxx | 106 ++++++++++++++----------- 1 file changed, 61 insertions(+), 45 deletions(-)
New commits: commit 8cd958a48e93efa4c21fd7687652ded8f9432c84 Author: Tor Lillqvist <t...@collabora.com> Date: Thu Oct 26 23:30:42 2017 +0300 Add a comment in CreateTableStyle() related to the AOO fix for #i120723# Change-Id: Ic2eadf1942927efb6a6b209db591e869b61362f4 diff --git a/oox/source/drawingml/table/tableproperties.cxx b/oox/source/drawingml/table/tableproperties.cxx index a20191e05633..e5bc4f0cc3d5 100644 --- a/oox/source/drawingml/table/tableproperties.cxx +++ b/oox/source/drawingml/table/tableproperties.cxx @@ -144,6 +144,22 @@ static void SetTableStyleProperties(TableStyle* &pTableStyle , sal_Int32 tblFill TableStyle* CreateTableStyle(const OUString& styleId) { TableStyle* pTableStyle = nullptr; + + // It is a bit silly to handle styleIds specifically and separately like this. Also note that + // the first two code blocks below are mostly copy-pasted, modulo the comments and the fact that + // one uses XML_accent1 and the other XML_accent2. Presumably it would be better to use a + // table-based approach, to have a mapping from style ids to the parameters that actually change + // between styles. See + // https://msdn.microsoft.com/en-us/library/office/hh273476(v=office.14).aspx for an unofficial + // list of these ids (that is said on that page to be undocumented, which doesn't sound credible?). + + // But the odd thing is that even if the code here handles only three specific style ids, if I + // edit the bug doc from AOO bug #i120723# (for which this code was added) and choose some other + // style, the table shows up mostly fine in Impress anyway. Thus I wonder whether this whole + // code is actually unnecessary, and the .pptx contains explicit values for all the components + // of a style anyway, and LibreOffice's code (at least now, maybe not when this code was added + // to AOO in 2012) knows to look at that? + if(styleId == "{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}") { //Medium Style 2 Accent 1 pTableStyle = new TableStyle(); //first row style commit 84eb42728a3ceedaac382a8212230e3960732c41 Author: Tor Lillqvist <t...@collabora.com> Date: Thu Oct 26 22:00:57 2017 +0300 Don't abbreviate "First" as "Fst" Change-Id: I16726fbc8bf4f67fe1018d54437d59b715738bfe diff --git a/oox/source/drawingml/table/tableproperties.cxx b/oox/source/drawingml/table/tableproperties.cxx index cee8df58dc5b..a20191e05633 100644 --- a/oox/source/drawingml/table/tableproperties.cxx +++ b/oox/source/drawingml/table/tableproperties.cxx @@ -148,65 +148,65 @@ TableStyle* CreateTableStyle(const OUString& styleId) pTableStyle = new TableStyle(); //first row style //fill color and type - oox::drawingml::FillPropertiesPtr pFstRowFillProperties( new oox::drawingml::FillProperties ); - pFstRowFillProperties->moFillType.set(XML_solidFill); - pFstRowFillProperties->maFillColor.setSchemeClr(XML_accent1); - pTableStyle->getFirstRow().getFillProperties() = pFstRowFillProperties; + oox::drawingml::FillPropertiesPtr pFirstRowFillProperties( new oox::drawingml::FillProperties ); + pFirstRowFillProperties->moFillType.set(XML_solidFill); + pFirstRowFillProperties->maFillColor.setSchemeClr(XML_accent1); + pTableStyle->getFirstRow().getFillProperties() = pFirstRowFillProperties; //text color - ::oox::drawingml::Color fstRowTextColor; - fstRowTextColor.setSchemeClr(XML_lt1); - pTableStyle->getFirstRow().getTextColor() = fstRowTextColor; + ::oox::drawingml::Color firstRowTextColor; + firstRowTextColor.setSchemeClr(XML_lt1); + pTableStyle->getFirstRow().getTextColor() = firstRowTextColor; //bottom line border - oox::drawingml::LinePropertiesPtr pFstBottomBorder( new oox::drawingml::LineProperties); - pFstBottomBorder->moLineWidth = 38100; - pFstBottomBorder->moPresetDash = XML_sng; - pFstBottomBorder->maLineFill.moFillType.set(XML_solidFill); - pFstBottomBorder->maLineFill.maFillColor.setSchemeClr(XML_lt1); - pTableStyle->getFirstRow().getLineBorders().insert(std::pair<sal_Int32, ::oox::drawingml::LinePropertiesPtr>(XML_bottom,pFstBottomBorder)); + oox::drawingml::LinePropertiesPtr pFirstBottomBorder( new oox::drawingml::LineProperties); + pFirstBottomBorder->moLineWidth = 38100; + pFirstBottomBorder->moPresetDash = XML_sng; + pFirstBottomBorder->maLineFill.moFillType.set(XML_solidFill); + pFirstBottomBorder->maLineFill.maFillColor.setSchemeClr(XML_lt1); + pTableStyle->getFirstRow().getLineBorders().insert(std::pair<sal_Int32, ::oox::drawingml::LinePropertiesPtr>(XML_bottom,pFirstBottomBorder)); //last row style - pTableStyle->getLastRow().getFillProperties() = pFstRowFillProperties; - pTableStyle->getLastRow().getTextColor() = fstRowTextColor; - pTableStyle->getLastRow().getLineBorders().insert(std::pair<sal_Int32, ::oox::drawingml::LinePropertiesPtr>(XML_top,pFstBottomBorder)); + pTableStyle->getLastRow().getFillProperties() = pFirstRowFillProperties; + pTableStyle->getLastRow().getTextColor() = firstRowTextColor; + pTableStyle->getLastRow().getLineBorders().insert(std::pair<sal_Int32, ::oox::drawingml::LinePropertiesPtr>(XML_top,pFirstBottomBorder)); //first column style - pTableStyle->getFirstRow().getFillProperties() = pFstRowFillProperties; - pTableStyle->getFirstRow().getTextColor() = fstRowTextColor; + pTableStyle->getFirstRow().getFillProperties() = pFirstRowFillProperties; + pTableStyle->getFirstRow().getTextColor() = firstRowTextColor; //last column style - pTableStyle->getLastCol().getFillProperties() = pFstRowFillProperties; - pTableStyle->getLastCol().getTextColor() = fstRowTextColor; + pTableStyle->getLastCol().getFillProperties() = pFirstRowFillProperties; + pTableStyle->getLastCol().getTextColor() = firstRowTextColor; SetTableStyleProperties(pTableStyle, XML_accent1, XML_dk1, XML_lt1); } else if (styleId == "{21E4AEA4-8DFA-4A89-87EB-49C32662AFE0}") //Medium Style 2 Accent 2 { pTableStyle = new TableStyle(); - oox::drawingml::FillPropertiesPtr pFstRowFillProperties( new oox::drawingml::FillProperties ); - pFstRowFillProperties->moFillType.set(XML_solidFill); - pFstRowFillProperties->maFillColor.setSchemeClr(XML_accent2); - pTableStyle->getFirstRow().getFillProperties() = pFstRowFillProperties; - - ::oox::drawingml::Color fstRowTextColor; - fstRowTextColor.setSchemeClr(XML_lt1); - pTableStyle->getFirstRow().getTextColor() = fstRowTextColor; - - oox::drawingml::LinePropertiesPtr pFstBottomBorder( new oox::drawingml::LineProperties); - pFstBottomBorder->moLineWidth = 38100; - pFstBottomBorder->moPresetDash = XML_sng; - pFstBottomBorder->maLineFill.moFillType.set(XML_solidFill); - pFstBottomBorder->maLineFill.maFillColor.setSchemeClr(XML_lt1); - pTableStyle->getFirstRow().getLineBorders().insert(std::pair<sal_Int32, ::oox::drawingml::LinePropertiesPtr>(XML_bottom,pFstBottomBorder)); - - pTableStyle->getLastRow().getFillProperties() = pFstRowFillProperties; - pTableStyle->getLastRow().getTextColor() = fstRowTextColor; - pTableStyle->getLastRow().getLineBorders().insert(std::pair<sal_Int32, ::oox::drawingml::LinePropertiesPtr>(XML_top,pFstBottomBorder)); - - pTableStyle->getFirstCol().getFillProperties() = pFstRowFillProperties; - pTableStyle->getFirstCol().getTextColor() = fstRowTextColor; - - pTableStyle->getLastCol().getFillProperties() = pFstRowFillProperties; - pTableStyle->getLastCol().getTextColor() = fstRowTextColor; + oox::drawingml::FillPropertiesPtr pFirstRowFillProperties( new oox::drawingml::FillProperties ); + pFirstRowFillProperties->moFillType.set(XML_solidFill); + pFirstRowFillProperties->maFillColor.setSchemeClr(XML_accent2); + pTableStyle->getFirstRow().getFillProperties() = pFirstRowFillProperties; + + ::oox::drawingml::Color firstRowTextColor; + firstRowTextColor.setSchemeClr(XML_lt1); + pTableStyle->getFirstRow().getTextColor() = firstRowTextColor; + + oox::drawingml::LinePropertiesPtr pFirstBottomBorder( new oox::drawingml::LineProperties); + pFirstBottomBorder->moLineWidth = 38100; + pFirstBottomBorder->moPresetDash = XML_sng; + pFirstBottomBorder->maLineFill.moFillType.set(XML_solidFill); + pFirstBottomBorder->maLineFill.maFillColor.setSchemeClr(XML_lt1); + pTableStyle->getFirstRow().getLineBorders().insert(std::pair<sal_Int32, ::oox::drawingml::LinePropertiesPtr>(XML_bottom,pFirstBottomBorder)); + + pTableStyle->getLastRow().getFillProperties() = pFirstRowFillProperties; + pTableStyle->getLastRow().getTextColor() = firstRowTextColor; + pTableStyle->getLastRow().getLineBorders().insert(std::pair<sal_Int32, ::oox::drawingml::LinePropertiesPtr>(XML_top,pFirstBottomBorder)); + + pTableStyle->getFirstCol().getFillProperties() = pFirstRowFillProperties; + pTableStyle->getFirstCol().getTextColor() = firstRowTextColor; + + pTableStyle->getLastCol().getFillProperties() = pFirstRowFillProperties; + pTableStyle->getLastCol().getTextColor() = firstRowTextColor; SetTableStyleProperties(pTableStyle, XML_accent2, XML_dk1, XML_lt1); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits