diff options
author | Jakub Trzebiatowski <ubap.dev@gmail.com> | 2016-05-30 22:07:04 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-06-01 18:51:46 +0000 |
commit | fe10783e4abd5509676c777c7aa6f172ab3a8bf6 (patch) | |
tree | 1beaf7087faf523361ddcbbc191c64fe932f98d4 | |
parent | c14627d66ca8d9fe14272fadb5305857101f513e (diff) |
sw UNO API XTextTable add TableTemplateName property
Change-Id: I8450fd4003ad5f9b082817765a2d44fc00dea15e
Reviewed-on: https://gerrit.libreoffice.org/25688
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r-- | offapi/com/sun/star/text/TextTable.idl | 6 | ||||
-rw-r--r-- | sw/inc/cmdid.h | 1 | ||||
-rw-r--r-- | sw/inc/unoprnms.hxx | 1 | ||||
-rw-r--r-- | sw/qa/python/check_table.py | 12 | ||||
-rw-r--r-- | sw/source/core/unocore/unomap1.cxx | 1 | ||||
-rw-r--r-- | sw/source/core/unocore/unotbl.cxx | 22 |
6 files changed, 43 insertions, 0 deletions
diff --git a/offapi/com/sun/star/text/TextTable.idl b/offapi/com/sun/star/text/TextTable.idl index 23ff27870471..e47ad56c4aee 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 09cd1f48513c..94bbb0e6f287 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 63589f273ce5..8a437094f4f8 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 d718fb893d5e..d766f9159c97 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 069a15f69039..c93effc95184 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 eb1de8f06725..0ff7440d5a91 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(); |