diff options
author | Jakub Trzebiatowski <ubap.dev@gmail.com> | 2016-06-11 15:17:48 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-06-20 12:08:01 +0000 |
commit | 309bc35559cb823415139044272b10feccdb6ae7 (patch) | |
tree | 0a2533ae40f366e95c84c18b751a877340c0d407 /sw | |
parent | 7423629f0abec966bd9403800ca0bd5c96a8b3a6 (diff) |
GSoC Table Styles, Export Cell Styles
Exporting cell-styles
Exporting table-template
To be able to map SwTableAutoFormat to table-template 1:1
extended table-template by the following elements:
loext:first-row-even-column
loext:last-row-even-column
loext:first-row-end-column
loext:first-row-start-column
loext:last-row-end-column
loext:last-row-start-column
Added attributes describing box format to SwXTextCellStyle
Change-Id: I2967ba461dfc6f030c1e5cdbba62e2673d3b232b
Reviewed-on: https://gerrit.libreoffice.org/26185
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/unostyle.hxx | 7 | ||||
-rw-r--r-- | sw/qa/python/check_styles.py | 2 | ||||
-rw-r--r-- | sw/source/core/doc/tblafmt.cxx | 45 | ||||
-rw-r--r-- | sw/source/core/unocore/unomap.cxx | 14 | ||||
-rw-r--r-- | sw/source/core/unocore/unostyle.cxx | 40 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlfmte.cxx | 1 |
6 files changed, 97 insertions, 12 deletions
diff --git a/sw/inc/unostyle.hxx b/sw/inc/unostyle.hxx index cbb04f5c8c07..07311e8fa73e 100644 --- a/sw/inc/unostyle.hxx +++ b/sw/inc/unostyle.hxx @@ -272,6 +272,13 @@ class SwXTextTableStyle : public cppu::WeakImplHelper ODD_COLUMNS_STYLE, BODY_STYLE, BACKGROUND_STYLE, + // loext namespace + FIRST_ROW_START_COLUMN_STYLE, + FIRST_ROW_END_COLUMN_STYLE, + LAST_ROW_START_COLUMN_STYLE, + LAST_ROW_END_COLUMN_STYLE, + FIRST_ROW_EVEN_COLUMN_STYLE, + LAST_ROW_EVEN_COLUMN_STYLE, STYLE_COUNT }; diff --git a/sw/qa/python/check_styles.py b/sw/qa/python/check_styles.py index 7a3e80ea8b42..144082a1cdaa 100644 --- a/sw/qa/python/check_styles.py +++ b/sw/qa/python/check_styles.py @@ -206,7 +206,7 @@ class CheckStyle(unittest.TestCase): def test_CellFamily(self): xDoc = CheckStyle._uno.openEmptyWriterDoc() xCellStyles = xDoc.StyleFamilies["CellStyles"] - vEmptyDocStyles = ['Default Style.1', 'Default Style.2', 'Default Style.3', 'Default Style.4', 'Default Style.5', 'Default Style.6', 'Default Style.7', 'Default Style.8', 'Default Style.9', 'Default Style.10'] + vEmptyDocStyles = ['Default Style.1', 'Default Style.2', 'Default Style.3', 'Default Style.4', 'Default Style.5', 'Default Style.6', 'Default Style.7', 'Default Style.8', 'Default Style.9', 'Default Style.10', 'Default Style.11', 'Default Style.12', 'Default Style.13', 'Default Style.14', 'Default Style.15', 'Default Style.16'] self.__test_StyleFamily(xCellStyles, vEmptyDocStyles, "SwXTextCellStyle") self.__test_StyleFamilyIndex(xCellStyles, vEmptyDocStyles, "SwXTextCellStyle") self.__test_StyleFamilyInsert(xDoc, xCellStyles, vEmptyDocStyles, "com.sun.star.style.CellStyle", "com.sun.star.style.CharacterStyle") diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx index d5b623d11652..481f65f9c31d 100644 --- a/sw/source/core/doc/tblafmt.cxx +++ b/sw/source/core/doc/tblafmt.cxx @@ -1073,22 +1073,47 @@ OUString SwTableAutoFormat::GetTableTemplateCellSubName(const SwBoxAutoFormat& r return OUString(); } +/* + * Mapping schema + * 0 1 2 3 4 5 + * +-----------------------------------------------------------------------+ + * 0 | FRSC | FR | FREC | | | FRENC | + * +-----------------------------------------------------------------------+ + * 1 | FC | ER | EC | | | LC | + * +-----------------------------------------------------------------------+ + * 2 | OR | OC | BODY | | | BCKG | + * +-----------------------------------------------------------------------+ + * 3 | | | | | | | + * +-----------------------------------------------------------------------+ + * 4 | | | | | | | + * +-----------------------------------------------------------------------+ + * 5 | LRSC | LR | LRENC | | | LRENC | + * +-----------+-----------+-----------+-----------+-----------+-----------+ + * ODD = 1, 3, 5, ... + * EVEN = 2, 4, 6, ... + */ const std::vector<sal_Int32>& SwTableAutoFormat::GetTableTemplateMap() { static std::vector<sal_Int32>* pTableTemplateMap; if (!pTableTemplateMap) { pTableTemplateMap = new std::vector<sal_Int32>; - pTableTemplateMap->push_back(0); // FIRST_ROW - pTableTemplateMap->push_back(1); // LAST_ROW - pTableTemplateMap->push_back(2); // FIRST_COLUMN - pTableTemplateMap->push_back(3); // LAST_COLUMN - pTableTemplateMap->push_back(4); // EVEN_ROWS - pTableTemplateMap->push_back(5); // ODD_ROWS - pTableTemplateMap->push_back(6); // EVEN_COLUMNS - pTableTemplateMap->push_back(7); // ODD_COLUMNS - pTableTemplateMap->push_back(8); // BODY - pTableTemplateMap->push_back(9); // BACKGROUND + pTableTemplateMap->push_back(1 ); // FIRST_ROW // FR + pTableTemplateMap->push_back(13); // LAST_ROW // LR + pTableTemplateMap->push_back(4 ); // FIRST_COLUMN // FC + pTableTemplateMap->push_back(7 ); // LAST_COLUMN // LC + pTableTemplateMap->push_back(5 ); // EVEN_ROWS // ER + pTableTemplateMap->push_back(8 ); // ODD_ROWS // OR + pTableTemplateMap->push_back(6 ); // EVEN_COLUMNS // EC + pTableTemplateMap->push_back(9 ); // ODD_COLUMNS // OC + pTableTemplateMap->push_back(10); // BODY + pTableTemplateMap->push_back(11); // BACKGROUND // BCKG + pTableTemplateMap->push_back(0 ); // FIRST_ROW_START_COLUMN // FRSC + pTableTemplateMap->push_back(3 ); // FIRST_ROW_END_COLUMN // FRENC + pTableTemplateMap->push_back(12); // LAST_ROW_START_COLUMN // LRSC + pTableTemplateMap->push_back(15); // LAST_ROW_END_COLUMN // LRENC + pTableTemplateMap->push_back(2 ); // FIRST_ROW_EVEN_COLUMN // FREC + pTableTemplateMap->push_back(14); // LAST_ROW_EVEN_COLUMN // LREC } return *pTableTemplateMap; } diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx index 70594f4e68cc..7fe145dd08d8 100644 --- a/sw/source/core/unocore/unomap.cxx +++ b/sw/source/core/unocore/unomap.cxx @@ -1505,7 +1505,19 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s { static SfxItemPropertyMapEntry const aCellStyleMap[] = { - { OUString(UNO_NAME_BACK_COLOR), RES_BACKGROUND, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE , 0 }, + { OUString(UNO_NAME_BACK_COLOR), RES_BACKGROUND, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, 0 }, + { OUString(UNO_NAME_LEFT_BORDER), RES_BOX, cppu::UnoType<css::table::BorderLine>::get(), PROPERTY_NONE, LEFT_BORDER|CONVERT_TWIPS }, + { OUString(UNO_NAME_RIGHT_BORDER), RES_BOX, cppu::UnoType<css::table::BorderLine>::get(), PROPERTY_NONE, RIGHT_BORDER|CONVERT_TWIPS }, + { OUString(UNO_NAME_TOP_BORDER), RES_BOX, cppu::UnoType<css::table::BorderLine>::get(), PROPERTY_NONE, TOP_BORDER|CONVERT_TWIPS }, + { OUString(UNO_NAME_BOTTOM_BORDER), RES_BOX, cppu::UnoType<css::table::BorderLine>::get(), PROPERTY_NONE, BOTTOM_BORDER|CONVERT_TWIPS }, + { OUString(UNO_NAME_BORDER_DISTANCE), RES_BOX, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, BORDER_DISTANCE|CONVERT_TWIPS }, + { OUString(UNO_NAME_LEFT_BORDER_DISTANCE), RES_BOX, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, LEFT_BORDER_DISTANCE |CONVERT_TWIPS }, + { OUString(UNO_NAME_RIGHT_BORDER_DISTANCE), RES_BOX, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS }, + { OUString(UNO_NAME_TOP_BORDER_DISTANCE), RES_BOX, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, TOP_BORDER_DISTANCE |CONVERT_TWIPS }, + { OUString(UNO_NAME_BOTTOM_BORDER_DISTANCE), RES_BOX, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS }, + { OUString(UNO_NAME_VERT_ORIENT), RES_VERT_ORIENT, cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, MID_VERTORIENT_ORIENT }, + { OUString(UNO_NAME_WRITING_MODE), RES_FRAMEDIR, cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, 0 }, + { OUString(UNO_NAME_NUMBER_FORMAT), RES_BOXATR_FORMAT, cppu::UnoType<sal_Int32>::get(),PropertyAttribute::MAYBEVOID, 0 }, { OUString(), 0, css::uno::Type(), 0, 0 } }; m_aMapEntriesArr[nPropertyId] = aCellStyleMap; diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 44133afffed1..4ea2f08aecab 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -25,6 +25,7 @@ #include <svtools/ctrltool.hxx> #include <svl/style.hxx> #include <svl/itemiter.hxx> +#include <svl/zforlist.hxx> #include <svx/pageitem.hxx> #include <editeng/sizeitem.hxx> #include <editeng/ulspitem.hxx> @@ -4401,6 +4402,14 @@ const CellStyleNameMap& SwXTextTableStyle::GetCellStyleNameMap() aNewMap[ "even-columns" ] = EVEN_COLUMNS_STYLE; aNewMap[ "odd-columns" ] = ODD_COLUMNS_STYLE; aNewMap[ "background" ] = BACKGROUND_STYLE; + // loext namespace + aNewMap[ "first-row-start-column" ] = FIRST_ROW_START_COLUMN_STYLE; + aNewMap[ "first-row-end-column" ] = FIRST_ROW_END_COLUMN_STYLE; + aNewMap[ "last-row-start-column" ] = LAST_ROW_START_COLUMN_STYLE; + aNewMap[ "last-row-end-column" ] = LAST_ROW_END_COLUMN_STYLE; + aNewMap[ "first-row-even-column" ] = FIRST_ROW_EVEN_COLUMN_STYLE; + aNewMap[ "last-row-even-column" ] = LAST_ROW_EVEN_COLUMN_STYLE; + aMap.swap(aNewMap); } return aMap; @@ -4829,6 +4838,37 @@ css::uno::Any SAL_CALL SwXTextCellStyle::getPropertyValue(const OUString& rPrope rBrush.QueryValue(aRet); return aRet; } + case RES_BOX: + { + const SvxBoxItem& rBox = m_pBoxAutoFormat->GetBox(); + rBox.QueryValue(aRet, pEntry->nMemberId); + return aRet; + } + case RES_VERT_ORIENT: + { + const SwFormatVertOrient& rVertOrient = m_pBoxAutoFormat->GetVerticalAlignment(); + rVertOrient.QueryValue(aRet, pEntry->nMemberId); + return aRet; + } + case RES_FRAMEDIR: + { + const SvxFrameDirectionItem& rDirItem = m_pBoxAutoFormat->GetTextOrientation(); + rDirItem.QueryValue(aRet, pEntry->nMemberId); + return aRet; + } + case RES_BOXATR_FORMAT: + { + OUString sFormat; + LanguageType eLng, eSys; + m_pBoxAutoFormat->GetValueFormat(sFormat, eLng, eSys); + if(!sFormat.isEmpty()) + { + short nType; bool bNew; sal_Int32 nCheckPos; + sal_uInt32 nKey = m_pDocShell->GetDoc()->GetNumberFormatter()->GetIndexPuttingAndConverting(sFormat, eLng, eSys, nType, bNew, nCheckPos); + aRet <<= nKey; + } + return aRet; + } default: SAL_WARN("sw.uno", "SwXTextCellStyle unknown nWID"); throw css::uno::RuntimeException(); diff --git a/sw/source/filter/xml/xmlfmte.cxx b/sw/source/filter/xml/xmlfmte.cxx index e2ac39e0bffd..3f68785afccd 100644 --- a/sw/source/filter/xml/xmlfmte.cxx +++ b/sw/source/filter/xml/xmlfmte.cxx @@ -170,6 +170,7 @@ void SwXMLExport::ExportStyles_( bool bUsed ) GetTextParagraphExport()->exportTextStyles( bUsed ,IsShowProgress() ); + GetShapeExport()->GetShapeTableExport()->exportTableStyles(); //page defaults GetPageExport()->exportDefaultStyle(); } |