From 309bc35559cb823415139044272b10feccdb6ae7 Mon Sep 17 00:00:00 2001 From: Jakub Trzebiatowski Date: Sat, 11 Jun 2016 15:17:48 +0200 Subject: 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 Reviewed-by: Miklos Vajna --- sw/source/core/doc/tblafmt.cxx | 45 ++++++++++++++++++++++++++++--------- sw/source/core/unocore/unomap.cxx | 14 +++++++++++- sw/source/core/unocore/unostyle.cxx | 40 +++++++++++++++++++++++++++++++++ sw/source/filter/xml/xmlfmte.cxx | 1 + 4 files changed, 89 insertions(+), 11 deletions(-) (limited to 'sw/source') 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& SwTableAutoFormat::GetTableTemplateMap() { static std::vector* pTableTemplateMap; if (!pTableTemplateMap) { pTableTemplateMap = new std::vector; - 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::get(), PROPERTY_NONE , 0 }, + { OUString(UNO_NAME_BACK_COLOR), RES_BACKGROUND, cppu::UnoType::get(), PROPERTY_NONE, 0 }, + { OUString(UNO_NAME_LEFT_BORDER), RES_BOX, cppu::UnoType::get(), PROPERTY_NONE, LEFT_BORDER|CONVERT_TWIPS }, + { OUString(UNO_NAME_RIGHT_BORDER), RES_BOX, cppu::UnoType::get(), PROPERTY_NONE, RIGHT_BORDER|CONVERT_TWIPS }, + { OUString(UNO_NAME_TOP_BORDER), RES_BOX, cppu::UnoType::get(), PROPERTY_NONE, TOP_BORDER|CONVERT_TWIPS }, + { OUString(UNO_NAME_BOTTOM_BORDER), RES_BOX, cppu::UnoType::get(), PROPERTY_NONE, BOTTOM_BORDER|CONVERT_TWIPS }, + { OUString(UNO_NAME_BORDER_DISTANCE), RES_BOX, cppu::UnoType::get(), PROPERTY_NONE, BORDER_DISTANCE|CONVERT_TWIPS }, + { OUString(UNO_NAME_LEFT_BORDER_DISTANCE), RES_BOX, cppu::UnoType::get(), PROPERTY_NONE, LEFT_BORDER_DISTANCE |CONVERT_TWIPS }, + { OUString(UNO_NAME_RIGHT_BORDER_DISTANCE), RES_BOX, cppu::UnoType::get(), PROPERTY_NONE, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS }, + { OUString(UNO_NAME_TOP_BORDER_DISTANCE), RES_BOX, cppu::UnoType::get(), PROPERTY_NONE, TOP_BORDER_DISTANCE |CONVERT_TWIPS }, + { OUString(UNO_NAME_BOTTOM_BORDER_DISTANCE), RES_BOX, cppu::UnoType::get(), PROPERTY_NONE, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS }, + { OUString(UNO_NAME_VERT_ORIENT), RES_VERT_ORIENT, cppu::UnoType::get(), PROPERTY_NONE, MID_VERTORIENT_ORIENT }, + { OUString(UNO_NAME_WRITING_MODE), RES_FRAMEDIR, cppu::UnoType::get(), PROPERTY_NONE, 0 }, + { OUString(UNO_NAME_NUMBER_FORMAT), RES_BOXATR_FORMAT, cppu::UnoType::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 #include #include +#include #include #include #include @@ -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(); } -- cgit