diff options
author | Daniel Rentz <dr@openoffice.org> | 2010-06-17 11:32:18 +0200 |
---|---|---|
committer | Daniel Rentz <dr@openoffice.org> | 2010-06-17 11:32:18 +0200 |
commit | 74721a30a80c06fac3d51dbe9da54344b60542ab (patch) | |
tree | 4443d765a3a9b4ccc7317f3fbe258925e75394c2 /oox/source | |
parent | 614e369c4cb48ea4bcafcae6c29f412e20a4e6a7 (diff) | |
parent | 1f4a5d96da42928176c86bc7b29423b63dbaefc9 (diff) |
mib16: rebase to m82
Diffstat (limited to 'oox/source')
36 files changed, 1179 insertions, 165 deletions
diff --git a/oox/source/drawingml/chart/axisconverter.cxx b/oox/source/drawingml/chart/axisconverter.cxx index 3ad1c0023ebe..77cf21698c62 100644 --- a/oox/source/drawingml/chart/axisconverter.cxx +++ b/oox/source/drawingml/chart/axisconverter.cxx @@ -301,11 +301,12 @@ void AxisConverter::convertFromModel( const Reference< XCoordinateSystem >& rxCo // axis title --------------------------------------------------------- - if( mrModel.mxTitle.is() ) + // in radar charts, title objects may exist, but are not shown + if( mrModel.mxTitle.is() && (rTypeGroup.getTypeInfo().meTypeCategory != TYPECATEGORY_RADAR) ) { Reference< XTitled > xTitled( xAxis, UNO_QUERY_THROW ); TitleConverter aTitleConv( *this, *mrModel.mxTitle ); - aTitleConv.convertFromModel( xTitled, CREATE_OUSTRING( "Axis Title" ), OBJECTTYPE_AXISTITLE ); + aTitleConv.convertFromModel( xTitled, CREATE_OUSTRING( "Axis Title" ), OBJECTTYPE_AXISTITLE, nAxesSetIdx, nAxisIdx ); } } catch( Exception& ) diff --git a/oox/source/drawingml/chart/chartcontextbase.cxx b/oox/source/drawingml/chart/chartcontextbase.cxx index 2666d22ccbe0..d3746f07ba6c 100644 --- a/oox/source/drawingml/chart/chartcontextbase.cxx +++ b/oox/source/drawingml/chart/chartcontextbase.cxx @@ -27,6 +27,7 @@ #include "oox/drawingml/chart/chartcontextbase.hxx" #include "oox/drawingml/shapepropertiescontext.hxx" +#include "oox/drawingml/chart/modelbase.hxx" using ::oox::core::ContextHandler2Helper; using ::oox::core::ContextHandlerRef; @@ -53,6 +54,66 @@ ContextHandlerRef ShapePrWrapperContext::onCreateContext( sal_Int32 nElement, co // ============================================================================ +LayoutContext::LayoutContext( ContextHandler2Helper& rParent, LayoutModel& rModel ) : + ContextBase< LayoutModel >( rParent, rModel ) +{ +} + +LayoutContext::~LayoutContext() +{ +} + +ContextHandlerRef LayoutContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) +{ + switch( getCurrentElement() ) + { + case C_TOKEN( layout ): + switch( nElement ) + { + case C_TOKEN( manualLayout ): + mrModel.mbAutoLayout = false; + return this; + } + break; + + case C_TOKEN( manualLayout ): + switch( nElement ) + { + case C_TOKEN( x ): + mrModel.mfX = rAttribs.getDouble( XML_val, 0.0 ); + return 0; + case C_TOKEN( y ): + mrModel.mfY = rAttribs.getDouble( XML_val, 0.0 ); + return 0; + case C_TOKEN( w ): + mrModel.mfW = rAttribs.getDouble( XML_val, 0.0 ); + return 0; + case C_TOKEN( h ): + mrModel.mfH = rAttribs.getDouble( XML_val, 0.0 ); + return 0; + case C_TOKEN( xMode ): + mrModel.mnXMode = rAttribs.getToken( XML_val, XML_factor ); + return 0; + case C_TOKEN( yMode ): + mrModel.mnYMode = rAttribs.getToken( XML_val, XML_factor ); + return 0; + case C_TOKEN( wMode ): + mrModel.mnWMode = rAttribs.getToken( XML_val, XML_factor ); + return 0; + case C_TOKEN( hMode ): + mrModel.mnHMode = rAttribs.getToken( XML_val, XML_factor ); + return 0; + case C_TOKEN( layoutTarget ): + mrModel.mnTarget = rAttribs.getToken( XML_val, XML_outer ); + return 0; + } + break; + } + return 0; +} + +// ============================================================================ + } // namespace chart } // namespace drawingml } // namespace oox diff --git a/oox/source/drawingml/chart/chartspaceconverter.cxx b/oox/source/drawingml/chart/chartspaceconverter.cxx index 6460e94a4f3b..54212f1bdbda 100644 --- a/oox/source/drawingml/chart/chartspaceconverter.cxx +++ b/oox/source/drawingml/chart/chartspaceconverter.cxx @@ -26,12 +26,12 @@ ************************************************************************/ #include "oox/drawingml/chart/chartspaceconverter.hxx" -#include <com/sun/star/drawing/XDrawPageSupplier.hpp> #include <com/sun/star/chart/MissingValueTreatment.hpp> #include <com/sun/star/chart/XChartDocument.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> #include <com/sun/star/chart2/XTitled.hpp> #include <com/sun/star/chart2/data/XDataReceiver.hpp> +#include <com/sun/star/drawing/XDrawPageSupplier.hpp> #include "oox/core/xmlfilterbase.hxx" #include "oox/drawingml/chart/chartconverter.hxx" #include "oox/drawingml/chart/chartdrawingfragment.hxx" @@ -147,14 +147,23 @@ void ChartSpaceConverter::convertFromModel( const Reference< XShapes >& rxExtern aDiaProp.setProperty( PROP_MissingValueTreatment, nMissingValues ); } - Reference< com::sun::star::chart::XChartDocument > xOldChartDoc( getChartDocument(), UNO_QUERY ); - if( xOldChartDoc.is() ) + /* Following all conversions needing the old Chart1 API that involves full + initialization of the chart view. */ + namespace cssc = ::com::sun::star::chart; + Reference< cssc::XChartDocument > xChart1Doc( getChartDocument(), UNO_QUERY ); + if( xChart1Doc.is() ) { /* Set the IncludeHiddenCells property via the old API as only this ensures that the data provider and all created sequences get this flag correctly. */ - PropertySet aOldDiaProp( xOldChartDoc->getDiagram() ); - aOldDiaProp.setProperty( PROP_IncludeHiddenCells, !mrModel.mbPlotVisOnly ); + PropertySet aDiaProp( xChart1Doc->getDiagram() ); + aDiaProp.setProperty( PROP_IncludeHiddenCells, !mrModel.mbPlotVisOnly ); + + // plot area position and size + aPlotAreaConv.convertPositionFromModel(); + + // positions of main title and all axis titles + convertTitlePositions(); } // embedded drawing shapes diff --git a/oox/source/drawingml/chart/converterbase.cxx b/oox/source/drawingml/chart/converterbase.cxx index 534ce48e0278..b5a0511bf1b8 100644 --- a/oox/source/drawingml/chart/converterbase.cxx +++ b/oox/source/drawingml/chart/converterbase.cxx @@ -30,6 +30,14 @@ #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/drawing/FillStyle.hpp> #include <com/sun/star/drawing/LineStyle.hpp> +#include <com/sun/star/chart/XAxisXSupplier.hpp> +#include <com/sun/star/chart/XAxisYSupplier.hpp> +#include <com/sun/star/chart/XAxisZSupplier.hpp> +#include <com/sun/star/chart/XChartDocument.hpp> +#include <com/sun/star/chart/XSecondAxisTitleSupplier.hpp> +#include <com/sun/star/chart2/RelativePosition.hpp> +#include <tools/solar.h> // for F_PI180 +#include "properties.hxx" #include "oox/core/xmlfilterbase.hxx" #include "oox/drawingml/theme.hxx" @@ -37,22 +45,126 @@ using ::rtl::OUString; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::XInterface; using ::com::sun::star::uno::Exception; +using ::com::sun::star::uno::RuntimeException; +using ::com::sun::star::uno::UNO_QUERY; using ::com::sun::star::uno::UNO_QUERY_THROW; +using ::com::sun::star::uno::UNO_SET_THROW; using ::com::sun::star::lang::XMultiServiceFactory; using ::com::sun::star::frame::XModel; +using ::com::sun::star::awt::Point; +using ::com::sun::star::awt::Rectangle; using ::com::sun::star::awt::Size; +using ::com::sun::star::chart2::RelativePosition; using ::com::sun::star::chart2::XChartDocument; +using ::com::sun::star::chart2::XTitle; +using ::com::sun::star::drawing::XShape; using ::oox::core::XmlFilterBase; +namespace cssc = ::com::sun::star::chart; + namespace oox { namespace drawingml { namespace chart { // ============================================================================ +namespace { + +struct TitleKey : public ::std::pair< ObjectType, ::std::pair< sal_Int32, sal_Int32 > > +{ + inline explicit TitleKey( ObjectType eObjType, sal_Int32 nMainIdx = -1, sal_Int32 nSubIdx = -1 ) + { first = eObjType; second.first = nMainIdx; second.second = nSubIdx; } +}; + +// ---------------------------------------------------------------------------- + +/** A helper structure to store all data related to title objects. Needed for + the conversion of manual title positions that needs the old Chart1 API. + */ +struct TitleLayoutInfo +{ + typedef Reference< XShape > (*GetShapeFunc)( const Reference< cssc::XChartDocument >& ); + + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTitle > + mxTitle; /// The API title object. + ModelRef< LayoutModel > mxLayout; /// The layout model, if existing. + GetShapeFunc mpGetShape; /// Helper function to receive the title shape. + + inline explicit TitleLayoutInfo() : mpGetShape( 0 ) {} + + void convertTitlePos( + ConverterRoot& rRoot, + const Reference< cssc::XChartDocument >& rxChart1Doc ); +}; + +void TitleLayoutInfo::convertTitlePos( ConverterRoot& rRoot, const Reference< cssc::XChartDocument >& rxChart1Doc ) +{ + if( mxTitle.is() && mpGetShape ) try + { + // try to get the title shape + Reference< XShape > xTitleShape( mpGetShape( rxChart1Doc ), UNO_SET_THROW ); + // get title rotation angle, needed for correction of position of top-left edge + double fAngle = 0.0; + PropertySet aTitleProp( mxTitle ); + aTitleProp.getProperty( fAngle, PROP_TextRotation ); + // convert the position + LayoutModel& rLayout = mxLayout.getOrCreate(); + LayoutConverter aLayoutConv( rRoot, rLayout ); + aLayoutConv.convertFromModel( xTitleShape, fAngle ); + } + catch( Exception& ) + { + } +} + +// ---------------------------------------------------------------------------- + +/* The following local functions implement getting the XShape interface of all + supported title objects (chart and axes). This needs some effort due to the + design of the old Chart1 API used to access these objects. */ + +/** A code fragment that returns a shape object from the passed shape supplier + using the specified interface function. Checks a boolean property first. */ +#define OOX_FRAGMENT_GETTITLESHAPE( shape_supplier, supplier_func, property_name ) \ + PropertySet aPropSet( shape_supplier ); \ + if( shape_supplier.is() && aPropSet.getBoolProperty( PROP_##property_name ) ) \ + return shape_supplier->supplier_func(); \ + return Reference< XShape >(); \ + +/** Implements a function returning the drawing shape of an axis title, if + existing, using the specified API interface and its function. */ +#define OOX_DEFINEFUNC_GETAXISTITLESHAPE( func_name, interface_type, supplier_func, property_name ) \ +Reference< XShape > func_name( const Reference< cssc::XChartDocument >& rxChart1Doc ) \ +{ \ + Reference< cssc::interface_type > xAxisSupp( rxChart1Doc->getDiagram(), UNO_QUERY ); \ + OOX_FRAGMENT_GETTITLESHAPE( xAxisSupp, supplier_func, property_name ) \ +} + +/** Returns the drawing shape of the main title, if existing. */ +Reference< XShape > lclGetMainTitleShape( const Reference< cssc::XChartDocument >& rxChart1Doc ) +{ + OOX_FRAGMENT_GETTITLESHAPE( rxChart1Doc, getTitle, HasMainTitle ) +} + +OOX_DEFINEFUNC_GETAXISTITLESHAPE( lclGetXAxisTitleShape, XAxisXSupplier, getXAxisTitle, HasXAxisTitle ) +OOX_DEFINEFUNC_GETAXISTITLESHAPE( lclGetYAxisTitleShape, XAxisYSupplier, getYAxisTitle, HasYAxisTitle ) +OOX_DEFINEFUNC_GETAXISTITLESHAPE( lclGetZAxisTitleShape, XAxisZSupplier, getZAxisTitle, HasZAxisTitle ) +OOX_DEFINEFUNC_GETAXISTITLESHAPE( lclGetSecXAxisTitleShape, XSecondAxisTitleSupplier, getSecondXAxisTitle, HasSecondaryXAxisTitle ) +OOX_DEFINEFUNC_GETAXISTITLESHAPE( lclGetSecYAxisTitleShape, XSecondAxisTitleSupplier, getSecondYAxisTitle, HasSecondaryYAxisTitle ) + +#undef OOX_DEFINEFUNC_GETAXISTITLESHAPE +#undef OOX_IMPLEMENT_GETTITLESHAPE + +} // namespace + +// ============================================================================ + struct ConverterData { + typedef ::std::map< TitleKey, TitleLayoutInfo > TitleMap; + ObjectFormatter maFormatter; + TitleMap maTitles; XmlFilterBase& mrFilter; ChartConverter& mrConverter; Reference< XChartDocument > mxDoc; @@ -91,6 +203,14 @@ ConverterData::ConverterData( catch( Exception& ) { } + + // prepare conversion of title positions + maTitles[ TitleKey( OBJECTTYPE_CHARTTITLE ) ].mpGetShape = lclGetMainTitleShape; + maTitles[ TitleKey( OBJECTTYPE_AXISTITLE, API_PRIM_AXESSET, API_X_AXIS ) ].mpGetShape = lclGetXAxisTitleShape; + maTitles[ TitleKey( OBJECTTYPE_AXISTITLE, API_PRIM_AXESSET, API_Y_AXIS ) ].mpGetShape = lclGetYAxisTitleShape; + maTitles[ TitleKey( OBJECTTYPE_AXISTITLE, API_PRIM_AXESSET, API_Z_AXIS ) ].mpGetShape = lclGetZAxisTitleShape; + maTitles[ TitleKey( OBJECTTYPE_AXISTITLE, API_SECN_AXESSET, API_X_AXIS ) ].mpGetShape = lclGetSecXAxisTitleShape; + maTitles[ TitleKey( OBJECTTYPE_AXISTITLE, API_SECN_AXESSET, API_Y_AXIS ) ].mpGetShape = lclGetSecYAxisTitleShape; } ConverterData::~ConverterData() @@ -122,13 +242,12 @@ ConverterRoot::~ConverterRoot() { } -Reference< XInterface > ConverterRoot::createInstance( - const Reference< XMultiServiceFactory >& rxFactory, const OUString& rServiceName ) +Reference< XInterface > ConverterRoot::createInstance( const OUString& rServiceName ) const { Reference< XInterface > xInt; - if( rxFactory.is() ) try + try { - xInt = rxFactory->createInstance( rServiceName ); + xInt = mxData->mrFilter.getGlobalFactory()->createInstance( rServiceName ); } catch( Exception& ) { @@ -137,11 +256,6 @@ Reference< XInterface > ConverterRoot::createInstance( return xInt; } -Reference< XInterface > ConverterRoot::createInstance( const OUString& rServiceName ) const -{ - return createInstance( mxData->mrFilter.getGlobalFactory(), rServiceName ); -} - XmlFilterBase& ConverterRoot::getFilter() const { return mxData->mrFilter; @@ -167,6 +281,139 @@ ObjectFormatter& ConverterRoot::getFormatter() const return mxData->maFormatter; } +void ConverterRoot::registerTitleLayout( const Reference< XTitle >& rxTitle, + const ModelRef< LayoutModel >& rxLayout, ObjectType eObjType, sal_Int32 nMainIdx, sal_Int32 nSubIdx ) +{ + OSL_ENSURE( rxTitle.is(), "ConverterRoot::registerTitleLayout - missing title object" ); + TitleLayoutInfo& rTitleInfo = mxData->maTitles[ TitleKey( eObjType, nMainIdx, nSubIdx ) ]; + OSL_ENSURE( rTitleInfo.mpGetShape, "ConverterRoot::registerTitleLayout - invalid title key" ); + rTitleInfo.mxTitle = rxTitle; + rTitleInfo.mxLayout = rxLayout; +} + +void ConverterRoot::convertTitlePositions() +{ + try + { + Reference< cssc::XChartDocument > xChart1Doc( mxData->mxDoc, UNO_QUERY_THROW ); + for( ConverterData::TitleMap::iterator aIt = mxData->maTitles.begin(), aEnd = mxData->maTitles.end(); aIt != aEnd; ++aIt ) + aIt->second.convertTitlePos( *this, xChart1Doc ); + } + catch( Exception& ) + { + } +} + +// ============================================================================ + +namespace { + +/** Returns a position value in the chart area in 1/100 mm. */ +sal_Int32 lclCalcPosition( sal_Int32 nChartSize, double fPos, sal_Int32 nPosMode ) +{ + switch( nPosMode ) + { + case XML_edge: // absolute start position as factor of chart size + return getLimitedValue< sal_Int32, double >( nChartSize * fPos + 0.5, 0, nChartSize ); + case XML_factor: // position relative to object default position + OSL_ENSURE( false, "lclCalcPosition - relative positioning not supported" ); + return -1; + }; + + OSL_ENSURE( false, "lclCalcPosition - unknown positioning mode" ); + return -1; +} + +/** Returns a size value in the chart area in 1/100 mm. */ +sal_Int32 lclCalcSize( sal_Int32 nPos, sal_Int32 nChartSize, double fSize, sal_Int32 nSizeMode ) +{ + sal_Int32 nValue = getLimitedValue< sal_Int32, double >( nChartSize * fSize + 0.5, 0, nChartSize ); + switch( nSizeMode ) + { + case XML_factor: // size as factor of chart size + return nValue; + case XML_edge: // absolute end position as factor of chart size + return nValue - nPos + 1; + }; + + OSL_ENSURE( false, "lclCalcSize - unknown size mode" ); + return -1; +} + +} // namespace + +// ---------------------------------------------------------------------------- + +LayoutConverter::LayoutConverter( const ConverterRoot& rParent, LayoutModel& rModel ) : + ConverterBase< LayoutModel >( rParent, rModel ) +{ +} + +LayoutConverter::~LayoutConverter() +{ +} + +bool LayoutConverter::calcAbsRectangle( Rectangle& orRect ) const +{ + if( !mrModel.mbAutoLayout ) + { + const Size& rChartSize = getChartSize(); + orRect.X = lclCalcPosition( rChartSize.Width, mrModel.mfX, mrModel.mnXMode ); + orRect.Y = lclCalcPosition( rChartSize.Height, mrModel.mfY, mrModel.mnYMode ); + if( (orRect.X >= 0) && (orRect.Y >= 0) ) + { + orRect.Width = lclCalcSize( orRect.X, rChartSize.Width, mrModel.mfW, mrModel.mnWMode ); + orRect.Height = lclCalcSize( orRect.Y, rChartSize.Height, mrModel.mfH, mrModel.mnHMode ); + return (orRect.Width > 0) && (orRect.Height > 0); + } + } + return false; +} + +bool LayoutConverter::convertFromModel( PropertySet& rPropSet ) +{ + if( !mrModel.mbAutoLayout && + (mrModel.mnXMode == XML_edge) && (mrModel.mfX >= 0.0) && + (mrModel.mnYMode == XML_edge) && (mrModel.mfY >= 0.0) ) + { + RelativePosition aPos; + aPos.Primary = getLimitedValue< double, double >( mrModel.mfX, 0.0, 1.0 ); + aPos.Secondary = getLimitedValue< double, double >( mrModel.mfY, 0.0, 1.0 ); + aPos.Anchor = ::com::sun::star::drawing::Alignment_TOP_LEFT; + rPropSet.setProperty( PROP_RelativePosition, aPos ); + return true; + } + return false; +} + +bool LayoutConverter::convertFromModel( const Reference< XShape >& rxShape, double fRotationAngle ) +{ + if( !mrModel.mbAutoLayout ) + { + const Size& rChartSize = getChartSize(); + Point aShapePos( + lclCalcPosition( rChartSize.Width, mrModel.mfX, mrModel.mnXMode ), + lclCalcPosition( rChartSize.Height, mrModel.mfY, mrModel.mnYMode ) ); + if( (aShapePos.X >= 0) && (aShapePos.Y >= 0) ) + { + // the call to XShape.getSize() may recalc the chart view + Size aShapeSize = rxShape->getSize(); + // rotated shapes need special handling... + double fSin = fabs( sin( fRotationAngle * F_PI180 ) ); + // add part of height to X direction, if title is rotated down + if( fRotationAngle > 180.0 ) + aShapePos.X += static_cast< sal_Int32 >( fSin * aShapeSize.Height + 0.5 ); + // add part of width to Y direction, if title is rotated up + else if( fRotationAngle > 0.0 ) + aShapePos.Y += static_cast< sal_Int32 >( fSin * aShapeSize.Width + 0.5 ); + // set the resulting position at the shape + rxShape->setPosition( aShapePos ); + return true; + } + } + return false; +} + // ============================================================================ } // namespace chart diff --git a/oox/source/drawingml/chart/modelbase.cxx b/oox/source/drawingml/chart/modelbase.cxx index 3aa6b1f0047f..c182d8e3e410 100644 --- a/oox/source/drawingml/chart/modelbase.cxx +++ b/oox/source/drawingml/chart/modelbase.cxx @@ -50,6 +50,26 @@ void NumberFormat::setAttributes( const AttributeList& rAttribs ) // ============================================================================ +LayoutModel::LayoutModel() : + mfX( 0.0 ), + mfY( 0.0 ), + mfW( 0.0 ), + mfH( 0.0 ), + mnXMode( XML_factor ), + mnYMode( XML_factor ), + mnWMode( XML_factor ), + mnHMode( XML_factor ), + mnTarget( XML_outer ), + mbAutoLayout( true ) +{ +} + +LayoutModel::~LayoutModel() +{ +} + +// ============================================================================ + } // namespace chart } // namespace drawingml } // namespace oox diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx index 5b898d4da6ed..d96e2d43dd6f 100644 --- a/oox/source/drawingml/chart/objectformatter.cxx +++ b/oox/source/drawingml/chart/objectformatter.cxx @@ -1142,18 +1142,19 @@ void ObjectFormatter::convertTextRotation( PropertySet& rPropSet, const ModelRef { if( rxTextProp.is() ) { - /* Chart2 expects rotation angle as double value in range of [0,360). - OOXML counts clockwise, Chart2 counts counterclockwise. */ - double fAngle = rxTextProp->getTextProperties().moRotation.get( 0 ); - fAngle = getDoubleIntervalValue< double >( -fAngle / 60000.0, 0.0, 360.0 ); - rPropSet.setProperty( PROP_TextRotation, fAngle ); - + bool bStacked = false; if( bSupportsStacked ) { sal_Int32 nVert = rxTextProp->getTextProperties().moVert.get( XML_horz ); - bool bStacked = (nVert == XML_wordArtVert) || (nVert == XML_wordArtVertRtl); + bStacked = (nVert == XML_wordArtVert) || (nVert == XML_wordArtVertRtl); rPropSet.setProperty( PROP_StackCharacters, bStacked ); } + + /* Chart2 expects rotation angle as double value in range of [0,360). + OOXML counts clockwise, Chart2 counts counterclockwise. */ + double fAngle = static_cast< double >( bStacked ? 0 : rxTextProp->getTextProperties().moRotation.get( 0 ) ); + fAngle = getDoubleIntervalValue< double >( -fAngle / 60000.0, 0.0, 360.0 ); + rPropSet.setProperty( PROP_TextRotation, fAngle ); } } @@ -1195,12 +1196,12 @@ void ObjectFormatter::convertAutomaticFill( PropertySet& rPropSet, ObjectType eO pFormat->convertAutomaticFill( rPropSet, nSeriesIdx ); } -bool ObjectFormatter::isAutomaticLine( const ModelRef< Shape >& rxShapeProp ) +/*static*/ bool ObjectFormatter::isAutomaticLine( const ModelRef< Shape >& rxShapeProp ) { return !rxShapeProp || !rxShapeProp->getLineProperties().maLineFill.moFillType.has(); } -bool ObjectFormatter::isAutomaticFill( const ModelRef< Shape >& rxShapeProp ) +/*static*/ bool ObjectFormatter::isAutomaticFill( const ModelRef< Shape >& rxShapeProp ) { return !rxShapeProp || !rxShapeProp->getFillProperties().moFillType.has(); } diff --git a/oox/source/drawingml/chart/plotareaconverter.cxx b/oox/source/drawingml/chart/plotareaconverter.cxx index 82a22213b713..c3f74899ed97 100644 --- a/oox/source/drawingml/chart/plotareaconverter.cxx +++ b/oox/source/drawingml/chart/plotareaconverter.cxx @@ -27,7 +27,10 @@ #include "oox/drawingml/chart/plotareaconverter.hxx" #include <com/sun/star/drawing/Direction3D.hpp> +#include <com/sun/star/drawing/ProjectionMode.hpp> #include <com/sun/star/drawing/ShadeMode.hpp> +#include <com/sun/star/chart/XChartDocument.hpp> +#include <com/sun/star/chart/XDiagramPositioning.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp> #include <com/sun/star/chart2/XDiagram.hpp> @@ -41,6 +44,7 @@ using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Exception; using ::com::sun::star::uno::UNO_QUERY_THROW; +using ::com::sun::star::awt::Rectangle; using ::com::sun::star::chart2::XCoordinateSystem; using ::com::sun::star::chart2::XCoordinateSystemContainer; using ::com::sun::star::chart2::XDiagram; @@ -53,14 +57,15 @@ namespace chart { namespace { -/** Axes set model. This is a helper class for the plot area converter. */ +/** Axes set model. This is a helper for the plot area converter collecting all + type groups and axes of the primary or secondary axes set. */ struct AxesSetModel { typedef ModelVector< TypeGroupModel > TypeGroupVector; typedef ModelMap< sal_Int32, AxisModel > AxisMap; - TypeGroupVector maTypeGroups; - AxisMap maAxes; + TypeGroupVector maTypeGroups; /// All type groups containing data series. + AxisMap maAxes; /// All axes mapped by API axis type. inline explicit AxesSetModel() {} inline ~AxesSetModel() {} @@ -89,11 +94,14 @@ public: inline bool is3dChart() const { return mb3dChart; } /** Returns true, if chart type supports wall and floor format in 3D mode. */ inline bool isWall3dChart() const { return mbWall3dChart; } + /** Returns true, if chart is a pie chart or doughnut chart. */ + inline bool isPieChart() const { return mbPieChart; } private: ::rtl::OUString maAutoTitle; bool mb3dChart; bool mbWall3dChart; + bool mbPieChart; }; // ---------------------------------------------------------------------------- @@ -101,7 +109,8 @@ private: AxesSetConverter::AxesSetConverter( const ConverterRoot& rParent, AxesSetModel& rModel ) : ConverterBase< AxesSetModel >( rParent, rModel ), mb3dChart( false ), - mbWall3dChart( false ) + mbWall3dChart( false ), + mbPieChart( false ) { } @@ -158,6 +167,7 @@ void AxesSetConverter::convertFromModel( const Reference< XDiagram >& rxDiagram, // 3D view settings mb3dChart = rFirstTypeGroup.is3dChart(); mbWall3dChart = rFirstTypeGroup.isWall3dChart(); + mbPieChart = rFirstTypeGroup.getTypeInfo().meTypeCategory == TYPECATEGORY_PIE; if( mb3dChart ) { View3DConverter aView3DConv( *this, rView3DModel ); @@ -304,7 +314,8 @@ void WallFloorConverter::convertFromModel( const Reference< XDiagram >& rxDiagra PlotAreaConverter::PlotAreaConverter( const ConverterRoot& rParent, PlotAreaModel& rModel ) : ConverterBase< PlotAreaModel >( rParent, rModel ), mb3dChart( false ), - mbWall3dChart( false ) + mbWall3dChart( false ), + mbPieChart( false ) { } @@ -391,6 +402,7 @@ void PlotAreaConverter::convertFromModel( View3DModel& rView3DModel ) maAutoTitle = aAxesSetConv.getAutomaticTitle(); mb3dChart = aAxesSetConv.is3dChart(); mbWall3dChart = aAxesSetConv.isWall3dChart(); + mbPieChart = aAxesSetConv.isPieChart(); } else { @@ -406,6 +418,35 @@ void PlotAreaConverter::convertFromModel( View3DModel& rView3DModel ) } } +void PlotAreaConverter::convertPositionFromModel() +{ + LayoutModel& rLayout = mrModel.mxLayout.getOrCreate(); + LayoutConverter aLayoutConv( *this, rLayout ); + Rectangle aDiagramRect; + if( aLayoutConv.calcAbsRectangle( aDiagramRect ) ) try + { + namespace cssc = ::com::sun::star::chart; + Reference< cssc::XChartDocument > xChart1Doc( getChartDocument(), UNO_QUERY_THROW ); + Reference< cssc::XDiagramPositioning > xPositioning( xChart1Doc->getDiagram(), UNO_QUERY_THROW ); + // for pie charts, always set inner plot area size to exclude the data labels as Excel does + sal_Int32 nTarget = (mbPieChart && (rLayout.mnTarget == XML_outer)) ? XML_inner : rLayout.mnTarget; + switch( nTarget ) + { + case XML_inner: + xPositioning->setDiagramPositionExcludingAxes( aDiagramRect ); + break; + case XML_outer: + xPositioning->setDiagramPositionIncludingAxes( aDiagramRect ); + break; + default: + OSL_ENSURE( false, "PlotAreaConverter::convertPositionFromModel - unknown positioning target" ); + } + } + catch( Exception& ) + { + } +} + // ============================================================================ } // namespace chart diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx index a4cf7c1f3eb2..717a3972550e 100644 --- a/oox/source/drawingml/chart/seriesconverter.cxx +++ b/oox/source/drawingml/chart/seriesconverter.cxx @@ -344,6 +344,23 @@ Reference< XLabeledDataSequence > ErrorBarConverter::createLabeledDataSequence( // ============================================================================ +TrendlineLabelConverter::TrendlineLabelConverter( const ConverterRoot& rParent, TrendlineLabelModel& rModel ) : + ConverterBase< TrendlineLabelModel >( rParent, rModel ) +{ +} + +TrendlineLabelConverter::~TrendlineLabelConverter() +{ +} + +void TrendlineLabelConverter::convertFromModel( PropertySet& rPropSet ) +{ + // formatting + getFormatter().convertFormatting( rPropSet, mrModel.mxShapeProp, mrModel.mxTextProp, OBJECTTYPE_TRENDLINELABEL ); +} + +// ============================================================================ + TrendlineConverter::TrendlineConverter( const ConverterRoot& rParent, TrendlineModel& rModel ) : ConverterBase< TrendlineModel >( rParent, rModel ) { @@ -385,8 +402,8 @@ void TrendlineConverter::convertFromModel( const Reference< XDataSeries >& rxDat // #i83100# formatting of the equation text box if( mrModel.mbDispEquation || mrModel.mbDispRSquared ) { - TrendlineLabelModel& rLabel = mrModel.mxLabel.getOrCreate(); - getFormatter().convertFormatting( aLabelProp, rLabel.mxShapeProp, rLabel.mxTextProp, OBJECTTYPE_TRENDLINELABEL ); + TrendlineLabelConverter aLabelConv( *this, mrModel.mxLabel.getOrCreate() ); + aLabelConv.convertFromModel( aLabelProp ); } // unsupported: #i5085# manual trendline size diff --git a/oox/source/drawingml/chart/titlecontext.cxx b/oox/source/drawingml/chart/titlecontext.cxx index e9007e4d53d7..963ccdad595a 100644 --- a/oox/source/drawingml/chart/titlecontext.cxx +++ b/oox/source/drawingml/chart/titlecontext.cxx @@ -41,65 +41,6 @@ namespace chart { // ============================================================================ -LayoutContext::LayoutContext( ContextHandler2Helper& rParent, LayoutModel& rModel ) : - ContextBase< LayoutModel >( rParent, rModel ) -{ -} - -LayoutContext::~LayoutContext() -{ -} - -ContextHandlerRef LayoutContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) -{ - switch( getCurrentElement() ) - { - case C_TOKEN( layout ): - switch( nElement ) - { - case C_TOKEN( manualLayout ): - return this; - } - break; - - case C_TOKEN( manualLayout ): - switch( nElement ) - { - case C_TOKEN( x ): - mrModel.mfX = rAttribs.getDouble( XML_val, 0.0 ); - return 0; - case C_TOKEN( y ): - mrModel.mfY = rAttribs.getDouble( XML_val, 0.0 ); - return 0; - case C_TOKEN( w ): - mrModel.mfW = rAttribs.getDouble( XML_val, 0.0 ); - return 0; - case C_TOKEN( h ): - mrModel.mfH = rAttribs.getDouble( XML_val, 0.0 ); - return 0; - case C_TOKEN( xMode ): - mrModel.mnXMode = rAttribs.getToken( XML_val, XML_factor ); - return 0; - case C_TOKEN( yMode ): - mrModel.mnYMode = rAttribs.getToken( XML_val, XML_factor ); - return 0; - case C_TOKEN( wMode ): - mrModel.mnWMode = rAttribs.getToken( XML_val, XML_factor ); - return 0; - case C_TOKEN( hMode ): - mrModel.mnHMode = rAttribs.getToken( XML_val, XML_factor ); - return 0; - case C_TOKEN( layoutTarget ): - mrModel.mnTarget = rAttribs.getToken( XML_val, XML_outer ); - return 0; - } - break; - } - return 0; -} - -// ============================================================================ - TextContext::TextContext( ContextHandler2Helper& rParent, TextModel& rModel ) : ContextBase< TextModel >( rParent, rModel ) { diff --git a/oox/source/drawingml/chart/titleconverter.cxx b/oox/source/drawingml/chart/titleconverter.cxx index 6316ee5f7ee4..bca53f1a2c01 100644 --- a/oox/source/drawingml/chart/titleconverter.cxx +++ b/oox/source/drawingml/chart/titleconverter.cxx @@ -26,11 +26,14 @@ ************************************************************************/ #include "oox/drawingml/chart/titleconverter.hxx" +#include <com/sun/star/chart2/LegendExpansion.hpp> +#include <com/sun/star/chart2/LegendPosition.hpp> #include <com/sun/star/chart2/XDiagram.hpp> #include <com/sun/star/chart2/XFormattedString.hpp> #include <com/sun/star/chart2/XLegend.hpp> #include <com/sun/star/chart2/XTitle.hpp> #include <com/sun/star/chart2/XTitled.hpp> +#include "properties.hxx" #include "oox/drawingml/textbody.hxx" #include "oox/drawingml/textparagraph.hxx" #include "oox/drawingml/chart/datasourceconverter.hxx" @@ -41,6 +44,7 @@ using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Exception; using ::com::sun::star::uno::UNO_QUERY_THROW; +using ::com::sun::star::awt::Rectangle; using ::com::sun::star::chart2::XDiagram; using ::com::sun::star::chart2::XFormattedString; using ::com::sun::star::chart2::XLegend; @@ -149,7 +153,7 @@ TitleConverter::~TitleConverter() { } -void TitleConverter::convertFromModel( const Reference< XTitled >& rxTitled, const OUString& rAutoTitle, ObjectType eObjType ) +void TitleConverter::convertFromModel( const Reference< XTitled >& rxTitled, const OUString& rAutoTitle, ObjectType eObjType, sal_Int32 nMainIdx, sal_Int32 nSubIdx ) { if( rxTitled.is() ) { @@ -172,6 +176,9 @@ void TitleConverter::convertFromModel( const Reference< XTitled >& rxTitled, con OSL_ENSURE( !mrModel.mxTextProp || !rText.mxTextBody, "TitleConverter::convertFromModel - multiple text properties" ); ModelRef< TextBody > xTextProp = mrModel.mxTextProp.is() ? mrModel.mxTextProp : rText.mxTextBody; getFormatter().convertTextRotation( aPropSet, xTextProp, true ); + + // register the title and layout data for conversion of position + registerTitleLayout( xTitle, mrModel.mxLayout, eObjType, nMainIdx, nSubIdx ); } catch( Exception& ) { @@ -194,13 +201,64 @@ void LegendConverter::convertFromModel( const Reference< XDiagram >& rxDiagram ) { if( rxDiagram.is() ) try { + namespace cssc2 = ::com::sun::star::chart2; + // create the legend Reference< XLegend > xLegend( createInstance( CREATE_OUSTRING( "com.sun.star.chart2.Legend" ) ), UNO_QUERY_THROW ); rxDiagram->setLegend( xLegend ); + PropertySet aPropSet( xLegend ); + aPropSet.setProperty( PROP_Show, true ); // legend formatting - PropertySet aPropSet( xLegend ); getFormatter().convertFormatting( aPropSet, mrModel.mxShapeProp, mrModel.mxTextProp, OBJECTTYPE_LEGEND ); + + // predefined legend position and expansion + cssc2::LegendPosition eLegendPos = cssc2::LegendPosition_CUSTOM; + cssc2::LegendExpansion eLegendExpand = cssc2::LegendExpansion_HIGH; + switch( mrModel.mnPosition ) + { + case XML_l: + eLegendPos = cssc2::LegendPosition_LINE_START; + eLegendExpand = cssc2::LegendExpansion_HIGH; + break; + case XML_r: + eLegendPos = cssc2::LegendPosition_LINE_END; + eLegendExpand = cssc2::LegendExpansion_HIGH; + break; + case XML_t: + eLegendPos = cssc2::LegendPosition_PAGE_START; + eLegendExpand = cssc2::LegendExpansion_WIDE; + break; + case XML_b: + eLegendPos = cssc2::LegendPosition_PAGE_END; + eLegendExpand = cssc2::LegendExpansion_WIDE; + break; + case XML_tr: + eLegendPos = cssc2::LegendPosition_LINE_END; // top-right not supported + eLegendExpand = cssc2::LegendExpansion_HIGH; + break; + } + + // manual positioning + LayoutModel& rLayout = mrModel.mxLayout.getOrCreate(); + LayoutConverter aLayoutConv( *this, rLayout ); + aLayoutConv.convertFromModel( aPropSet ); + Rectangle aLegendRect; + if( aLayoutConv.calcAbsRectangle( aLegendRect ) ) + { + // #i71697# it is not possible to set the size directly, do some magic here + double fRatio = static_cast< double >( aLegendRect.Width ) / aLegendRect.Height; + if( fRatio > 1.5 ) + eLegendExpand = cssc2::LegendExpansion_WIDE; + else if( fRatio < 0.75 ) + eLegendExpand = cssc2::LegendExpansion_HIGH; + else + eLegendExpand = cssc2::LegendExpansion_BALANCED; + } + + // set position and expansion properties + aPropSet.setProperty( PROP_AnchorPosition, eLegendPos ); + aPropSet.setProperty( PROP_Expansion, eLegendExpand ); } catch( Exception& ) { diff --git a/oox/source/drawingml/chart/titlemodel.cxx b/oox/source/drawingml/chart/titlemodel.cxx index 51c51a62c4b7..bb5501e05f32 100644 --- a/oox/source/drawingml/chart/titlemodel.cxx +++ b/oox/source/drawingml/chart/titlemodel.cxx @@ -33,25 +33,6 @@ namespace chart { // ============================================================================ -LayoutModel::LayoutModel() : - mfX( 0.0 ), - mfY( 0.0 ), - mfW( 0.0 ), - mfH( 0.0 ), - mnXMode( XML_factor ), - mnYMode( XML_factor ), - mnWMode( XML_factor ), - mnHMode( XML_factor ), - mnTarget( XML_outer ) -{ -} - -LayoutModel::~LayoutModel() -{ -} - -// ============================================================================ - TextModel::TextModel() { } diff --git a/oox/source/drawingml/customshapegeometry.cxx b/oox/source/drawingml/customshapegeometry.cxx index decb759579f3..79c0c2e28d99 100644 --- a/oox/source/drawingml/customshapegeometry.cxx +++ b/oox/source/drawingml/customshapegeometry.cxx @@ -26,10 +26,12 @@ ************************************************************************/ #include "oox/drawingml/customshapegeometry.hxx" +#include "oox/drawingml/customshapeproperties.hxx" #include <com/sun/star/xml/sax/FastToken.hpp> #include <comphelper/stl_types.hxx> #include <hash_map> +#include <basegfx/polygon/b2dpolygon.hxx> #include "oox/helper/helper.hxx" #include "oox/helper/propertymap.hxx" @@ -37,6 +39,7 @@ #include "tokens.hxx" using ::rtl::OUString; +using namespace ::basegfx; using namespace ::oox::core; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::xml::sax; @@ -180,6 +183,88 @@ Reference< XFastContextHandler > AdjustmentValueContext::createFastChildContext( // --------------------------------------------------------------------- +class PathListContext : public ContextHandler +{ +public: + PathListContext( ContextHandler& rParent, Shape& rShape ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL endFastElement( sal_Int32 aElementToken ) throw (SAXException, RuntimeException); + +protected: + Shape& mrShape; + sal_Int32 maPointToken; + ::basegfx::B2DPolygon maPolygon; +}; + +PathListContext::PathListContext( ContextHandler& rParent, Shape& rShape ) +: ContextHandler( rParent ) +, mrShape( rShape ) +{ +} + +Reference< XFastContextHandler > PathListContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException) +{ + switch( aElementToken ) { + case NMSP_DRAWINGML | XML_path: + maPolygon.clear(); + break; + case NMSP_DRAWINGML | XML_close: + maPolygon.setClosed( true ); + break; + case NMSP_DRAWINGML | XML_pt: + { + OUString sX, sY; + + sX = xAttribs->getOptionalValue( XML_x ); + sY = xAttribs->getOptionalValue( XML_y ); + + double dX, dY; + + dX = sX.toDouble(); + dY = sY.toDouble(); + + maPolygon.append( B2DPoint ( dX, dY ) ); + break; + } + case NMSP_DRAWINGML | XML_lnTo: + case NMSP_DRAWINGML | XML_moveTo: + maPointToken = aElementToken; + break; + } + + return this; +} + +void PathListContext::endFastElement( sal_Int32 aElementToken ) throw (SAXException, RuntimeException) +{ + switch( aElementToken ) { + case NMSP_DRAWINGML|XML_pathLst: + { + B2DPolyPolygon& rPoly = mrShape.getCustomShapeProperties()->getPolygon(); + if( rPoly.count() ) { + if( rPoly.areControlPointsUsed() ) { + if( rPoly.isClosed() ) + mrShape.setServiceName( "com.sun.star.drawing.ClosedBezierShape" ); + else + mrShape.setServiceName( "com.sun.star.drawing.OpenBezierShape" ); + } else { + if( rPoly.isClosed() ) + mrShape.setServiceName( "com.sun.star.drawing.PolyPolygonPathShape" ); + else + mrShape.setServiceName( "com.sun.star.drawing.PolyLinePathShape" ); + } + } + break; + } + case NMSP_DRAWINGML|XML_path: + if( maPolygon.count() > 0 ) + mrShape.getCustomShapeProperties()->getPolygon().append( maPolygon ); + break; + } +} + +// --------------------------------------------------------------------- + OUString GetShapeType( sal_Int32 nType ) { OUString sType; @@ -981,9 +1066,9 @@ static OUString GetTextShapeType( sal_Int32 nType ) // --------------------------------------------------------------------- // CT_CustomGeometry2D -CustomShapeGeometryContext::CustomShapeGeometryContext( ContextHandler& rParent, const Reference< XFastAttributeList >& /* xAttribs */, CustomShapeProperties& rCustomShapeProperties ) +CustomShapeGeometryContext::CustomShapeGeometryContext( ContextHandler& rParent, const Reference< XFastAttributeList >& /* xAttribs */, Shape& rShape ) : ContextHandler( rParent ) -, mrCustomShapeProperties( rCustomShapeProperties ) +, mrShape( rShape ) { } @@ -997,8 +1082,9 @@ Reference< XFastContextHandler > CustomShapeGeometryContext::createFastChildCont case NMSP_DRAWINGML|XML_ahLst: // CT_AdjustHandleList adjust handle list case NMSP_DRAWINGML|XML_cxnLst: // CT_ConnectionSiteList connection site list case NMSP_DRAWINGML|XML_rect: // CT_GeomRectList geometry rect list + break; case NMSP_DRAWINGML|XML_pathLst: // CT_Path2DList 2d path list - break; + return new PathListContext( *this, mrShape ); } Reference< XFastContextHandler > xEmpty; diff --git a/oox/source/drawingml/diagram/diagramdefinitioncontext.cxx b/oox/source/drawingml/diagram/diagramdefinitioncontext.cxx index 81c0d597afe2..53477211848e 100644 --- a/oox/source/drawingml/diagram/diagramdefinitioncontext.cxx +++ b/oox/source/drawingml/diagram/diagramdefinitioncontext.cxx @@ -30,6 +30,7 @@ #include "oox/helper/helper.hxx" #include "layoutnodecontext.hxx" #include "oox/drawingml/diagram/datamodelcontext.hxx" +#include "tokens.hxx" using namespace ::oox::core; using namespace ::com::sun::star::uno; diff --git a/oox/source/drawingml/diagram/diagramfragmenthandler.cxx b/oox/source/drawingml/diagram/diagramfragmenthandler.cxx index 0cad22660ab6..ac2e755bee40 100644 --- a/oox/source/drawingml/diagram/diagramfragmenthandler.cxx +++ b/oox/source/drawingml/diagram/diagramfragmenthandler.cxx @@ -31,7 +31,7 @@ #include "oox/drawingml/diagram/datamodelcontext.hxx" #include "oox/core/namespaces.hxx" #include "diagramdefinitioncontext.hxx" - +#include "tokens.hxx" using namespace ::oox::core; using namespace ::com::sun::star::xml::sax; diff --git a/oox/source/drawingml/drawingmltypes.cxx b/oox/source/drawingml/drawingmltypes.cxx index 6773c5d6149b..e5aef824bf54 100644 --- a/oox/source/drawingml/drawingmltypes.cxx +++ b/oox/source/drawingml/drawingmltypes.cxx @@ -37,8 +37,9 @@ using ::rtl::OUString; using ::com::sun::star::uno::Reference; using ::com::sun::star::xml::sax::XFastAttributeList; using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::style; +using namespace ::com::sun::star::drawing; using namespace ::com::sun::star::geometry; +using namespace ::com::sun::star::style; namespace oox { namespace drawingml { @@ -125,10 +126,30 @@ sal_Int32 GetTextSpacingPoint( const OUString& sValue ) { sal_Int32 nRet; if( ::sax::Converter::convertNumber( nRet, sValue ) ) - nRet = ( nRet * 254 + 360 ) / 720; + nRet = GetTextSpacingPoint( nRet ); return nRet; } +sal_Int32 GetTextSpacingPoint( const sal_Int32 nValue ) +{ + return ( nValue * 254 + 360 ) / 720; +} + +TextVerticalAdjust GetTextVerticalAdjust( sal_Int32 nToken ) +{ + TextVerticalAdjust rVal = TextVerticalAdjust_TOP; + + switch( nToken ) { + case XML_b: + rVal = TextVerticalAdjust_BOTTOM; + break; + case XML_ctr: + rVal = TextVerticalAdjust_CENTER; + break; + } + + return rVal; +} float GetFontHeight( sal_Int32 nHeight ) { diff --git a/oox/source/drawingml/graphicshapecontext.cxx b/oox/source/drawingml/graphicshapecontext.cxx index a0335fe68ee2..8537017c2118 100644 --- a/oox/source/drawingml/graphicshapecontext.cxx +++ b/oox/source/drawingml/graphicshapecontext.cxx @@ -30,6 +30,7 @@ #include <com/sun/star/chart2/XChartDocument.hpp> #include "oox/drawingml/fillpropertiesgroupcontext.hxx" +#include "oox/drawingml/customshapeproperties.hxx" #include "oox/drawingml/diagram/diagramfragmenthandler.hxx" #include "oox/drawingml/table/tablecontext.hxx" #include "oox/core/namespaces.hxx" diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 59b3f35dc8cc..1a32d6a206a0 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -26,6 +26,7 @@ ************************************************************************/ #include "oox/drawingml/shape.hxx" +#include "oox/drawingml/customshapeproperties.hxx" #include "oox/drawingml/theme.hxx" #include "oox/drawingml/fillproperties.hxx" #include "oox/drawingml/lineproperties.hxx" @@ -218,8 +219,8 @@ void Shape::addChildren( aIter = rMaster.maChildren.begin(); while( aIter != rMaster.maChildren.end() ) { - Rectangle aShapeRect; - Rectangle* pShapeRect = 0; + awt::Rectangle aShapeRect; + awt::Rectangle* pShapeRect = 0; if ( ( nGlobalLeft != SAL_MAX_INT32 ) && ( nGlobalRight != SAL_MIN_INT32 ) && ( nGlobalTop != SAL_MAX_INT32 ) && ( nGlobalBottom != SAL_MIN_INT32 ) ) { sal_Int32 nGlobalWidth = nGlobalRight - nGlobalLeft; @@ -298,6 +299,35 @@ Reference< XShape > Shape::createAndInsert( aTransformation.translate( aPosition.X / 360.0, aPosition.Y / 360.0 ); } + if ( mpCustomShapePropertiesPtr && mpCustomShapePropertiesPtr->getPolygon().count() ) + { + ::basegfx::B2DPolyPolygon& rPolyPoly = mpCustomShapePropertiesPtr->getPolygon(); + + if( rPolyPoly.count() > 0 ) { + if( rPolyPoly.areControlPointsUsed() ) { + // TODO Beziers + } else { + uno::Sequence< uno::Sequence< awt::Point > > aPolyPolySequence( rPolyPoly.count() ); + + for (sal_uInt32 j = 0; j < rPolyPoly.count(); j++ ) { + ::basegfx::B2DPolygon aPoly = rPolyPoly.getB2DPolygon( j ); + + // now creating the corresponding PolyPolygon + sal_Int32 i, nNumPoints = aPoly.count(); + uno::Sequence< awt::Point > aPointSequence( nNumPoints ); + awt::Point* pPoints = aPointSequence.getArray(); + for( i = 0; i < nNumPoints; ++i ) + { + const ::basegfx::B2DPoint aPoint( aPoly.getB2DPoint( i ) ); + pPoints[ i ] = awt::Point( static_cast< sal_Int32 >( aPoint.getX() ), static_cast< sal_Int32 >( aPoint.getY() ) ); + } + aPolyPolySequence.getArray()[ j ] = aPointSequence; + } + maShapeProperties[ PROP_PolyPolygon ] <<= aPolyPolySequence; + } + } + } + // special for lineshape if ( aServiceName == OUString::createFromAscii( "com.sun.star.drawing.LineShape" ) ) { @@ -422,7 +452,6 @@ Reference< XShape > Shape::createAndInsert( PropertyMap aShapeProperties; PropertyMap::const_iterator aShapePropIter; - aShapeProperties.insert( getShapeProperties().begin(), getShapeProperties().end() ); if( mxCreateCallback.get() ) { for ( aShapePropIter = mxCreateCallback->getShapeProperties().begin(); @@ -438,6 +467,7 @@ Reference< XShape > Shape::createAndInsert( aShapeProperties[ (*aShapePropIter).first ] = (*aShapePropIter).second; } + aShapeProperties.insert( getShapeProperties().begin(), getShapeProperties().end() ); // applying properties PropertySet aPropSet( xSet ); if ( aServiceName == OUString::createFromAscii( "com.sun.star.drawing.GraphicObjectShape" ) ) diff --git a/oox/source/drawingml/shapepropertiescontext.cxx b/oox/source/drawingml/shapepropertiescontext.cxx index 68c8ed967159..7724ba9b44b2 100644 --- a/oox/source/drawingml/shapepropertiescontext.cxx +++ b/oox/source/drawingml/shapepropertiescontext.cxx @@ -74,7 +74,7 @@ Reference< XFastContextHandler > ShapePropertiesContext::createFastChildContext( // GeometryGroup case NMSP_DRAWINGML|XML_custGeom: // custom geometry "CT_CustomGeometry2D" - xRet.set( new CustomShapeGeometryContext( *this, xAttribs, *(mrShape.getCustomShapeProperties()) ) ); + xRet.set( new CustomShapeGeometryContext( *this, xAttribs, mrShape ) ); break; diff --git a/oox/source/drawingml/table/tablerowcontext.cxx b/oox/source/drawingml/table/tablerowcontext.cxx index 17881d89639b..7e0ff052bb4e 100644 --- a/oox/source/drawingml/table/tablerowcontext.cxx +++ b/oox/source/drawingml/table/tablerowcontext.cxx @@ -31,6 +31,7 @@ #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; diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx b/oox/source/drawingml/textbodypropertiescontext.cxx index ec605a3adadd..668266f2f679 100644 --- a/oox/source/drawingml/textbodypropertiescontext.cxx +++ b/oox/source/drawingml/textbodypropertiescontext.cxx @@ -27,7 +27,9 @@ #include "oox/drawingml/textbodypropertiescontext.hxx" +#include <com/sun/star/drawing/TextHorizontalAdjust.hpp> #include <com/sun/star/text/ControlCharacter.hpp> +#include <com/sun/star/text/WritingMode.hpp> #include <com/sun/star/drawing/TextVerticalAdjust.hpp> #include <com/sun/star/drawing/TextHorizontalAdjust.hpp> #include "oox/drawingml/textbodyproperties.hxx" @@ -41,8 +43,9 @@ using ::rtl::OUString; using namespace ::oox::core; using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::drawing; using namespace ::com::sun::star::text; +using namespace ::com::sun::star::uno; using namespace ::com::sun::star::xml::sax; namespace oox { namespace drawingml { @@ -64,21 +67,25 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler& rParent, // ST_Coordinate OUString sValue; sValue = xAttributes->getOptionalValue( XML_lIns ); + if( sValue.getLength() ) { sal_Int32 nLeftInset = ( sValue.getLength() != 0 ? GetCoordinate( sValue ) : 91440 / 360 ); mrTextBodyProp.maPropertyMap[ PROP_TextLeftDistance ] <<= static_cast< sal_Int32 >( nLeftInset ); - + } sValue = xAttributes->getOptionalValue( XML_tIns ); + if( sValue.getLength() ) { sal_Int32 nTopInset = ( sValue.getLength() != 0 ? GetCoordinate( sValue ) : 91440 / 360 ); mrTextBodyProp.maPropertyMap[ PROP_TextUpperDistance ] <<= static_cast< sal_Int32 >( nTopInset ); - + } sValue = xAttributes->getOptionalValue( XML_rIns ); + if( sValue.getLength() ) { sal_Int32 nRightInset = ( sValue.getLength() != 0 ? GetCoordinate( sValue ) : 91440 / 360 ); mrTextBodyProp.maPropertyMap[ PROP_TextRightDistance ] <<= static_cast< sal_Int32 >( nRightInset ); - + } sValue = xAttributes->getOptionalValue( XML_bIns ); + if( sValue.getLength() ) { sal_Int32 nBottonInset = ( sValue.getLength() != 0 ? GetCoordinate( sValue ) : 45720 / 360 ); mrTextBodyProp.maPropertyMap[ PROP_TextLowerDistance ] <<= static_cast< sal_Int32 >( nBottonInset ); - + } // ST_TextAnchoringType drawing::TextVerticalAdjust eVA( drawing::TextVerticalAdjust_TOP ); @@ -93,7 +100,10 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler& rParent, } mrTextBodyProp.maPropertyMap[ PROP_TextVerticalAdjust ] <<= eVA; -// bool bAnchorCenter = aAttribs.getBool( XML_anchorCtr, false ); + bool bAnchorCenter = aAttribs.getBool( XML_anchorCtr, false ); + if( bAnchorCenter ) + mrTextBodyProp.maPropertyMap[ PROP_TextHorizontalAdjust ] <<= + TextHorizontalAdjust_CENTER; // bool bCompatLineSpacing = aAttribs.getBool( XML_compatLnSpc, false ); // bool bForceAA = aAttribs.getBool( XML_forceAA, false ); @@ -118,6 +128,18 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler& rParent, // ST_TextVerticalType mrTextBodyProp.moVert = aAttribs.getToken( XML_vert ); + bool bRtl = aAttribs.getBool( XML_rtl, false ); + sal_Int32 tVert = mrTextBodyProp.moVert.get( XML_horz ); + if( tVert == XML_vert || tVert == XML_eaVert || tVert == XML_vert270 || tVert == XML_mongolianVert ) { + mrTextBodyProp.maPropertyMap[ PROP_TextWritingMode ] + <<= WritingMode_TB_RL; + // workaround for TB_LR as using WritingMode2 doesn't work + if( !bAnchorCenter ) + mrTextBodyProp.maPropertyMap[ PROP_TextHorizontalAdjust ] <<= + TextHorizontalAdjust_LEFT; + } else + mrTextBodyProp.maPropertyMap[ PROP_TextWritingMode ] + <<= ( bRtl ? WritingMode_RL_TB : WritingMode_LR_TB ); } // -------------------------------------------------------------------- @@ -143,6 +165,9 @@ Reference< XFastContextHandler > TextBodyPropertiesContext::createFastChildConte mrTextBodyProp.maPropertyMap[ PROP_TextAutoGrowHeight ] <<= false; // CT_TextNoAutofit break; case NMSP_DRAWINGML|XML_normAutofit: // CT_TextNormalAutofit + mrTextBodyProp.maPropertyMap[ PROP_TextFitToSize ] <<= true; + mrTextBodyProp.maPropertyMap[ PROP_TextAutoGrowHeight ] <<= false; + break; case NMSP_DRAWINGML|XML_spAutoFit: mrTextBodyProp.maPropertyMap[ PROP_TextAutoGrowHeight ] <<= true; break; diff --git a/oox/source/drawingml/textcharacterproperties.cxx b/oox/source/drawingml/textcharacterproperties.cxx index 4dbd632b2191..3ac5018c1dad 100644 --- a/oox/source/drawingml/textcharacterproperties.cxx +++ b/oox/source/drawingml/textcharacterproperties.cxx @@ -59,6 +59,7 @@ void TextCharacterProperties::assignUsed( const TextCharacterProperties& rSource maHighlightColor.assignIfUsed( rSourceProps.maHighlightColor ); maUnderlineColor.assignIfUsed( rSourceProps.maUnderlineColor ); moHeight.assignIfUsed( rSourceProps.moHeight ); + moSpacing.assignIfUsed( rSourceProps.moSpacing ); moUnderline.assignIfUsed( rSourceProps.moUnderline ); moStrikeout.assignIfUsed( rSourceProps.moStrikeout ); moCaseMap.assignIfUsed( rSourceProps.moCaseMap ); @@ -126,6 +127,8 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil rPropMap[ PROP_CharHeightComplex ] <<= fHeight; } + rPropMap[ PROP_CharKerning ] <<= (sal_Int16) GetTextSpacingPoint( moSpacing.get( 0 ) ); + rPropMap[ PROP_CharUnderline ] <<= GetFontUnderline( moUnderline.get( XML_none ) ); rPropMap[ PROP_CharStrikeout ] <<= GetFontStrikeout( moStrikeout.get( XML_noStrike ) ); rPropMap[ PROP_CharCaseMap ] <<= GetCaseMap( moCaseMap.get( XML_none ) ); diff --git a/oox/source/drawingml/textliststyle.cxx b/oox/source/drawingml/textliststyle.cxx index 5d01a28c9cfd..07a71c0855a1 100644 --- a/oox/source/drawingml/textliststyle.cxx +++ b/oox/source/drawingml/textliststyle.cxx @@ -65,4 +65,15 @@ void TextListStyle::apply( const TextListStyle& rTextListStyle ) applyStyleList( rTextListStyle.getListStyle(), getListStyle() ); } +#if OSL_DEBUG_LEVEL > 0 +void TextListStyle::dump( int nLevels ) +{ + for ( int i = 0; i < nLevels; i++ ) + { + OSL_TRACE("level: %d", i); + maListStyle[ i ]->dump(); + } +} +#endif + } } diff --git a/oox/source/drawingml/theme.cxx b/oox/source/drawingml/theme.cxx index b37ccdbaf13c..59245201eb61 100644 --- a/oox/source/drawingml/theme.cxx +++ b/oox/source/drawingml/theme.cxx @@ -26,6 +26,7 @@ ************************************************************************/ #include "oox/drawingml/theme.hxx" +#include "tokens.hxx" using ::rtl::OUString; diff --git a/oox/source/dump/biffdumper.cxx b/oox/source/dump/biffdumper.cxx index ea1944d935a4..aa32cbe53d1b 100644 --- a/oox/source/dump/biffdumper.cxx +++ b/oox/source/dump/biffdumper.cxx @@ -1697,7 +1697,7 @@ void WorkbookStreamObject::implDumpRecordBody() case BIFF_ID_CHAXESSET: dumpDec< sal_uInt16 >( "axesset-id", "CHAXESSET-ID" ); - dumpRect< sal_Int32 >( "position", (eBiff <= BIFF4) ? "CONV-TWIP-TO-CM" : "" ); + dumpRect< sal_Int32 >( "inner-plotarea-pos", (eBiff <= BIFF4) ? "CONV-TWIP-TO-CM" : "" ); break; case BIFF_ID_CHAXIS: @@ -1728,11 +1728,6 @@ void WorkbookStreamObject::implDumpRecordBody() dumpHex< sal_uInt16 >( "flags", "CHCHART3D-FLAGS" ); break; - case BIFF_ID_CHECKCOMPAT: - dumpFrHeader( true, true ); - dumpBool< sal_uInt32 >( "check-compatibility" ); - break; - case BIFF_ID_CHDATAFORMAT: dumpDec< sal_Int16 >( "point-idx", "CHDATAFORMAT-POINTIDX" ); dumpDec< sal_Int16 >( "series-idx" ); @@ -1740,6 +1735,11 @@ void WorkbookStreamObject::implDumpRecordBody() if( eBiff >= BIFF5 ) dumpHex< sal_uInt16 >( "flags", "CHDATAFORMAT-FLAGS" ); break; + case BIFF_ID_CHECKCOMPAT: + dumpFrHeader( true, true ); + dumpBool< sal_uInt32 >( "check-compatibility" ); + break; + case BIFF_ID_CHESCHERFORMAT: dumpEmbeddedDff(); break; @@ -1750,9 +1750,9 @@ void WorkbookStreamObject::implDumpRecordBody() break; case BIFF_ID_CHFRAMEPOS: - dumpDec< sal_uInt16 >( "object-type", "CHFRAMEPOS-OBJTYPE" ); - dumpDec< sal_uInt16 >( "size-mode", "CHFRAMEPOS-SIZEMODE" ); - dumpRect< sal_Int32 >( "position", (eBiff <= BIFF4) ? "CONV-TWIP-TO-CM" : "" ); + dumpDec< sal_uInt16 >( "tl-mode", "CHFRAMEPOS-POSMODE" ); + dumpDec< sal_uInt16 >( "br-mode", "CHFRAMEPOS-POSMODE" ); + dumpRectWithGaps< sal_Int16 >( "position", 2 ); break; case BIFF_ID_CHFRBLOCKBEGIN: @@ -1770,6 +1770,25 @@ void WorkbookStreamObject::implDumpRecordBody() dumpUnused( 6 ); break; + case BIFF_ID_CHFRCATEGORYPROPS: + dumpFrHeader( true, false ); + dumpDec< sal_uInt16 >( "label-offset", "CONV-PERCENT" ); + dumpDec< sal_uInt16 >( "alignment", "CHFRCATEGORYPROPS-ALIGN" ); + dumpHex< sal_uInt16 >( "flags", "CHFRCATEGORYPROPS-FLAGS" ); + break; + + case BIFF_ID_CHFREXTPROPS: + { + dumpFrHeader( true, true ); + dumpDec< sal_uInt32 >( "data-size" ); + dumpDec< sal_uInt8 >( "version" ); + dumpUnused( 1 ); + dumpDec< sal_uInt16 >( "parent", "CHFREXTPROPS-PARENT" ); + dumpChFrExtProps(); + dumpUnused( 4 ); + } + break; + case BIFF_ID_CHFRINFO: { dumpFrHeader( true, false ); @@ -1788,6 +1807,45 @@ void WorkbookStreamObject::implDumpRecordBody() dumpUniString( "separator", BIFF_STR_SMARTFLAGS ); break; + case BIFF_ID_CHFRLAYOUT: + dumpFrHeader( true, true ); + dumpHex< sal_uInt32 >( "checksum" ); + dumpHex< sal_uInt16 >( "flags", "CHFRLAYOUT-FLAGS" ); + dumpDec< sal_uInt16 >( "mode-x", "CHFRLAYOUT-MODE" ); + dumpDec< sal_uInt16 >( "mode-y", "CHFRLAYOUT-MODE" ); + dumpDec< sal_uInt16 >( "mode-w", "CHFRLAYOUT-MODE" ); + dumpDec< sal_uInt16 >( "mode-h", "CHFRLAYOUT-MODE" ); + dumpRect< double >( "position" ); + dumpUnused( 2 ); + break; + + case BIFF_ID_CHFRPLOTAREALAYOUT: + dumpFrHeader( true, true ); + dumpHex< sal_uInt32 >( "checksum" ); + dumpHex< sal_uInt16 >( "flags", "CHFRPLOTAREALAYOUT-FLAGS" ); + dumpRect< sal_Int16 >( "position" ); + dumpDec< sal_uInt16 >( "mode-x", "CHFRLAYOUT-MODE" ); + dumpDec< sal_uInt16 >( "mode-y", "CHFRLAYOUT-MODE" ); + dumpDec< sal_uInt16 >( "mode-w", "CHFRLAYOUT-MODE" ); + dumpDec< sal_uInt16 >( "mode-h", "CHFRLAYOUT-MODE" ); + dumpRect< double >( "position" ); + dumpUnused( 2 ); + break; + + case BIFF_ID_CHFRSHAPEPROPS: + dumpFrHeader( true, true ); + dumpDec< sal_uInt16 >( "context" ); + dumpUnused( 2 ); + dumpHex< sal_uInt32 >( "checksum" ); + dumpDec< sal_uInt32 >( "xml-size" ); + break; + + case BIFF_ID_CHFRTEXTPROPS: + dumpFrHeader( true, true ); + dumpHex< sal_uInt32 >( "checksum" ); + dumpDec< sal_uInt32 >( "xml-size" ); + break; + case BIFF_ID_CHFRUNITPROPS: dumpFrHeader( true, false ); dumpDec< sal_Int16 >( "preset", "CHFRUNITPROPS-PRESET" ); @@ -1941,9 +1999,9 @@ void WorkbookStreamObject::implDumpRecordBody() dumpDec< sal_uInt16 >( "fill-mode", "CHTEXT-FILLMODE" ); dumpColorABGR(); dumpRect< sal_Int32 >( "position", (eBiff <= BIFF4) ? "CONV-TWIP-TO-CM" : "" ); - dumpHex< sal_uInt16 >( "flags", "CHTEXT-FLAGS" ); + dumpHex< sal_uInt16 >( "flags-1", "CHTEXT-FLAGS1" ); if( eBiff == BIFF8 ) dumpColorIdx(); - if( eBiff == BIFF8 ) dumpDec< sal_uInt16 >( "placement", "CHTEXT-PLACEMENT" ); + if( eBiff == BIFF8 ) dumpHex< sal_uInt16 >( "flags-2", "CHTEXT-FLAGS2" ); if( eBiff == BIFF8 ) dumpDec< sal_uInt16 >( "rotation", "TEXTROTATION" ); break; @@ -4116,6 +4174,56 @@ void WorkbookStreamObject::dumpObjRecPictFmla( sal_uInt16 nFmlaSize ) } } +void WorkbookStreamObject::dumpChFrExtProps() +{ + BiffInputStream& rStrm = getBiffStream(); + bool bValid = true; + while( bValid && (rStrm.getRemaining() > 4) ) + { + ChFrExtPropInfo aInfo = dumpChFrExtPropHeader(); + IndentGuard aIndGuard( mxOut ); + switch( aInfo.first ) + { + case 0: // start + case 1: // end + break; + case 2: // bool + dumpBoolean( "value" ); + dumpUnused( 1 ); + break; + case 3: // double + dumpUnused( 4 ); + dumpDec< double >( "value", aInfo.second ); + break; + case 4: // int32 + dumpDec< sal_Int32 >( "value", aInfo.second ); + break; + case 5: // string + dumpUnicodeArray( "value", rStrm.readInt32() ); + break; + case 6: // uint16 + dumpDec< sal_uInt16 >( "value", aInfo.second ); + break; + case 7: // blob + dumpBinary( "value", rStrm.readuInt32() ); + break; + default: + bValid = false; + } + } +} + +WorkbookStreamObject::ChFrExtPropInfo WorkbookStreamObject::dumpChFrExtPropHeader() +{ + MultiItemsGuard aMultiGuard( mxOut ); + ChFrExtPropInfo aInfo; + aInfo.first = dumpDec< sal_uInt8 >( "datatype", "CHFREXTPROPS-TYPE" ); + dumpUnused( 1 ); + sal_uInt16 nTag = dumpDec< sal_uInt16 >( "tag", "CHFREXTPROPS-TAG" ); + aInfo.second = cfg().getName( "CHFREXTPROPS-TAG-NAMELIST", nTag ); + return aInfo; +} + // ============================================================================ PivotCacheStreamObject::PivotCacheStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, BiffType eBiff, const ::rtl::OUString& rSysFileName ) diff --git a/oox/source/dump/biffdumper.ini b/oox/source/dump/biffdumper.ini index fab205733430..d4b862825b3c 100644 --- a/oox/source/dump/biffdumper.ini +++ b/oox/source/dump/biffdumper.ini @@ -293,7 +293,7 @@ end multilist=RECORD-NAMES-BIFF3 include=RECORD-NAMES-BIFF2 # worksheet records - exclude=0x0006,0x0008,0x0009,0x000B,0x0018,0x0020,0x0021,0x0023,0x0024,0x0025,0x0031,0x0036,0x0037,0x003E,0x0043,0x0044,0x0045 + exclude=0x0006,0x0008,0x0009,0x000B,0x0018,0x0020,0x0023,0x0024,0x0025,0x0031,0x0036,0x0037,0x003E,0x0043,0x0044,0x0045 0x0050=,,,,,,BUILTINFMTCOUNT, 0x0058=TOOLBAR,XCT,CRN,FILESHARING,WRITEACCESS,OBJ,UNCALCED,SAFERECALC 0x0060=TEMPLATE,INTL,,OBJECTPROTECT,,,, @@ -383,16 +383,17 @@ multilist=RECORD-NAMES-BIFF8 0x01B0=CFHEADER,CFRULE,DATAVALIDATIONS,,,DCONBINAME,TXO,REFRESHALL 0x01B8=HYPERLINK,NLRDELNAME,CODENAME,PCDFSQLTYPE,PROT4REVPASS,VBAPROJECTEMPTY,DATAVALIDATION, 0x01C0=XL9FILE,RECALCID,INTCACHEDDATA,,,,, + # future records 0x0800=SCREENTIP,,,WEBQRYSETTINGS,WEBQRYTABLES,,, - 0x0850=CHFRINFO,CHFRWRAPPER,CHFRBLOCKBEGIN,CHFRBLOCKEND,,,,CHFRUNITPROPS + 0x0850=CHFRINFO,CHFRWRAPPER,CHFRBLOCKBEGIN,CHFRBLOCKEND,,,CHFRCATEGORYPROPS,CHFRUNITPROPS 0x0858=CHPIVOTREF,CHPIVOTFLAGS,,,,,, 0x0860=,,SHEETEXT,BOOKEXT,,,,SHAREDFEATHEAD 0x0868=,,,CHFRLABELPROPS,,,, 0x0878=,,CFRULE12,CFRULEEXT,XFCRC,XFEXT,, 0x0888=,,,PAGELAYOUTVIEW,CHECKCOMPAT,DXF,TABLESTYLES, 0x0890=,,STYLEEXT,,,,THEME, - 0x0898=,,MTHREADSETTINGS,COMPRESSPICS,HEADERFOOTER,,, - 0x08A0=,,,FORCEFULLCALC,,,, + 0x0898=,,MTHREADSETTINGS,COMPRESSPICS,HEADERFOOTER,CHFRLAYOUT,CHFREXTPROPS,CHFREXTPROPSCONT + 0x08A0=,,,FORCEFULLCALC,CHFRSHAPEPROPS,CHFRTEXTPROPS,,CHFRPLOTAREALAYOUT # chart records 0x1058=,,,,,,,CH3DDATAFORMAT 0x1060=CHFONTBASE,CHPIEEXT,CHLABELRANGE2,CHDATATABLE,CHPLOTGROWTH,CHSERINDEX,CHESCHERFORMAT,CHPIEEXTSETT @@ -829,16 +830,104 @@ end # CHFRAMEPOS ----------------------------------------------------------------- -shortlist=CHFRAMEPOS-OBJTYPE,2,any,,,legend -shortlist=CHFRAMEPOS-SIZEMODE,1,manual,auto +shortlist=CHFRAMEPOS-POSMODE,0,rel-points,abssize-points,parent-dependent,offset-plotarea-size,,chartsize # CHFRBLOCKBEGIN, CHFRBLOCKEND ----------------------------------------------- shortlist=CHFRBLOCK-TYPE,0,axes-set,,text,,axis,type-group,data-table,frame,,legend,legend-exception,,series,chart,data-format,drop-bar +# CHFRCATEGORYPROPS ---------------------------------------------------------- + +shortlist=CHFRCATEGORYPROPS-ALIGN,1,top-left,center,bottom-right + +flagslist=CHFRCATEGORYPROPS-FLAGS + ignore=0xFFFE + 0x0001=auto-label-frequency +end + +# CHFREXTPROPS --------------------------------------------------------------- + +constlist=CHFREXTPROPS-PARENT + 0x0001=log-scaling + 0x0002=style + 0x0004=category-scaling + 0x0005=chart-props + 0x000F=legend + 0x0013=marker + 0x0016=plot-area + 0x0019=chart-title + 0x0037=3d-props +end + +constlist=CHFREXTPROPS-TYPE + 0=start + 1=end + 2=bool + 3=double + 4=int32 + 5=string + 6=uint16 + 7=blob +end + +constlist=CHFREXTPROPS-TAG + 0x0000=log-base + 0x0003=style + 0x001E=chart-formatting + 0x0020=text-formatting + 0x0022=symbol-type + 0x002E=no-multi-level + 0x002F=overlay + 0x0033=theme-override + 0x0034=color-mapping-override + 0x0035=backwall-thickness + 0x0036=floor-thickness + 0x004D=perspective + 0x004E=rotation-x + 0x004F=rotation-y + 0x0050=right-angled-axes-off + 0x0052=tick-mark-skip + 0x0051=tick-label-skip + 0x0053=major-unit + 0x0054=minor-unit + 0x0055=max + 0x0056=min + 0x0059=side-wall + 0x005B=show-data-labels-over-max + 0x005C=tick-label-pos + 0x005E=pie-combination + 0x005F=basetime-unit + 0x0064=format-code + 0x0065=height-percent + 0x0066=display-blanks-as + 0x006A=major-unit-type + 0x006B=minor-unit-type + 0x0076=edit-language +end + +constlist=CHFREXTPROPS-TAG-NAMELIST + default= + 0x0022=CHFREXTPROPS-SYMBOLTYPE + 0x0035=CONV-PERCENT + 0x0036=CONV-PERCENT + 0x004E=CONV-DEG + 0x004F=CONV-DEG + 0x005C=CHFREXTPROPS-TICKLABELPOS + 0x005F=CHFREXTPROPS-TIMEUNIT + 0x0065=CONV-PERCENT + 0x0066=CHFREXTPROPS-DISPBLANKSAS + 0x006A=CHFREXTPROPS-TIMEUNIT + 0x006B=CHFREXTPROPS-TIMEUNIT +end + +shortlist=CHFREXTPROPS-DISPBLANKSAS,0x0067,gap,,spanned +shortlist=CHFREXTPROPS-SYMBOLTYPE,0x0023,none,diamond,square,triangle,x,star,dot,dash,circle,plus +shortlist=CHFREXTPROPS-TICKLABELPOS,0x005D,center +shortlist=CHFREXTPROPS-TIMEUNIT,0x0060,days,months,years + # CHFRINFO ------------------------------------------------------------------- -shortlist=CHFRINFO-APPVERSION,9,excel-2000,excel-xp-2003,excel-2007 +shortlist=CHFRINFO-APPVERSION,9,excel-2000,excel-xp-2003,,excel-2007 # CHFRLABELPROPS ------------------------------------------------------------- @@ -850,6 +939,26 @@ flagslist=CHFRLABELPROPS-FLAGS 0x0010=show-bubble end +# CHFRLAYOUT ----------------------------------------------------------------- + +combilist=CHFRLAYOUT-FLAGS + 0x001E=uint8,dec,legend-pos,CHFRLAYOUT-LEGENDPOS +end + +shortlist=CHFRLAYOUT-LEGENDPOS,0,bottom,top-right,top,right,left + +shortlist=CHFRLAYOUT-MODE,0,auto,factor,egde + +# CHFRPLOTAREALAYOUT --------------------------------------------------------- + +flagslist=CHFRPLOTAREALAYOUT-FLAGS + 0x0001=!outer!inner +end + +shortlist=CHFRLAYOUT-LEGENDPOS,0,bottom,top-right,top,right,left + +shortlist=CHFRLAYOUT-MODE,0,auto,factor,egde + # CHFRUNITPROPS -------------------------------------------------------------- shortlist=CHFRUNITPROPS-PRESET,-1,manual,none,hundred,thousand,10000,100000,million,10-million,100-million,billion,trillion @@ -881,7 +990,7 @@ end # CHLEGEND ------------------------------------------------------------------- -shortlist=CHLEGEND-DOCKPOS,0,bottom,top-left,top,right,left,,,manual +shortlist=CHLEGEND-DOCKPOS,0,bottom,top-right,top,right,left,,,manual shortlist=CHLEGEND-SPACING,0,close,medium,open flagslist=CHLEGEND-FLAGS @@ -909,6 +1018,7 @@ shortlist=CHLINEFORMAT-LINEWEIGHT,-1,hair,thin,medium,thick flagslist=CHLINEFORMAT-FLAGS 0x0001=auto 0x0004=axis-enabled + 0x0008=system-color end # CHMARKERFORMAT ------------------------------------------------------------- @@ -1040,7 +1150,7 @@ shortlist=CHTEXT-HORALIGN,1,left,center,right,block,distribute shortlist=CHTEXT-VERALIGN,1,top,center,bottom,block,distribute shortlist=CHTEXT-FILLMODE,1,transparent,opaque -flagslist=CHTEXT-FLAGS-BIFF2 +flagslist=CHTEXT-FLAGS1-BIFF2 0x0001=auto-color 0x0002=show-symbol 0x0004=show-value @@ -1051,28 +1161,31 @@ flagslist=CHTEXT-FLAGS-BIFF2 0x0080=auto-fill end -combilist=CHTEXT-FLAGS-BIFF3 - include=CHTEXT-FLAGS-BIFF2 +combilist=CHTEXT-FLAGS1-BIFF3 + include=CHTEXT-FLAGS1-BIFF2 0x0700=uint8,dec,orientation,TEXTORIENTATION end -combilist=CHTEXT-FLAGS-BIFF5 - include=CHTEXT-FLAGS-BIFF3 +combilist=CHTEXT-FLAGS1-BIFF5 + include=CHTEXT-FLAGS1-BIFF3 0x0800=show-categ-percent 0x1000=show-percent end -combilist=CHTEXT-FLAGS-BIFF8 - include=CHTEXT-FLAGS-BIFF5 +combilist=CHTEXT-FLAGS1-BIFF8 + include=CHTEXT-FLAGS1-BIFF5 0x2000=show-bubble-size 0x4000=show-categ end -multilist=CHTEXT-PLACEMENT - default= - 0=context,outside,inside,center,axis,above,below,left,right,auto,manual +combilist=CHTEXT-FLAGS2 + ignore=0x3FF0 + 0x000F=uint8,dec,placement,CHTEXT-PLACEMENT + 0xC000=uint8,dec,text-dir,XF-TEXTDIRECTION end +shortlist=CHTEXT-PLACEMENT,0,context,outside,inside,center,axis,above,below,left,right,auto,manual + # CHTICK --------------------------------------------------------------------- shortlist=CHTICK-TYPE,0,none,inside,outside,both diff --git a/oox/source/helper/propertymap.cxx b/oox/source/helper/propertymap.cxx index 9ff791fd21f3..31072fe449e5 100644 --- a/oox/source/helper/propertymap.cxx +++ b/oox/source/helper/propertymap.cxx @@ -50,6 +50,19 @@ using ::com::sun::star::beans::XPropertySet; using ::com::sun::star::beans::XPropertySetInfo; using ::com::sun::star::beans::XVetoableChangeListener; +#if OSL_DEBUG_LEVEL > 0 +#include <cstdio> +#include <com/sun/star/style/LineSpacing.hpp> +#include <com/sun/star/style/LineSpacingMode.hpp> +#include <com/sun/star/text/WritingMode.hpp> +#define USS(x) OUStringToOString( x, RTL_TEXTENCODING_UTF8 ).getStr() +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using ::rtl::OString; +using ::com::sun::star::style::LineSpacing; +using ::com::sun::star::text::WritingMode; +#endif + namespace oox { // ============================================================================ @@ -228,6 +241,66 @@ Reference< XPropertySet > PropertyMap::makePropertySet() const return new GenericPropertySet( *this ); } +#if OSL_DEBUG_LEVEL > 0 +void PropertyMap::dump( Reference< XPropertySet > rXPropSet ) +{ + Reference< XPropertySetInfo > info = rXPropSet->getPropertySetInfo (); + Sequence< beans::Property > props = info->getProperties (); + + OSL_TRACE("dump props, len: %d", props.getLength ()); + + for (int i=0; i < props.getLength (); i++) { + OString name = OUStringToOString( props [i].Name, RTL_TEXTENCODING_UTF8); + fprintf (stderr,"%30s = ", name.getStr() ); + + try { + Any value = rXPropSet->getPropertyValue( props [i].Name ); + + OUString strValue; + sal_Int32 intValue = 0; + sal_uInt32 uintValue = 0; + sal_Int16 int16Value = 0; + sal_uInt16 uint16Value = 0; + bool boolValue = false; + LineSpacing spacing; +// RectanglePoint pointValue; + WritingMode aWritingMode; + + if( value >>= strValue ) + fprintf (stderr,"\"%s\"\n", USS( strValue ) ); + else if( value >>= intValue ) + fprintf (stderr,"%"SAL_PRIdINT32" (hex: %"SAL_PRIxUINT32")\n", intValue, intValue); + else if( value >>= uintValue ) + fprintf (stderr,"%"SAL_PRIdINT32" (hex: %"SAL_PRIxUINT32")\n", uintValue, uintValue); + else if( value >>= int16Value ) + fprintf (stderr,"%d (hex: %x)\n", int16Value, int16Value); + else if( value >>= uint16Value ) + fprintf (stderr,"%d (hex: %x)\n", uint16Value, uint16Value); + else if( value >>= boolValue ) + fprintf (stderr,"%d (bool)\n", boolValue); + else if( value >>= aWritingMode ) + fprintf (stderr, "%d writing mode\n", aWritingMode); + else if( value >>= spacing ) { + fprintf (stderr, "mode: %d value: %d\n", spacing.Mode, spacing.Height); + } else if( value.isExtractableTo(::getCppuType((const sal_Int32*)0))) { + fprintf (stderr,"is extractable to int32\n"); + } +// else if( value >>= pointValue ) +// fprintf (stderr,"%d (RectanglePoint)\n", pointValue); + else + fprintf (stderr,"??? <unhandled type %s>\n", USS(value.getValueTypeName())); + } catch(Exception e) { + fprintf (stderr,"unable to get '%s' value\n", USS(props [i].Name)); + } + } +} + +void PropertyMap::dump() +{ + dump( Reference< XPropertySet >( makePropertySet(), UNO_QUERY ) ); +} +#endif + // ============================================================================ } // namespace oox diff --git a/oox/source/helper/propertyset.cxx b/oox/source/helper/propertyset.cxx index c52872e50f2f..e7071ba402a2 100644 --- a/oox/source/helper/propertyset.cxx +++ b/oox/source/helper/propertyset.cxx @@ -172,6 +172,13 @@ void PropertySet::setAnyProperty( const OUString& rPropName, const Any& rValue ) } } +#if OSL_DEBUG_LEVEL > 0 +void PropertySet::dump() +{ + PropertyMap::dump( Reference< XPropertySet >( getXPropertySet(), UNO_QUERY ) ); +} +#endif + // ============================================================================ } // namespace oox diff --git a/oox/source/helper/zipstorage.cxx b/oox/source/helper/zipstorage.cxx index 72b6fcd1bff0..384870430c39 100644 --- a/oox/source/helper/zipstorage.cxx +++ b/oox/source/helper/zipstorage.cxx @@ -66,10 +66,15 @@ ZipStorage::ZipStorage( /* #i105325# ::comphelper::OStorageHelper::GetStorageFromInputStream() cannot be used here as it will open a storage with format type 'PackageFormat' that will not work with OOXML packages. + + #161971# The MS-document storages should always be opened in Repair-Mode to + ignore the format errors and get so much info as possible. I hate this + solution, but it seems to be the only consistent way to handle the MS-documents. + TODO: #i105410# switch to 'OFOPXMLFormat' and use its implementation of relations handling. */ mxStorage = ::comphelper::OStorageHelper::GetStorageOfFormatFromInputStream( - ZIP_STORAGE_FORMAT_STRING, rxInStream, rxFactory ); + ZIP_STORAGE_FORMAT_STRING, rxInStream, rxFactory, sal_True ); } catch( Exception& ) { @@ -87,7 +92,7 @@ ZipStorage::ZipStorage( { using namespace ::com::sun::star::embed::ElementModes; mxStorage = ::comphelper::OStorageHelper::GetStorageOfFormatFromStream( - OFOPXML_STORAGE_FORMAT_STRING, rxStream, READWRITE | TRUNCATE, rxFactory ); + OFOPXML_STORAGE_FORMAT_STRING, rxStream, READWRITE | TRUNCATE, rxFactory, sal_True ); } catch( Exception& ) { diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx index ed53992f944b..eb3b3503452e 100644 --- a/oox/source/ppt/pptshape.cxx +++ b/oox/source/ppt/pptshape.cxx @@ -28,6 +28,7 @@ #include "oox/ppt/pptshape.hxx" #include "oox/core/namespaces.hxx" #include "oox/core/xmlfilterbase.hxx" +#include "oox/drawingml/textbody.hxx" #include "tokens.hxx" #include <com/sun/star/container/XNamed.hpp> @@ -40,6 +41,7 @@ using rtl::OUString; using namespace ::oox::core; +using namespace ::oox::drawingml; using namespace ::com::sun::star; using namespace ::com::sun::star::awt; using namespace ::com::sun::star::uno; @@ -97,6 +99,11 @@ void PPTShape::addShape( { if ( ( meShapeLocation == Master ) || ( meShapeLocation == Layout ) ) sServiceName = rtl::OUString(); + else { + const rtl::OUString sTitleShapeService( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.SubtitleShape" ) ); + sServiceName = sTitleShapeService; + aMasterTextListStyle = rSlidePersist.getMasterPersist().get() ? rSlidePersist.getMasterPersist()->getTitleTextStyle() : rSlidePersist.getTitleTextStyle(); + } } break; case XML_obj : @@ -162,6 +169,21 @@ void PPTShape::addShape( } } + // use placeholder index if possible + if( mnSubType && getSubTypeIndex() && rSlidePersist.getMasterPersist().get() ) { + oox::drawingml::ShapePtr pPlaceholder = PPTShape::findPlaceholderByIndex( getSubTypeIndex(), rSlidePersist.getMasterPersist()->getShapes()->getChildren() ); + if( pPlaceholder.get() && pPlaceholder->getTextBody() ) { + TextListStylePtr pNewTextListStyle ( new TextListStyle() ); + + pNewTextListStyle->apply( pPlaceholder->getTextBody()->getTextListStyle() ); + if( pPlaceholder->getMasterTextListStyle().get() ) + pNewTextListStyle->apply( *pPlaceholder->getMasterTextListStyle() ); + + aMasterTextListStyle = pNewTextListStyle; + } + } + + if ( sServiceName.getLength() ) { if ( !aMasterTextListStyle.get() ) @@ -209,4 +231,51 @@ void PPTShape::applyShapeReference( const oox::drawingml::Shape& rReferencedShap Shape::applyShapeReference( rReferencedShape ); } +oox::drawingml::ShapePtr PPTShape::findPlaceholder( const sal_Int32 nMasterPlaceholder, std::vector< oox::drawingml::ShapePtr >& rShapes ) +{ + oox::drawingml::ShapePtr aShapePtr; + std::vector< oox::drawingml::ShapePtr >::reverse_iterator aRevIter( rShapes.rbegin() ); + while( aRevIter != rShapes.rend() ) + { + if ( (*aRevIter)->getSubType() == nMasterPlaceholder ) + { + aShapePtr = *aRevIter; + break; + } + std::vector< oox::drawingml::ShapePtr >& rChildren = (*aRevIter)->getChildren(); + aShapePtr = findPlaceholder( nMasterPlaceholder, rChildren ); + if ( aShapePtr.get() ) + break; + aRevIter++; + } + return aShapePtr; +} + +oox::drawingml::ShapePtr PPTShape::findPlaceholderByIndex( const sal_Int32 nIdx, std::vector< oox::drawingml::ShapePtr >& rShapes ) +{ + oox::drawingml::ShapePtr aShapePtr; + std::vector< oox::drawingml::ShapePtr >::reverse_iterator aRevIter( rShapes.rbegin() ); + while( aRevIter != rShapes.rend() ) + { + if ( (*aRevIter)->getSubTypeIndex() == nIdx ) + { + aShapePtr = *aRevIter; + break; + } + std::vector< oox::drawingml::ShapePtr >& rChildren = (*aRevIter)->getChildren(); + aShapePtr = findPlaceholderByIndex( nIdx, rChildren ); + if ( aShapePtr.get() ) + break; + aRevIter++; + } + return aShapePtr; +} + +// if nFirstPlaceholder can't be found, it will be searched for nSecondPlaceholder +oox::drawingml::ShapePtr PPTShape::findPlaceholder( sal_Int32 nFirstPlaceholder, sal_Int32 nSecondPlaceholder, std::vector< oox::drawingml::ShapePtr >& rShapes ) +{ + oox::drawingml::ShapePtr pPlaceholder = findPlaceholder( nFirstPlaceholder, rShapes ); + return !nSecondPlaceholder || pPlaceholder.get() ? pPlaceholder : findPlaceholder( nSecondPlaceholder, rShapes ); +} + } } diff --git a/oox/source/ppt/pptshapecontext.cxx b/oox/source/ppt/pptshapecontext.cxx index 8379a6e95735..86e254088041 100644 --- a/oox/source/ppt/pptshapecontext.cxx +++ b/oox/source/ppt/pptshapecontext.cxx @@ -111,14 +111,27 @@ Reference< XFastContextHandler > PPTShapeContext::createFastChildContext( sal_In { sal_Int32 nSubType( xAttribs->getOptionalValueToken( XML_type, XML_obj ) ); mpShapePtr->setSubType( nSubType ); - mpShapePtr->setSubTypeIndex( xAttribs->getOptionalValue( XML_idx ).toInt32() ); - if ( nSubType ) + OUString sIdx( xAttribs->getOptionalValue( XML_idx ) ); + sal_Bool bHasIdx = sIdx.getLength() > 0; + sal_Int32 nIdx = sIdx.toInt32(); + mpShapePtr->setSubTypeIndex( nIdx ); + + if ( nSubType || bHasIdx ) { PPTShape* pPPTShapePtr = dynamic_cast< PPTShape* >( mpShapePtr.get() ); if ( pPPTShapePtr ) { oox::ppt::ShapeLocation eShapeLocation = pPPTShapePtr->getShapeLocation(); - if ( ( eShapeLocation == Slide ) || ( eShapeLocation == Layout ) ) + oox::drawingml::ShapePtr pPlaceholder; + + if ( bHasIdx && eShapeLocation == Slide ) + { + // TODO: use id to shape map + SlidePersistPtr pMasterPersist( mpSlidePersistPtr->getMasterPersist() ); + if ( pMasterPersist.get() ) + pPlaceholder = PPTShape::findPlaceholderByIndex( nIdx, pMasterPersist->getShapes()->getChildren() ); + } + if ( !pPlaceholder.get() && ( ( eShapeLocation == Slide ) || ( eShapeLocation == Layout ) ) ) { // inheriting properties from placeholder objects by cloning shape @@ -157,7 +170,6 @@ Reference< XFastContextHandler > PPTShapeContext::createFastChildContext( sal_In } if ( nFirstPlaceholder ) { - oox::drawingml::ShapePtr pPlaceholder; if ( eShapeLocation == Layout ) // for layout objects the referenced object can be found within the same shape tree pPlaceholder = findPlaceholder( nFirstPlaceholder, nSecondPlaceholder, -1, mpSlidePersistPtr->getShapes()->getChildren() ); else if ( eShapeLocation == Slide ) // normal slide shapes have to search within the corresponding master tree for referenced objects @@ -176,6 +188,14 @@ Reference< XFastContextHandler > PPTShapeContext::createFastChildContext( sal_In } } } + if ( pPlaceholder.get() ) + { + mpShapePtr->applyShapeReference( *pPlaceholder.get() ); + PPTShape* pPPTShape = dynamic_cast< PPTShape* >( pPlaceholder.get() ); + if ( pPPTShape ) + pPPTShape->setReferenced( sal_True ); + pPPTShapePtr->setPlaceholder( pPlaceholder ); + } } } break; diff --git a/oox/source/ppt/slidefragmenthandler.cxx b/oox/source/ppt/slidefragmenthandler.cxx index 62fbc1a87725..69f32e01e7eb 100644 --- a/oox/source/ppt/slidefragmenthandler.cxx +++ b/oox/source/ppt/slidefragmenthandler.cxx @@ -32,6 +32,7 @@ #include <com/sun/star/container/XNamed.hpp> #include "tokens.hxx" +#include "properties.hxx" #include "oox/helper/propertyset.hxx" #include "oox/core/namespaces.hxx" #include "oox/core/xmlfilterbase.hxx" @@ -86,6 +87,18 @@ Reference< XFastContextHandler > SlideFragmentHandler::createFastChildContext( s case NMSP_PPT|XML_sldMaster: // CT_SlideMaster case NMSP_PPT|XML_handoutMaster: // CT_HandoutMaster case NMSP_PPT|XML_sld: // CT_CommonSlideData + { + AttributeList attribs( xAttribs ); + + Reference< XDrawPage > xSlide( mpSlidePersistPtr->getPage() ); + PropertyMap aPropMap; + PropertySet aSlideProp( xSlide ); + + aPropMap[ PROP_Visible ] = Any( attribs.getBool( XML_show, sal_True ) ); + aSlideProp.setProperties( aPropMap ); + + break; + } case NMSP_PPT|XML_notes: // CT_NotesSlide case NMSP_PPT|XML_notesMaster: // CT_NotesMaster break; diff --git a/oox/source/ppt/slidetransition.cxx b/oox/source/ppt/slidetransition.cxx index bdfc1621e486..ee889e13d840 100644 --- a/oox/source/ppt/slidetransition.cxx +++ b/oox/source/ppt/slidetransition.cxx @@ -176,6 +176,39 @@ namespace oox { namespace ppt { return nOdpDirection; } + sal_Int16 SlideTransition::ooxToOdpSideDirections( ::sal_Int32 nOoxType ) + { + sal_Int16 nOdpDirection; + switch( nOoxType ) + { + case XML_d: + case XML_u: + nOdpDirection = TransitionSubType::TOPTOBOTTOM; + break; + case XML_l: + case XML_r: + nOdpDirection = TransitionSubType::LEFTTORIGHT; + break; + default: + nOdpDirection= 0; + break; + } + return nOdpDirection; + } + + sal_Bool SlideTransition::ooxToOdpSideDirectionsDirectionNormal( ::sal_Int32 nOoxType ) + { + sal_Bool nOdpDirection = true; + switch( nOoxType ) + { + case XML_u: + case XML_l: + nOdpDirection = false; + break; + } + return nOdpDirection; + } + sal_Int16 SlideTransition::ooxToOdpCornerDirections( ::sal_Int32 nOoxType ) { sal_Int16 nOdpDirection; @@ -291,7 +324,8 @@ namespace oox { namespace ppt { break; case NMSP_PPT|XML_wipe: mnTransitionType = TransitionType::BARWIPE; - mnTransitionSubType = ooxToOdpBorderDirections( param1 ); + mnTransitionSubType = ooxToOdpSideDirections( param1 ); + mbTransitionDirectionNormal = ooxToOdpSideDirectionsDirectionNormal( param1 ); break; case NMSP_PPT|XML_split: mnTransitionType = TransitionType::BARNDOORWIPE; diff --git a/oox/source/shape/ShapeContextHandler.cxx b/oox/source/shape/ShapeContextHandler.cxx index 42efee474d90..05734b65e2a7 100644 --- a/oox/source/shape/ShapeContextHandler.cxx +++ b/oox/source/shape/ShapeContextHandler.cxx @@ -29,6 +29,7 @@ #include "oox/vml/vmldrawingfragment.hxx" #include "oox/vml/vmlshape.hxx" #include "oox/vml/vmlshapecontainer.hxx" +#include "tokens.hxx" #if DEBUG #include <iostream> diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index 59018311d49f..56606a289a6e 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -6,6 +6,7 @@ Adjust AdjustContrast AdjustLuminance Align +AnchorPosition ArrangeOrder Aspect AttachedAxisIndex @@ -58,6 +59,7 @@ CharFontPitchComplex CharHeight CharHeightAsian CharHeightComplex +CharKerning CharLocale CharLocaleAsian CharLocaleComplex @@ -121,6 +123,7 @@ ErrorBarX ErrorBarY ErrorMessage ErrorTitle +Expansion ExternalDocLinks ExternalLinks FileFormat @@ -169,10 +172,16 @@ HasAutoShowInfo HasColumnRowHeaders HasHorizontalScrollBar HasLayoutInfo +HasMainTitle HasReference +HasSecondaryXAxisTitle +HasSecondaryYAxisTitle HasSheetTabs HasSortInfo HasVerticalScrollBar +HasXAxisTitle +HasYAxisTitle +HasZAxisTitle HeaderBodyDistance HeaderHeight HeaderIsDynamicHeight @@ -305,6 +314,7 @@ ReferenceDevice RegularExpressions RelId RelativeHorizontalTabbarWidth +RelativePosition Repeat RepeatDelay Representation @@ -382,6 +392,8 @@ Text TextAutoGrowHeight TextBreak TextColor +TextFitToSize +TextHorizontalAdjust TextLeftDistance TextLowerDistance TextOverlap @@ -415,6 +427,7 @@ VertJustify VerticalAlign VerticalSplitMode VerticalSplitPositionTwips +Visible VisibleSize VisualArea VisualEffect diff --git a/oox/source/xls/externallinkbuffer.cxx b/oox/source/xls/externallinkbuffer.cxx index a4c0731b19ed..04fcd2f84648 100644 --- a/oox/source/xls/externallinkbuffer.cxx +++ b/oox/source/xls/externallinkbuffer.cxx @@ -909,7 +909,7 @@ void ExternalLink::insertExternalSheet( const OUString& rSheetName ) OSL_ENSURE( rSheetName.getLength() > 0, "ExternalLink::insertExternalSheet - empty sheet name" ); if( mxDocLink.is() ) { - Reference< XExternalSheetCache > xSheetCache = mxDocLink->addSheetCache( rSheetName ); + Reference< XExternalSheetCache > xSheetCache = mxDocLink->addSheetCache( rSheetName, false ); sal_Int32 nCacheIdx = xSheetCache.is() ? xSheetCache->getTokenIndex() : -1; maSheetCaches.push_back( nCacheIdx ); } diff --git a/oox/source/xls/themebuffer.cxx b/oox/source/xls/themebuffer.cxx index 3aabd471742d..23617287dc57 100644 --- a/oox/source/xls/themebuffer.cxx +++ b/oox/source/xls/themebuffer.cxx @@ -27,6 +27,7 @@ #include "oox/xls/themebuffer.hxx" #include "oox/xls/stylesbuffer.hxx" +#include "tokens.hxx" using ::oox::drawingml::ClrScheme; |