offapi/com/sun/star/text/TextTable.idl | 6 ++++++ sw/inc/cmdid.h | 1 + sw/inc/unoprnms.hxx | 1 + sw/qa/python/check_table.py | 12 ++++++++++++ sw/source/core/unocore/unomap1.cxx | 1 + sw/source/core/unocore/unotbl.cxx | 22 ++++++++++++++++++++++ 6 files changed, 43 insertions(+)
New commits: commit fe10783e4abd5509676c777c7aa6f172ab3a8bf6 Author: Jakub Trzebiatowski <ubap....@gmail.com> Date: Mon May 30 22:07:04 2016 +0200 sw UNO API XTextTable add TableTemplateName property Change-Id: I8450fd4003ad5f9b082817765a2d44fc00dea15e Reviewed-on: https://gerrit.libreoffice.org/25688 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/offapi/com/sun/star/text/TextTable.idl b/offapi/com/sun/star/text/TextTable.idl index 23ff278..e47ad56 100644 --- a/offapi/com/sun/star/text/TextTable.idl +++ b/offapi/com/sun/star/text/TextTable.idl @@ -221,6 +221,12 @@ published service TextTable */ [optional, property] sequence<com::sun::star::beans::PropertyValue> TableInteropGrabBag; + /** contains the name of table style used by the table. + + @since LibreOffice 5.3 + */ + [optional, property] string TableTemplateName; + }; diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index 09cd1f4..94bbb0e 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -623,6 +623,7 @@ #define FN_UNO_REPLACEMENT_GRAPHIC_U_R_L (FN_EXTRA2 + 121) #define FN_UNO_HIDDEN (FN_EXTRA2 + 122) #define FN_UNO_STYLE_INTEROP_GRAB_BAG (FN_EXTRA2 + 123) +#define FN_UNO_TABLE_TEMPLATE_NAME (FN_EXTRA2 + 124) // Area: Help // Region: Traveling & Selection diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx index 63589f2..8a43709 100644 --- a/sw/inc/unoprnms.hxx +++ b/sw/inc/unoprnms.hxx @@ -306,6 +306,7 @@ #define UNO_NAME_SURROUND_CONTOUR "SurroundContour" #define UNO_NAME_SURROUND_ANCHORONLY "SurroundAnchorOnly" #define UNO_NAME_TABLE_NAME "TableName" +#define UNO_NAME_TABLE_TEMPLATE_NAME "TableTemplateName" #define UNO_NAME_TABSTOPS "ParaTabStops" #define UNO_NAME_TITLE "Title" #define UNO_NAME_TOP_MARGIN "TopMargin" diff --git a/sw/qa/python/check_table.py b/sw/qa/python/check_table.py index d718fb8..d766f91 100644 --- a/sw/qa/python/check_table.py +++ b/sw/qa/python/check_table.py @@ -482,6 +482,18 @@ class CheckTable(unittest.TestCase): self.assertEqual(xTable.getCellByPosition(0, 1).getValue(), 42307.0) xDoc.dispose() + def test_tableTemplate(self): + xDoc = CheckTable._uno.openEmptyWriterDoc() + xTable = xDoc.createInstance("com.sun.star.text.TextTable") + xTable.initialize(1, 1) + xTable.setPropertyValue("TableTemplateName", "Default") + self.assertEqual(xTable.getPropertyValue("TableTemplateName"), "Default") + xTable.setPropertyValue("TableTemplateName", "other_style") + self.assertEqual(xTable.getPropertyValue("TableTemplateName"), "other_style") + xTable.setPropertyValue("TableTemplateName", "") + self.assertEqual(xTable.getPropertyValue("TableTemplateName"), "") + xDoc.dispose() + if __name__ == '__main__': unittest.main() diff --git a/sw/source/core/unocore/unomap1.cxx b/sw/source/core/unocore/unomap1.cxx index 069a15f..c93effc 100644 --- a/sw/source/core/unocore/unomap1.cxx +++ b/sw/source/core/unocore/unomap1.cxx @@ -680,6 +680,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetTablePropertyMap() { OUString(UNO_NAME_WRITING_MODE), RES_FRAMEDIR, cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, 0 }, { OUString(UNO_NAME_TABLE_NAME), FN_UNO_TABLE_NAME, cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0 }, { OUString(UNO_NAME_PAGE_STYLE_NAME), RES_PAGEDESC, cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0}, + { OUString(UNO_NAME_TABLE_TEMPLATE_NAME), FN_UNO_TABLE_TEMPLATE_NAME, cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0 }, // #i29550# { OUString(UNO_NAME_COLLAPSING_BORDERS), RES_COLLAPSING_BORDERS, cppu::UnoType<bool>::get(), PROPERTY_NONE, 0}, REDLINE_NODE_PROPERTIES diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index eb1de8f..0ff7440 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -106,6 +106,8 @@ #include <comphelper/sequence.hxx> #include <comphelper/sequenceashashmap.hxx> #include <swtable.hxx> +#include <docsh.hxx> +#include <fesh.hxx> using namespace ::com::sun::star; using ::editeng::SvxBorderLine; @@ -2779,6 +2781,18 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName, const uno::An case FN_UNO_TABLE_COLUMN_RELATIVE_SUM:/*_readonly_*/ break; + case FN_UNO_TABLE_TEMPLATE_NAME: + { + SwTable* pTable = SwTable::FindTable(pFormat); + OUString sName; + if (!(aValue >>= sName)) + break; + pTable->SetTableStyleName(sName); + SwDoc* pDoc = pFormat->GetDoc(); + pDoc->GetDocShell()->GetFEShell()->UpdateTableStyleFormatting(pTable->GetTableNode()); + } + break; + default: { SwAttrSet aSet(pFormat->GetAttrSet()); @@ -3018,6 +3032,14 @@ uno::Any SwXTextTable::getPropertyValue(const OUString& rPropertyName) } break; + case FN_UNO_TABLE_TEMPLATE_NAME: + { + SwTable* pTable = SwTable::FindTable(pFormat); + OUString sName = pTable->GetTableStyleName(); + aRet <<= sName; + } + break; + default: { const SwAttrSet& rSet = pFormat->GetAttrSet(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits