summaryrefslogtreecommitdiff
path: root/oox/source/drawingml/table
diff options
context:
space:
mode:
Diffstat (limited to 'oox/source/drawingml/table')
-rw-r--r--oox/source/drawingml/table/makefile.mk62
-rw-r--r--oox/source/drawingml/table/tablebackgroundstylecontext.cxx95
-rw-r--r--oox/source/drawingml/table/tablecell.cxx376
-rw-r--r--oox/source/drawingml/table/tablecellcontext.cxx130
-rw-r--r--oox/source/drawingml/table/tablecontext.cxx112
-rw-r--r--oox/source/drawingml/table/tablepartstylecontext.cxx80
-rw-r--r--oox/source/drawingml/table/tableproperties.cxx183
-rw-r--r--oox/source/drawingml/table/tablerow.cxx58
-rw-r--r--oox/source/drawingml/table/tablerowcontext.cxx83
-rw-r--r--oox/source/drawingml/table/tablestyle.cxx43
-rw-r--r--oox/source/drawingml/table/tablestylecellstylecontext.cxx129
-rw-r--r--oox/source/drawingml/table/tablestylecontext.cxx120
-rw-r--r--oox/source/drawingml/table/tablestylelist.cxx44
-rw-r--r--oox/source/drawingml/table/tablestylelistfragmenthandler.cxx86
-rw-r--r--oox/source/drawingml/table/tablestylepart.cxx52
-rw-r--r--oox/source/drawingml/table/tablestyletextstylecontext.cxx116
16 files changed, 1769 insertions, 0 deletions
diff --git a/oox/source/drawingml/table/makefile.mk b/oox/source/drawingml/table/makefile.mk
new file mode 100644
index 000000000000..fa71971fc278
--- /dev/null
+++ b/oox/source/drawingml/table/makefile.mk
@@ -0,0 +1,62 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=oox
+TARGET=table
+AUTOSEG=true
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE: $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/tablecontext.obj \
+ $(SLO)$/tableproperties.obj \
+ $(SLO)$/tablerow.obj \
+ $(SLO)$/tablerowcontext.obj \
+ $(SLO)$/tablecell.obj \
+ $(SLO)$/tablecellcontext.obj \
+ $(SLO)$/tablestylelist.obj \
+ $(SLO)$/tablestylelistfragmenthandler.obj \
+ $(SLO)$/tablestylecontext.obj \
+ $(SLO)$/tablestyle.obj \
+ $(SLO)$/tablebackgroundstylecontext.obj \
+ $(SLO)$/tablepartstylecontext.obj \
+ $(SLO)$/tablestyletextstylecontext.obj \
+ $(SLO)$/tablestylecellstylecontext.obj \
+ $(SLO)$/tablestylepart.obj
+
+# --- Targets -------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/oox/source/drawingml/table/tablebackgroundstylecontext.cxx b/oox/source/drawingml/table/tablebackgroundstylecontext.cxx
new file mode 100644
index 000000000000..73c50b8c0645
--- /dev/null
+++ b/oox/source/drawingml/table/tablebackgroundstylecontext.cxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <osl/diagnose.h>
+
+#include "oox/drawingml/table/tablebackgroundstylecontext.hxx"
+#include "oox/drawingml/fillpropertiesgroupcontext.hxx"
+#include "oox/core/namespaces.hxx"
+#include "oox/helper/attributelist.hxx"
+#include "tokens.hxx"
+using namespace ::oox::core;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using ::rtl::OUString;
+
+namespace oox { namespace drawingml { namespace table {
+
+TableBackgroundStyleContext::TableBackgroundStyleContext( ContextHandler& rParent, TableStyle& rTableStyle )
+: ContextHandler( rParent )
+, mrTableStyle( rTableStyle )
+{
+}
+
+TableBackgroundStyleContext::~TableBackgroundStyleContext()
+{
+}
+
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
+TableBackgroundStyleContext::createFastChildContext( ::sal_Int32 aElementToken, const uno::Reference< xml::sax::XFastAttributeList >& xAttribs )
+ throw ( xml::sax::SAXException, uno::RuntimeException)
+{
+ uno::Reference< xml::sax::XFastContextHandler > xRet;
+
+ AttributeList aAttribs( xAttribs );
+ switch( aElementToken )
+ {
+ // EG_ThemeableFillStyle (choice)
+ case NMSP_DRAWINGML|XML_fill: // CT_FillProperties
+ {
+ boost::shared_ptr< FillProperties >& rxFillProperties = mrTableStyle.getBackgroundFillProperties();
+ rxFillProperties.reset( new FillProperties );
+ xRet.set( new FillPropertiesContext( *this, *rxFillProperties ) );
+ }
+ break;
+ case NMSP_DRAWINGML|XML_fillRef: // CT_StyleMatrixReference
+ {
+ ShapeStyleRef& rStyleRef = mrTableStyle.getBackgroundFillStyleRef();
+ rStyleRef.mnThemedIdx = aAttribs.getInteger( XML_idx, 0 );
+ xRet.set( new ColorContext( *this, rStyleRef.maPhClr ) );
+ }
+ break;
+
+ // EG_ThemeableEffectStyle (choice)
+ case NMSP_DRAWINGML|XML_effect: // CT_EffectProperties
+ break;
+ case NMSP_DRAWINGML|XML_effectRef: // CT_StyleMatrixReference
+ break;
+ }
+ if( !xRet.is() )
+ {
+ uno::Reference<XFastContextHandler> xTmp(this);
+ xRet.set( xTmp );
+ }
+ return xRet;
+}
+
+} } }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/drawingml/table/tablecell.cxx b/oox/source/drawingml/table/tablecell.cxx
new file mode 100644
index 000000000000..08d4f4d310a7
--- /dev/null
+++ b/oox/source/drawingml/table/tablecell.cxx
@@ -0,0 +1,376 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "oox/drawingml/table/tablecell.hxx"
+#include "oox/drawingml/table/tableproperties.hxx"
+#include "oox/drawingml/textbody.hxx"
+#include "oox/core/namespaces.hxx"
+#include "oox/core/xmlfilterbase.hxx"
+#include "properties.hxx"
+#include "tokens.hxx"
+#include "oox/helper/propertyset.hxx"
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/table/XTable.hpp>
+#include <com/sun/star/table/XMergeableCellRange.hpp>
+#include <com/sun/star/table/BorderLine2.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
+#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
+#include <com/sun/star/text/XText.hpp>
+
+using rtl::OUString;
+using namespace ::oox::core;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using ::com::sun::star::table::BorderLine2;
+using ::com::sun::star::drawing::LineStyle;
+
+namespace oox { namespace drawingml { namespace table {
+
+TableCell::TableCell()
+: mnRowSpan ( 1 )
+, mnGridSpan( 1 )
+, mbhMerge( sal_False )
+, mbvMerge( sal_False )
+, mnMarL( 91440 )
+, mnMarR( 91440 )
+, mnMarT( 45720 )
+, mnMarB( 45720 )
+, mnVertToken( XML_horz )
+, mnAnchorToken( XML_t )
+, mbAnchorCtr( sal_False )
+, mnHorzOverflowToken( XML_clip )
+{
+}
+TableCell::~TableCell()
+{
+}
+
+void applyLineAttributes( const ::oox::core::XmlFilterBase& rFilterBase,
+ Reference< XPropertySet >& rxPropSet, oox::drawingml::LineProperties& rLineProperties,
+ sal_Int32 nPropId )
+{
+ BorderLine2 aBorderLine( 0, 0, 0, 0, API_LINE_SOLID );
+ if( rLineProperties.maLineFill.moFillType.differsFrom( XML_noFill ) )
+ {
+ Color aColor = rLineProperties.maLineFill.getBestSolidColor();
+ aBorderLine.Color = aColor.getColor( rFilterBase.getGraphicHelper() );
+ aBorderLine.OuterLineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 4 );
+ aBorderLine.InnerLineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 4 );
+ aBorderLine.LineDistance = 0;
+ }
+
+ PropertySet aPropSet( rxPropSet );
+ aPropSet.setProperty( nPropId, aBorderLine );
+}
+
+void applyBorder( TableStylePart& rTableStylePart, sal_Int32 nLineType, oox::drawingml::LineProperties& rLineProperties )
+{
+ std::map < sal_Int32, ::oox::drawingml::LinePropertiesPtr >& rPartLineBorders( rTableStylePart.getLineBorders() );
+ std::map < sal_Int32, ::oox::drawingml::LinePropertiesPtr >::const_iterator aIter( rPartLineBorders.find( nLineType ) );
+ if ( ( aIter != rPartLineBorders.end() ) && aIter->second.get() )
+ rLineProperties.assignUsed( *aIter->second );
+}
+
+void applyTableStylePart( const ::oox::core::XmlFilterBase& rFilterBase, const Reference < text::XTextRange >& rxStart, oox::drawingml::FillProperties& rFillProperties,
+ oox::drawingml::LineProperties& rLeftBorder,
+ oox::drawingml::LineProperties& rRightBorder,
+ oox::drawingml::LineProperties& rTopBorder,
+ oox::drawingml::LineProperties& rBottomBorder,
+ oox::drawingml::LineProperties& rTopLeftToBottomRightBorder,
+ oox::drawingml::LineProperties& rBottomLeftToTopRightBorder,
+ TableStylePart& rTableStylePart )
+{
+ boost::shared_ptr< ::oox::drawingml::FillProperties >& rPartFillPropertiesPtr( rTableStylePart.getFillProperties() );
+ if ( rPartFillPropertiesPtr.get() )
+ rFillProperties.assignUsed( *rPartFillPropertiesPtr );
+
+ applyBorder( rTableStylePart, XML_left, rLeftBorder );
+ applyBorder( rTableStylePart, XML_right, rRightBorder );
+ applyBorder( rTableStylePart, XML_top, rTopBorder );
+ applyBorder( rTableStylePart, XML_bottom, rBottomBorder );
+ applyBorder( rTableStylePart, XML_tl2br, rTopLeftToBottomRightBorder );
+ applyBorder( rTableStylePart, XML_tr2bl, rBottomLeftToTopRightBorder );
+
+ TextCharacterProperties aTextCharProps;
+ aTextCharProps.maLatinFont = rTableStylePart.getLatinFont();
+ aTextCharProps.maAsianFont = rTableStylePart.getAsianFont();
+ aTextCharProps.maComplexFont = rTableStylePart.getComplexFont();
+ aTextCharProps.maSymbolFont = rTableStylePart.getSymbolFont();
+ aTextCharProps.maCharColor = rTableStylePart.getTextColor();
+ if( rTableStylePart.getTextBoldStyle().is_initialized() )
+ aTextCharProps.moBold = rTableStylePart.getTextBoldStyle();
+ if( rTableStylePart.getTextItalicStyle().is_initialized() )
+ aTextCharProps.moItalic = rTableStylePart.getTextItalicStyle();
+
+ PropertySet aPropSet( rxStart );
+ aTextCharProps.pushToPropSet( aPropSet, rFilterBase, true );
+}
+
+void applyTableCellProperties( const Reference < ::com::sun::star::table::XCell >& rxCell, const TableCell& rTableCell )
+{
+ static const rtl::OUString sTopBorder( RTL_CONSTASCII_USTRINGPARAM( "TextUpperDistance" ) );
+ static const rtl::OUString sBottomBorder( RTL_CONSTASCII_USTRINGPARAM( "TextLowerDistance" ) );
+ static const rtl::OUString sLeftBorder( RTL_CONSTASCII_USTRINGPARAM( "TextLeftDistance" ) );
+ static const rtl::OUString sRightBorder( RTL_CONSTASCII_USTRINGPARAM( "TextRightDistance" ) );
+ static const rtl::OUString sVerticalAdjust( RTL_CONSTASCII_USTRINGPARAM( "TextVerticalAdjust" ) );
+
+ Reference< XPropertySet > xPropSet( rxCell, UNO_QUERY_THROW );
+ xPropSet->setPropertyValue( sTopBorder, Any( static_cast< sal_Int32 >( rTableCell.getTopMargin() / 360 ) ) );
+ xPropSet->setPropertyValue( sRightBorder, Any( static_cast< sal_Int32 >( rTableCell.getRightMargin() / 360 ) ) );
+ xPropSet->setPropertyValue( sLeftBorder, Any( static_cast< sal_Int32 >( rTableCell.getLeftMargin() / 360 ) ) );
+ xPropSet->setPropertyValue( sBottomBorder, Any( static_cast< sal_Int32 >( rTableCell.getBottomMargin() / 360 ) ) );
+
+ drawing::TextVerticalAdjust eVA;
+ switch( rTableCell.getAnchorToken() )
+ {
+ case XML_ctr: eVA = drawing::TextVerticalAdjust_CENTER; break;
+ case XML_b: eVA = drawing::TextVerticalAdjust_BOTTOM; break;
+ case XML_just:
+ case XML_dist:
+ default:
+ case XML_t: eVA = drawing::TextVerticalAdjust_TOP; break;
+ }
+ xPropSet->setPropertyValue( sVerticalAdjust, Any( eVA ) );
+}
+
+void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oox::drawingml::TextListStylePtr pMasterTextListStyle,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::table::XCell >& rxCell, const TableProperties& rTableProperties,
+ const TableStyle& rTableStyle, sal_Int32 nColumn, sal_Int32 nMaxColumn, sal_Int32 nRow, sal_Int32 nMaxRow )
+{
+ TableStyle& rTable( const_cast< TableStyle& >( rTableStyle ) );
+ TableProperties& rProperties( const_cast< TableProperties& >( rTableProperties ) );
+
+ Reference< text::XText > xText( rxCell, UNO_QUERY_THROW );
+ Reference< text::XTextCursor > xAt = xText->createTextCursor();
+
+ applyTableCellProperties( rxCell, *this );
+ TextCharacterProperties aTextStyleProps;
+ getTextBody()->insertAt( rFilterBase, xText, xAt, aTextStyleProps, pMasterTextListStyle );
+ xAt->gotoStart( sal_True );
+ Reference< text::XTextRange > xStart( xAt, UNO_QUERY );
+ xAt->gotoEnd( sal_True );
+
+ Reference< XPropertySet > xPropSet( rxCell, UNO_QUERY_THROW );
+ oox::drawingml::FillProperties aFillProperties;
+ oox::drawingml::LineProperties aLinePropertiesLeft;
+ oox::drawingml::LineProperties aLinePropertiesRight;
+ oox::drawingml::LineProperties aLinePropertiesTop;
+ oox::drawingml::LineProperties aLinePropertiesBottom;
+ oox::drawingml::LineProperties aLinePropertiesTopLeftToBottomRight;
+ oox::drawingml::LineProperties aLinePropertiesBottomLeftToTopRight;
+
+ boost::shared_ptr< ::oox::drawingml::FillProperties >& rBackgroundFillPropertiesPtr( rTable.getBackgroundFillProperties() );
+ if ( rBackgroundFillPropertiesPtr.get() )
+ aFillProperties.assignUsed( *rBackgroundFillPropertiesPtr );
+
+ applyTableStylePart( rFilterBase, xStart, aFillProperties,
+ aLinePropertiesLeft,
+ aLinePropertiesRight,
+ aLinePropertiesTop,
+ aLinePropertiesBottom,
+ aLinePropertiesTopLeftToBottomRight,
+ aLinePropertiesBottomLeftToTopRight,
+ rTable.getWholeTbl() );
+
+ if ( rProperties.isFirstRow() && ( nRow == 0 ) )
+ {
+ applyTableStylePart( rFilterBase, xStart, aFillProperties,
+ aLinePropertiesLeft,
+ aLinePropertiesRight,
+ aLinePropertiesTop,
+ aLinePropertiesBottom,
+ aLinePropertiesTopLeftToBottomRight,
+ aLinePropertiesBottomLeftToTopRight,
+ rTable.getFirstRow() );
+ }
+ if ( rProperties.isLastRow() && ( nRow == nMaxRow ) )
+ {
+ applyTableStylePart( rFilterBase, xStart, aFillProperties,
+ aLinePropertiesLeft,
+ aLinePropertiesRight,
+ aLinePropertiesTop,
+ aLinePropertiesBottom,
+ aLinePropertiesTopLeftToBottomRight,
+ aLinePropertiesBottomLeftToTopRight,
+ rTable.getLastRow() );
+ }
+ if ( rProperties.isFirstCol() && ( nColumn == 0 ) )
+ {
+ applyTableStylePart( rFilterBase, xStart, aFillProperties,
+ aLinePropertiesLeft,
+ aLinePropertiesRight,
+ aLinePropertiesTop,
+ aLinePropertiesBottom,
+ aLinePropertiesTopLeftToBottomRight,
+ aLinePropertiesBottomLeftToTopRight,
+ rTable.getFirstCol() );
+ }
+ if ( rProperties.isLastCol() && ( nColumn == nMaxColumn ) )
+ {
+ applyTableStylePart( rFilterBase, xStart, aFillProperties,
+ aLinePropertiesLeft,
+ aLinePropertiesRight,
+ aLinePropertiesTop,
+ aLinePropertiesBottom,
+ aLinePropertiesTopLeftToBottomRight,
+ aLinePropertiesBottomLeftToTopRight,
+ rTable.getLastCol() );
+ }
+ if ( rProperties.isBandRow() )
+ {
+ if ( ( !rProperties.isFirstRow() || ( nRow != 0 ) ) &&
+ ( !rProperties.isLastRow() || ( nRow != nMaxRow ) ) )
+ {
+ sal_Int32 nBand = nRow;
+ if ( rProperties.isFirstRow() )
+ nBand++;
+ if ( nBand & 1 )
+ {
+ applyTableStylePart( rFilterBase, xStart, aFillProperties,
+ aLinePropertiesLeft,
+ aLinePropertiesRight,
+ aLinePropertiesTop,
+ aLinePropertiesBottom,
+ aLinePropertiesTopLeftToBottomRight,
+ aLinePropertiesBottomLeftToTopRight,
+ rTable.getBand2H() );
+ }
+ else
+ {
+ applyTableStylePart( rFilterBase, xStart, aFillProperties,
+ aLinePropertiesLeft,
+ aLinePropertiesRight,
+ aLinePropertiesTop,
+ aLinePropertiesBottom,
+ aLinePropertiesTopLeftToBottomRight,
+ aLinePropertiesBottomLeftToTopRight,
+ rTable.getBand1H() );
+ }
+ }
+ }
+ if ( ( nRow == 0 ) && ( nColumn == 0 ) )
+ {
+ applyTableStylePart( rFilterBase, xStart, aFillProperties,
+ aLinePropertiesLeft,
+ aLinePropertiesRight,
+ aLinePropertiesTop,
+ aLinePropertiesBottom,
+ aLinePropertiesTopLeftToBottomRight,
+ aLinePropertiesBottomLeftToTopRight,
+ rTable.getNwCell() );
+ }
+ if ( ( nRow == nMaxRow ) && ( nColumn == 0 ) )
+ {
+ applyTableStylePart( rFilterBase, xStart, aFillProperties,
+ aLinePropertiesLeft,
+ aLinePropertiesRight,
+ aLinePropertiesTop,
+ aLinePropertiesBottom,
+ aLinePropertiesTopLeftToBottomRight,
+ aLinePropertiesBottomLeftToTopRight,
+ rTable.getSwCell() );
+ }
+ if ( ( nRow == 0 ) && ( nColumn == nMaxColumn ) )
+ {
+ applyTableStylePart( rFilterBase, xStart, aFillProperties,
+ aLinePropertiesLeft,
+ aLinePropertiesRight,
+ aLinePropertiesTop,
+ aLinePropertiesBottom,
+ aLinePropertiesTopLeftToBottomRight,
+ aLinePropertiesBottomLeftToTopRight,
+ rTable.getNeCell() );
+ }
+ if ( ( nRow == nMaxColumn ) && ( nColumn == nMaxColumn ) )
+ {
+ applyTableStylePart( rFilterBase, xStart, aFillProperties,
+ aLinePropertiesLeft,
+ aLinePropertiesRight,
+ aLinePropertiesTop,
+ aLinePropertiesBottom,
+ aLinePropertiesTopLeftToBottomRight,
+ aLinePropertiesBottomLeftToTopRight,
+ rTable.getSeCell() );
+ }
+ if ( rProperties.isBandCol() )
+ {
+ if ( ( !rProperties.isFirstCol() || ( nColumn != 0 ) ) &&
+ ( !rProperties.isLastCol() || ( nColumn != nMaxColumn ) ) )
+ {
+ sal_Int32 nBand = nColumn;
+ if ( rProperties.isFirstCol() )
+ nBand++;
+ if ( nBand & 1 )
+ {
+ applyTableStylePart( rFilterBase, xStart, aFillProperties,
+ aLinePropertiesLeft,
+ aLinePropertiesRight,
+ aLinePropertiesTop,
+ aLinePropertiesBottom,
+ aLinePropertiesTopLeftToBottomRight,
+ aLinePropertiesBottomLeftToTopRight,
+ rTable.getBand2V() );
+ }
+ else
+ {
+ applyTableStylePart( rFilterBase, xStart, aFillProperties,
+ aLinePropertiesLeft,
+ aLinePropertiesRight,
+ aLinePropertiesTop,
+ aLinePropertiesBottom,
+ aLinePropertiesTopLeftToBottomRight,
+ aLinePropertiesBottomLeftToTopRight,
+ rTable.getBand1V() );
+ }
+ }
+ }
+ aLinePropertiesLeft.assignUsed( maLinePropertiesLeft );
+ aLinePropertiesRight.assignUsed( maLinePropertiesRight );
+ aLinePropertiesTop.assignUsed( maLinePropertiesTop );
+ aLinePropertiesBottom.assignUsed( maLinePropertiesBottom );
+ aLinePropertiesTopLeftToBottomRight.assignUsed( maLinePropertiesTopLeftToBottomRight );
+ aLinePropertiesBottomLeftToTopRight.assignUsed( maLinePropertiesBottomLeftToTopRight );
+ applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesLeft, PROP_LeftBorder );
+ applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesRight, PROP_RightBorder );
+ applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesTop, PROP_TopBorder );
+ applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesBottom, PROP_BottomBorder );
+ applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesTopLeftToBottomRight, PROP_DiagonalTLBR );
+ applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesBottomLeftToTopRight, PROP_DiagonalBLTR );
+
+ aFillProperties.assignUsed( maFillProperties );
+ PropertySet aPropSet( xPropSet );
+ // TODO: phClr?
+ aFillProperties.pushToPropSet( aPropSet, rFilterBase.getModelObjectHelper(), rFilterBase.getGraphicHelper() );
+}
+
+} } }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/drawingml/table/tablecellcontext.cxx b/oox/source/drawingml/table/tablecellcontext.cxx
new file mode 100644
index 000000000000..732fefc27eeb
--- /dev/null
+++ b/oox/source/drawingml/table/tablecellcontext.cxx
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <osl/diagnose.h>
+
+#include "oox/drawingml/table/tablecellcontext.hxx"
+#include "oox/drawingml/textbodycontext.hxx"
+#include "oox/drawingml/linepropertiescontext.hxx"
+#include "oox/drawingml/fillpropertiesgroupcontext.hxx"
+#include "oox/core/namespaces.hxx"
+#include "oox/helper/attributelist.hxx"
+
+using namespace ::oox::core;
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+namespace oox { namespace drawingml { namespace table {
+
+TableCellContext::TableCellContext( ContextHandler& rParent, const uno::Reference< xml::sax::XFastAttributeList >& xAttribs, TableCell& rTableCell )
+: ContextHandler( rParent )
+, mrTableCell( rTableCell )
+{
+ if ( xAttribs->hasAttribute( XML_rowSpan ) )
+ mrTableCell.setRowSpan( xAttribs->getOptionalValue( XML_rowSpan ).toInt32() );
+ if ( xAttribs->hasAttribute( XML_gridSpan ) )
+ mrTableCell.setGridSpan( xAttribs->getOptionalValue( XML_gridSpan ).toInt32() );
+
+ AttributeList aAttribs( xAttribs );
+ mrTableCell.sethMerge( aAttribs.getBool( XML_hMerge, sal_False ) );
+ mrTableCell.setvMerge( aAttribs.getBool( XML_vMerge, sal_False ) );
+}
+
+TableCellContext::~TableCellContext()
+{
+}
+
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
+TableCellContext::createFastChildContext( ::sal_Int32 aElementToken, const uno::Reference< xml::sax::XFastAttributeList >& xAttribs )
+ throw ( xml::sax::SAXException, uno::RuntimeException)
+{
+ uno::Reference< xml::sax::XFastContextHandler > xRet;
+
+ switch( aElementToken )
+ {
+ case NMSP_DRAWINGML|XML_txBody: // CT_TextBody
+ {
+ oox::drawingml::TextBodyPtr xTextBody( new oox::drawingml::TextBody );
+ mrTableCell.setTextBody( xTextBody );
+ xRet = new oox::drawingml::TextBodyContext( *this, *xTextBody );
+ }
+ break;
+
+ case NMSP_DRAWINGML|XML_tcPr: // CT_TableCellProperties
+ {
+ AttributeList aAttribs( xAttribs );
+ mrTableCell.setLeftMargin( aAttribs.getInteger( XML_marL, 91440 ) );
+ mrTableCell.setRightMargin( aAttribs.getInteger( XML_marR, 91440 ) );
+ mrTableCell.setTopMargin( aAttribs.getInteger( XML_marT, 45720 ) );
+ mrTableCell.setBottomMargin( aAttribs.getInteger( XML_marB, 45720 ) );
+ mrTableCell.setVertToken( xAttribs->getOptionalValueToken( XML_vert, XML_horz ) ); // ST_TextVerticalType
+ mrTableCell.setAnchorToken( xAttribs->getOptionalValueToken( XML_anchor, XML_t ) ); // ST_TextAnchoringType
+ mrTableCell.setAnchorCtr( aAttribs.getBool( XML_anchorCtr, sal_False ) );
+ mrTableCell.setHorzOverflowToken( xAttribs->getOptionalValueToken( XML_horzOverflow, XML_clip ) ); // ST_TextHorzOverflowType
+ }
+ break;
+ case NMSP_DRAWINGML|XML_lnL:
+ xRet.set( new oox::drawingml::LinePropertiesContext( *this, xAttribs, mrTableCell.maLinePropertiesLeft ) );
+ break;
+ case NMSP_DRAWINGML|XML_lnR:
+ xRet.set( new oox::drawingml::LinePropertiesContext( *this, xAttribs, mrTableCell.maLinePropertiesRight ) );
+ break;
+ case NMSP_DRAWINGML|XML_lnT:
+ xRet.set( new oox::drawingml::LinePropertiesContext( *this, xAttribs, mrTableCell.maLinePropertiesTop ) );
+ break;
+ case NMSP_DRAWINGML|XML_lnB:
+ xRet.set( new oox::drawingml::LinePropertiesContext( *this, xAttribs, mrTableCell.maLinePropertiesBottom ) );
+ break;
+ case NMSP_DRAWINGML|XML_lnTlToBr:
+ xRet.set( new oox::drawingml::LinePropertiesContext( *this, xAttribs, mrTableCell.maLinePropertiesTopLeftToBottomRight ) );
+ break;
+ case NMSP_DRAWINGML|XML_lnBlToTr:
+ xRet.set( new oox::drawingml::LinePropertiesContext( *this, xAttribs, mrTableCell.maLinePropertiesBottomLeftToTopRight ) );
+ break;
+ case NMSP_DRAWINGML|XML_cell3D: // CT_Cell3D
+ break;
+
+ case NMSP_DRAWINGML|XML_extLst: // CT_OfficeArtExtensionList
+ break;
+
+ default:
+ xRet.set( FillPropertiesContext::createFillContext( *this, aElementToken, xAttribs, mrTableCell.maFillProperties ) );
+ break;
+
+ }
+ if ( !xRet.is() )
+ {
+ uno::Reference< XFastContextHandler > xTmp( this );
+ xRet.set( xTmp );
+ }
+ return xRet;
+}
+
+} } }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/drawingml/table/tablecontext.cxx b/oox/source/drawingml/table/tablecontext.cxx
new file mode 100644
index 000000000000..419aef5d8307
--- /dev/null
+++ b/oox/source/drawingml/table/tablecontext.cxx
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <osl/diagnose.h>
+#include "oox/helper/attributelist.hxx"
+#include "oox/drawingml/guidcontext.hxx"
+#include "oox/drawingml/table/tablecontext.hxx"
+#include "oox/drawingml/table/tableproperties.hxx"
+#include "oox/drawingml/table/tablestylecontext.hxx"
+#include "oox/drawingml/table/tablerowcontext.hxx"
+#include "oox/core/namespaces.hxx"
+
+using namespace ::oox::core;
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+namespace oox { namespace drawingml { namespace table {
+
+TableContext::TableContext( ContextHandler& rParent, ShapePtr pShapePtr )
+: ShapeContext( rParent, ShapePtr(), pShapePtr )
+, mrTableProperties( *pShapePtr->getTableProperties().get() )
+{
+ pShapePtr->setServiceName( "com.sun.star.drawing.TableShape" );
+ pShapePtr->setSubType( 0 );
+}
+
+TableContext::~TableContext()
+{
+}
+
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
+TableContext::createFastChildContext( ::sal_Int32 aElementToken, const uno::Reference< xml::sax::XFastAttributeList >& xAttribs )
+ throw ( xml::sax::SAXException, uno::RuntimeException)
+{
+ uno::Reference< xml::sax::XFastContextHandler > xRet;
+
+ switch( aElementToken )
+ {
+ case NMSP_DRAWINGML|XML_tblPr: // CT_TableProperties
+ {
+ AttributeList aAttribs( xAttribs );
+ mrTableProperties.isRtl() = aAttribs.getBool( XML_rtl, sal_False );
+ mrTableProperties.isFirstRow() = aAttribs.getBool( XML_firstRow, sal_False );
+ mrTableProperties.isFirstCol() = aAttribs.getBool( XML_firstCol, sal_False );
+ mrTableProperties.isLastRow() = aAttribs.getBool( XML_lastRow, sal_False );
+ mrTableProperties.isLastCol() = aAttribs.getBool( XML_lastCol, sal_False );
+ mrTableProperties.isBandRow() = aAttribs.getBool( XML_bandRow, sal_False );
+ mrTableProperties.isBandCol() = aAttribs.getBool( XML_bandCol, sal_False );
+ }
+ break;
+ case NMSP_DRAWINGML|XML_tableStyle: // CT_TableStyle
+ {
+ boost::shared_ptr< TableStyle >& rTableStyle = mrTableProperties.getTableStyle();
+ rTableStyle.reset( new TableStyle() );
+ xRet = new TableStyleContext( *this, xAttribs, *rTableStyle );
+ }
+ break;
+ case NMSP_DRAWINGML|XML_tableStyleId: // ST_Guid
+ xRet.set( new oox::drawingml::GuidContext( *this, mrTableProperties.getStyleId() ) );
+ break;
+
+ case NMSP_DRAWINGML|XML_tblGrid: // CT_TableGrid
+ break;
+ case NMSP_DRAWINGML|XML_gridCol: // CT_TableCol
+ {
+ std::vector< sal_Int32 >& rvTableGrid( mrTableProperties.getTableGrid() );
+ rvTableGrid.push_back( xAttribs->getOptionalValue( XML_w ).toInt32() );
+ }
+ break;
+ case NMSP_DRAWINGML|XML_tr: // CT_TableRow
+ {
+ std::vector< TableRow >& rvTableRows( mrTableProperties.getTableRows() );
+ rvTableRows.resize( rvTableRows.size() + 1 );
+ xRet.set( new TableRowContext( *this, xAttribs, rvTableRows.back() ) );
+ }
+ break;
+ }
+
+ if( !xRet.is() )
+ xRet.set( this );
+
+ return xRet;
+}
+
+} } }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/drawingml/table/tablepartstylecontext.cxx b/oox/source/drawingml/table/tablepartstylecontext.cxx
new file mode 100644
index 000000000000..edbe76ff4b76
--- /dev/null
+++ b/oox/source/drawingml/table/tablepartstylecontext.cxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <osl/diagnose.h>
+
+#include "oox/drawingml/table/tablepartstylecontext.hxx"
+#include "oox/drawingml/table/tablestyletextstylecontext.hxx"
+#include "oox/drawingml/table/tablestylecellstylecontext.hxx"
+#include "oox/core/namespaces.hxx"
+#include "tokens.hxx"
+using namespace ::oox::core;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using ::rtl::OUString;
+
+namespace oox { namespace drawingml { namespace table {
+
+TablePartStyleContext::TablePartStyleContext( ContextHandler& rParent, TableStylePart& rTableStylePart )
+: ContextHandler( rParent )
+, mrTableStylePart( rTableStylePart )
+{
+}
+
+TablePartStyleContext::~TablePartStyleContext()
+{
+}
+
+// CT_TablePartStyle
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
+TablePartStyleContext::createFastChildContext( ::sal_Int32 aElementToken, const uno::Reference< xml::sax::XFastAttributeList >& xAttribs )
+ throw ( xml::sax::SAXException, uno::RuntimeException)
+{
+ uno::Reference< xml::sax::XFastContextHandler > xRet;
+
+ switch( aElementToken )
+ {
+ case NMSP_DRAWINGML|XML_tcTxStyle: // CT_TableStyleTextStyle
+ xRet.set( new TableStyleTextStyleContext( *this, xAttribs, mrTableStylePart ) );
+ break;
+ case NMSP_DRAWINGML|XML_tcStyle: // CT_TableStyleCellStyle
+ xRet.set( new TableStyleCellStyleContext( *this, mrTableStylePart ) );
+ break;
+ }
+ if( !xRet.is() )
+ {
+ uno::Reference<XFastContextHandler> xTmp(this);
+ xRet.set( xTmp );
+ }
+ return xRet;
+}
+
+} } }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/drawingml/table/tableproperties.cxx b/oox/source/drawingml/table/tableproperties.cxx
new file mode 100644
index 000000000000..592af5868463
--- /dev/null
+++ b/oox/source/drawingml/table/tableproperties.cxx
@@ -0,0 +1,183 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "oox/drawingml/table/tableproperties.hxx"
+#include "oox/drawingml/drawingmltypes.hxx"
+#include <com/sun/star/table/XTable.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/table/XMergeableCellRange.hpp>
+#include <com/sun/star/table/BorderLine2.hpp>
+#include "oox/core/namespaces.hxx"
+#include "oox/core/xmlfilterbase.hxx"
+#include "oox/helper/propertyset.hxx"
+#include "tokens.hxx"
+
+using rtl::OUString;
+using namespace ::oox::core;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::table;
+
+
+namespace oox { namespace drawingml { namespace table {
+
+TableProperties::TableProperties()
+: mbRtl( sal_False )
+, mbFirstRow( sal_False )
+, mbFirstCol( sal_False )
+, mbLastRow( sal_False )
+, mbLastCol( sal_False )
+, mbBandRow( sal_False )
+, mbBandCol( sal_False )
+{
+}
+TableProperties::~TableProperties()
+{
+}
+
+void TableProperties::apply( const TablePropertiesPtr& /* rSourceTableProperties */ )
+{
+}
+
+void CreateTableRows( uno::Reference< XTableRows > xTableRows, const std::vector< TableRow >& rvTableRows )
+{
+ if ( rvTableRows.size() > 1 )
+ xTableRows->insertByIndex( 0, rvTableRows.size() - 1 );
+ std::vector< TableRow >::const_iterator aTableRowIter( rvTableRows.begin() );
+ uno::Reference< container::XIndexAccess > xIndexAccess( xTableRows, UNO_QUERY_THROW );
+ for ( sal_Int32 n = 0; n < xIndexAccess->getCount(); n++ )
+ {
+ static const rtl::OUString sHeight( RTL_CONSTASCII_USTRINGPARAM ( "Height" ) );
+ Reference< XPropertySet > xPropSet( xIndexAccess->getByIndex( n ), UNO_QUERY_THROW );
+ xPropSet->setPropertyValue( sHeight, Any( static_cast< sal_Int32 >( aTableRowIter->getHeight() / 360 ) ) );
+ ++aTableRowIter;
+ }
+}
+
+void CreateTableColumns( Reference< XTableColumns > xTableColumns, const std::vector< sal_Int32 >& rvTableGrid )
+{
+ if ( rvTableGrid.size() > 1 )
+ xTableColumns->insertByIndex( 0, rvTableGrid.size() - 1 );
+ std::vector< sal_Int32 >::const_iterator aTableGridIter( rvTableGrid.begin() );
+ uno::Reference< container::XIndexAccess > xIndexAccess( xTableColumns, UNO_QUERY_THROW );
+ for ( sal_Int32 n = 0; n < xIndexAccess->getCount(); n++ )
+ {
+ static const rtl::OUString sWidth( RTL_CONSTASCII_USTRINGPARAM ( "Width" ) );
+ Reference< XPropertySet > xPropSet( xIndexAccess->getByIndex( n ), UNO_QUERY_THROW );
+ xPropSet->setPropertyValue( sWidth, Any( static_cast< sal_Int32 >( *aTableGridIter++ / 360 ) ) );
+ }
+}
+
+void MergeCells( const uno::Reference< XTable >& xTable, sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nColSpan, sal_Int32 nRowSpan )
+{
+ if( xTable.is() ) try
+ {
+ Reference< XMergeableCellRange > xRange( xTable->createCursorByRange( xTable->getCellRangeByPosition( nCol, nRow,nCol + nColSpan - 1, nRow + nRowSpan - 1 ) ), UNO_QUERY_THROW );
+ if( xRange->isMergeable() )
+ xRange->merge();
+ }
+ catch( Exception& )
+ {
+ }
+}
+
+static TableStyle* pDefaultTableStyle = new TableStyle();
+
+const TableStyle& TableProperties::getUsedTableStyle( const ::oox::core::XmlFilterBase& rFilterBase )
+{
+ ::oox::core::XmlFilterBase& rBase( const_cast< ::oox::core::XmlFilterBase& >( rFilterBase ) );
+
+ TableStyle* pTableStyle = NULL;
+ if ( mpTableStyle )
+ pTableStyle = &*mpTableStyle;
+ else if ( rBase.getTableStyles() )
+ {
+ const std::vector< TableStyle >& rTableStyles( rBase.getTableStyles()->getTableStyles() );
+ const rtl::OUString aStyleId( getStyleId().getLength() ? getStyleId() : rBase.getTableStyles()->getDefaultStyleId() );
+ std::vector< TableStyle >::const_iterator aIter( rTableStyles.begin() );
+ while( aIter != rTableStyles.end() )
+ {
+ if ( const_cast< TableStyle& >( *aIter ).getStyleId() == aStyleId )
+ {
+ pTableStyle = &const_cast< TableStyle& >( *aIter );
+ break; // we get the correct style
+ }
+ aIter++;
+ }
+ }
+ if ( !pTableStyle )
+ pTableStyle = pDefaultTableStyle;
+
+ return *pTableStyle;
+}
+
+void TableProperties::pushToPropSet( const ::oox::core::XmlFilterBase& rFilterBase,
+ const Reference < XPropertySet >& xPropSet, TextListStylePtr pMasterTextListStyle )
+{
+ TableStyleListPtr( const_cast< ::oox::core::XmlFilterBase& >( rFilterBase ).getTableStyles() );
+
+ uno::Reference< XColumnRowRange > xColumnRowRange(
+ xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("Model") ) ), uno::UNO_QUERY_THROW );
+
+ CreateTableColumns( xColumnRowRange->getColumns(), mvTableGrid );
+ CreateTableRows( xColumnRowRange->getRows(), mvTableRows );
+
+ const TableStyle& rTableStyle( getUsedTableStyle( rFilterBase ) );
+ sal_Int32 nRow = 0;
+ std::vector< TableRow >::iterator aTableRowIter( mvTableRows.begin() );
+ while( aTableRowIter != mvTableRows.end() )
+ {
+ sal_Int32 nColumn = 0;
+ std::vector< TableCell >::iterator aTableCellIter( aTableRowIter->getTableCells().begin() );
+ while( aTableCellIter != aTableRowIter->getTableCells().end() )
+ {
+ TableCell& rTableCell( *aTableCellIter );
+ if ( !rTableCell.getvMerge() && !rTableCell.gethMerge() )
+ {
+ uno::Reference< XTable > xTable( xColumnRowRange, uno::UNO_QUERY_THROW );
+ if ( ( rTableCell.getRowSpan() > 1 ) || ( rTableCell.getGridSpan() > 1 ) )
+ MergeCells( xTable, nColumn, nRow, rTableCell.getGridSpan(), rTableCell.getRowSpan() );
+
+ Reference< XCellRange > xCellRange( xTable, UNO_QUERY_THROW );
+ rTableCell.pushToXCell( rFilterBase, pMasterTextListStyle, xCellRange->getCellByPosition( nColumn, nRow ), *this, rTableStyle,
+ nColumn, aTableRowIter->getTableCells().size(), nRow, mvTableRows.size() );
+ }
+ nColumn++;
+ aTableCellIter++;
+ }
+ nRow++;
+ aTableRowIter++;
+ }
+}
+
+} } }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/drawingml/table/tablerow.cxx b/oox/source/drawingml/table/tablerow.cxx
new file mode 100644
index 000000000000..915a76a57c2a
--- /dev/null
+++ b/oox/source/drawingml/table/tablerow.cxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "oox/drawingml/table/tablerow.hxx"
+#include "oox/drawingml/drawingmltypes.hxx"
+#include "oox/core/namespaces.hxx"
+#include "tokens.hxx"
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include "oox/helper/propertyset.hxx"
+#include <com/sun/star/table/XTable.hpp>
+#include <com/sun/star/table/XMergeableCellRange.hpp>
+#include <com/sun/star/table/BorderLine2.hpp>
+
+using rtl::OUString;
+using namespace ::oox::core;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+
+namespace oox { namespace drawingml { namespace table {
+
+TableRow::TableRow()
+: mnHeight( 0 )
+{
+}
+TableRow::~TableRow()
+{
+}
+
+} } }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/drawingml/table/tablerowcontext.cxx b/oox/source/drawingml/table/tablerowcontext.cxx
new file mode 100644
index 000000000000..84c9d3aad4b2
--- /dev/null
+++ b/oox/source/drawingml/table/tablerowcontext.cxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <osl/diagnose.h>
+
+#include "oox/drawingml/table/tablerowcontext.hxx"
+#include "oox/drawingml/table/tablecellcontext.hxx"
+#include "oox/drawingml/table/tablerow.hxx"
+#include "oox/core/namespaces.hxx"
+#include "tokens.hxx"
+
+using namespace ::oox::core;
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+namespace oox { namespace drawingml { namespace table {
+
+TableRowContext::TableRowContext( ContextHandler& rParent, const uno::Reference< xml::sax::XFastAttributeList >& xAttribs, TableRow& rTableRow )
+: ContextHandler( rParent )
+, mrTableRow( rTableRow )
+{
+ rTableRow.setHeight( xAttribs->getOptionalValue( XML_h ).toInt32() );
+}
+
+TableRowContext::~TableRowContext()
+{
+}
+
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
+TableRowContext::createFastChildContext( ::sal_Int32 aElementToken, const uno::Reference< xml::sax::XFastAttributeList >& xAttribs )
+ throw ( xml::sax::SAXException, uno::RuntimeException)
+{
+ uno::Reference< xml::sax::XFastContextHandler > xRet;
+
+ switch( aElementToken )
+ {
+ case NMSP_DRAWINGML|XML_tc: // CT_TableCell
+ {
+ std::vector< TableCell >& rvTableCells = mrTableRow.getTableCells();
+ rvTableCells.resize( rvTableCells.size() + 1 );
+ xRet.set( new TableCellContext( *this, xAttribs, rvTableCells.back() ) );
+ }
+ break;
+ case NMSP_DRAWINGML|XML_extLst: // CT_OfficeArtExtensionList
+ default:
+ break;
+ }
+ if( !xRet.is() )
+ {
+ uno::Reference< XFastContextHandler > xTmp( this );
+ xRet.set( xTmp );
+ }
+ return xRet;
+}
+
+} } }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/drawingml/table/tablestyle.cxx b/oox/source/drawingml/table/tablestyle.cxx
new file mode 100644
index 000000000000..233d32f260f3
--- /dev/null
+++ b/oox/source/drawingml/table/tablestyle.cxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "oox/drawingml/table/tablestyle.hxx"
+
+namespace oox { namespace drawingml { namespace table {
+
+TableStyle::TableStyle()
+{
+}
+
+TableStyle::~TableStyle()
+{
+}
+
+} } }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/drawingml/table/tablestylecellstylecontext.cxx b/oox/source/drawingml/table/tablestylecellstylecontext.cxx
new file mode 100644
index 000000000000..bad3a7191903
--- /dev/null
+++ b/oox/source/drawingml/table/tablestylecellstylecontext.cxx
@@ -0,0 +1,129 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <osl/diagnose.h>
+
+#include "oox/drawingml/table/tablestylecellstylecontext.hxx"
+#include "oox/drawingml/fillpropertiesgroupcontext.hxx"
+#include "oox/drawingml/linepropertiescontext.hxx"
+#include "oox/core/namespaces.hxx"
+#include "oox/helper/attributelist.hxx"
+#include "tokens.hxx"
+using namespace ::oox::core;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using ::rtl::OUString;
+
+namespace oox { namespace drawingml { namespace table {
+
+TableStyleCellStyleContext::TableStyleCellStyleContext( ContextHandler& rParent, TableStylePart& rTableStylePart )
+: ContextHandler( rParent )
+, mrTableStylePart( rTableStylePart )
+, mnLineType( XML_none )
+{
+}
+
+TableStyleCellStyleContext::~TableStyleCellStyleContext()
+{
+}
+
+// CT_TableStyleCellStyle
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
+TableStyleCellStyleContext::createFastChildContext( ::sal_Int32 aElementToken, const uno::Reference< xml::sax::XFastAttributeList >& xAttribs )
+ throw ( xml::sax::SAXException, uno::RuntimeException)
+{
+ uno::Reference< xml::sax::XFastContextHandler > xRet;
+ AttributeList aAttribs( xAttribs );
+ switch( aElementToken )
+ {
+ case NMSP_DRAWINGML|XML_tcBdr: // CT_TableCellBorderStyle
+ break;
+ case NMSP_DRAWINGML|XML_left: // CT_ThemeableLineStyle
+ case NMSP_DRAWINGML|XML_right:
+ case NMSP_DRAWINGML|XML_top:
+ case NMSP_DRAWINGML|XML_bottom:
+ case NMSP_DRAWINGML|XML_insideH:
+ case NMSP_DRAWINGML|XML_insideV:
+ case NMSP_DRAWINGML|XML_tl2br:
+ case NMSP_DRAWINGML|XML_tr2bl:
+ mnLineType = getToken( aElementToken );
+ break;
+
+ case NMSP_DRAWINGML|XML_ln:
+ {
+ if ( mnLineType != XML_none )
+ {
+ std::map < sal_Int32, ::oox::drawingml::LinePropertiesPtr >& rLineBorders = mrTableStylePart.getLineBorders();
+ ::oox::drawingml::LinePropertiesPtr mpLineProperties( new oox::drawingml::LineProperties );
+ rLineBorders[ mnLineType ] = mpLineProperties;
+ xRet = new LinePropertiesContext( *this, xAttribs, *mpLineProperties );
+ }
+ }
+ break;
+ case NMSP_DRAWINGML|XML_lnRef:
+ {
+ if ( mnLineType != XML_none )
+ {
+ ShapeStyleRef& rLineStyleRef = mrTableStylePart.getStyleRefs()[ mnLineType ];
+ rLineStyleRef.mnThemedIdx = aAttribs.getInteger( XML_idx, 0 );
+ xRet.set( new ColorContext( *this, rLineStyleRef.maPhClr ) );
+ }
+ }
+ break;
+
+ // EG_ThemeableFillStyle (choice)
+ case NMSP_DRAWINGML|XML_fill: // CT_FillProperties
+ {
+ FillPropertiesPtr& rxFillProperties = mrTableStylePart.getFillProperties();
+ rxFillProperties.reset( new FillProperties );
+ xRet.set( new FillPropertiesContext( *this, *rxFillProperties ) );
+ }
+ break;
+ case NMSP_DRAWINGML|XML_fillRef: // CT_StyleMatrixReference
+ {
+ ShapeStyleRef& rStyleRef = mrTableStylePart.getStyleRefs()[ XML_fillRef ];
+ rStyleRef.mnThemedIdx = aAttribs.getInteger( XML_idx, 0 );
+ xRet.set( new ColorContext( *this, rStyleRef.maPhClr ) );
+ }
+ break;
+
+ case NMSP_DRAWINGML|XML_cell3D: // CT_Cell3D
+ break;
+ }
+ if( !xRet.is() )
+ {
+ uno::Reference<XFastContextHandler> xTmp(this);
+ xRet.set( xTmp );
+ }
+ return xRet;
+}
+
+} } }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/drawingml/table/tablestylecontext.cxx b/oox/source/drawingml/table/tablestylecontext.cxx
new file mode 100644
index 000000000000..037ec22d22fc
--- /dev/null
+++ b/oox/source/drawingml/table/tablestylecontext.cxx
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <osl/diagnose.h>
+
+#include "oox/drawingml/table/tablestylecontext.hxx"
+#include "oox/drawingml/table/tablebackgroundstylecontext.hxx"
+#include "oox/drawingml/table/tablepartstylecontext.hxx"
+#include "oox/core/namespaces.hxx"
+#include "tokens.hxx"
+using namespace ::oox::core;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using ::rtl::OUString;
+
+namespace oox { namespace drawingml { namespace table {
+
+TableStyleContext::TableStyleContext( ContextHandler& rParent,
+ const Reference< XFastAttributeList >& xAttribs, TableStyle& rTableStyle )
+: ContextHandler( rParent )
+, mrTableStyle( rTableStyle )
+{
+ mrTableStyle.getStyleId() = xAttribs->getOptionalValue( XML_styleId );
+ mrTableStyle.getStyleName() = xAttribs->getOptionalValue( XML_styleName );
+}
+
+TableStyleContext::~TableStyleContext()
+{
+}
+
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
+TableStyleContext::createFastChildContext( ::sal_Int32 aElementToken, const uno::Reference< xml::sax::XFastAttributeList >& /* xAttribs */ )
+ throw ( xml::sax::SAXException, uno::RuntimeException)
+{
+ uno::Reference< xml::sax::XFastContextHandler > xRet;
+
+ switch( aElementToken )
+ {
+ case NMSP_DRAWINGML|XML_tblBg: // CT_TableBackgroundStyle
+ xRet = new TableBackgroundStyleContext( *this, mrTableStyle );
+ break;
+ case NMSP_DRAWINGML|XML_wholeTbl: // CT_TablePartStyle
+ xRet = new TablePartStyleContext( *this, mrTableStyle.getWholeTbl() );
+ break;
+ case NMSP_DRAWINGML|XML_band1H: // CT_TablePartStyle
+ xRet = new TablePartStyleContext( *this, mrTableStyle.getBand1H() );
+ break;
+ case NMSP_DRAWINGML|XML_band2H: // CT_TablePartStyle
+ xRet = new TablePartStyleContext( *this, mrTableStyle.getBand2H() );
+ break;
+ case NMSP_DRAWINGML|XML_band1V: // CT_TablePartStyle
+ xRet = new TablePartStyleContext( *this, mrTableStyle.getBand1V() );
+ break;
+ case NMSP_DRAWINGML|XML_band2V: // CT_TablePartStyle
+ xRet = new TablePartStyleContext( *this, mrTableStyle.getBand2V() );
+ break;
+ case NMSP_DRAWINGML|XML_lastCol: // CT_TablePartStyle
+ xRet = new TablePartStyleContext( *this, mrTableStyle.getLastCol() );
+ break;
+ case NMSP_DRAWINGML|XML_firstCol: // CT_TablePartStyle
+ xRet = new TablePartStyleContext( *this, mrTableStyle.getFirstCol() );
+ break;
+ case NMSP_DRAWINGML|XML_lastRow: // CT_TablePartStyle
+ xRet = new TablePartStyleContext( *this, mrTableStyle.getLastRow() );
+ break;
+ case NMSP_DRAWINGML|XML_seCell: // CT_TablePartStyle
+ xRet = new TablePartStyleContext( *this, mrTableStyle.getSeCell() );
+ break;
+ case NMSP_DRAWINGML|XML_swCell: // CT_TablePartStyle
+ xRet = new TablePartStyleContext( *this, mrTableStyle.getSwCell() );
+ break;
+ case NMSP_DRAWINGML|XML_firstRow: // CT_TablePartStyle
+ xRet = new TablePartStyleContext( *this, mrTableStyle.getFirstRow() );
+ break;
+ case NMSP_DRAWINGML|XML_neCell: // CT_TablePartStyle
+ xRet = new TablePartStyleContext( *this, mrTableStyle.getNeCell() );
+ break;
+ case NMSP_DRAWINGML|XML_nwCell: // CT_TablePartStyle
+ xRet = new TablePartStyleContext( *this, mrTableStyle.getNwCell() );
+ break;
+ case NMSP_DRAWINGML|XML_extLst: // CT_OfficeArtExtensionList
+ break;
+ }
+ if( !xRet.is() )
+ {
+ uno::Reference<XFastContextHandler> xTmp(this);
+ xRet.set( xTmp );
+ }
+ return xRet;
+}
+
+} } }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/drawingml/table/tablestylelist.cxx b/oox/source/drawingml/table/tablestylelist.cxx
new file mode 100644
index 000000000000..18a6af4a3330
--- /dev/null
+++ b/oox/source/drawingml/table/tablestylelist.cxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "oox/drawingml/table/tablestylelist.hxx"
+#include "oox/drawingml/table/tablestyle.hxx"
+
+namespace oox { namespace drawingml { namespace table {
+
+TableStyleList::TableStyleList()
+{
+}
+
+TableStyleList::~TableStyleList()
+{
+}
+
+} } }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/drawingml/table/tablestylelistfragmenthandler.cxx b/oox/source/drawingml/table/tablestylelistfragmenthandler.cxx
new file mode 100644
index 000000000000..d257a4e00a0d
--- /dev/null
+++ b/oox/source/drawingml/table/tablestylelistfragmenthandler.cxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "oox/drawingml/table/tablestylelistfragmenthandler.hxx"
+#include "oox/drawingml/table/tablestylecontext.hxx"
+
+using ::rtl::OUString;
+using namespace ::oox::core;
+
+using rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::oox::core;
+using namespace ::oox::drawingml;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+
+namespace oox {
+namespace drawingml {
+namespace table {
+
+// ============================================================================
+
+TableStyleListFragmentHandler::TableStyleListFragmentHandler( XmlFilterBase& rFilter, const OUString& rFragmentPath, TableStyleList& rTableStyleList ):
+FragmentHandler2( rFilter, rFragmentPath ),
+mrTableStyleList( rTableStyleList )
+{
+}
+
+TableStyleListFragmentHandler::~TableStyleListFragmentHandler()
+{
+}
+
+// CT_TableStyleList
+Reference< XFastContextHandler > TableStyleListFragmentHandler::createFastChildContext(
+ sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs )
+ throw ( SAXException, RuntimeException )
+{
+ Reference< XFastContextHandler > xRet;
+ switch( aElementToken )
+ {
+ case NMSP_DRAWINGML|XML_tblStyleLst: // CT_TableStyleList
+ mrTableStyleList.getDefaultStyleId() = xAttribs->getOptionalValue( XML_def );
+ break;
+ case NMSP_DRAWINGML|XML_tblStyle: // CT_TableStyle
+ std::vector< TableStyle >& rTableStyles = mrTableStyleList.getTableStyles();
+ rTableStyles.resize( rTableStyles.size() + 1 );
+ xRet = new TableStyleContext( *this, xAttribs, rTableStyles.back() );
+ break;
+ }
+ if ( !xRet.is() )
+ xRet = getFastContextHandler();
+ return xRet;
+}
+
+// ============================================================================
+
+} // namespace table
+} // namespace drawingml
+} // namespace oox
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/drawingml/table/tablestylepart.cxx b/oox/source/drawingml/table/tablestylepart.cxx
new file mode 100644
index 000000000000..8372dd93ef48
--- /dev/null
+++ b/oox/source/drawingml/table/tablestylepart.cxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "oox/drawingml/table/tablestylepart.hxx"
+#include "oox/drawingml/drawingmltypes.hxx"
+#include "oox/core/namespaces.hxx"
+#include "tokens.hxx"
+
+using rtl::OUString;
+using namespace ::oox::core;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+
+namespace oox { namespace drawingml { namespace table {
+
+TableStylePart::TableStylePart()
+{
+}
+
+TableStylePart::~TableStylePart()
+{
+}
+
+} } }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/drawingml/table/tablestyletextstylecontext.cxx b/oox/source/drawingml/table/tablestyletextstylecontext.cxx
new file mode 100644
index 000000000000..2e94e57df66a
--- /dev/null
+++ b/oox/source/drawingml/table/tablestyletextstylecontext.cxx
@@ -0,0 +1,116 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <osl/diagnose.h>
+
+#include "oox/drawingml/table/tablestyletextstylecontext.hxx"
+#include "oox/drawingml/colorchoicecontext.hxx"
+#include "oox/core/namespaces.hxx"
+#include "oox/helper/attributelist.hxx"
+#include "tokens.hxx"
+using namespace ::oox::core;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using ::rtl::OUString;
+
+namespace oox { namespace drawingml { namespace table {
+
+TableStyleTextStyleContext::TableStyleTextStyleContext( ContextHandler& rParent,
+ const Reference< XFastAttributeList >& xAttribs, TableStylePart& rTableStylePart )
+: ContextHandler( rParent )
+, mrTableStylePart( rTableStylePart )
+{
+ if( xAttribs->hasAttribute( XML_b ) ) {
+ sal_Int32 nB = xAttribs->getOptionalValueToken( XML_b, XML_def );
+ if ( nB == XML_on )
+ mrTableStylePart.getTextBoldStyle() = ::boost::optional< sal_Bool >( sal_True );
+ else if ( nB == XML_off )
+ mrTableStylePart.getTextBoldStyle() = ::boost::optional< sal_Bool >( sal_False );
+ }
+
+ if( xAttribs->hasAttribute( XML_i ) ) {
+ sal_Int32 nI = xAttribs->getOptionalValueToken( XML_i, XML_def );
+ if ( nI == XML_on )
+ mrTableStylePart.getTextItalicStyle() = ::boost::optional< sal_Bool >( sal_True );
+ else if ( nI == XML_off )
+ mrTableStylePart.getTextItalicStyle() = ::boost::optional< sal_Bool >( sal_False );
+ }
+}
+
+TableStyleTextStyleContext::~TableStyleTextStyleContext()
+{
+}
+
+// CT_TableStyleTextStyle
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
+TableStyleTextStyleContext::createFastChildContext( ::sal_Int32 aElementToken, const uno::Reference< xml::sax::XFastAttributeList >& xAttribs )
+ throw ( xml::sax::SAXException, uno::RuntimeException)
+{
+ uno::Reference< xml::sax::XFastContextHandler > xRet;
+ AttributeList aAttribs( xAttribs );
+
+ switch( aElementToken )
+ {
+ // EG_ThemeableFontStyles (choice)
+ case NMSP_DRAWINGML|XML_font: // CT_FontCollection
+ xRet.set( this );
+ break;
+ case NMSP_DRAWINGML|XML_ea: // CT_TextFont
+ mrTableStylePart.getAsianFont().setAttributes( aAttribs );
+ return 0;
+ case NMSP_DRAWINGML|XML_cs: // CT_TextFont
+ mrTableStylePart.getComplexFont().setAttributes( aAttribs );
+ return 0;
+ case NMSP_DRAWINGML|XML_sym: // CT_TextFont
+ mrTableStylePart.getSymbolFont().setAttributes( aAttribs );
+ return 0;
+ case NMSP_DRAWINGML|XML_latin: // CT_TextFont
+ mrTableStylePart.getLatinFont().setAttributes( aAttribs );
+ return 0;
+
+ case NMSP_DRAWINGML|XML_fontRef: // CT_FontReference
+ {
+ ShapeStyleRef& rFontStyle = mrTableStylePart.getStyleRefs()[ XML_fontRef ];
+ rFontStyle.mnThemedIdx = aAttribs.getToken( XML_idx, XML_none );
+ xRet.set( new ColorContext( *this, rFontStyle.maPhClr ) );
+ }
+ break;
+
+ case NMSP_DRAWINGML|XML_extLst: // CT_OfficeArtExtensionList
+ break;
+ }
+ if( !xRet.is() )
+ xRet.set( new ColorValueContext( *this, mrTableStylePart.getTextColor() ) );
+
+ return xRet;
+}
+
+} } }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */