summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Trzebiatowski <ubap.dev@gmail.com>2016-06-11 15:17:48 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-06-20 12:08:01 +0000
commit309bc35559cb823415139044272b10feccdb6ae7 (patch)
tree0a2533ae40f366e95c84c18b751a877340c0d407
parentcppcheck: oppositeInnerCondition if new fails, its going to throw (diff)
downloadcore-309bc35559cb823415139044272b10feccdb6ae7.tar.gz
core-309bc35559cb823415139044272b10feccdb6ae7.zip
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>
-rw-r--r--include/xmloff/table/XMLTableExport.hxx1
-rw-r--r--include/xmloff/xmltoken.hxx8
-rw-r--r--sw/inc/unostyle.hxx7
-rw-r--r--sw/qa/python/check_styles.py2
-rw-r--r--sw/source/core/doc/tblafmt.cxx45
-rw-r--r--sw/source/core/unocore/unomap.cxx14
-rw-r--r--sw/source/core/unocore/unostyle.cxx40
-rw-r--r--sw/source/filter/xml/xmlfmte.cxx1
-rw-r--r--xmloff/source/core/xmltoken.cxx8
-rw-r--r--xmloff/source/style/prhdlfac.cxx21
-rw-r--r--xmloff/source/table/XMLTableExport.cxx146
-rw-r--r--xmloff/source/text/txtprhdl.cxx19
12 files changed, 270 insertions, 42 deletions
diff --git a/include/xmloff/table/XMLTableExport.hxx b/include/xmloff/table/XMLTableExport.hxx
index 73ad0e32e5dc..c91c734819ee 100644
--- a/include/xmloff/table/XMLTableExport.hxx
+++ b/include/xmloff/table/XMLTableExport.hxx
@@ -83,6 +83,7 @@ private:
std::map< const css::uno::Reference< css::table::XColumnRowRange >, std::shared_ptr< XMLTableInfo > >
maTableInfoMap;
bool mbExportTables;
+ bool mbWriter;
protected:
SvXMLExport& GetExport() { return mrExport; }
diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index aaabbba53244..5b0902da167d 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -3067,6 +3067,14 @@ namespace xmloff { namespace token {
XML_ODD_ROWS,
XML_EVEN_COLUMNS,
XML_ODD_COLUMNS,
+ // table styles
+ XML_FIRST_ROW_EVEN_COLUMN,
+ XML_LAST_ROW_EVEN_COLUMN,
+ XML_FIRST_ROW_END_COLUMN,
+ XML_FIRST_ROW_START_COLUMN,
+ XML_LAST_ROW_END_COLUMN,
+ XML_LAST_ROW_START_COLUMN,
+
XML_HORIZONTAL_ON_ODD,
// Password error from 1.4 to 2.0 Beta (#i45874#)
XML_RESTART_NUMBERING,
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();
}
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 847f61d9eecf..fe35e33ed696 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -3065,6 +3065,14 @@ namespace xmloff { namespace token {
TOKEN( "odd-rows", XML_ODD_ROWS ),
TOKEN( "even-columns", XML_EVEN_COLUMNS ),
TOKEN( "odd-columns", XML_ODD_COLUMNS ),
+ // table styles
+ TOKEN( "first-row-even-column", XML_FIRST_ROW_EVEN_COLUMN ),
+ TOKEN( "last-row-even-column", XML_LAST_ROW_EVEN_COLUMN ),
+ TOKEN( "first-row-end-column", XML_FIRST_ROW_END_COLUMN ),
+ TOKEN( "first-row-start-column", XML_FIRST_ROW_START_COLUMN ),
+ TOKEN( "last-row-end-column", XML_LAST_ROW_END_COLUMN ),
+ TOKEN( "last-row-start-column", XML_LAST_ROW_START_COLUMN ),
+
TOKEN( "horizontal-on-odd", XML_HORIZONTAL_ON_ODD ),
// Password error from 1.4 to 2.0 Beta (#i45874#)
TOKEN( "restart-numbering", XML_RESTART_NUMBERING),
diff --git a/xmloff/source/style/prhdlfac.cxx b/xmloff/source/style/prhdlfac.cxx
index 8e703e3fe778..e70168782d88 100644
--- a/xmloff/source/style/prhdlfac.cxx
+++ b/xmloff/source/style/prhdlfac.cxx
@@ -22,6 +22,7 @@
#include <com/sun/star/drawing/ColorMode.hpp>
#include <com/sun/star/text/HorizontalAdjust.hpp>
#include <com/sun/star/text/WritingMode2.hpp>
+#include <com/sun/star/text/VertOrientation.hpp>
#include <tools/debug.hxx>
@@ -98,6 +99,22 @@ static SvXMLEnumMapEntry const aXML_WritingDirection_Enum[] =
{ XML_TOKEN_INVALID, 0 }
};
+static SvXMLEnumMapEntry const pXML_VertPos_Enum[] =
+{
+ { XML_FROM_TOP, text::VertOrientation::NONE },
+ { XML_TOP, text::VertOrientation::TOP },
+ { XML_TOP, text::VertOrientation::CHAR_TOP }, // export only
+ { XML_TOP, text::VertOrientation::LINE_TOP }, // export only
+ { XML_MIDDLE, text::VertOrientation::CENTER },
+ { XML_MIDDLE, text::VertOrientation::CHAR_CENTER }, // export only
+ { XML_MIDDLE, text::VertOrientation::LINE_CENTER }, // export only
+ { XML_BOTTOM, text::VertOrientation::BOTTOM },
+ { XML_BOTTOM, text::VertOrientation::CHAR_BOTTOM }, // export only
+ { XML_BOTTOM, text::VertOrientation::LINE_BOTTOM }, // export only
+ { XML_BELOW, text::VertOrientation::CHAR_BOTTOM }, // import only
+ { XML_TOKEN_INVALID, 0 }
+};
+
typedef std::map<sal_Int32, const XMLPropertyHandler*> CacheMap;
struct XMLPropertyHandlerFactory::Impl
@@ -446,6 +463,10 @@ const XMLPropertyHandler* XMLPropertyHandlerFactory::CreatePropertyHandler( sal_
case XML_TYPE_NUMBER16_AUTO:
pPropHdl = new XMLNumberWithAutoInsteadZeroPropHdl();
break;
+ case XML_TYPE_TEXT_VERTICAL_POS:
+ pPropHdl = new XMLConstantsPropertyHandler( pXML_VertPos_Enum, XML_TOKEN_INVALID );
+ break;
+
}
return pPropHdl;
diff --git a/xmloff/source/table/XMLTableExport.cxx b/xmloff/source/table/XMLTableExport.cxx
index 913c40c7a8bd..f0f51c7fdd09 100644
--- a/xmloff/source/table/XMLTableExport.cxx
+++ b/xmloff/source/table/XMLTableExport.cxx
@@ -61,6 +61,7 @@ using namespace ::com::sun::star::style;
#define MAP_(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, type, context, SvtSaveOptions::ODFVER_010, false }
#define CMAP(name,prefix,token,type,context) MAP_(name,prefix,token,type|XML_TYPE_PROP_TABLE_COLUMN,context)
#define RMAP(name,prefix,token,type,context) MAP_(name,prefix,token,type|XML_TYPE_PROP_TABLE_ROW,context)
+#define CELLMAP(name,prefix,token,type,context) MAP_(name,prefix,token,type|XML_TYPE_PROP_TABLE_CELL,context)
#define MAP_END { nullptr, 0, 0, XML_EMPTY, 0, 0, SvtSaveOptions::ODFVER_010, false }
const XMLPropertyMapEntry* getColumnPropertiesMap()
@@ -88,6 +89,29 @@ const XMLPropertyMapEntry* getRowPropertiesMap()
return &aXMLRowProperties[0];
}
+const XMLPropertyMapEntry* getSwCellStylePropertiesMap()
+{
+ static const XMLPropertyMapEntry aXMLSwCellStyleProperties[] =
+ {
+ CELLMAP( "BackColor", XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY, 0 ),
+ CELLMAP( "LeftBorder", XML_NAMESPACE_FO, XML_BORDER_LEFT, XML_TYPE_BORDER, 0 ),
+ CELLMAP( "RightBorder", XML_NAMESPACE_FO, XML_BORDER_RIGHT, XML_TYPE_BORDER, 0 ),
+ CELLMAP( "TopBorder", XML_NAMESPACE_FO, XML_BORDER_TOP, XML_TYPE_BORDER, 0 ),
+ CELLMAP( "BottomBorder", XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_TYPE_BORDER, 0 ),
+ CELLMAP( "BorderDistance", XML_NAMESPACE_FO, XML_PADDING, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ CELLMAP( "LeftBorderDistance", XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ CELLMAP( "RightBorderDistance", XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ CELLMAP( "TopBorderDistance", XML_NAMESPACE_FO, XML_PADDING_TOP, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ CELLMAP( "BottomBorderDistance", XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ CELLMAP( "VertOrient", XML_NAMESPACE_STYLE, XML_VERTICAL_ALIGN, XML_TYPE_TEXT_VERTICAL_POS, 0 ),
+ CELLMAP( "WritingMode", XML_NAMESPACE_STYLE, XML_WRITING_MODE, XML_TYPE_TEXT_WRITING_MODE_WITH_DEFAULT, 0 ),
+ CELLMAP( "NumberFormat", XML_NAMESPACE_STYLE, XML_DATA_STYLE_NAME, XML_TYPE_NUMBER, 0 ),
+ MAP_END
+ };
+
+ return &aXMLSwCellStyleProperties[0];
+}
+
class StringStatisticHelper
{
private:
@@ -135,6 +159,7 @@ sal_Int32 StringStatisticHelper::getModeString( OUString& rStyleName )
XMLTableExport::XMLTableExport(SvXMLExport& rExp, const rtl::Reference< SvXMLExportPropertyMapper >& xExportPropertyMapper, const rtl::Reference< XMLPropertyHandlerFactory >& xFactoryRef )
: mrExport( rExp )
, mbExportTables( false )
+, mbWriter( false )
{
Reference< XMultiServiceFactory > xFac( rExp.GetModel(), UNO_QUERY );
if( xFac.is() ) try
@@ -144,19 +169,28 @@ XMLTableExport::XMLTableExport(SvXMLExport& rExp, const rtl::Reference< SvXMLExp
const OUString* pSNS( sSNS.getConstArray() );
while( --n > 0 )
{
- if( (*pSNS++) == "com.sun.star.drawing.TableShape" )
+ if( *pSNS == "com.sun.star.drawing.TableShape" || *pSNS == "com.sun.star.style.TableStyle" )
{
mbExportTables = true;
+ mbWriter = (*pSNS == "com.sun.star.style.TableStyle");
break;
}
+ pSNS++;
}
}
catch(const Exception&)
{
}
- mxCellExportPropertySetMapper = xExportPropertyMapper;
- mxCellExportPropertySetMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaExtPropMapper(rExp));
+ if (mbWriter)
+ {
+ mxCellExportPropertySetMapper = new SvXMLExportPropertyMapper( new XMLPropertySetMapper( getSwCellStylePropertiesMap(), xFactoryRef.get(), true ) );
+ }
+ else
+ {
+ mxCellExportPropertySetMapper = xExportPropertyMapper;
+ mxCellExportPropertySetMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaExtPropMapper(rExp));
+ }
mxRowExportPropertySetMapper = new SvXMLExportPropertyMapper( new XMLPropertySetMapper( getRowPropertiesMap(), xFactoryRef.get(), true ) );
mxColumnExportPropertySetMapper = new SvXMLExportPropertyMapper( new XMLPropertySetMapper( getColumnPropertiesMap(), xFactoryRef.get(), true ) );
@@ -456,10 +490,21 @@ void XMLTableExport::exportTableStyles()
if( !mbExportTables )
return;
- rtl::Reference<XMLStyleExport> aStEx(new XMLStyleExport(mrExport, OUString(), mrExport.GetAutoStylePool().get()));
+ rtl::Reference<XMLStyleExport> aStEx;
+ OUString sCellStyleName;
+ if (mbWriter)
+ {
+ sCellStyleName = "CellStyles";
+ aStEx.set(new XMLStyleExport(mrExport, OUString()));
+ }
+ else
+ {
+ // write graphic family styles
+ sCellStyleName = "cell";
+ aStEx.set(new XMLStyleExport(mrExport, OUString(), mrExport.GetAutoStylePool().get()));
+ }
- // write graphic family styles
- aStEx->exportStyleFamily("cell", OUString(XML_STYLE_FAMILY_TABLE_CELL_STYLES_NAME), mxCellExportPropertySetMapper.get(), true, XML_STYLE_FAMILY_TABLE_CELL);
+ aStEx->exportStyleFamily(sCellStyleName, OUString(XML_STYLE_FAMILY_TABLE_CELL_STYLES_NAME), mxCellExportPropertySetMapper.get(), true, XML_STYLE_FAMILY_TABLE_CELL);
exportTableTemplates();
}
@@ -484,17 +529,47 @@ const TableStyleElement* getTableStyleMap()
{ XML_LAST_ROW, OUString("last-row") },
{ XML_FIRST_COLUMN, OUString("first-column") },
{ XML_LAST_COLUMN, OUString("last-column") },
+ { XML_BODY, OUString("body") },
{ XML_EVEN_ROWS, OUString("even-rows") },
{ XML_ODD_ROWS, OUString("odd-rows") },
{ XML_EVEN_COLUMNS, OUString("even-columns") },
{ XML_ODD_COLUMNS, OUString("odd-columns") },
- { XML_BODY, OUString("body") },
{ XML_TOKEN_END, OUString() }
};
return &gTableStyleElements[0];
}
+const TableStyleElement* getWriterSpecificTableStyleMap()
+{
+ static const struct TableStyleElement gWriterSpecificTableStyleElements[] =
+ {
+ { XML_FIRST_ROW_EVEN_COLUMN, OUString("first-row-even-column") },
+ { XML_LAST_ROW_EVEN_COLUMN, OUString("last-row-even-column") },
+ { XML_FIRST_ROW_END_COLUMN, OUString("first-row-end-column") },
+ { XML_FIRST_ROW_START_COLUMN, OUString("first-row-start-column") },
+ { XML_LAST_ROW_END_COLUMN, OUString("last-row-end-column") },
+ { XML_LAST_ROW_START_COLUMN, OUString("last-row-start-column") },
+ { XML_TOKEN_END, OUString() }
+ };
+
+ return &gWriterSpecificTableStyleElements[0];
+}
+
+const TableStyleElement* getWriterSpecificTableStyleAttributes()
+{
+ static const struct TableStyleElement gWriterSpecifitTableStyleAttributes[] =
+ {
+ { XML_FIRST_ROW_END_COLUMN, OUString("FirstRowEndColumn") },
+ { XML_FIRST_ROW_START_COLUMN, OUString("FirstRowStartColumn") },
+ { XML_LAST_ROW_END_COLUMN, OUString("LastRowEndColumn") },
+ { XML_LAST_ROW_START_COLUMN, OUString("LastRowStartColumn") },
+ { XML_TOKEN_END, OUString() }
+ };
+
+ return &gWriterSpecifitTableStyleAttributes[0];
+}
+
void XMLTableExport::exportTableTemplates()
{
if( !mbExportTables )
@@ -504,7 +579,12 @@ void XMLTableExport::exportTableTemplates()
{
Reference< XStyleFamiliesSupplier > xFamiliesSupp( mrExport.GetModel(), UNO_QUERY_THROW );
Reference< XNameAccess > xFamilies( xFamiliesSupp->getStyleFamilies() );
- const OUString sFamilyName( "table" );
+ OUString sFamilyName;
+ if (mbWriter)
+ sFamilyName = "TableStyles";
+ else
+ sFamilyName = "table";
+
Reference< XIndexAccess > xTableFamily( xFamilies->getByName( sFamilyName ), UNO_QUERY_THROW );
for( sal_Int32 nIndex = 0; nIndex < xTableFamily->getCount(); nIndex++ ) try
@@ -513,12 +593,34 @@ void XMLTableExport::exportTableTemplates()
if( !xTableStyle->isInUse() )
continue;
- Reference< XNameAccess > xStyleNames( xTableStyle, UNO_QUERY_THROW );
+ const TableStyleElement* pElements;
+ if (mbWriter)
+ {
+ mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, GetExport().EncodeStyleName(xTableStyle->getName()));
+ Reference<XPropertySet> xTableStylePropSet(xTableStyle.get(), UNO_QUERY_THROW);
+ pElements = getWriterSpecificTableStyleAttributes();
+ while(pElements->meElement != XML_TOKEN_END)
+ {
+ try
+ {
+ OUString sVal;
+ xTableStylePropSet->getPropertyValue(pElements->msStyleName) >>= sVal;
+ mrExport.AddAttribute(XML_NAMESPACE_TABLE, pElements->meElement, sVal);
+ }
+ catch(const Exception&)
+ {
+ SAL_WARN("xmloff", "XMLTableExport::exportTableTemplates(), export Writer specific attributes, exception caught!");
+ }
+ pElements++;
+ }
+ }
+ else
+ mrExport.AddAttribute(XML_NAMESPACE_TEXT, XML_STYLE_NAME, GetExport().EncodeStyleName( xTableStyle->getName() ) );
- mrExport.AddAttribute(XML_NAMESPACE_TEXT, XML_STYLE_NAME, GetExport().EncodeStyleName( xTableStyle->getName() ) );
SvXMLElementExport tableTemplate( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_TEMPLATE, true, true );
- const TableStyleElement* pElements = getTableStyleMap();
+ Reference< XNameAccess > xStyleNames( xTableStyle, UNO_QUERY_THROW );
+ pElements = getTableStyleMap();
while( pElements->meElement != XML_TOKEN_END )
{
try
@@ -537,6 +639,28 @@ void XMLTableExport::exportTableTemplates()
pElements++;
}
+
+ if (mbWriter)
+ {
+ pElements = getWriterSpecificTableStyleMap();
+ while(pElements->meElement != XML_TOKEN_END)
+ {
+ try
+ {
+ Reference<XStyle> xStyle(xStyleNames->getByName(pElements->msStyleName), UNO_QUERY);
+ if(xStyle.is())
+ {
+ mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_STYLE_NAME, GetExport().EncodeStyleName(xStyle->getName()));
+ SvXMLElementExport element(mrExport, XML_NAMESPACE_LO_EXT, pElements->meElement, true, true);
+ }
+ }
+ catch(const Exception&)
+ {
+ SAL_WARN("xmloff", "XMLTableExport::exportTableTemplates(), export Writer specific styles, exception caught!");
+ }
+ pElements++;
+ }
+ }
}
catch(const Exception&)
{
diff --git a/xmloff/source/text/txtprhdl.cxx b/xmloff/source/text/txtprhdl.cxx
index f03edd6eba76..5e7e69939aa0 100644
--- a/xmloff/source/text/txtprhdl.cxx
+++ b/xmloff/source/text/txtprhdl.cxx
@@ -137,22 +137,6 @@ static SvXMLEnumMapEntry const pXML_HoriMirror_Enum[] =
{ XML_TOKEN_INVALID, 0 }
};
-static SvXMLEnumMapEntry const pXML_VertPos_Enum[] =
-{
- { XML_FROM_TOP, VertOrientation::NONE },
- { XML_TOP, VertOrientation::TOP },
- { XML_TOP, VertOrientation::CHAR_TOP }, // export only
- { XML_TOP, VertOrientation::LINE_TOP }, // export only
- { XML_MIDDLE, VertOrientation::CENTER },
- { XML_MIDDLE, VertOrientation::CHAR_CENTER }, // export only
- { XML_MIDDLE, VertOrientation::LINE_CENTER }, // export only
- { XML_BOTTOM, VertOrientation::BOTTOM },
- { XML_BOTTOM, VertOrientation::CHAR_BOTTOM }, // export only
- { XML_BOTTOM, VertOrientation::LINE_BOTTOM }, // export only
- { XML_BELOW, VertOrientation::CHAR_BOTTOM }, // import only
- { XML_TOKEN_INVALID, 0 }
-};
-
static SvXMLEnumMapEntry const pXML_VertPosAtChar_Enum[] =
{
{ XML_FROM_TOP, VertOrientation::NONE },
@@ -1272,9 +1256,6 @@ static const XMLPropertyHandler *GetPropertyHandler
case XML_TYPE_TEXT_HORIZONTAL_MIRROR:
pHdl = new XMLHoriMirrorPropHdl_Impl;
break;
- case XML_TYPE_TEXT_VERTICAL_POS:
- pHdl = new XMLConstantsPropertyHandler( pXML_VertPos_Enum, XML_TOKEN_INVALID );
- break;
case XML_TYPE_TEXT_VERTICAL_POS_AT_CHAR:
pHdl = new XMLConstantsPropertyHandler( pXML_VertPosAtChar_Enum, XML_TOKEN_INVALID );
break;