diff options
author | Michael Brauer <mib@openoffice.org> | 2000-11-07 12:33:09 +0000 |
---|---|---|
committer | Michael Brauer <mib@openoffice.org> | 2000-11-07 12:33:09 +0000 |
commit | b5fc47fe5c2892dd712e2bda922656eacbd932f1 (patch) | |
tree | e00ae2ef750a72ad2b10b1b4cdbe31a02b7ecb33 | |
parent | aa841ce0e4fb3e83c7bcccc541447def18e14e75 (diff) |
shape import and export for text documents
34 files changed, 1840 insertions, 1297 deletions
diff --git a/xmloff/inc/XMLChartPropertySetMapper.hxx b/xmloff/inc/XMLChartPropertySetMapper.hxx index dd527183f692..5f2250ae6915 100644 --- a/xmloff/inc/XMLChartPropertySetMapper.hxx +++ b/xmloff/inc/XMLChartPropertySetMapper.hxx @@ -2,9 +2,9 @@ * * $RCSfile: XMLChartPropertySetMapper.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: sab $ $Date: 2000-10-26 10:06:05 $ + * last change: $Author: mib $ $Date: 2000-11-07 13:33:02 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -95,12 +95,6 @@ public: class XMLChartPropertySetMapper : public XMLPropertySetMapper { -protected: - virtual void ContextFilter( - ::std::vector< XMLPropertyState >& rProperties, - ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > rPropSet ) const; - public: XMLChartPropertySetMapper(); ~XMLChartPropertySetMapper(); @@ -115,6 +109,13 @@ private: const rtl::OUString msTrue; const rtl::OUString msFalse; +protected: + virtual void ContextFilter( + ::std::vector< XMLPropertyState >& rProperties, + ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > rPropSet ) const; + +private: /// this method is called for every item that has the MID_FLAG_ELEMENT_EXPORT flag set virtual void handleElementItem( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler, diff --git a/xmloff/prj/d.lst b/xmloff/prj/d.lst index 45a669bbf56f..b6dcf530ff87 100644 --- a/xmloff/prj/d.lst +++ b/xmloff/prj/d.lst @@ -79,3 +79,4 @@ hedabu: ..\inc\XMLTextMasterPageExport.hxx %_DEST%\inc%_EXT%\xmloff\XMLTextMaste hedabu: ..\inc\XMLTextMasterStylesContext.hxx %_DEST%\inc%_EXT%\xmloff\XMLTextMasterStylesContext.hxx hedabu: ..\inc\XMLTextMasterPageContext.hxx %_DEST%\inc%_EXT%\xmloff\XMLTextMasterPageContext.hxx hedabu: ..\inc\XMLTextTableContext.hxx %_DEST%\inc%_EXT%\xmloff\XMLTextTableContext.hxx +hedabu: ..\source\text\XMLTextShapeImportHelper.hxx %_DEST%\inc%_EXT%\xmloff\XMLTextShapeImportHelper.hxx diff --git a/xmloff/source/chart/PropertyMaps.cxx b/xmloff/source/chart/PropertyMaps.cxx index 510cf69cde19..bce8de328bfa 100644 --- a/xmloff/source/chart/PropertyMaps.cxx +++ b/xmloff/source/chart/PropertyMaps.cxx @@ -2,9 +2,9 @@ * * $RCSfile: PropertyMaps.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: sab $ $Date: 2000-10-26 10:33:17 $ + * last change: $Author: mib $ $Date: 2000-11-07 13:33:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -313,7 +313,21 @@ XMLChartPropertySetMapper::~XMLChartPropertySetMapper() { } -void XMLChartPropertySetMapper::ContextFilter( +// ---------------------------------------- + +XMLChartExportPropertyMapper::XMLChartExportPropertyMapper( const UniReference< XMLPropertySetMapper >& rMapper ) : + SvXMLExportPropertyMapper( rMapper ), + msCDATA( rtl::OUString::createFromAscii( sXML_CDATA )), + msTrue( rtl::OUString::createFromAscii( sXML_true )), + msFalse( rtl::OUString::createFromAscii( sXML_false )) +{ +} + +XMLChartExportPropertyMapper::~XMLChartExportPropertyMapper() +{ +} + +void XMLChartExportPropertyMapper::ContextFilter( std::vector< XMLPropertyState >& rProperties, uno::Reference< beans::XPropertySet > rPropSet ) const { @@ -324,7 +338,7 @@ void XMLChartPropertySetMapper::ContextFilter( { // find properties with context // to prevent writing this property set mnIndex member to -1 - switch( GetEntryContextId( property->mnIndex )) + switch( getPropertySetMapper()->GetEntryContextId( property->mnIndex )) { case XML_SCH_USER_SYMBOL: { @@ -338,20 +352,6 @@ void XMLChartPropertySetMapper::ContextFilter( } } -// ---------------------------------------- - -XMLChartExportPropertyMapper::XMLChartExportPropertyMapper( const UniReference< XMLPropertySetMapper >& rMapper ) : - SvXMLExportPropertyMapper( rMapper ), - msCDATA( rtl::OUString::createFromAscii( sXML_CDATA )), - msTrue( rtl::OUString::createFromAscii( sXML_true )), - msFalse( rtl::OUString::createFromAscii( sXML_false )) -{ -} - -XMLChartExportPropertyMapper::~XMLChartExportPropertyMapper() -{ -} - void XMLChartExportPropertyMapper::handleElementItem( const uno::Reference< xml::sax::XDocumentHandler > & rHandler, const XMLPropertyState& rProperty, const SvXMLUnitConverter& rUnitConverter, diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index 8b06efe03668..8fe4a38b088b 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -2,9 +2,9 @@ * * $RCSfile: SchXMLExport.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: bm $ $Date: 2000-09-27 15:15:41 $ + * last change: $Author: mib $ $Date: 2000-11-07 13:33:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -175,15 +175,16 @@ SchXMLExportHelper::SchXMLExportHelper( // create property set mapper mxPropertySetMapper = new XMLChartPropertySetMapper; - // register chart auto-style family - mrAutoStylePool.AddFamily( - XML_STYLE_FAMILY_SCH_CHART_ID, - rtl::OUString::createFromAscii( XML_STYLE_FAMILY_SCH_CHART_NAME ), - mxPropertySetMapper, - rtl::OUString::createFromAscii( XML_STYLE_FAMILY_SCH_CHART_PREFIX )); } mxExpPropMapper = new XMLChartExportPropertyMapper( mxPropertySetMapper ); + + // register chart auto-style family + mrAutoStylePool.AddFamily( + XML_STYLE_FAMILY_SCH_CHART_ID, + rtl::OUString::createFromAscii( XML_STYLE_FAMILY_SCH_CHART_NAME ), + mxExpPropMapper.get(), + rtl::OUString::createFromAscii( XML_STYLE_FAMILY_SCH_CHART_PREFIX )); } void SchXMLExportHelper::exportAutoStyles() @@ -192,7 +193,6 @@ void SchXMLExportHelper::exportAutoStyles() { mrAutoStylePool.exportXML( XML_STYLE_FAMILY_SCH_CHART_ID, - *( mxExpPropMapper.get()), mrExport.GetDocHandler(), mrExport.GetMM100UnitConverter(), mrExport.GetNamespaceMap()); @@ -345,11 +345,11 @@ void SchXMLExportHelper::parseDocument( uno::Reference< chart::XChartDocument >& SvXMLElementExport* pElChart = 0; // get property states for autostyles - if( mxPropertySetMapper.is()) + if( mxExpPropMapper.is()) { uno::Reference< beans::XPropertySet > xPropSet( rChartDoc->getArea(), uno::UNO_QUERY ); if( xPropSet.is()) - aPropertyStates = mxPropertySetMapper->Filter( xPropSet ); + aPropertyStates = mxExpPropMapper->Filter( xPropSet ); } if( bExportContent ) { @@ -413,11 +413,11 @@ void SchXMLExportHelper::parseDocument( uno::Reference< chart::XChartDocument >& if( bHasMainTitle ) { // get property states for autostyles - if( mxPropertySetMapper.is()) + if( mxExpPropMapper.is()) { uno::Reference< beans::XPropertySet > xPropSet( rChartDoc->getTitle(), uno::UNO_QUERY ); if( xPropSet.is()) - aPropertyStates = mxPropertySetMapper->Filter( xPropSet ); + aPropertyStates = mxExpPropMapper->Filter( xPropSet ); } if( bExportContent ) { @@ -456,11 +456,11 @@ void SchXMLExportHelper::parseDocument( uno::Reference< chart::XChartDocument >& if( bHasSubTitle ) { // get property states for autostyles - if( mxPropertySetMapper.is()) + if( mxExpPropMapper.is()) { uno::Reference< beans::XPropertySet > xPropSet( rChartDoc->getSubTitle(), uno::UNO_QUERY ); if( xPropSet.is()) - aPropertyStates = mxPropertySetMapper->Filter( xPropSet ); + aPropertyStates = mxExpPropMapper->Filter( xPropSet ); } if( bExportContent ) @@ -499,11 +499,11 @@ void SchXMLExportHelper::parseDocument( uno::Reference< chart::XChartDocument >& if( bHasLegend ) { // get property states for autostyles - if( mxPropertySetMapper.is()) + if( mxExpPropMapper.is()) { uno::Reference< beans::XPropertySet > xPropSet( rChartDoc->getLegend(), uno::UNO_QUERY ); if( xPropSet.is()) - aPropertyStates = mxPropertySetMapper->Filter( xPropSet ); + aPropertyStates = mxExpPropMapper->Filter( xPropSet ); } if( bExportContent ) @@ -725,8 +725,8 @@ void SchXMLExportHelper::exportPlotArea( uno::Reference< chart::XDiagram > xDiag xPropSet = uno::Reference< beans::XPropertySet >( xDiagram, uno::UNO_QUERY ); if( xPropSet.is()) { - if( mxPropertySetMapper.is()) - aPropertyStates = mxPropertySetMapper->Filter( xPropSet ); + if( mxExpPropMapper.is()) + aPropertyStates = mxExpPropMapper->Filter( xPropSet ); } if( bExportContent ) { @@ -880,9 +880,9 @@ void SchXMLExportHelper::exportPlotArea( uno::Reference< chart::XDiagram > xDiag DBG_WARNING( "Required property not found in DataRowProperties" ); } - if( mxPropertySetMapper.is()) + if( mxExpPropMapper.is()) { - aPropertyStates = mxPropertySetMapper->Filter( xPropSet ); + aPropertyStates = mxExpPropMapper->Filter( xPropSet ); } } @@ -1014,7 +1014,7 @@ void SchXMLExportHelper::exportPlotArea( uno::Reference< chart::XDiagram > xDiag // Note: if only the nth data-point has autostyles there is an element // without style and repeat="n-1" attribute written in advance. - if( mxPropertySetMapper.is()) + if( mxExpPropMapper.is()) { const sal_Int32 nSeriesCount = ( bRowSourceColumns ? ( mnRowCount - nRowOffset ): ( mnColCount - nColOffset )); @@ -1027,7 +1027,7 @@ void SchXMLExportHelper::exportPlotArea( uno::Reference< chart::XDiagram > xDiag // get property states for autostyles xPropSet = xDiagram->getDataPointProperties( nElement, nSeries ); if( xPropSet.is()) - aPropertyStates = mxPropertySetMapper->Filter( xPropSet ); + aPropertyStates = mxExpPropMapper->Filter( xPropSet ); bIsEmpty = ( aPropertyStates.size() == 0 ); if( bExportContent ) @@ -1238,11 +1238,11 @@ void SchXMLExportHelper::exportAxes( uno::Reference< chart::XDiagram > xDiagram, if( xAxisSupp.is()) { // get property states for autostyles - if( mxPropertySetMapper.is()) + if( mxExpPropMapper.is()) { xPropSet = xAxisSupp->getXAxis(); if( xPropSet.is()) - aPropertyStates = mxPropertySetMapper->Filter( xPropSet ); + aPropertyStates = mxExpPropMapper->Filter( xPropSet ); } if( bExportContent ) { @@ -1290,7 +1290,7 @@ void SchXMLExportHelper::exportAxes( uno::Reference< chart::XDiagram > xDiagram, uno::Reference< beans::XPropertySet > xMajorGrid( xAxisSupp->getXMainGrid(), uno::UNO_QUERY ); if( bHasXAxisMajorGrid && xMajorGrid.is()) { - aPropertyStates = mxPropertySetMapper->Filter( xMajorGrid ); + aPropertyStates = mxExpPropMapper->Filter( xMajorGrid ); if( bExportContent ) { aASName = GetAutoStylePoolP().Find( nStyleFamily, aPropertyStates ); @@ -1309,7 +1309,7 @@ void SchXMLExportHelper::exportAxes( uno::Reference< chart::XDiagram > xDiagram, uno::Reference< beans::XPropertySet > xMinorGrid( xAxisSupp->getXHelpGrid(), uno::UNO_QUERY ); if( bHasXAxisMinorGrid && xMinorGrid.is()) { - aPropertyStates = mxPropertySetMapper->Filter( xMinorGrid ); + aPropertyStates = mxExpPropMapper->Filter( xMinorGrid ); if( bExportContent ) { aASName = GetAutoStylePoolP().Find( nStyleFamily, aPropertyStates ); @@ -1340,11 +1340,11 @@ void SchXMLExportHelper::exportAxes( uno::Reference< chart::XDiagram > xDiagram, if( xAxisSupp.is()) { // get property states for autostyles - if( mxPropertySetMapper.is()) + if( mxExpPropMapper.is()) { xPropSet = xAxisSupp->getSecondaryXAxis(); if( xPropSet.is()) - aPropertyStates = mxPropertySetMapper->Filter( xPropSet ); + aPropertyStates = mxExpPropMapper->Filter( xPropSet ); } if( bExportContent ) { @@ -1382,11 +1382,11 @@ void SchXMLExportHelper::exportAxes( uno::Reference< chart::XDiagram > xDiagram, if( xAxisSupp.is()) { // get property states for autostyles - if( mxPropertySetMapper.is()) + if( mxExpPropMapper.is()) { xPropSet = xAxisSupp->getYAxis(); if( xPropSet.is()) - aPropertyStates = mxPropertySetMapper->Filter( xPropSet ); + aPropertyStates = mxExpPropMapper->Filter( xPropSet ); } if( bExportContent ) { @@ -1428,7 +1428,7 @@ void SchXMLExportHelper::exportAxes( uno::Reference< chart::XDiagram > xDiagram, uno::Reference< beans::XPropertySet > xMajorGrid( xAxisSupp->getYMainGrid(), uno::UNO_QUERY ); if( bHasYAxisMajorGrid && xMajorGrid.is()) { - aPropertyStates = mxPropertySetMapper->Filter( xMajorGrid ); + aPropertyStates = mxExpPropMapper->Filter( xMajorGrid ); if( bExportContent ) { @@ -1449,7 +1449,7 @@ void SchXMLExportHelper::exportAxes( uno::Reference< chart::XDiagram > xDiagram, uno::Reference< beans::XPropertySet > xMinorGrid( xAxisSupp->getYHelpGrid(), uno::UNO_QUERY ); if( bHasYAxisMinorGrid && xMinorGrid.is()) { - aPropertyStates = mxPropertySetMapper->Filter( xMinorGrid ); + aPropertyStates = mxExpPropMapper->Filter( xMinorGrid ); if( bExportContent ) { @@ -1479,11 +1479,11 @@ void SchXMLExportHelper::exportAxes( uno::Reference< chart::XDiagram > xDiagram, if( xAxisSupp.is()) { // get property states for autostyles - if( mxPropertySetMapper.is()) + if( mxExpPropMapper.is()) { xPropSet = xAxisSupp->getSecondaryYAxis(); if( xPropSet.is()) - aPropertyStates = mxPropertySetMapper->Filter( xPropSet ); + aPropertyStates = mxExpPropMapper->Filter( xPropSet ); } if( bExportContent ) { @@ -1517,11 +1517,11 @@ void SchXMLExportHelper::exportAxes( uno::Reference< chart::XDiagram > xDiagram, if( xAxisSupp.is()) { // get property states for autostyles - if( mxPropertySetMapper.is()) + if( mxExpPropMapper.is()) { xPropSet = xAxisSupp->getZAxis(); if( xPropSet.is()) - aPropertyStates = mxPropertySetMapper->Filter( xPropSet ); + aPropertyStates = mxExpPropMapper->Filter( xPropSet ); } if( bExportContent ) { @@ -1563,7 +1563,7 @@ void SchXMLExportHelper::exportAxes( uno::Reference< chart::XDiagram > xDiagram, uno::Reference< beans::XPropertySet > xMajorGrid( xAxisSupp->getZMainGrid(), uno::UNO_QUERY ); if( bHasZAxisMajorGrid && xMajorGrid.is()) { - aPropertyStates = mxPropertySetMapper->Filter( xMajorGrid ); + aPropertyStates = mxExpPropMapper->Filter( xMajorGrid ); if( bExportContent ) { @@ -1584,7 +1584,7 @@ void SchXMLExportHelper::exportAxes( uno::Reference< chart::XDiagram > xDiagram, uno::Reference< beans::XPropertySet > xMinorGrid( xAxisSupp->getZHelpGrid(), uno::UNO_QUERY ); if( bHasZAxisMinorGrid && xMinorGrid.is()) { - aPropertyStates = mxPropertySetMapper->Filter( xMinorGrid ); + aPropertyStates = mxExpPropMapper->Filter( xMinorGrid ); if( bExportContent ) { diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx index 35b257d29e99..6465268c05de 100644 --- a/xmloff/source/draw/sdxmlexp.cxx +++ b/xmloff/source/draw/sdxmlexp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: sdxmlexp.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: cl $ $Date: 2000-11-06 14:47:58 $ + * last change: $Author: mib $ $Date: 2000-11-07 13:33:05 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -608,7 +608,9 @@ SdXMLExport::SdXMLExport( const UniReference< XMLPropertyHandlerFactory > aFactoryRef = mpSdPropHdlFactory; // construct PropertySetMapper - mpPropertySetMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLSDProperties, aFactoryRef); + UniReference < XMLPropertySetMapper > xMapper = + new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLSDProperties, aFactoryRef); + mpPropertySetMapper = new ImpPresPageDrawStylePropMapper( xMapper ); if(mpPropertySetMapper) { // set lock to avoid deletion @@ -616,7 +618,10 @@ SdXMLExport::SdXMLExport( } // construct PresPagePropsMapper - mpPresPagePropsMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLSDPresPageProps, aFactoryRef); + xMapper = + new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLSDPresPageProps, aFactoryRef); + + mpPresPagePropsMapper = new ImpPresPageDrawStylePropMapper( xMapper ); if(mpPresPagePropsMapper) { // set lock to avoid deletion @@ -854,14 +859,12 @@ void SdXMLExport::ImpWriteDefaultStyleInfos() if(xPropState.is()) { uno::Reference< beans::XPropertySet > xImpDefaultMapper( new ImpDefaultMapper( xPropState ) ); - const UniReference< XMLPropertySetMapper > aMapperRef = GetPropertySetMapper(); + const UniReference< SvXMLExportPropertyMapper > aMapperRef = GetPropertySetMapper(); std::vector< XMLPropertyState > xPropStates = aMapperRef->Filter( xImpDefaultMapper ); if(xPropStates.size()) { - ImpPresPageDrawStylePropMapper aExpPropMapper(aMapperRef); - - aExpPropMapper.exportXML(GetDocHandler(), xPropStates, + aMapperRef->exportXML(GetDocHandler(), xPropStates, GetMM100UnitConverter(), GetNamespaceMap()); bDone = TRUE; } @@ -878,7 +881,7 @@ void SdXMLExport::ImpWriteObjGraphicStyleInfos() { XMLStyleExport aStEx(*this, OUString(RTL_CONSTASCII_USTRINGPARAM(sXML_drawpool)), GetAutoStylePool().get()); - const UniReference< XMLPropertySetMapper > aMapperRef = GetPropertySetMapper(); + const UniReference< SvXMLExportPropertyMapper > aMapperRef = GetPropertySetMapper(); aStEx.exportStyleFamily(XML_STYLE_FAMILY_SD_GRAPHICS_NAME, XML_STYLE_FAMILY_SD_GRAPHICS_NAME, aMapperRef, FALSE, XML_STYLE_FAMILY_SD_GRAPHICS_ID); @@ -1488,14 +1491,12 @@ void SdXMLExport::ImpWriteDrawPageInfos() uno::Reference< beans::XPropertySet > xPropSet(xDrawPage, uno::UNO_QUERY); if(xPropSet.is()) { - const UniReference< XMLPropertySetMapper > aMapperRef = GetPresPagePropsMapper(); + const UniReference< SvXMLExportPropertyMapper > aMapperRef = GetPresPagePropsMapper(); std::vector< XMLPropertyState > xPropStates = aMapperRef->Filter( xPropSet ); if(xPropStates.size()) { - ImpPresPageDrawStylePropMapper aExpPropMapper(aMapperRef); - - aExpPropMapper.exportXML(GetDocHandler(), xPropStates, + aMapperRef->exportXML(GetDocHandler(), xPropStates, GetMM100UnitConverter(), GetNamespaceMap()); } } @@ -3157,7 +3158,7 @@ void SdXMLExport::_ExportMasterStyles() { XMLStyleExport aStEx(*this, OUString(RTL_CONSTASCII_USTRINGPARAM(sXML_drawpool)), GetAutoStylePool().get()); - const UniReference< XMLPropertySetMapper > aMapperRef = GetPropertySetMapper(); + const UniReference< SvXMLExportPropertyMapper > aMapperRef = GetPropertySetMapper(); OUString aPrefix = xNamed->getName(); aPrefix += OUString(RTL_CONSTASCII_USTRINGPARAM("-")); diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index 7365a1e119a2..8e45561f76ca 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -2,9 +2,9 @@ * * $RCSfile: shapeexport.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: cl $ $Date: 2000-11-06 12:58:31 $ + * last change: $Author: mib $ $Date: 2000-11-07 13:33:05 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -92,15 +92,23 @@ using namespace ::com::sun::star; ////////////////////////////////////////////////////////////////////////////// -XMLShapeExport::XMLShapeExport(SvXMLExport& rExp) +XMLShapeExport::XMLShapeExport(SvXMLExport& rExp, + SvXMLExportPropertyMapper *pExtMapper ) : rExport( rExp ) { // construct PropertyHandlerFactory xSdPropHdlFactory = new XMLSdPropHdlFactory; // construct PropertySetMapper - xPropertySetMapper = new XMLPropertySetMapper( - (XMLPropertyMapEntry*)aXMLSDProperties, xSdPropHdlFactory); + UniReference < XMLPropertySetMapper > xMapper = + new XMLPropertySetMapper( + (XMLPropertyMapEntry*)aXMLSDProperties, xSdPropHdlFactory); + xPropertySetMapper = new SvXMLExportPropertyMapper( xMapper ); + if( pExtMapper ) + { + UniReference < SvXMLExportPropertyMapper > xExtMapper( pExtMapper ); + xPropertySetMapper->ChainExportMapper( xExtMapper ); + } rExp.GetAutoStylePool()->AddFamily( XML_STYLE_FAMILY_SD_GRAPHICS_ID, @@ -207,15 +215,12 @@ void XMLShapeExport::exportShape(const uno::Reference< drawing::XShape >& xShape void XMLShapeExport::exportAutoStyles() { // export all autostyle infos - const UniReference< XMLPropertySetMapper > aMapperRef( GetPropertySetMapper() ); - SvXMLExportPropertyMapper aExpPropMapper(aMapperRef); // ...for graphic // if(IsFamilyGraphicUsed()) { GetExport().GetAutoStylePool()->exportXML( XML_STYLE_FAMILY_SD_GRAPHICS_ID, - aExpPropMapper, GetExport().GetDocHandler(), GetExport().GetMM100UnitConverter(), GetExport().GetNamespaceMap()); @@ -226,7 +231,6 @@ void XMLShapeExport::exportAutoStyles() { GetExport().GetAutoStylePool()->exportXML( XML_STYLE_FAMILY_SD_PRESENTATION_ID, - aExpPropMapper, GetExport().GetDocHandler(), GetExport().GetMM100UnitConverter(), GetExport().GetNamespaceMap()); diff --git a/xmloff/source/draw/shapeimport.cxx b/xmloff/source/draw/shapeimport.cxx index 1e631a3be8b9..33900440cff7 100644 --- a/xmloff/source/draw/shapeimport.cxx +++ b/xmloff/source/draw/shapeimport.cxx @@ -2,9 +2,9 @@ * * $RCSfile: shapeimport.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: cl $ $Date: 2000-11-06 14:47:58 $ + * last change: $Author: mib $ $Date: 2000-11-07 13:33:05 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -100,7 +100,9 @@ using namespace ::com::sun::star; ////////////////////////////////////////////////////////////////////////////// -XMLShapeImportHelper::XMLShapeImportHelper(const uno::Reference< frame::XModel>& rModel) +XMLShapeImportHelper::XMLShapeImportHelper( + const uno::Reference< frame::XModel>& rModel, + SvXMLImportPropertyMapper *pExtMapper ) : mxModel(rModel), mpSdPropHdlFactory(0L), mpPropertySetMapper(0L), @@ -130,15 +132,24 @@ XMLShapeImportHelper::XMLShapeImportHelper(const uno::Reference< frame::XModel>& const UniReference< XMLPropertyHandlerFactory > aFactoryRef = mpSdPropHdlFactory; // construct PropertySetMapper - mpPropertySetMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLSDProperties, aFactoryRef); + UniReference < XMLPropertySetMapper > xMapper = + new XMLPropertySetMapper( (XMLPropertyMapEntry*)aXMLSDProperties, + aFactoryRef); + mpPropertySetMapper = new SvXMLImportPropertyMapper( xMapper ); if(mpPropertySetMapper) { // set lock to avoid deletion mpPropertySetMapper->acquire(); + if( pExtMapper ) + { + UniReference < SvXMLImportPropertyMapper > xExtMapper( pExtMapper ); + mpPropertySetMapper->ChainImportMapper( xExtMapper ); + } } // construct PresPagePropsMapper - mpPresPagePropsMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLSDPresPageProps, aFactoryRef); + xMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLSDPresPageProps, aFactoryRef); + mpPresPagePropsMapper = new SvXMLImportPropertyMapper( xMapper ); if(mpPresPagePropsMapper) { // set lock to avoid deletion diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx index 1389a2bdaecc..de2e16b3a683 100644 --- a/xmloff/source/draw/ximpshap.cxx +++ b/xmloff/source/draw/ximpshap.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ximpshap.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: cl $ $Date: 2000-11-06 12:08:07 $ + * last change: $Author: mib $ $Date: 2000-11-07 13:33:05 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -299,14 +299,19 @@ void SdXMLShapeContext::SetStyle() pStyle = GetImport().GetShapeImport()->GetStylesContext()-> FindStyleChildContext(mnStyleFamily, maDrawStyleName); - if(pStyle && pStyle->ISA(XMLShapeStyleContext)) + if(pStyle && pStyle->ISA(XMLPropStyleContext) ) { uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY); - if(xPropSet.is()) + if(xPropSet.is() ) { - XMLShapeStyleContext* pDocStyle = (XMLShapeStyleContext*)pStyle; + XMLPropStyleContext* pPropStyle = + PTR_CAST( XMLPropStyleContext, pStyle ); + + XMLShapeStyleContext* pDocStyle = 0; + if( pPropStyle->ISA(XMLShapeStyleContext) ) + pDocStyle = PTR_CAST( XMLShapeStyleContext, pPropStyle ); - if(pDocStyle->GetStyle().is()) + if( pDocStyle && pDocStyle->GetStyle().is() ) { // set style on object uno::Any aAny; @@ -317,7 +322,7 @@ void SdXMLShapeContext::SetStyle() if(bAutoStyle) { // set PropertySet on object - pDocStyle->FillPropertySet(xPropSet); + pPropStyle->FillPropertySet(xPropSet); } } } diff --git a/xmloff/source/draw/ximpstyl.cxx b/xmloff/source/draw/ximpstyl.cxx index 7ce70af0eab8..dd803a8494ba 100644 --- a/xmloff/source/draw/ximpstyl.cxx +++ b/xmloff/source/draw/ximpstyl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ximpstyl.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 17:07:04 $ + * last change: $Author: mib $ $Date: 2000-11-07 13:33:05 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -799,7 +799,7 @@ UniReference< SvXMLImportPropertyMapper > SdXMLStylesContext::GetImportPropertyM { UniReference< XMLShapeImportHelper > aImpHelper = ((SvXMLImport&)GetImport()).GetShapeImport(); ((SdXMLStylesContext*)this)->xPresImpPropMapper = - new SvXMLImportPropertyMapper(aImpHelper->GetPresPagePropsMapper()); + aImpHelper->GetPresPagePropsMapper(); } xMapper = xPresImpPropMapper; return xMapper; diff --git a/xmloff/source/style/PageMasterExportPropMapper.cxx b/xmloff/source/style/PageMasterExportPropMapper.cxx index b07be906387e..76226b72baf4 100644 --- a/xmloff/source/style/PageMasterExportPropMapper.cxx +++ b/xmloff/source/style/PageMasterExportPropMapper.cxx @@ -2,9 +2,9 @@ * * $RCSfile: PageMasterExportPropMapper.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: mib $ $Date: 2000-10-30 13:34:13 $ + * last change: $Author: mib $ $Date: 2000-11-07 13:33:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -63,6 +63,13 @@ #include "PageMasterExportPropMapper.hxx" #endif +#ifndef _COMPHELPER_TYPES_HXX_ +#include <comphelper/types.hxx> +#endif + +#ifndef _COM_SUN_STAR_TABLE_BORDERLINE_HPP_ +#include <com/sun/star/table/BorderLine.hpp> +#endif #ifndef _XMLOFF_PAGEMASTERSTYLEMAP_HXX #include "PageMasterStyleMap.hxx" #endif @@ -73,7 +80,167 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +using namespace ::comphelper; + + +//______________________________________________________________________________ + +inline sal_Bool lcl_HasSameLineWidth( const table::BorderLine& rLine1, const table::BorderLine& rLine2 ) +{ + return (rLine1.InnerLineWidth == rLine2.InnerLineWidth) && + (rLine1.OuterLineWidth == rLine2.OuterLineWidth) && + (rLine1.LineDistance == rLine2.LineDistance); +} + +inline sal_Bool operator==( const table::BorderLine& rLine1, const table::BorderLine& rLine2 ) +{ + return (rLine1.Color == rLine2.Color) && + lcl_HasSameLineWidth( rLine1, rLine2 ); +} + +inline void lcl_RemoveState( XMLPropertyState* pState ) +{ + pState->mnIndex = -1; + pState->maValue.clear(); +} + +void lcl_RemoveStateIfZero16( XMLPropertyState* pState ) +{ + sal_Int16 nValue; + if( (pState->maValue >>= nValue) && !nValue ) + lcl_RemoveState( pState ); +} + + + +//______________________________________________________________________________ +// helper struct to handle equal XMLPropertyState's for page, header and footer + +struct XMLPropertyStateBuffer +{ + XMLPropertyState* pPMBorderAll; + XMLPropertyState* pPMBorderTop; + XMLPropertyState* pPMBorderBottom; + XMLPropertyState* pPMBorderLeft; + XMLPropertyState* pPMBorderRight; + + XMLPropertyState* pPMBorderWidthAll; + XMLPropertyState* pPMBorderWidthTop; + XMLPropertyState* pPMBorderWidthBottom; + XMLPropertyState* pPMBorderWidthLeft; + XMLPropertyState* pPMBorderWidthRight; + + XMLPropertyState* pPMPaddingAll; + XMLPropertyState* pPMPaddingTop; + XMLPropertyState* pPMPaddingBottom; + XMLPropertyState* pPMPaddingLeft; + XMLPropertyState* pPMPaddingRight; + + XMLPropertyStateBuffer(); + void ContextFilter( ::std::vector< XMLPropertyState >& rPropState ); +}; + +XMLPropertyStateBuffer::XMLPropertyStateBuffer() : + pPMBorderAll( NULL ), + pPMBorderTop( NULL ), + pPMBorderBottom( NULL ), + pPMBorderLeft( NULL ), + pPMBorderRight( NULL ), + + pPMBorderWidthAll( NULL ), + pPMBorderWidthTop( NULL ), + pPMBorderWidthBottom( NULL ), + pPMBorderWidthLeft( NULL ), + pPMBorderWidthRight( NULL ), + + pPMPaddingAll( NULL ), + pPMPaddingTop( NULL ), + pPMPaddingBottom( NULL ), + pPMPaddingLeft( NULL ), + pPMPaddingRight( NULL ) +{ +} + +void XMLPropertyStateBuffer::ContextFilter( ::std::vector< XMLPropertyState >& rPropState ) +{ + if( pPMBorderAll ) + { + if( pPMBorderTop && pPMBorderBottom && pPMBorderLeft && pPMBorderRight ) + { + table::BorderLine aLineTop, aLineBottom, aLineLeft, aLineRight; + pPMBorderTop->maValue >>= aLineTop; + pPMBorderBottom->maValue >>= aLineBottom; + pPMBorderLeft->maValue >>= aLineLeft; + pPMBorderRight->maValue >>= aLineRight; + + if( (aLineTop == aLineBottom) && (aLineBottom == aLineLeft) && (aLineLeft == aLineRight) ) + { + lcl_RemoveState( pPMBorderTop ); + lcl_RemoveState( pPMBorderBottom ); + lcl_RemoveState( pPMBorderLeft ); + lcl_RemoveState( pPMBorderRight ); + } + else + lcl_RemoveState( pPMBorderAll ); + } + else + lcl_RemoveState( pPMBorderAll ); + } + + if( pPMBorderWidthAll ) + { + if( pPMBorderWidthTop && pPMBorderWidthBottom && pPMBorderWidthLeft && pPMBorderWidthRight ) + { + table::BorderLine aLineTop, aLineBottom, aLineLeft, aLineRight; + + pPMBorderWidthTop->maValue >>= aLineTop; + pPMBorderWidthBottom->maValue >>= aLineBottom; + pPMBorderWidthLeft->maValue >>= aLineLeft; + pPMBorderWidthRight->maValue >>= aLineRight; + + if( lcl_HasSameLineWidth( aLineTop, aLineBottom ) && + lcl_HasSameLineWidth( aLineBottom, aLineLeft ) && + lcl_HasSameLineWidth( aLineLeft, aLineRight ) ) + { + lcl_RemoveState( pPMBorderWidthTop ); + lcl_RemoveState( pPMBorderWidthBottom ); + lcl_RemoveState( pPMBorderWidthLeft ); + lcl_RemoveState( pPMBorderWidthRight ); + } + else + lcl_RemoveState( pPMBorderWidthAll ); + } + else + lcl_RemoveState( pPMBorderWidthAll ); + } + + if( pPMPaddingAll ) + { + if( pPMPaddingTop && pPMPaddingBottom && pPMPaddingLeft && pPMPaddingRight ) + { + sal_Int32 nTop, nBottom, nLeft, nRight; + + pPMPaddingTop->maValue >>= nTop; + pPMPaddingBottom->maValue >>= nBottom; + pPMPaddingLeft->maValue >>= nLeft; + pPMPaddingRight->maValue >>= nRight; + + if( (nTop == nBottom) && (nBottom == nLeft) && (nLeft == nRight) ) + { + lcl_RemoveState( pPMPaddingTop ); + lcl_RemoveState( pPMPaddingBottom ); + lcl_RemoveState( pPMPaddingLeft ); + lcl_RemoveState( pPMPaddingRight ); + } + else + lcl_RemoveState( pPMPaddingAll ); + } + else + lcl_RemoveState( pPMPaddingAll ); + } +} //______________________________________________________________________________ @@ -144,3 +311,92 @@ void XMLPageMasterExportPropMapper::handleSpecialItem( { } +void XMLPageMasterExportPropMapper::ContextFilter( + ::std::vector< XMLPropertyState >& rPropState, + Reference< XPropertySet > rPropSet ) const +{ + XMLPropertyStateBuffer aPageBuffer; + XMLPropertyStateBuffer aHeaderBuffer; + XMLPropertyStateBuffer aFooterBuffer; + + XMLPropertyState* pPMHeaderHeight = NULL; + XMLPropertyState* pPMHeaderMinHeight = NULL; + XMLPropertyState* pPMHeaderDynamic = NULL; + + XMLPropertyState* pPMFooterHeight = NULL; + XMLPropertyState* pPMFooterMinHeight = NULL; + XMLPropertyState* pPMFooterDynamic = NULL; + + XMLPropertyState* pPMScaleTo = NULL; + XMLPropertyState* pPMScaleToPages = NULL; + + for( ::std::vector< XMLPropertyState >::iterator pProp = rPropState.begin(); pProp != rPropState.end(); pProp++ ) + { + sal_Int16 nContextId = getPropertySetMapper()->GetEntryContextId( pProp->mnIndex ); + sal_Int16 nFlag = nContextId & CTF_PM_FLAGMASK; + sal_Int16 nSimpleId = nContextId & ~CTF_PM_FLAGMASK; + + XMLPropertyStateBuffer* pBuffer; + switch( nFlag ) + { + case CTF_PM_HEADERFLAG: pBuffer = &aHeaderBuffer; break; + case CTF_PM_FOOTERFLAG: pBuffer = &aFooterBuffer; break; + default: pBuffer = &aPageBuffer; break; + } + + switch( nSimpleId ) + { + case CTF_PM_BORDERALL: pBuffer->pPMBorderAll = pProp; break; + case CTF_PM_BORDERTOP: pBuffer->pPMBorderTop = pProp; break; + case CTF_PM_BORDERBOTTOM: pBuffer->pPMBorderBottom = pProp; break; + case CTF_PM_BORDERLEFT: pBuffer->pPMBorderLeft = pProp; break; + case CTF_PM_BORDERRIGHT: pBuffer->pPMBorderRight = pProp; break; + case CTF_PM_BORDERWIDTHALL: pBuffer->pPMBorderWidthAll = pProp; break; + case CTF_PM_BORDERWIDTHTOP: pBuffer->pPMBorderWidthTop = pProp; break; + case CTF_PM_BORDERWIDTHBOTTOM: pBuffer->pPMBorderWidthBottom = pProp; break; + case CTF_PM_BORDERWIDTHLEFT: pBuffer->pPMBorderWidthLeft = pProp; break; + case CTF_PM_BORDERWIDTHRIGHT: pBuffer->pPMBorderWidthRight = pProp; break; + case CTF_PM_PADDINGALL: pBuffer->pPMPaddingAll = pProp; break; + case CTF_PM_PADDINGTOP: pBuffer->pPMPaddingTop = pProp; break; + case CTF_PM_PADDINGBOTTOM: pBuffer->pPMPaddingBottom = pProp; break; + case CTF_PM_PADDINGLEFT: pBuffer->pPMPaddingLeft = pProp; break; + case CTF_PM_PADDINGRIGHT: pBuffer->pPMPaddingRight = pProp; break; + } + + switch( nContextId ) + { + case CTF_PM_HEADERHEIGHT: pPMHeaderHeight = pProp; break; + case CTF_PM_HEADERMINHEIGHT: pPMHeaderMinHeight = pProp; break; + case CTF_PM_HEADERDYNAMIC: pPMHeaderDynamic = pProp; break; + case CTF_PM_FOOTERHEIGHT: pPMFooterHeight = pProp; break; + case CTF_PM_FOOTERMINHEIGHT: pPMFooterMinHeight = pProp; break; + case CTF_PM_FOOTERDYNAMIC: pPMFooterDynamic = pProp; break; + case CTF_PM_SCALETO: pPMScaleTo = pProp; break; + case CTF_PM_SCALETOPAGES: pPMScaleToPages = pProp; break; + } + } + + aPageBuffer.ContextFilter( rPropState ); + aHeaderBuffer.ContextFilter( rPropState ); + aFooterBuffer.ContextFilter( rPropState ); + + if( pPMHeaderHeight && (!pPMHeaderDynamic || (pPMHeaderDynamic && getBOOL( pPMHeaderDynamic->maValue ))) ) + lcl_RemoveState( pPMHeaderHeight ); + if( pPMHeaderMinHeight && pPMHeaderDynamic && !getBOOL( pPMHeaderDynamic->maValue ) ) + lcl_RemoveState( pPMHeaderMinHeight ); + if( pPMHeaderDynamic ) + lcl_RemoveState( pPMHeaderDynamic ); + + if( pPMFooterHeight && (!pPMFooterDynamic || (pPMFooterDynamic && getBOOL( pPMFooterDynamic->maValue ))) ) + lcl_RemoveState( pPMFooterHeight ); + if( pPMFooterMinHeight && pPMFooterDynamic && !getBOOL( pPMFooterDynamic->maValue ) ) + lcl_RemoveState( pPMFooterMinHeight ); + if( pPMFooterDynamic ) + lcl_RemoveState( pPMFooterDynamic ); + + if( pPMScaleTo ) + lcl_RemoveStateIfZero16( pPMScaleTo ); + if( pPMScaleToPages ) + lcl_RemoveStateIfZero16( pPMScaleToPages ); +} + diff --git a/xmloff/source/style/PageMasterExportPropMapper.hxx b/xmloff/source/style/PageMasterExportPropMapper.hxx index 8a3e495fc5ac..9eea4addc4b8 100644 --- a/xmloff/source/style/PageMasterExportPropMapper.hxx +++ b/xmloff/source/style/PageMasterExportPropMapper.hxx @@ -2,9 +2,9 @@ * * $RCSfile: PageMasterExportPropMapper.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: mib $ $Date: 2000-10-26 08:35:06 $ + * last change: $Author: mib $ $Date: 2000-11-07 13:33:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -81,6 +81,11 @@ protected: XMLBackgroundImageExport aBackgroundImageExport; XMLTextColumnsExport aTextColumnsExport; + virtual void ContextFilter( + ::std::vector< XMLPropertyState >& rProperties, + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rPropSet + ) const; + public: XMLPageMasterExportPropMapper( const UniReference< XMLPropertySetMapper >& rMapper, diff --git a/xmloff/source/style/PageMasterPropMapper.cxx b/xmloff/source/style/PageMasterPropMapper.cxx index be6cd08eb08c..3e5a760fff93 100644 --- a/xmloff/source/style/PageMasterPropMapper.cxx +++ b/xmloff/source/style/PageMasterPropMapper.cxx @@ -2,9 +2,9 @@ * * $RCSfile: PageMasterPropMapper.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: dr $ $Date: 2000-10-26 07:54:14 $ + * last change: $Author: mib $ $Date: 2000-11-07 13:33:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -63,13 +63,6 @@ #include "PageMasterPropMapper.hxx" #endif -#ifndef _COMPHELPER_TYPES_HXX_ -#include <comphelper/types.hxx> -#endif - -#ifndef _COM_SUN_STAR_TABLE_BORDERLINE_HPP_ -#include <com/sun/star/table/BorderLine.hpp> -#endif #ifndef _XMLOFF_PAGEMASTERSTYLEMAP_HXX #include "PageMasterStyleMap.hxx" @@ -81,165 +74,6 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; -using namespace ::comphelper; - - -//______________________________________________________________________________ - -inline sal_Bool lcl_HasSameLineWidth( const table::BorderLine& rLine1, const table::BorderLine& rLine2 ) -{ - return (rLine1.InnerLineWidth == rLine2.InnerLineWidth) && - (rLine1.OuterLineWidth == rLine2.OuterLineWidth) && - (rLine1.LineDistance == rLine2.LineDistance); -} - -inline sal_Bool operator==( const table::BorderLine& rLine1, const table::BorderLine& rLine2 ) -{ - return (rLine1.Color == rLine2.Color) && - lcl_HasSameLineWidth( rLine1, rLine2 ); -} - -inline void lcl_RemoveState( XMLPropertyState* pState ) -{ - pState->mnIndex = -1; - pState->maValue.clear(); -} - -void lcl_RemoveStateIfZero16( XMLPropertyState* pState ) -{ - sal_Int16 nValue; - if( (pState->maValue >>= nValue) && !nValue ) - lcl_RemoveState( pState ); -} - - -//______________________________________________________________________________ -// helper struct to handle equal XMLPropertyState's for page, header and footer - -struct XMLPropertyStateBuffer -{ - XMLPropertyState* pPMBorderAll; - XMLPropertyState* pPMBorderTop; - XMLPropertyState* pPMBorderBottom; - XMLPropertyState* pPMBorderLeft; - XMLPropertyState* pPMBorderRight; - - XMLPropertyState* pPMBorderWidthAll; - XMLPropertyState* pPMBorderWidthTop; - XMLPropertyState* pPMBorderWidthBottom; - XMLPropertyState* pPMBorderWidthLeft; - XMLPropertyState* pPMBorderWidthRight; - - XMLPropertyState* pPMPaddingAll; - XMLPropertyState* pPMPaddingTop; - XMLPropertyState* pPMPaddingBottom; - XMLPropertyState* pPMPaddingLeft; - XMLPropertyState* pPMPaddingRight; - - XMLPropertyStateBuffer(); - void ContextFilter( ::std::vector< XMLPropertyState >& rPropState ); -}; - -XMLPropertyStateBuffer::XMLPropertyStateBuffer() : - pPMBorderAll( NULL ), - pPMBorderTop( NULL ), - pPMBorderBottom( NULL ), - pPMBorderLeft( NULL ), - pPMBorderRight( NULL ), - - pPMBorderWidthAll( NULL ), - pPMBorderWidthTop( NULL ), - pPMBorderWidthBottom( NULL ), - pPMBorderWidthLeft( NULL ), - pPMBorderWidthRight( NULL ), - - pPMPaddingAll( NULL ), - pPMPaddingTop( NULL ), - pPMPaddingBottom( NULL ), - pPMPaddingLeft( NULL ), - pPMPaddingRight( NULL ) -{ -} - -void XMLPropertyStateBuffer::ContextFilter( ::std::vector< XMLPropertyState >& rPropState ) -{ - if( pPMBorderAll ) - { - if( pPMBorderTop && pPMBorderBottom && pPMBorderLeft && pPMBorderRight ) - { - table::BorderLine aLineTop, aLineBottom, aLineLeft, aLineRight; - - pPMBorderTop->maValue >>= aLineTop; - pPMBorderBottom->maValue >>= aLineBottom; - pPMBorderLeft->maValue >>= aLineLeft; - pPMBorderRight->maValue >>= aLineRight; - - if( (aLineTop == aLineBottom) && (aLineBottom == aLineLeft) && (aLineLeft == aLineRight) ) - { - lcl_RemoveState( pPMBorderTop ); - lcl_RemoveState( pPMBorderBottom ); - lcl_RemoveState( pPMBorderLeft ); - lcl_RemoveState( pPMBorderRight ); - } - else - lcl_RemoveState( pPMBorderAll ); - } - else - lcl_RemoveState( pPMBorderAll ); - } - - if( pPMBorderWidthAll ) - { - if( pPMBorderWidthTop && pPMBorderWidthBottom && pPMBorderWidthLeft && pPMBorderWidthRight ) - { - table::BorderLine aLineTop, aLineBottom, aLineLeft, aLineRight; - - pPMBorderWidthTop->maValue >>= aLineTop; - pPMBorderWidthBottom->maValue >>= aLineBottom; - pPMBorderWidthLeft->maValue >>= aLineLeft; - pPMBorderWidthRight->maValue >>= aLineRight; - - if( lcl_HasSameLineWidth( aLineTop, aLineBottom ) && - lcl_HasSameLineWidth( aLineBottom, aLineLeft ) && - lcl_HasSameLineWidth( aLineLeft, aLineRight ) ) - { - lcl_RemoveState( pPMBorderWidthTop ); - lcl_RemoveState( pPMBorderWidthBottom ); - lcl_RemoveState( pPMBorderWidthLeft ); - lcl_RemoveState( pPMBorderWidthRight ); - } - else - lcl_RemoveState( pPMBorderWidthAll ); - } - else - lcl_RemoveState( pPMBorderWidthAll ); - } - - if( pPMPaddingAll ) - { - if( pPMPaddingTop && pPMPaddingBottom && pPMPaddingLeft && pPMPaddingRight ) - { - sal_Int32 nTop, nBottom, nLeft, nRight; - - pPMPaddingTop->maValue >>= nTop; - pPMPaddingBottom->maValue >>= nBottom; - pPMPaddingLeft->maValue >>= nLeft; - pPMPaddingRight->maValue >>= nRight; - - if( (nTop == nBottom) && (nBottom == nLeft) && (nLeft == nRight) ) - { - lcl_RemoveState( pPMPaddingTop ); - lcl_RemoveState( pPMPaddingBottom ); - lcl_RemoveState( pPMPaddingLeft ); - lcl_RemoveState( pPMPaddingRight ); - } - else - lcl_RemoveState( pPMPaddingAll ); - } - else - lcl_RemoveState( pPMPaddingAll ); - } -} //______________________________________________________________________________ @@ -260,92 +94,3 @@ XMLPageMasterPropSetMapper::~XMLPageMasterPropSetMapper() { } -void XMLPageMasterPropSetMapper::ContextFilter( - ::std::vector< XMLPropertyState >& rPropState, - Reference< XPropertySet > rPropSet ) const -{ - XMLPropertyStateBuffer aPageBuffer; - XMLPropertyStateBuffer aHeaderBuffer; - XMLPropertyStateBuffer aFooterBuffer; - - XMLPropertyState* pPMHeaderHeight = NULL; - XMLPropertyState* pPMHeaderMinHeight = NULL; - XMLPropertyState* pPMHeaderDynamic = NULL; - - XMLPropertyState* pPMFooterHeight = NULL; - XMLPropertyState* pPMFooterMinHeight = NULL; - XMLPropertyState* pPMFooterDynamic = NULL; - - XMLPropertyState* pPMScaleTo = NULL; - XMLPropertyState* pPMScaleToPages = NULL; - - for( ::std::vector< XMLPropertyState >::iterator pProp = rPropState.begin(); pProp != rPropState.end(); pProp++ ) - { - sal_Int16 nContextId = GetEntryContextId( pProp->mnIndex ); - sal_Int16 nFlag = nContextId & CTF_PM_FLAGMASK; - sal_Int16 nSimpleId = nContextId & ~CTF_PM_FLAGMASK; - - XMLPropertyStateBuffer* pBuffer; - switch( nFlag ) - { - case CTF_PM_HEADERFLAG: pBuffer = &aHeaderBuffer; break; - case CTF_PM_FOOTERFLAG: pBuffer = &aFooterBuffer; break; - default: pBuffer = &aPageBuffer; break; - } - - switch( nSimpleId ) - { - case CTF_PM_BORDERALL: pBuffer->pPMBorderAll = pProp; break; - case CTF_PM_BORDERTOP: pBuffer->pPMBorderTop = pProp; break; - case CTF_PM_BORDERBOTTOM: pBuffer->pPMBorderBottom = pProp; break; - case CTF_PM_BORDERLEFT: pBuffer->pPMBorderLeft = pProp; break; - case CTF_PM_BORDERRIGHT: pBuffer->pPMBorderRight = pProp; break; - case CTF_PM_BORDERWIDTHALL: pBuffer->pPMBorderWidthAll = pProp; break; - case CTF_PM_BORDERWIDTHTOP: pBuffer->pPMBorderWidthTop = pProp; break; - case CTF_PM_BORDERWIDTHBOTTOM: pBuffer->pPMBorderWidthBottom = pProp; break; - case CTF_PM_BORDERWIDTHLEFT: pBuffer->pPMBorderWidthLeft = pProp; break; - case CTF_PM_BORDERWIDTHRIGHT: pBuffer->pPMBorderWidthRight = pProp; break; - case CTF_PM_PADDINGALL: pBuffer->pPMPaddingAll = pProp; break; - case CTF_PM_PADDINGTOP: pBuffer->pPMPaddingTop = pProp; break; - case CTF_PM_PADDINGBOTTOM: pBuffer->pPMPaddingBottom = pProp; break; - case CTF_PM_PADDINGLEFT: pBuffer->pPMPaddingLeft = pProp; break; - case CTF_PM_PADDINGRIGHT: pBuffer->pPMPaddingRight = pProp; break; - } - - switch( nContextId ) - { - case CTF_PM_HEADERHEIGHT: pPMHeaderHeight = pProp; break; - case CTF_PM_HEADERMINHEIGHT: pPMHeaderMinHeight = pProp; break; - case CTF_PM_HEADERDYNAMIC: pPMHeaderDynamic = pProp; break; - case CTF_PM_FOOTERHEIGHT: pPMFooterHeight = pProp; break; - case CTF_PM_FOOTERMINHEIGHT: pPMFooterMinHeight = pProp; break; - case CTF_PM_FOOTERDYNAMIC: pPMFooterDynamic = pProp; break; - case CTF_PM_SCALETO: pPMScaleTo = pProp; break; - case CTF_PM_SCALETOPAGES: pPMScaleToPages = pProp; break; - } - } - - aPageBuffer.ContextFilter( rPropState ); - aHeaderBuffer.ContextFilter( rPropState ); - aFooterBuffer.ContextFilter( rPropState ); - - if( pPMHeaderHeight && (!pPMHeaderDynamic || (pPMHeaderDynamic && getBOOL( pPMHeaderDynamic->maValue ))) ) - lcl_RemoveState( pPMHeaderHeight ); - if( pPMHeaderMinHeight && pPMHeaderDynamic && !getBOOL( pPMHeaderDynamic->maValue ) ) - lcl_RemoveState( pPMHeaderMinHeight ); - if( pPMHeaderDynamic ) - lcl_RemoveState( pPMHeaderDynamic ); - - if( pPMFooterHeight && (!pPMFooterDynamic || (pPMFooterDynamic && getBOOL( pPMFooterDynamic->maValue ))) ) - lcl_RemoveState( pPMFooterHeight ); - if( pPMFooterMinHeight && pPMFooterDynamic && !getBOOL( pPMFooterDynamic->maValue ) ) - lcl_RemoveState( pPMFooterMinHeight ); - if( pPMFooterDynamic ) - lcl_RemoveState( pPMFooterDynamic ); - - if( pPMScaleTo ) - lcl_RemoveStateIfZero16( pPMScaleTo ); - if( pPMScaleToPages ) - lcl_RemoveStateIfZero16( pPMScaleToPages ); -} - diff --git a/xmloff/source/style/PageMasterPropMapper.hxx b/xmloff/source/style/PageMasterPropMapper.hxx index 3e0bbd58058e..9f2318e2c80c 100644 --- a/xmloff/source/style/PageMasterPropMapper.hxx +++ b/xmloff/source/style/PageMasterPropMapper.hxx @@ -2,9 +2,9 @@ * * $RCSfile: PageMasterPropMapper.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: sab $ $Date: 2000-10-25 15:00:52 $ + * last change: $Author: mib $ $Date: 2000-11-07 13:33:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -71,12 +71,6 @@ class XMLPageMasterPropSetMapper : public XMLPropertySetMapper { - -protected: - virtual void ContextFilter( - ::std::vector< XMLPropertyState >& rProperties, - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rPropSet - ) const; public: XMLPageMasterPropSetMapper(); XMLPageMasterPropSetMapper( diff --git a/xmloff/source/style/XMLPageExport.cxx b/xmloff/source/style/XMLPageExport.cxx index 8a3095bc4c07..3d1b7f4fe85b 100644 --- a/xmloff/source/style/XMLPageExport.cxx +++ b/xmloff/source/style/XMLPageExport.cxx @@ -2,9 +2,9 @@ * * $RCSfile: XMLPageExport.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: dr $ $Date: 2000-10-20 16:30:27 $ + * last change: $Author: mib $ $Date: 2000-11-07 13:33:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -142,10 +142,10 @@ void XMLPageExport::collectPageMasterAutoStyle( const Reference < XPropertySet > & rPropSet, OUString& rPageMasterName ) { - DBG_ASSERT( pPageMasterPropSetMapper, "page master family/XMLPageMasterPropSetMapper not found" ); - if( pPageMasterPropSetMapper ) + DBG_ASSERT( xPageMasterPropSetMapper.is(), "page master family/XMLPageMasterPropSetMapper not found" ); + if( xPageMasterPropSetMapper.is() ) { - ::std::vector<XMLPropertyState> xPropStates = pPageMasterPropSetMapper->Filter( rPropSet ); + ::std::vector<XMLPropertyState> xPropStates = xPageMasterExportPropMapper->Filter( rPropSet ); if(xPropStates.size()) { OUString sParent; @@ -226,27 +226,18 @@ sal_Bool XMLPageExport::exportStyle( XMLPageExport::XMLPageExport( SvXMLExport& rExp ) : rExport( rExp ), - pPageMasterPropHdlFactory( NULL ), - pPageMasterPropSetMapper( NULL ), - pPageMasterExportPropMapper( NULL ), sIsPhysical( RTL_CONSTASCII_USTRINGPARAM( "IsPhysical" ) ), sFollowStyle( RTL_CONSTASCII_USTRINGPARAM( "FollowStyle" ) ) { - pPageMasterPropHdlFactory = new XMLPageMasterPropHdlFactory; - if( pPageMasterPropHdlFactory ) - { - pPageMasterPropHdlFactory->acquire(); - const UniReference< XMLPropertyHandlerFactory > aFactoryRef = pPageMasterPropHdlFactory; - - pPageMasterPropSetMapper = new XMLPageMasterPropSetMapper( (XMLPropertyMapEntry*) aXMLPageMasterStyleMap, aFactoryRef ); - if(pPageMasterPropSetMapper) - pPageMasterPropSetMapper->acquire(); - } - const UniReference< XMLPropertySetMapper > aPageMasterMapperRef = pPageMasterPropSetMapper; - pPageMasterExportPropMapper = new XMLPageMasterExportPropMapper(aPageMasterMapperRef, rExp); + xPageMasterPropHdlFactory = new XMLPageMasterPropHdlFactory; + xPageMasterPropSetMapper = new XMLPageMasterPropSetMapper( + (XMLPropertyMapEntry*) aXMLPageMasterStyleMap, + xPageMasterPropHdlFactory ); + xPageMasterExportPropMapper = new XMLPageMasterExportPropMapper( + xPageMasterPropSetMapper, rExp); rExport.GetAutoStylePool()->AddFamily( XML_STYLE_FAMILY_PAGE_MASTER, OUString( RTL_CONSTASCII_USTRINGPARAM( XML_STYLE_FAMILY_PAGE_MASTER_NAME ) ), - pPageMasterPropSetMapper, OUString( RTL_CONSTASCII_USTRINGPARAM( XML_STYLE_FAMILY_PAGE_MASTER_PREFIX ) ), sal_False ); + xPageMasterExportPropMapper, OUString( RTL_CONSTASCII_USTRINGPARAM( XML_STYLE_FAMILY_PAGE_MASTER_PREFIX ) ), sal_False ); Reference< XStyleFamiliesSupplier > xFamiliesSupp( GetExport().GetModel(), UNO_QUERY ); @@ -279,17 +270,6 @@ XMLPageExport::XMLPageExport( SvXMLExport& rExp ) : XMLPageExport::~XMLPageExport() { - if (pPageMasterPropHdlFactory) - { - pPageMasterPropHdlFactory->release(); - pPageMasterPropHdlFactory = NULL; - } - if (pPageMasterPropSetMapper) - { - pPageMasterPropSetMapper->release(); - pPageMasterPropSetMapper = NULL; - } - delete pPageMasterExportPropMapper; } void XMLPageExport::exportStyles( sal_Bool bUsed, sal_Bool bAutoStyles ) @@ -312,6 +292,6 @@ void XMLPageExport::exportStyles( sal_Bool bUsed, sal_Bool bAutoStyles ) void XMLPageExport::exportAutoStyles() { rExport.GetAutoStylePool()->exportXML(XML_STYLE_FAMILY_PAGE_MASTER, - *pPageMasterExportPropMapper, rExport.GetDocHandler(), rExport.GetMM100UnitConverter(), + rExport.GetDocHandler(), rExport.GetMM100UnitConverter(), rExport.GetNamespaceMap()); } diff --git a/xmloff/source/style/impastp1.cxx b/xmloff/source/style/impastp1.cxx index a7bfefa39b9e..e1e8a47408dd 100644 --- a/xmloff/source/style/impastp1.cxx +++ b/xmloff/source/style/impastp1.cxx @@ -2,9 +2,9 @@ * * $RCSfile: impastp1.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: dr $ $Date: 2000-10-18 11:37:23 $ + * last change: $Author: mib $ $Date: 2000-11-07 13:33:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -78,7 +78,7 @@ using namespace rtl; XMLFamilyData_Impl::XMLFamilyData_Impl( sal_Int32 nFamily, const ::rtl::OUString& rStrName, - const UniReference < XMLPropertySetMapper > &rMapper, + const UniReference < SvXMLExportPropertyMapper > &rMapper, const OUString& rStrPrefix, sal_Bool bAsFam ) : mnFamily( nFamily ), maStrFamilyName( rStrName), mxMapper( rMapper ), maStrPrefix( rStrPrefix ), diff --git a/xmloff/source/style/impastp4.cxx b/xmloff/source/style/impastp4.cxx index 85260ebc4089..38204f326947 100644 --- a/xmloff/source/style/impastp4.cxx +++ b/xmloff/source/style/impastp4.cxx @@ -2,9 +2,9 @@ * * $RCSfile: impastp4.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: sab $ $Date: 2000-10-25 15:00:52 $ + * last change: $Author: mib $ $Date: 2000-11-07 13:33:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -129,7 +129,7 @@ SvXMLAutoStylePoolP_Impl::~SvXMLAutoStylePoolP_Impl() void SvXMLAutoStylePoolP_Impl::AddFamily( sal_Int32 nFamily, const OUString& rStrName, - const UniReference < XMLPropertySetMapper > & rMapper, + const UniReference < SvXMLExportPropertyMapper > & rMapper, const OUString& rStrPrefix, sal_Bool bAsFamily ) { @@ -251,7 +251,6 @@ OUString SvXMLAutoStylePoolP_Impl::Find( sal_Int32 nFamily, void SvXMLAutoStylePoolP_Impl::exportXML( sal_Int32 nFamily, - const SvXMLExportPropertyMapper& rPropExp, const uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler, const SvXMLUnitConverter& rUnitConverter, const SvXMLNamespaceMap& rNamespaceMap, @@ -348,7 +347,7 @@ void SvXMLAutoStylePoolP_Impl::exportXML( pAntiImpl->exportStyleAttributes( *mpAttrList, nFamily, aExpStyles[i].mpProperties->GetProperties(), - rPropExp, + *pFamily->mxMapper.get(), rUnitConverter, rNamespaceMap ); rHandler->ignorableWhitespace( msWS ); @@ -360,7 +359,8 @@ void SvXMLAutoStylePoolP_Impl::exportXML( { nStart = 0; sal_Int32 nIndex = 0; - UniReference< XMLPropertySetMapper > aPropMapper = rPropExp.getPropertySetMapper(); + UniReference< XMLPropertySetMapper > aPropMapper = + pFamily->mxMapper->getPropertySetMapper(); while(nIndex < aPropMapper->GetEntryCount() && nEnd == -1) { if (aPropMapper->GetEntryContextId( nIndex ) & CTF_PM_FLAGMASK) @@ -371,12 +371,12 @@ void SvXMLAutoStylePoolP_Impl::exportXML( nEnd = nIndex; } - rPropExp.exportXML( rHandler, aExpStyles[i].mpProperties->GetProperties(), rUnitConverter, + pFamily->mxMapper->exportXML( rHandler, aExpStyles[i].mpProperties->GetProperties(), rUnitConverter, rNamespaceMap, nStart, nEnd, XML_EXPORT_FLAG_IGN_WS ); pAntiImpl->exportStyleContent( rHandler, nFamily, aExpStyles[i].mpProperties->GetProperties(), - rPropExp, rUnitConverter, rNamespaceMap ); + *pFamily->mxMapper.get(), rUnitConverter, rNamespaceMap ); rHandler->ignorableWhitespace( msWS ); rHandler->endElement( sName ); diff --git a/xmloff/source/style/impastpl.hxx b/xmloff/source/style/impastpl.hxx index 9431d07fbdd8..a4972f37bb82 100644 --- a/xmloff/source/style/impastpl.hxx +++ b/xmloff/source/style/impastpl.hxx @@ -2,9 +2,9 @@ * * $RCSfile: impastpl.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: dr $ $Date: 2000-10-18 11:37:23 $ + * last change: $Author: mib $ $Date: 2000-11-07 13:33:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -91,7 +91,6 @@ #include <xmlexppr.hxx> #endif -class XMLPropertySetMapper; class SvXMLAutoStylePoolP; class SvXMLAutoStylePoolParentsP_Impl; class SvXMLAutoStylePoolNamesP_Impl; @@ -108,7 +107,7 @@ class XMLFamilyData_Impl public: sal_uInt32 mnFamily; ::rtl::OUString maStrFamilyName; - UniReference < XMLPropertySetMapper > mxMapper; + UniReference < SvXMLExportPropertyMapper > mxMapper; SvXMLAutoStylePoolParentsP_Impl* mpParentList; SvXMLAutoStylePoolNamesP_Impl* mpNameList; @@ -119,7 +118,7 @@ public: public: XMLFamilyData_Impl( sal_Int32 nFamily, const ::rtl::OUString& rStrName, - const UniReference < XMLPropertySetMapper > & rMapper, + const UniReference < SvXMLExportPropertyMapper > & rMapper, const ::rtl::OUString& rStrPrefix, sal_Bool bAsFamily = sal_True ); XMLFamilyData_Impl( sal_Int32 nFamily ) : mnFamily( nFamily ), mpParentList( NULL ), @@ -223,7 +222,7 @@ public: ~SvXMLAutoStylePoolP_Impl(); void AddFamily( sal_Int32 nFamily, const ::rtl::OUString& rStrName, - const UniReference < XMLPropertySetMapper > & rMapper, + const UniReference < SvXMLExportPropertyMapper > & rMapper, const ::rtl::OUString& rStrPrefix, sal_Bool bAsFamily = sal_True ); void RegisterName( sal_Int32 nFamily, const ::rtl::OUString& rName ); @@ -233,7 +232,6 @@ public: const ::std::vector< XMLPropertyState >& rProperties ) const; void exportXML( sal_Int32 nFamily, - const SvXMLExportPropertyMapper& rPropExp, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler, const SvXMLUnitConverter& rUnitConverter, const SvXMLNamespaceMap& rNamespaceMap, diff --git a/xmloff/source/style/prstylei.cxx b/xmloff/source/style/prstylei.cxx index 03b7c9e14e7f..5813ddac942e 100644 --- a/xmloff/source/style/prstylei.cxx +++ b/xmloff/source/style/prstylei.cxx @@ -2,9 +2,9 @@ * * $RCSfile: prstylei.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: mib $ $Date: 2000-10-18 11:18:29 $ + * last change: $Author: mib $ $Date: 2000-11-07 13:33:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -175,8 +175,7 @@ void XMLPropStyleContext::FillPropertySet( GetFamily() ); DBG_ASSERT( xImpPrMap.is(), "There is the import prop mapper" ); if( xImpPrMap.is() ) - xImpPrMap->getPropertySetMapper()->FillPropertySet( aProperties, - rPropSet ); + xImpPrMap->FillPropertySet( aProperties, rPropSet ); } Reference < XStyle > XMLPropStyleContext::Create() diff --git a/xmloff/source/style/styleexp.cxx b/xmloff/source/style/styleexp.cxx index e19453eddbe5..e5cba4a1aeab 100644 --- a/xmloff/source/style/styleexp.cxx +++ b/xmloff/source/style/styleexp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: styleexp.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 17:07:05 $ + * last change: $Author: mib $ $Date: 2000-11-07 13:33:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -272,7 +272,7 @@ sal_Bool XMLStyleExport::exportStyle( sal_True, sal_True ); // <style:properties> ::std::vector< XMLPropertyState > xPropStates = - rPropMapper->getPropertySetMapper()->Filter( xPropSet ); + rPropMapper->Filter( xPropSet ); rPropMapper->exportXML( GetExport().GetDocHandler(), xPropStates, GetExport().GetMM100UnitConverter(), GetExport().GetNamespaceMap(), diff --git a/xmloff/source/style/xmlaustp.cxx b/xmloff/source/style/xmlaustp.cxx index 4e7ac1ec4d3b..d97531945c4f 100644 --- a/xmloff/source/style/xmlaustp.cxx +++ b/xmloff/source/style/xmlaustp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlaustp.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: sab $ $Date: 2000-10-25 15:00:52 $ + * last change: $Author: mib $ $Date: 2000-11-07 13:33:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -237,18 +237,18 @@ SvXMLAutoStylePoolP::~SvXMLAutoStylePoolP() void SvXMLAutoStylePoolP::AddFamily( sal_Int32 nFamily, const OUString& rStrName, - XMLPropertySetMapper* pMapper, + SvXMLExportPropertyMapper* pMapper, OUString aStrPrefix, sal_Bool bAsFamily ) { - UniReference <XMLPropertySetMapper> xTmp = pMapper; + UniReference <SvXMLExportPropertyMapper> xTmp = pMapper; AddFamily( nFamily, rStrName, xTmp, aStrPrefix, bAsFamily ); } void SvXMLAutoStylePoolP::AddFamily( sal_Int32 nFamily, const OUString& rStrName, - const UniReference < XMLPropertySetMapper > & rMapper, + const UniReference < SvXMLExportPropertyMapper > & rMapper, const OUString& rStrPrefix, sal_Bool bAsFamily ) { @@ -290,12 +290,11 @@ OUString SvXMLAutoStylePoolP::Find( sal_Int32 nFamily, } void SvXMLAutoStylePoolP::exportXML( sal_Int32 nFamily, - const SvXMLExportPropertyMapper& rPropExp, const uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler, const SvXMLUnitConverter& rUnitConverter, const SvXMLNamespaceMap& rNamespaceMap) const { - pImpl->exportXML( nFamily, rPropExp, rHandler, rUnitConverter, + pImpl->exportXML( nFamily, rHandler, rUnitConverter, rNamespaceMap, this); } diff --git a/xmloff/source/style/xmlexppr.cxx b/xmloff/source/style/xmlexppr.cxx index c21cb66adfa6..40853b6fe5df 100644 --- a/xmloff/source/style/xmlexppr.cxx +++ b/xmloff/source/style/xmlexppr.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlexppr.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: mib $ $Date: 2000-10-30 13:34:13 $ + * last change: $Author: mib $ $Date: 2000-11-07 13:33:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -67,6 +67,14 @@ #include <com/sun/star/xml/AttributeData.hpp> #endif +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ +#include <com/sun/star/beans/XPropertySet.hpp> +#endif + +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSTATE_HPP_ +#include <com/sun/star/beans/XPropertyState.hpp> +#endif + #ifndef _RTL_USTRBUF_HXX_ #include <rtl/ustrbuf.hxx> #endif @@ -92,6 +100,9 @@ #ifndef _XMLOFF_XMLCNITM_HXX #include "xmlcnitm.hxx" #endif +#ifndef _XMLOFF_PROPERTYSETMAPPER_HXX +#include "xmlprmap.hxx" +#endif #ifndef _SVSTDARR_USHORTS #define _SVSTDARR_USHORTS @@ -99,7 +110,10 @@ #endif using namespace ::rtl; +using namespace ::std; using namespace ::com::sun::star; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::uno; /////////////////////////////////////////////////////////////////////////////// // @@ -114,6 +128,30 @@ SvXMLExportPropertyMapper::SvXMLExportPropertyMapper( SvXMLExportPropertyMapper::~SvXMLExportPropertyMapper() { + xNextMapper = 0; +} + +void SvXMLExportPropertyMapper::ChainExportMapper( + const UniReference< SvXMLExportPropertyMapper>& rMapper ) +{ + maPropMapper->AddMapperEntry( rMapper->getPropertySetMapper() ); + rMapper->maPropMapper = maPropMapper; + + if( xNextMapper.is() ) + xNextMapper->_ChainExportMapper( rMapper ); + else + xNextMapper = rMapper; +} + +void SvXMLExportPropertyMapper::_ChainExportMapper( + const UniReference< SvXMLExportPropertyMapper>& rMapper ) +{ + maPropMapper = rMapper->getPropertySetMapper(); + + if( xNextMapper.is() ) + xNextMapper->_ChainExportMapper( rMapper ); + else + xNextMapper = rMapper; } /////////////////////////////////////////////////////////////////////////////// @@ -121,6 +159,156 @@ SvXMLExportPropertyMapper::~SvXMLExportPropertyMapper() // public methods // +/////////////////////////////////////////////////////////////////////////// +// +// Take all properties of the XPropertySet which are also found in the +// XMLPropertyMapEntry-array and which are not set to their default-value, +// if a state is available. +// +// After that I call the method 'ContextFilter'. +// +vector< XMLPropertyState > SvXMLExportPropertyMapper::Filter( + const Reference< XPropertySet > xPropSet ) const +{ + vector< XMLPropertyState > aPropStateArray; + + // Retrieve XPropertySetInfo and XPropertyState + Reference< XPropertySetInfo > xInfo( xPropSet->getPropertySetInfo() ); + + if( xInfo.is() ) + { + Reference< XPropertyState > xPropState( xPropSet, UNO_QUERY ); + sal_Int32 nProps = maPropMapper->GetEntryCount(); + + if( xPropState.is() ) + { + Sequence<OUString> aApiNames( nProps ); + Sequence<sal_uInt32> aIndexes( nProps ); + OUString *pNames = aApiNames.getArray(); + sal_uInt32 *pIndexes = aIndexes.getArray(); + + sal_Int32 nCount = 0; + for( sal_Int32 i=0; i < nProps; i++ ) + { + // Does the PropertySet contain name of mpEntries-array ? + const OUString& rAPIName = maPropMapper->GetEntryAPIName( i ); + if( xInfo->hasPropertyByName( rAPIName ) ) + { + pNames[nCount] = rAPIName; + pIndexes[nCount] = i; + nCount++; + } + } + + aApiNames.realloc( nCount ); + aIndexes.realloc( nCount ); + + Sequence < PropertyState > aStates = + xPropState->getPropertyStates( aApiNames ); + + const PropertyState *pStates = aStates.getArray(); + for( i = 0; i < nCount; i++ ) + { + if( pStates[i] == PropertyState_DIRECT_VALUE ) + { + // The value is stored in the PropertySet itself, add to list. + XMLPropertyState aNewProperty( pIndexes[i], + xPropSet->getPropertyValue( + aApiNames[i] ) ); + aPropStateArray.push_back( aNewProperty ); + } + } + } + else + { + for( sal_Int32 i=0; i < nProps; i++ ) + { + // Does the PropertySet contain name of mpEntries-array ? + const OUString& rAPIName = maPropMapper->GetEntryAPIName( i ); + if( xInfo->hasPropertyByName( rAPIName ) ) + { + // If there isn't a XPropertyState we can't filter by its state + if( !xPropState.is() || + xPropState->getPropertyState( rAPIName ) == + PropertyState_DIRECT_VALUE ) + { + // The value is stored in the PropertySet itself, add to list. + XMLPropertyState aNewProperty( i, + xPropSet->getPropertyValue( rAPIName ) ); + aPropStateArray.push_back( aNewProperty ); + } + } + } + } + + // Call centext-filter + ContextFilter( aPropStateArray, xPropSet ); + } + + return aPropStateArray; +} + +void SvXMLExportPropertyMapper::ContextFilter( + vector< XMLPropertyState >& rProperties, + Reference< XPropertySet > rPropSet ) const +{ + // Derived class could implement this. + if( xNextMapper.is() ) + xNextMapper->ContextFilter( rProperties, rPropSet ); +} + +/////////////////////////////////////////////////////////////////////////// +// +// Compares two Sequences of XMLPropertyState: +// 1.Number of elements equal ? +// 2.Index of each element equal ? (So I know whether the propertynames are the same) +// 3.Value of each element equal ? +// +sal_Bool SvXMLExportPropertyMapper::Equals( + const vector< XMLPropertyState >& aProperties1, + const vector< XMLPropertyState >& aProperties2 ) const +{ + sal_Bool bRet = sal_True; + sal_Int32 nCount = aProperties1.size(); + + if( nCount == aProperties2.size() ) + { + sal_Int32 nIndex = 0; + while( bRet && nIndex < nCount ) + { + const XMLPropertyState& rProp1 = aProperties1[ nIndex ]; + const XMLPropertyState& rProp2 = aProperties2[ nIndex ]; + + // Compare index. If equal, compare value + if( rProp1.mnIndex == rProp2.mnIndex ) + { + if( rProp1.mnIndex != -1 ) + { + // Now compare values + if( ( maPropMapper->GetEntryType( rProp1.mnIndex ) & + XML_TYPE_BUILDIN_CMP ) != 0 ) + // simple type ( binary compare ) + bRet = ( rProp1.maValue == rProp2.maValue ); + else + // complex type ( ask for compare-function ) + bRet = maPropMapper->GetPropertyHandler( + rProp1.mnIndex )->equals( rProp1.maValue, + rProp2.maValue ); + } + } + else + bRet = sal_False; + + nIndex++; + } + } + else + bRet = sal_False; + + return bRet; +} + + /** fills the given attribute list with the items in the given set */ void SvXMLExportPropertyMapper::exportXML( SvXMLAttributeList& rAttrList, const ::std::vector< XMLPropertyState >& rProperties, @@ -215,7 +403,10 @@ void SvXMLExportPropertyMapper::handleSpecialItem( const ::std::vector< XMLPropertyState > *pProperties, sal_uInt32 nIdx ) const { - DBG_ERROR( "special item not handled in xml export" ); + DBG_ASSERT( xNextMapper.is(), "special item not handled in xml export" ); + if( xNextMapper.is() ) + xNextMapper->handleSpecialItem( rAttrList, rProperty, rUnitConverter, + rNamespaceMap, pProperties, nIdx ); } /** this method is called for every item that has the @@ -228,7 +419,10 @@ void SvXMLExportPropertyMapper::handleNoItem( const ::std::vector< XMLPropertyState > *pProperties, sal_uInt32 nIdx ) const { - DBG_ERROR( "no item not handled in xml export" ); + DBG_ASSERT( xNextMapper.is(), "no item not handled in xml export" ); + if( xNextMapper.is() ) + xNextMapper->handleNoItem( rAttrList, rProperty, rUnitConverter, + rNamespaceMap, pProperties, nIdx ); } /** this method is called for every item that has the @@ -242,7 +436,11 @@ void SvXMLExportPropertyMapper::handleElementItem( const ::std::vector< XMLPropertyState > *pProperties, sal_uInt32 nIdx ) const { - DBG_ERROR( "element item not handled in xml export" ); + DBG_ASSERT( xNextMapper.is(), "element item not handled in xml export" ); + if( xNextMapper.is() ) + xNextMapper->handleElementItem( rHandler, rProperty, rUnitConverter, + rNamespaceMap, nFlags, pProperties, + nIdx ); } /////////////////////////////////////////////////////////////////////////////// diff --git a/xmloff/source/style/xmlimppr.cxx b/xmloff/source/style/xmlimppr.cxx index 42e88d0d2090..7f6ab8c53f72 100644 --- a/xmloff/source/style/xmlimppr.cxx +++ b/xmloff/source/style/xmlimppr.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlimppr.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: cl $ $Date: 2000-10-27 14:08:05 $ + * last change: $Author: mib $ $Date: 2000-11-07 13:33:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -86,6 +86,7 @@ #include "xmlnmspe.hxx" using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; using namespace ::com::sun::star::container; using namespace ::com::sun::star::xml; using namespace ::com::sun::star::xml::sax; @@ -100,6 +101,30 @@ SvXMLImportPropertyMapper::SvXMLImportPropertyMapper( SvXMLImportPropertyMapper::~SvXMLImportPropertyMapper() { + xNextMapper = 0; +} + +void SvXMLImportPropertyMapper::ChainImportMapper( + const UniReference< SvXMLImportPropertyMapper>& rMapper ) +{ + maPropMapper->AddMapperEntry( rMapper->getPropertySetMapper() ); + rMapper->maPropMapper = maPropMapper; + + if( xNextMapper.is() ) + xNextMapper->_ChainImportMapper( rMapper ); + else + xNextMapper = rMapper; +} + +void SvXMLImportPropertyMapper::_ChainImportMapper( + const UniReference< SvXMLImportPropertyMapper>& rMapper ) +{ + maPropMapper = rMapper->getPropertySetMapper(); + + if( xNextMapper.is() ) + xNextMapper->_ChainImportMapper( rMapper ); + else + xNextMapper = rMapper; } void SvXMLImportPropertyMapper::importXML( @@ -269,8 +294,12 @@ BOOL SvXMLImportPropertyMapper::handleSpecialItem( const SvXMLUnitConverter& rUnitConverter, const SvXMLNamespaceMap& rNamespaceMap ) const { - DBG_ERROR( "unsuported special item in xml import" ); - return FALSE; + DBG_ASSERT( xNextMapper.is(), "unsuported special item in xml import" ); + if( xNextMapper.is() ) + return xNextMapper->handleSpecialItem( rProperty, rProperties, rValue, + rUnitConverter, rNamespaceMap ); + else + return FALSE; } /** this method is called for every item that has the MID_FLAG_NO_ITEM_IMPORT flag set */ @@ -281,13 +310,50 @@ BOOL SvXMLImportPropertyMapper::handleNoItem( const SvXMLUnitConverter& rUnitConverter, const SvXMLNamespaceMap& rNamespaceMap) const { - DBG_ERROR( "unsuported no item in xml import" ); - return FALSE; + DBG_ASSERT( xNextMapper.is(), "unsuported no item in xml import" ); + if( xNextMapper.is() ) + return xNextMapper->handleNoItem( nIndex, rProperties, rValue, + rUnitConverter, rNamespaceMap ); + else + return FALSE; } +sal_Bool SvXMLImportPropertyMapper::FillPropertySet( + const vector< XMLPropertyState >& aProperties, + const Reference< + XPropertySet > rPropSet ) const +{ + sal_Bool bSet = sal_False; + Reference< XPropertySetInfo > xInfo = rPropSet->getPropertySetInfo(); + + sal_Int32 nCount = aProperties.size(); + for( sal_Int32 i=0; i < nCount; i++ ) + { + const XMLPropertyState& rProp = aProperties[i]; + sal_Int32 nIdx = rProp.mnIndex; + if( -1 == nIdx ) + continue; + const OUString& rPropName = maPropMapper->GetEntryAPIName( nIdx ); + if( xInfo->hasPropertyByName( rPropName ) ) + { + try + { + rPropSet->setPropertyValue( rPropName, rProp.maValue ); + bSet = sal_True; + } + catch(...) + { + } + } + } + + return bSet; +} void SvXMLImportPropertyMapper::finished( vector< XMLPropertyState >& rProperties, sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const { // nothing to do here + if( xNextMapper.is() ) + xNextMapper->finished( rProperties, nStartIndex, nEndIndex ); } diff --git a/xmloff/source/style/xmlprmap.cxx b/xmloff/source/style/xmlprmap.cxx index 93e30269b000..28e6db565139 100644 --- a/xmloff/source/style/xmlprmap.cxx +++ b/xmloff/source/style/xmlprmap.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlprmap.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 17:07:06 $ + * last change: $Author: mib $ $Date: 2000-11-07 13:33:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -96,6 +96,30 @@ using namespace ::rtl; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; +XMLPropertySetMapperEntry_Impl::XMLPropertySetMapperEntry_Impl( + const XMLPropertyMapEntry& rMapEntry, + const UniReference< XMLPropertyHandlerFactory >& rFactory ) : + sXMLAttributeName( OUString::createFromAscii(rMapEntry.msXMLName) ), + sAPIPropertyName( OUString::createFromAscii(rMapEntry.msApiName) ), + nXMLNameSpace( rMapEntry.mnNameSpace ), + nType( rMapEntry.mnType ), + nContextId( rMapEntry.mnContextId ), + pHdl( rFactory->GetPropertyHandler( rMapEntry.mnType & MID_FLAG_MASK ) ) +{ +} + +XMLPropertySetMapperEntry_Impl::XMLPropertySetMapperEntry_Impl( + const XMLPropertySetMapperEntry_Impl& rEntry ) : + sXMLAttributeName( rEntry.sXMLAttributeName), + sAPIPropertyName( rEntry.sAPIPropertyName), + nXMLNameSpace( rEntry.nXMLNameSpace), + nType( rEntry.nType), + nContextId( rEntry.nContextId), + pHdl( rEntry.pHdl) +{ + DBG_ASSERT( pHdl, "Unknown XML property type handler!" ); +} + /////////////////////////////////////////////////////////////////////////// // // Ctor @@ -103,39 +127,17 @@ using namespace ::com::sun::star::beans; XMLPropertySetMapper::XMLPropertySetMapper( const XMLPropertyMapEntry* pEntries, const UniReference< XMLPropertyHandlerFactory >& rFactory ) -: mpEntries ( pEntries ), - mnEntryCount ( 0 ), - maHdlFactory ( rFactory ) { - if( mpEntries ) + aHdlFactories.push_back( rFactory ); + if( pEntries ) { - const XMLPropertyMapEntry* pIter = mpEntries; + const XMLPropertyMapEntry* pIter = pEntries; // count entries - while( pIter->msApiName ) // the last element of the array contains { NULL, ??, ?? } - { - mnEntryCount++; - pIter++; - } - - // fill Sequence of XML-names and PropertyHandler - maXMLNames.realloc( mnEntryCount ); - maApiNames.realloc( mnEntryCount ); - pIter = mpEntries; - for( sal_Int32 i=0; i < mnEntryCount; i++ ) + while( pIter->msApiName ) { - // create XML-name - maXMLNames[ i ] = OUString::createFromAscii( pIter->msXMLName ); - maApiNames[ i ] = OUString::createFromAscii( pIter->msApiName ); - - // create PropertyHandler for property - const XMLPropertyHandler* pHdl = - maHdlFactory->GetPropertyHandler( - pIter->mnType & MID_FLAG_MASK ); - - DBG_ASSERT( pHdl, "Unknown XML property type handler!" ); - maPropertyHandler.push_back( pHdl ); - + XMLPropertySetMapperEntry_Impl aEntry( *pIter, rFactory ); + aMapEntries.push_back( aEntry ); pIter++; } } @@ -145,182 +147,28 @@ XMLPropertySetMapper::~XMLPropertySetMapper() { } -/////////////////////////////////////////////////////////////////////////// -// -// Take all properties of the XPropertySet which are also found in the -// XMLPropertyMapEntry-array and which are not set to their default-value, -// if a state is available. -// -// After that I call the method 'ContextFilter'. -// -vector< XMLPropertyState > XMLPropertySetMapper::Filter( - const Reference< XPropertySet > xPropSet ) const +void XMLPropertySetMapper::AddMapperEntry( + const UniReference < XMLPropertySetMapper >& rMapper ) { - vector< XMLPropertyState > aPropStateArray; - - // Retrieve XPropertySetInfo and XPropertyState - Reference< XPropertySetInfo > xInfo( xPropSet->getPropertySetInfo() ); - Reference< XPropertyState > xPropState( xPropSet, UNO_QUERY ); - - if( mpEntries && xInfo.is() ) + for( vector < UniReference < XMLPropertyHandlerFactory > >::iterator + aFIter = rMapper->aHdlFactories.begin(); + aFIter != rMapper->aHdlFactories.end(); + aFIter++ ) { - const XMLPropertyMapEntry* pIter = mpEntries; - sal_Int32 nIndex=0; - - sal_Int32 nCount = 0; - while( (pIter++)->msApiName ) - nCount++; - pIter = mpEntries; - - - if( xPropState.is() ) - { - Sequence<OUString> aApiNames( nCount ); - Sequence<sal_uInt32> aIndexes( nCount ); - OUString *pNames = aApiNames.getArray(); - sal_uInt32 *pIndexes = aIndexes.getArray(); - nCount = 0; - while( pIter->msApiName ) // the last element of the array contains { NULL, ??, ?? } - { - // Does the PropertySet contain name of mpEntries-array ? - if( xInfo->hasPropertyByName( maApiNames[ nIndex ] ) ) - { - pNames[nCount] = maApiNames[ nIndex ]; - pIndexes[nCount] = nIndex; - nCount++; - } - - nIndex++; - pIter++; - } - - aApiNames.realloc( nCount ); - aIndexes.realloc( nCount ); - - Sequence < PropertyState > aStates = xPropState->getPropertyStates( aApiNames ); - - const PropertyState *pStates = aStates.getArray(); - for( sal_Int32 i = 0; i < nCount; i++ ) - { - if( pStates[i] == PropertyState_DIRECT_VALUE ) - { - // The value is stored in the PropertySet itself, add to list. - XMLPropertyState aNewProperty( pIndexes[i], - xPropSet->getPropertyValue( - aApiNames[i] ) ); - aPropStateArray.push_back( aNewProperty ); - } - } - } - else - { - while( pIter->msApiName ) // the last element of the array contains { NULL, ??, ?? } - { - // Does the PropertySet contain name of mpEntries-array ? - if( xInfo->hasPropertyByName( maApiNames[ nIndex ] ) ) - { - // If there isn't a XPropertyState we can't filter by its state - if( !xPropState.is() || xPropState->getPropertyState( maApiNames[ nIndex ] ) == PropertyState_DIRECT_VALUE ) - { - // The value is stored in the PropertySet itself, add to list. - XMLPropertyState aNewProperty( nIndex, - xPropSet->getPropertyValue( - maApiNames[ nIndex ] ) ); - aPropStateArray.push_back( aNewProperty ); - } - } - - nIndex++; - pIter++; - } - } - - // Call centext-filter - ContextFilter( aPropStateArray, xPropSet ); + aHdlFactories.push_back( *aFIter ); } - return aPropStateArray; -} - -void XMLPropertySetMapper::ContextFilter( - vector< XMLPropertyState >& rProperties, - Reference< XPropertySet > rPropSet ) const -{ - // Derived class could implement this. -} - - -/////////////////////////////////////////////////////////////////////////// -// -// Compares two Sequences of XMLPropertyState: -// 1.Number of elements equal ? -// 2.Index of each element equal ? (So I know whether the propertynames are the same) -// 3.Value of each element equal ? -// -sal_Bool XMLPropertySetMapper::Equals( - const vector< XMLPropertyState >& aProperties1, - const vector< XMLPropertyState >& aProperties2 ) const -{ - sal_Bool bRet = sal_True; - sal_Int32 nCount = aProperties1.size(); - - if( nCount == aProperties2.size() ) + for( vector < XMLPropertySetMapperEntry_Impl >::iterator + aEIter = rMapper->aMapEntries.begin(); + aEIter != rMapper->aMapEntries.end(); + aEIter++ ) { - sal_Int32 nIndex = 0; - while( bRet && nIndex < nCount ) - { - const XMLPropertyState& rProp1 = aProperties1[ nIndex ]; - const XMLPropertyState& rProp2 = aProperties2[ nIndex ]; - - // Compare index. If equal, compare value - if( rProp1.mnIndex == rProp2.mnIndex ) - { - if( rProp1.mnIndex != -1 ) - { - // Now compare values - if( ( mpEntries[rProp1.mnIndex].mnType & - XML_TYPE_BUILDIN_CMP ) != 0 ) - // simple type ( binary compare ) - bRet = ( rProp1.maValue == rProp2.maValue ); - else - // complex type ( ask for compare-function ) - bRet = maPropertyHandler[ rProp1.mnIndex ]->equals( - rProp1.maValue, rProp2.maValue ); - } - } - else - bRet = sal_False; - - nIndex++; - } + aMapEntries.push_back( *aEIter ); } - else - bRet = sal_False; - - return bRet; } /////////////////////////////////////////////////////////////////////////// // -// Retrieves a PropertyHandler for that property wich placed at nIndex in -// the XMLPropertyMapEntry-array -// -const XMLPropertyHandler* XMLPropertySetMapper::GetPropertyHandler( - sal_Int32 nIndex ) const -{ - nIndex &= MID_FLAG_MASK; - - const XMLPropertyHandler* pRet = NULL; - - if( maPropertyHandler.size() > nIndex ) - pRet = (const XMLPropertyHandler*)maPropertyHandler[ nIndex ]; - - return pRet; -} - - -/////////////////////////////////////////////////////////////////////////// -// // Export a Property // sal_Bool XMLPropertySetMapper::exportXML( @@ -371,74 +219,44 @@ const sal_Int32 XMLPropertySetMapper::GetEntryIndex( const OUString& rStrName, sal_Int32 nStartAt /* = -1 */ ) const { - sal_Int32 nEntries = maXMLNames.getLength(); + sal_Int32 nEntries = GetEntryCount(); sal_Int32 nIndex= nStartAt == - 1? 0 : nStartAt+1; - BOOL bFound = FALSE; do { - if( mpEntries[nIndex].mnNameSpace == nNamespace && - rStrName.equals( maXMLNames[nIndex] )) - bFound = TRUE; + const XMLPropertySetMapperEntry_Impl& rEntry = aMapEntries[nIndex]; + if( rEntry.nXMLNameSpace == nNamespace && + rStrName == rEntry.sXMLAttributeName ) + return nIndex; else nIndex++; - } while( nIndex<nEntries && !bFound ); + } while( nIndex<nEntries ); - if( !bFound ) - nIndex = -1; - - return nIndex; + return -1; } -sal_Bool XMLPropertySetMapper::FillPropertySet( - const vector< XMLPropertyState >& aProperties, - const Reference< - XPropertySet > rPropSet ) const -{ - sal_Bool bSet = sal_False; - Reference< XPropertySetInfo > xInfo = rPropSet->getPropertySetInfo(); - - sal_Int32 nCount = aProperties.size(); - for( sal_Int32 i=0; i < nCount; i++ ) - { - const XMLPropertyState& rProp = aProperties[i]; - sal_Int32 nIdx = rProp.mnIndex; - if( -1 == nIdx ) - continue; - const OUString& rPropName = maApiNames[nIdx]; - if( xInfo->hasPropertyByName( rPropName ) ) - { - try - { - rPropSet->setPropertyValue( rPropName, rProp.maValue ); - bSet = sal_True; - } - catch(...) - { - } - } - } - - return bSet; -} /** searches for an entry that matches the given api name, namespace and local name or -1 if nothing found */ -sal_Int32 XMLPropertySetMapper::FindEntryIndex( sal_Char* sApiName, sal_uInt16 nNameSpace, sal_Char* sXMLName ) const +sal_Int32 XMLPropertySetMapper::FindEntryIndex( + const sal_Char* sApiName, + sal_uInt16 nNameSpace, + const sal_Char* sXMLName ) const { - const XMLPropertyMapEntry* pEntries = mpEntries; sal_Int32 nIndex = 0; + sal_Int32 nEntries = GetEntryCount(); - while( pEntries && pEntries->msApiName ) + do { - if( pEntries->mnNameSpace == nNameSpace && - (strcmp( pEntries->msApiName, sApiName ) == 0) && - (strcmp( pEntries->msXMLName, sXMLName ) == 0)) + const XMLPropertySetMapperEntry_Impl& rEntry = aMapEntries[nIndex]; + if( rEntry.nXMLNameSpace == nNameSpace && + 0 == rEntry.sXMLAttributeName.compareToAscii( sXMLName ) && + 0 == rEntry.sAPIPropertyName.compareToAscii( sApiName ) ) return nIndex; + else + nIndex++; - nIndex++; - pEntries++; - } + } while( nIndex<nEntries ); return -1; } diff --git a/xmloff/source/style/xmlstyle.cxx b/xmloff/source/style/xmlstyle.cxx index 2dbac53ab8ae..6bb47914c30e 100644 --- a/xmloff/source/style/xmlstyle.cxx +++ b/xmloff/source/style/xmlstyle.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlstyle.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: sab $ $Date: 2000-10-23 10:27:59 $ + * last change: $Author: mib $ $Date: 2000-11-07 13:33:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -737,7 +737,7 @@ UniReference < SvXMLImportPropertyMapper > SvXMLStylesContext::GetImportProperty { UniReference< XMLShapeImportHelper > aImpHelper = ((SvXMLImport&)GetImport()).GetShapeImport(); ((SvXMLStylesContext*)this)->xShapeImpPropMapper = - new SvXMLImportPropertyMapper(aImpHelper->GetPropertySetMapper()); + aImpHelper->GetPropertySetMapper(); } xMapper = xShapeImpPropMapper; break; diff --git a/xmloff/source/text/XMLTextShapeImportHelper.cxx b/xmloff/source/text/XMLTextShapeImportHelper.cxx new file mode 100644 index 000000000000..f4c559c3819b --- /dev/null +++ b/xmloff/source/text/XMLTextShapeImportHelper.cxx @@ -0,0 +1,181 @@ +/************************************************************************* + * + * $RCSfile: XMLTextShapeImportHelper.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: mib $ $Date: 2000-11-07 13:33:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _COM_SUN_STAR_TEXT_XTEXTCONTENT_HPP_ +#include <com/sun/star/text/XTextContent.hpp> +#endif +#ifndef _COM_SUN_STAR_TEXT_TEXTCONTENTANCHORTYPE_HPP +#include <com/sun/star/text/TextContentAnchorType.hpp> +#endif + +#ifndef _XMLOFF_XMLTIMP_HXX_ +#include "xmlimp.hxx" +#endif +#ifndef _XMLOFF_TEXTIMP_HXX_ +#include "txtimp.hxx" +#endif +#ifndef _XMLOFF_XMLUCONV_HXX +#include "xmluconv.hxx" +#endif +#ifndef _XMLOFF_NMSPMAP_HXX +#include "nmspmap.hxx" +#endif +#ifndef _XMLOFF_XMLANCHORTYPEPROPHDL_HXX +#include "XMLAnchorTypePropHdl.hxx" +#endif + +#ifndef _XMLTEXTSHAPEIMPORTHELPER_HXX +#include "XMLTextShapeImportHelper.hxx" +#endif + +using namespace ::rtl; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::frame; +using namespace ::com::sun::star::drawing; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::text; +using namespace ::com::sun::star::xml::sax; + +XMLTextShapeImportHelper::XMLTextShapeImportHelper( + SvXMLImport& rImp ) : + XMLShapeImportHelper( rImp.GetModel(), + XMLTextImportHelper::CreateShapeExtPropMapper() ), + rImport( rImp ), + sAnchorType(RTL_CONSTASCII_USTRINGPARAM("AnchorType")), + sAnchorPageNo(RTL_CONSTASCII_USTRINGPARAM("AnchorPageNo")) +{ +} + +XMLTextShapeImportHelper::~XMLTextShapeImportHelper() +{ +} + +void XMLTextShapeImportHelper::addShape( + Reference< XShape >& rShape, + const Reference< XAttributeList >& xAttrList, + Reference< XShapes >& rShapes ) +{ + if( rShapes.is() ) + { + // It's a group shape, so we have to call the base class method. + XMLShapeImportHelper::addShape( rShape, xAttrList, rShapes ); + } + + TextContentAnchorType eAnchorType = TextContentAnchorType_AT_PARAGRAPH; + sal_Int16 nPage = 0; + + UniReference < XMLTextImportHelper > xTxtImport = + rImport.GetTextImport(); + const SvXMLTokenMap& rTokenMap = + xTxtImport->GetTextFrameAttrTokenMap(); + + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + for( sal_Int16 i=0; i < nAttrCount; i++ ) + { + const OUString& rAttrName = xAttrList->getNameByIndex( i ); + const OUString& rValue = xAttrList->getValueByIndex( i ); + + OUString aLocalName; + sal_uInt16 nPrefix = + rImport.GetNamespaceMap().GetKeyByAttrName( rAttrName, + &aLocalName ); + switch( rTokenMap.Get( nPrefix, aLocalName ) ) + { + case XML_TOK_TEXT_FRAME_ANCHOR_TYPE: + { + TextContentAnchorType eNew; + if( XMLAnchorTypePropHdl::convert( rValue, + rImport.GetMM100UnitConverter(), eNew ) && + ( TextContentAnchorType_AT_PAGE == eNew || + TextContentAnchorType_AT_PARAGRAPH == eNew || + TextContentAnchorType_AS_CHARACTER == eNew ) ) + eAnchorType = eNew; + } + break; + case XML_TOK_TEXT_FRAME_ANCHOR_PAGE_NUMBER: + { + sal_Int32 nTmp; + if( rImport.GetMM100UnitConverter(). + convertNumber( nTmp, rValue, 1, SHRT_MAX ) ) + nPage = (sal_Int16)nTmp; + } + break; + } + } + + Reference < XPropertySet > xPropSet( rShape, UNO_QUERY ); + Any aAny; + + // anchor type + aAny <<= eAnchorType; + xPropSet->setPropertyValue( sAnchorType, aAny ); + + Reference < XTextContent > xTxtCntnt( rShape, UNO_QUERY ); + xTxtImport->InsertTextContent( xTxtCntnt ); + + // page number (must be set after the frame is inserted, because it + // will be overwritten then inserting the frame. + if( TextContentAnchorType_AT_PAGE == eAnchorType ) + { + aAny <<= nPage; + xPropSet->setPropertyValue( sAnchorPageNo, aAny ); + } +} diff --git a/xmloff/source/text/XMLTextShapeImportHelper.hxx b/xmloff/source/text/XMLTextShapeImportHelper.hxx new file mode 100644 index 000000000000..7d70694c2c5d --- /dev/null +++ b/xmloff/source/text/XMLTextShapeImportHelper.hxx @@ -0,0 +1,90 @@ +/************************************************************************* + * + * $RCSfile: XMLTextShapeImportHelper.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: mib $ $Date: 2000-11-07 13:33:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _XMLTEXTSHAPEIMPORTHELPER_HXX +#define _XMLTEXTSHAPEIMPORTHELPER_HXX + +#ifndef _XMLOFF_SHAPEIMPORT_HXX_ +#include "shapeimport.hxx" +#endif + +class XMLTextShapeImportHelper : public XMLShapeImportHelper +{ + SvXMLImport& rImport; + + const ::rtl::OUString sAnchorType; + const ::rtl::OUString sAnchorPageNo; + +public: + + XMLTextShapeImportHelper( SvXMLImport& rImp ); + ~XMLTextShapeImportHelper(); + + virtual void addShape( + ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::XShape >& rShape, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList >& xAttrList, + ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::XShapes >& rShapes ); +}; + +#endif diff --git a/xmloff/source/text/makefile.mk b/xmloff/source/text/makefile.mk index 1b81a1747ad9..fc8b69a86be6 100644 --- a/xmloff/source/text/makefile.mk +++ b/xmloff/source/text/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.9 $ +# $Revision: 1.10 $ # -# last change: $Author: dvo $ $Date: 2000-11-02 15:51:18 $ +# last change: $Author: mib $ $Date: 2000-11-07 13:33:08 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -122,6 +122,7 @@ CXXFILES = \ XMLTextMasterStylesContext.cxx \ XMLTextNumRuleInfo.cxx \ XMLTextPropertySetContext.cxx \ + XMLTextShapeImportHelper.cxx \ XMLTextTableContext.cxx SLOFILES = \ @@ -170,6 +171,7 @@ SLOFILES = \ $(SLO)$/XMLTextMasterStylesContext.obj \ $(SLO)$/XMLTextNumRuleInfo.obj \ $(SLO)$/XMLTextPropertySetContext.obj \ + $(SLO)$/XMLTextShapeImportHelper.obj \ $(SLO)$/XMLTextTableContext.obj diff --git a/xmloff/source/text/txtexppr.cxx b/xmloff/source/text/txtexppr.cxx index d5d457c9908e..6936beff4a03 100644 --- a/xmloff/source/text/txtexppr.cxx +++ b/xmloff/source/text/txtexppr.cxx @@ -2,9 +2,9 @@ * * $RCSfile: txtexppr.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: mib $ $Date: 2000-10-19 14:25:20 $ + * last change: $Author: mib $ $Date: 2000-11-07 13:33:08 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -67,6 +67,18 @@ #include "txtprmap.hxx" #endif +#ifndef _COM_SUN_STAR_TABLE_BORDERLINE_HPP_ +#include <com/sun/star/table/BorderLine.hpp> +#endif +#ifndef _COM_SUN_STAR_TEXT_SIZETYPE_HPP_ +#include <com/sun/star/text/SizeType.hpp> +#endif +#ifndef _COM_SUN_STAR_TEXT_WRAPTEXTMODE_HPP_ +#include <com/sun/star/text/WrapTextMode.hpp> +#endif +#ifndef _COM_SUN_STAR_TEXT_TEXTCONTENTANCHORTYPE_HPP +#include <com/sun/star/text/TextContentAnchorType.hpp> +#endif #ifndef _XMLOFF_TXTEXPPR_HXX #include "txtexppr.hxx" #endif @@ -78,6 +90,8 @@ using namespace ::rtl; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::style; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::text; void XMLTextExportPropertySetMapper::handleElementItem( const Reference< xml::sax::XDocumentHandler > & rHandler, @@ -196,3 +210,490 @@ XMLTextExportPropertySetMapper::~XMLTextExportPropertySetMapper() { } +void XMLTextExportPropertySetMapper::ContextFilter( + ::std::vector< XMLPropertyState >& rProperties, + Reference< XPropertySet > rPropSet ) const +{ + // filter char height point/percent + XMLPropertyState* pCharHeightState = NULL; + XMLPropertyState* pCharPropHeightState = NULL; + XMLPropertyState* pCharDiffHeightState = NULL; + + // filter left margin measure/percent + XMLPropertyState* pParaLeftMarginState = NULL; + XMLPropertyState* pParaLeftMarginRelState = NULL; + + // filter right margin measure/percent + XMLPropertyState* pParaRightMarginState = NULL; + XMLPropertyState* pParaRightMarginRelState = NULL; + + // filter first line indent measure/percent + XMLPropertyState* pParaFirstLineState = NULL; + XMLPropertyState* pParaFirstLineRelState = NULL; + + // filter ParaTopMargin/Relative + XMLPropertyState* pParaTopMarginState = NULL; + XMLPropertyState* pParaTopMarginRelState = NULL; + + // filter ParaTopMargin/Relative + XMLPropertyState* pParaBottomMarginState = NULL; + XMLPropertyState* pParaBottomMarginRelState = NULL; + + // filter (Left|Right|Top|Bottom|)BorderWidth + XMLPropertyState* pAllBorderWidthState = NULL; + XMLPropertyState* pLeftBorderWidthState = NULL; + XMLPropertyState* pRightBorderWidthState = NULL; + XMLPropertyState* pTopBorderWidthState = NULL; + XMLPropertyState* pBottomBorderWidthState = NULL; + + // filter (Left|Right|Top|)BorderDistance + XMLPropertyState* pAllBorderDistanceState = NULL; + XMLPropertyState* pLeftBorderDistanceState = NULL; + XMLPropertyState* pRightBorderDistanceState = NULL; + XMLPropertyState* pTopBorderDistanceState = NULL; + XMLPropertyState* pBottomBorderDistanceState = NULL; + + // filter (Left|Right|Top|Bottom|)Border + XMLPropertyState* pAllBorderState = NULL; + XMLPropertyState* pLeftBorderState = NULL; + XMLPropertyState* pRightBorderState = NULL; + XMLPropertyState* pTopBorderState = NULL; + XMLPropertyState* pBottomBorderState = NULL; + + // filter width/height properties + XMLPropertyState* pWidthAbsState = NULL; + XMLPropertyState* pWidthMinAbsState = NULL; + XMLPropertyState* pWidthRelState = NULL; + XMLPropertyState* pWidthMinRelState = NULL; + XMLPropertyState* pHeightAbsState = NULL; + XMLPropertyState* pHeightMinAbsState = NULL; + XMLPropertyState* pHeightRelState = NULL; + XMLPropertyState* pHeightMinRelState = NULL; + XMLPropertyState* pSizeTypeState = NULL; + XMLPropertyState* pSyncHeightState = NULL; + + // wrap + XMLPropertyState* pWrapState = NULL; + XMLPropertyState* pWrapContourState = NULL; + XMLPropertyState* pWrapContourModeState = NULL; + XMLPropertyState* pWrapParagraphOnlyState = NULL; + + // anchor + XMLPropertyState* pAnchorTypeState = NULL; + XMLPropertyState* pAnchorPageNumberState = NULL; + + // horizontal position and relation + XMLPropertyState* pHoriOrientState = NULL; + XMLPropertyState* pHoriOrientMirroredState = NULL; + XMLPropertyState* pHoriOrientRelState = NULL; + XMLPropertyState* pHoriOrientRelFrameState = NULL; + XMLPropertyState* pHoriOrientMirrorState = NULL; + + // vertical position and relation + XMLPropertyState* pVertOrientState = NULL; + XMLPropertyState* pVertOrientRelState = NULL; + XMLPropertyState* pVertOrientRelPageState = NULL; + XMLPropertyState* pVertOrientRelFrameState = NULL; + XMLPropertyState* pVertOrientRelAsCharState = NULL; + + sal_Bool bNeedsAnchor = sal_False; + + for( ::std::vector< XMLPropertyState >::iterator propertie = rProperties.begin(); + propertie != rProperties.end(); + propertie++ ) + { + switch( getPropertySetMapper()->GetEntryContextId( propertie->mnIndex ) ) + { + case CTF_CHARHEIGHT: pCharHeightState = propertie; break; + case CTF_CHARHEIGHT_REL: pCharPropHeightState = propertie; break; + case CTF_CHARHEIGHT_DIFF: pCharDiffHeightState = propertie; break; + case CTF_PARALEFTMARGIN: pParaLeftMarginState = propertie; break; + case CTF_PARALEFTMARGIN_REL: pParaLeftMarginRelState = propertie; break; + case CTF_PARARIGHTMARGIN: pParaRightMarginState = propertie; break; + case CTF_PARARIGHTMARGIN_REL: pParaRightMarginRelState = propertie; break; + case CTF_PARAFIRSTLINE: pParaFirstLineState = propertie; break; + case CTF_PARAFIRSTLINE_REL: pParaFirstLineRelState = propertie; break; + case CTF_PARATOPMARGIN: pParaTopMarginState = propertie; break; + case CTF_PARATOPMARGIN_REL: pParaTopMarginRelState = propertie; break; + case CTF_PARABOTTOMMARGIN: pParaBottomMarginState = propertie; break; + case CTF_PARABOTTOMMARGIN_REL: pParaBottomMarginRelState = propertie; break; + case CTF_ALLBORDERWIDTH: pAllBorderWidthState = propertie; break; + case CTF_LEFTBORDERWIDTH: pLeftBorderWidthState = propertie; break; + case CTF_RIGHTBORDERWIDTH: pRightBorderWidthState = propertie; break; + case CTF_TOPBORDERWIDTH: pTopBorderWidthState = propertie; break; + case CTF_BOTTOMBORDERWIDTH: pBottomBorderWidthState = propertie; break; + case CTF_ALLBORDERDISTANCE: pAllBorderDistanceState = propertie; break; + case CTF_LEFTBORDERDISTANCE: pLeftBorderDistanceState = propertie; break; + case CTF_RIGHTBORDERDISTANCE: pRightBorderDistanceState = propertie; break; + case CTF_TOPBORDERDISTANCE: pTopBorderDistanceState = propertie; break; + case CTF_BOTTOMBORDERDISTANCE: pBottomBorderDistanceState = propertie; break; + case CTF_ALLBORDER: pAllBorderState = propertie; break; + case CTF_LEFTBORDER: pLeftBorderState = propertie; break; + case CTF_RIGHTBORDER: pRightBorderState = propertie; break; + case CTF_TOPBORDER: pTopBorderState = propertie; break; + case CTF_BOTTOMBORDER: pBottomBorderState = propertie; break; + + case CTF_FRAMEWIDTH_ABS: pWidthAbsState = propertie; break; + case CTF_FRAMEWIDTH_REL: pWidthRelState = propertie; break; + case CTF_FRAMEHEIGHT_ABS: pHeightAbsState = propertie; break; + case CTF_FRAMEHEIGHT_MIN_ABS: pHeightMinAbsState = propertie; break; + case CTF_FRAMEHEIGHT_REL: pHeightRelState = propertie; break; + case CTF_FRAMEHEIGHT_MIN_REL: pHeightMinRelState = propertie; break; + case CTF_SIZETYPE: pSizeTypeState = propertie; break; + case CTF_SYNCHEIGHT: pSyncHeightState = propertie; break; + + case CTF_WRAP: pWrapState = propertie; break; + case CTF_WRAP_CONTOUR: pWrapContourState = propertie; break; + case CTF_WRAP_CONTOUR_MODE: pWrapContourModeState = propertie; break; + case CTF_WRAP_PARAGRAPH_ONLY: pWrapParagraphOnlyState = propertie; break; + case CTF_ANCHORTYPE: pAnchorTypeState = propertie; break; + case CTF_ANCHORPAGENUMBER: pAnchorPageNumberState = propertie; bNeedsAnchor = sal_True; break; + + case CTF_HORIZONTALPOS: pHoriOrientState = propertie; bNeedsAnchor = sal_True; break; + case CTF_HORIZONTALPOS_MIRRORED: pHoriOrientMirroredState = propertie; bNeedsAnchor = sal_True; break; + case CTF_HORIZONTALREL: pHoriOrientRelState = propertie; bNeedsAnchor = sal_True; break; + case CTF_HORIZONTALREL_FRAME: pHoriOrientRelFrameState = propertie; bNeedsAnchor = sal_True; break; + case CTF_HORIZONTALMIRROR: pHoriOrientMirrorState = propertie; bNeedsAnchor = sal_True; break; + case CTF_VERTICALPOS: pVertOrientState = propertie; bNeedsAnchor = sal_True; break; + case CTF_VERTICALREL: pVertOrientRelState = propertie; bNeedsAnchor = sal_True; break; + case CTF_VERTICALREL_PAGE: pVertOrientRelPageState = propertie; bNeedsAnchor = sal_True; break; + case CTF_VERTICALREL_FRAME: pVertOrientRelFrameState = propertie; bNeedsAnchor = sal_True; break; + case CTF_VERTICALREL_ASCHAR: pVertOrientRelAsCharState = propertie; bNeedsAnchor = sal_True; break; + } + } + + if( pCharHeightState && pCharPropHeightState ) + { + sal_Int32 nTemp; + pCharPropHeightState->maValue >>= nTemp; + if( nTemp == 100 ) + { + pCharPropHeightState->mnIndex = -1; + pCharPropHeightState->maValue.clear(); + } + else + { + pCharHeightState->mnIndex = -1; + pCharHeightState->maValue.clear(); + } + } + if( pCharHeightState && pCharDiffHeightState ) + { + float nTemp; + pCharDiffHeightState->maValue >>= nTemp; + if( nTemp == 0. ) + { + pCharDiffHeightState->mnIndex = -1; + pCharDiffHeightState->maValue.clear(); + } + else + { + pCharHeightState->mnIndex = -1; + pCharHeightState->maValue.clear(); + } + } + + if( pParaLeftMarginState && pParaLeftMarginRelState ) + { + sal_Int32 nTemp; + pParaLeftMarginRelState->maValue >>= nTemp; + if( nTemp == 100 ) + { + pParaLeftMarginRelState->mnIndex = -1; + pParaLeftMarginRelState->maValue.clear(); + } + else + { + pParaLeftMarginState->mnIndex = -1; + pParaLeftMarginState->maValue.clear(); + } + + } + + if( pParaRightMarginState && pParaRightMarginRelState ) + { + sal_Int32 nTemp; + pParaRightMarginRelState->maValue >>= nTemp; + if( nTemp == 100 ) + { + pParaRightMarginRelState->mnIndex = -1; + pParaRightMarginRelState->maValue.clear(); + } + else + { + pParaRightMarginState->mnIndex = -1; + pParaRightMarginState->maValue.clear(); + } + } + + if( pParaFirstLineState && pParaFirstLineRelState ) + { + sal_Int32 nTemp; + pParaFirstLineRelState->maValue >>= nTemp; + if( nTemp == 100 ) + { + pParaFirstLineRelState->mnIndex = -1; + pParaFirstLineRelState->maValue.clear(); + } + else + { + pParaFirstLineState->mnIndex = -1; + pParaFirstLineState->maValue.clear(); + } + } + + if( pParaTopMarginState && pParaTopMarginRelState ) + { + sal_Int32 nTemp; + pParaTopMarginRelState->maValue >>= nTemp; + if( nTemp == 100 ) + { + pParaTopMarginRelState->mnIndex = -1; + pParaTopMarginRelState->maValue.clear(); + } + else + { + pParaTopMarginState->mnIndex = -1; + pParaTopMarginState->maValue.clear(); + } + + } + + if( pParaBottomMarginState && pParaBottomMarginRelState ) + { + sal_Int32 nTemp; + pParaBottomMarginRelState->maValue >>= nTemp; + if( nTemp == 100 ) + { + pParaBottomMarginRelState->mnIndex = -1; + pParaBottomMarginRelState->maValue.clear(); + } + else + { + pParaBottomMarginState->mnIndex = -1; + pParaBottomMarginState->maValue.clear(); + } + + } + + if( pAllBorderWidthState ) + { + if( pLeftBorderWidthState && pRightBorderWidthState && pTopBorderWidthState && pBottomBorderWidthState ) + { + table::BorderLine aLeft, aRight, aTop, aBottom; + + pLeftBorderWidthState->maValue >>= aLeft; + pRightBorderWidthState->maValue >>= aRight; + pTopBorderWidthState->maValue >>= aTop; + pBottomBorderWidthState->maValue >>= aBottom; + if( aLeft.Color == aRight.Color && aLeft.InnerLineWidth == aRight.InnerLineWidth && + aLeft.OuterLineWidth == aRight.OuterLineWidth && aLeft.LineDistance == aRight.LineDistance && + aLeft.Color == aTop.Color && aLeft.InnerLineWidth == aTop.InnerLineWidth && + aLeft.OuterLineWidth == aTop.OuterLineWidth && aLeft.LineDistance == aTop.LineDistance && + aLeft.Color == aBottom.Color && aLeft.InnerLineWidth == aBottom.InnerLineWidth && + aLeft.OuterLineWidth == aBottom.OuterLineWidth && aLeft.LineDistance == aBottom.LineDistance ) + { + pLeftBorderWidthState->mnIndex = -1; + pLeftBorderWidthState->maValue.clear(); + pRightBorderWidthState->mnIndex = -1; + pRightBorderWidthState->maValue.clear(); + pTopBorderWidthState->mnIndex = -1; + pTopBorderWidthState->maValue.clear(); + pBottomBorderWidthState->mnIndex = -1; + pBottomBorderWidthState->maValue.clear(); + } + else + { + pAllBorderWidthState->mnIndex = -1; + pAllBorderWidthState->maValue.clear(); + } + } + else + { + pAllBorderWidthState->mnIndex = -1; + pAllBorderWidthState->maValue.clear(); + } + } + + if( pAllBorderDistanceState ) + { + if( pLeftBorderDistanceState && pRightBorderDistanceState && pTopBorderDistanceState && pBottomBorderDistanceState ) + { + sal_Int32 aLeft, aRight, aTop, aBottom; + + pLeftBorderDistanceState->maValue >>= aLeft; + pRightBorderDistanceState->maValue >>= aRight; + pTopBorderDistanceState->maValue >>= aTop; + pBottomBorderDistanceState->maValue >>= aBottom; + if( aLeft == aRight && aLeft == aTop && aLeft == aBottom ) + { + pLeftBorderDistanceState->mnIndex = -1; + pLeftBorderDistanceState->maValue.clear(); + pRightBorderDistanceState->mnIndex = -1; + pRightBorderDistanceState->maValue.clear(); + pTopBorderDistanceState->mnIndex = -1; + pTopBorderDistanceState->maValue.clear(); + pBottomBorderDistanceState->mnIndex = -1; + pBottomBorderDistanceState->maValue.clear(); + } + else + { + pAllBorderDistanceState->mnIndex = -1; + pAllBorderDistanceState->maValue.clear(); + } + } + else + { + pAllBorderDistanceState->mnIndex = -1; + pAllBorderDistanceState->maValue.clear(); + } + } + + if( pAllBorderState ) + { + if( pLeftBorderState && pRightBorderState && pTopBorderState && pBottomBorderState ) + { + table::BorderLine aLeft, aRight, aTop, aBottom; + + pLeftBorderState->maValue >>= aLeft; + pRightBorderState->maValue >>= aRight; + pTopBorderState->maValue >>= aTop; + pBottomBorderState->maValue >>= aBottom; + if( aLeft.Color == aRight.Color && aLeft.InnerLineWidth == aRight.InnerLineWidth && + aLeft.OuterLineWidth == aRight.OuterLineWidth && aLeft.LineDistance == aRight.LineDistance && + aLeft.Color == aTop.Color && aLeft.InnerLineWidth == aTop.InnerLineWidth && + aLeft.OuterLineWidth == aTop.OuterLineWidth && aLeft.LineDistance == aTop.LineDistance && + aLeft.Color == aBottom.Color && aLeft.InnerLineWidth == aBottom.InnerLineWidth && + aLeft.OuterLineWidth == aBottom.OuterLineWidth && aLeft.LineDistance == aBottom.LineDistance ) + { + pLeftBorderState->mnIndex = -1; + pLeftBorderState->maValue.clear(); + pRightBorderState->mnIndex = -1; + pRightBorderState->maValue.clear(); + pTopBorderState->mnIndex = -1; + pTopBorderState->maValue.clear(); + pBottomBorderState->mnIndex = -1; + pBottomBorderState->maValue.clear(); + } + else + { + pAllBorderState->mnIndex = -1; + pAllBorderState->maValue.clear(); + } + } + else + { + pAllBorderState->mnIndex = -1; + pAllBorderState->maValue.clear(); + } + } + + if( pWidthAbsState && pWidthRelState ) + { + sal_Int16 nRelWidth = 0; + pWidthRelState->maValue >>= nRelWidth; + if( nRelWidth > 0 ) + pWidthAbsState->mnIndex = -1; + // TODO: instead of checking this value for 255 a new property + // must be introduced like for heights. + if( nRelWidth == 255 ) + pWidthRelState->mnIndex = -1; + } + + if( pHeightAbsState && pHeightRelState ) + { + DBG_ASSERT( pHeightMinAbsState, "no min abs state" ); + DBG_ASSERT( pHeightMinRelState, "no min rel state" ); + sal_Int32 nSizeType = SizeType::FIX; + if( pSizeTypeState ) + pSizeTypeState->maValue >>= nSizeType; + + if( SizeType::VARIABLE == nSizeType || + ( pSyncHeightState && + *(sal_Bool *)pSyncHeightState->maValue.getValue() ) ) + { + pHeightAbsState->mnIndex = -1; + pHeightMinAbsState->mnIndex = -1; + pHeightRelState->mnIndex = -1; + pHeightMinRelState->mnIndex = -1; + } + else + { + sal_Int16 nRelHeight = 0; + pHeightRelState->maValue >>= nRelHeight; + sal_Bool bRel = (nRelHeight > 0); + sal_Bool bMin = (SizeType::MIN == nSizeType); + if( bRel || bMin ) + pHeightAbsState->mnIndex = -1; + if( bRel || !bMin ) + pHeightMinAbsState->mnIndex = -1; + if( !bRel || bMin ) + pHeightRelState->mnIndex = -1; + if( !bRel || !bMin ) + pHeightMinRelState->mnIndex = -1; + } + } + if( pSizeTypeState ) + pSizeTypeState->mnIndex = -1; + if( pSyncHeightState ) + pSyncHeightState->mnIndex = -1; + + if( pWrapState ) + { + WrapTextMode eVal; + pWrapState->maValue >>= eVal; + switch( eVal ) + { + case WrapTextMode_NONE: + case WrapTextMode_THROUGHT: + if( pWrapContourState ) + pWrapContourState->mnIndex = -1; + if( pWrapParagraphOnlyState ) + pWrapParagraphOnlyState->mnIndex = -1; + break; + } + if( pWrapContourModeState && + (!pWrapContourState || + !*(sal_Bool *)pWrapContourState ->maValue.getValue() ) ) + pWrapContourModeState->mnIndex = -1; + } + + TextContentAnchorType eAnchor = TextContentAnchorType_AT_PARAGRAPH; + if( pAnchorTypeState ) + pAnchorTypeState->maValue >>= eAnchor; + else if( bNeedsAnchor ) + { + Any aAny = rPropSet->getPropertyValue( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ) ); + aAny >>= eAnchor; + } + + if( pAnchorPageNumberState && TextContentAnchorType_AT_PAGE != eAnchor ) + pAnchorPageNumberState->mnIndex = -1; + + if( pHoriOrientState && pHoriOrientMirroredState ) + { + if( pHoriOrientMirrorState && + *(sal_Bool *)pHoriOrientMirrorState->maValue.getValue() ) + pHoriOrientState->mnIndex = -1; + else + pHoriOrientMirroredState->mnIndex = -1; + } + if( pHoriOrientMirrorState ) + pHoriOrientMirrorState->mnIndex = -1; + + if( pHoriOrientRelState && TextContentAnchorType_AT_FRAME == eAnchor ) + pHoriOrientRelState->mnIndex = -1; + if( pHoriOrientRelFrameState && TextContentAnchorType_AT_FRAME != eAnchor ) + pHoriOrientRelFrameState->mnIndex = -1;; + + if( pVertOrientRelState && TextContentAnchorType_AT_PARAGRAPH != eAnchor && + TextContentAnchorType_AT_CHARACTER != eAnchor ) + pVertOrientRelState->mnIndex = -1; + if( pVertOrientRelPageState && TextContentAnchorType_AT_PAGE != eAnchor ) + pVertOrientRelPageState->mnIndex = -1; + if( pVertOrientRelFrameState && TextContentAnchorType_AT_FRAME != eAnchor ) + pVertOrientRelFrameState->mnIndex = -1; + if( pVertOrientRelAsCharState && TextContentAnchorType_AS_CHARACTER != eAnchor ) + pVertOrientRelAsCharState->mnIndex = -1; +} diff --git a/xmloff/source/text/txtexppr.hxx b/xmloff/source/text/txtexppr.hxx index 23f315be0526..b78eece92b2f 100644 --- a/xmloff/source/text/txtexppr.hxx +++ b/xmloff/source/text/txtexppr.hxx @@ -2,9 +2,9 @@ * * $RCSfile: txtexppr.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: mib $ $Date: 2000-10-19 14:25:20 $ + * last change: $Author: mib $ $Date: 2000-11-07 13:33:08 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -92,6 +92,11 @@ protected: XMLTextColumnsExport maTextColumnsExport; XMLBackgroundImageExport maBackgroundImageExport; + /** Application-specific filter. By default do nothing. */ + virtual void ContextFilter( + ::std::vector< XMLPropertyState >& rProperties, + ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > rPropSet ) const; public: XMLTextExportPropertySetMapper( diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index 0be968ed0b20..8f31bba2d33c 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: txtimp.cxx,v $ * - * $Revision: 1.19 $ + * $Revision: 1.20 $ * - * last change: $Author: dvo $ $Date: 2000-11-02 15:51:18 $ + * last change: $Author: mib $ $Date: 2000-11-07 13:33:08 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -103,6 +103,9 @@ #ifndef _COM_SUN_STAR_TEXT_XTEXTFRAME_HPP_ #include <com/sun/star/text/XTextFrame.hpp> #endif +#ifndef _COM_SUN_STAR_DRAWING_XSHAPES_HPP_ +#include <com/sun/star/drawing/XShapes.hpp> +#endif #ifndef _XMLOFF_XMLKYWD_HXX @@ -137,6 +140,9 @@ #ifndef _XMLOFF_TXTIMPPR_HXX #include "txtimppr.hxx" #endif +#ifndef _XMLOFF_XMLIMP_HXX +#include "xmlimp.hxx" +#endif #ifndef _XMLOFF_TXTVFLDI_HXX #include "txtvfldi.hxx" #endif @@ -174,6 +180,7 @@ using namespace ::com::sun::star::text; using namespace ::com::sun::star::frame; using namespace ::com::sun::star::style; using namespace ::com::sun::star::container; +using namespace ::com::sun::star::drawing; using namespace ::com::sun::star::xml::sax; @@ -540,6 +547,13 @@ XMLTextImportHelper::~XMLTextImportHelper() _FinitBackpatcher(); } +SvXMLImportPropertyMapper *XMLTextImportHelper::CreateShapeExtPropMapper() +{ + XMLPropertySetMapper *pPropMapper = + new XMLTextPropertySetMapper( TEXT_PROP_MAP_FRAME ); + return new XMLTextImportPropertyMapper( pPropMapper ); +} + void XMLTextImportHelper::SetCursor( const Reference < XTextCursor > & rCursor ) { xCursor = rCursor; @@ -967,6 +981,14 @@ SvXMLImportContext *XMLTextImportHelper::CreateTextChildContext( case XML_TOK_TEXT_TOC: pContext = new XMLIndexTOCContext( rImport, nPrefix, rLocalName ); break; + + default: + if( XML_TEXT_TYPE_BODY == eType || XML_TEXT_TYPE_TEXTBOX == eType ) + { + Reference < XShapes > xShapes; + pContext = rImport.GetShapeImport()->CreateGroupChildContext( + rImport, nPrefix, rLocalName, xAttrList, xShapes ); + } } // if( !pContext ) @@ -1185,13 +1207,13 @@ void XMLTextImportHelper::ConnectFrameChains( } } -sal_Bool XMLTextImportHelper::IsInFrame() +sal_Bool XMLTextImportHelper::IsInFrame() const { sal_Bool bIsInFrame = sal_False; // are we currently in a text frame? yes, if the cursor has a // TextFrame property and it's non-NULL - Reference<XPropertySet> xPropSet(GetCursor(), UNO_QUERY); + Reference<XPropertySet> xPropSet(((XMLTextImportHelper *)this)->GetCursor(), UNO_QUERY); if (xPropSet.is()) { if (xPropSet->getPropertySetInfo()->hasPropertyByName(sTextFrame)) @@ -1209,3 +1231,8 @@ sal_Bool XMLTextImportHelper::IsInFrame() return bIsInFrame; } + +sal_Bool XMLTextImportHelper::IsInHeaderFooter() const +{ + return sal_False; +} diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index f178ed1e135e..f1ea0e8263d0 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -2,9 +2,9 @@ * * $RCSfile: txtparae.cxx,v $ * - * $Revision: 1.17 $ + * $Revision: 1.18 $ * - * last change: $Author: dvo $ $Date: 2000-11-02 15:51:18 $ + * last change: $Author: mib $ $Date: 2000-11-07 13:33:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -149,12 +149,19 @@ #ifndef _COM_SUN_STAR_TEXT_XTEXTGRAPHICOBJECTSSUPPLIER_HPP_ #include <com/sun/star/text/XTextGraphicObjectsSupplier.hpp> #endif +#ifndef _COM_SUN_STAR_DRAWING_XDRAWPAGESUPPLIER_HPP_ +#include <com/sun/star/drawing/XDrawPageSupplier.hpp> +#endif + #ifndef _COM_SUN_STAR_TEXT_XTEXTSECTION_HPP_ #include <com/sun/star/text/XTextSection.hpp> #endif #ifndef _COM_SUN_STAR_TEXT_SECTIONFILELINK_HPP_ #include <com/sun/star/text/SectionFileLink.hpp> #endif +#ifndef _COM_SUN_STAR_DRAWING_XSHAPE_HPP_ +#include <com/sun/star/drawing/XShape.hpp> +#endif #ifndef _XMLOFF_XMLKYWD_HXX #include "xmlkywd.hxx" @@ -212,6 +219,7 @@ using namespace ::com::sun::star::beans; using namespace ::com::sun::star::container; using namespace ::com::sun::star::text; using namespace ::com::sun::star::util; +using namespace ::com::sun::star::drawing; typedef OUString *OUStringPtr; SV_DECL_PTRARR_DEL( OUStrings_Impl, OUStringPtr, 20, 10 ) @@ -223,20 +231,20 @@ SV_IMPL_OP_PTRARR_SORT( OUStringsSort_Impl, OUStringPtr ) void XMLTextParagraphExport::Add( sal_uInt16 nFamily, const Reference < XPropertySet > & rPropSet ) { - UniReference < XMLPropertySetMapper > xPropMapper; + UniReference < SvXMLExportPropertyMapper > xPropMapper; switch( nFamily ) { case XML_STYLE_FAMILY_TEXT_PARAGRAPH: - xPropMapper = GetParaPropMapper()->getPropertySetMapper(); + xPropMapper = GetParaPropMapper(); break; case XML_STYLE_FAMILY_TEXT_TEXT: - xPropMapper = GetTextPropMapper()->getPropertySetMapper(); + xPropMapper = GetTextPropMapper(); break; - case XML_STYLE_FAMILY_SD_GRAPHICS_ID: - xPropMapper = GetAutoFramePropMapper()->getPropertySetMapper(); + case XML_STYLE_FAMILY_TEXT_FRAME: + xPropMapper = GetAutoFramePropMapper(); break; case XML_STYLE_FAMILY_TEXT_SECTION: - xPropMapper = GetSectionPropMapper()->getPropertySetMapper(); + xPropMapper = GetSectionPropMapper(); break; } DBG_ASSERT( xPropMapper.is(), "There is the property mapper?" ); @@ -291,7 +299,7 @@ void XMLTextParagraphExport::Add( sal_uInt16 nFamily, aAny >>= sParent; } break; - case XML_STYLE_FAMILY_SD_GRAPHICS_ID: + case XML_STYLE_FAMILY_TEXT_FRAME: if( xPropSetInfo->hasPropertyByName( sFrameStyleName ) ) { aAny = rPropSet->getPropertyValue( sFrameStyleName ); @@ -315,20 +323,20 @@ OUString XMLTextParagraphExport::Find( const OUString& rParent ) const { OUString sName( rParent ); - UniReference < XMLPropertySetMapper > xPropMapper; + UniReference < SvXMLExportPropertyMapper > xPropMapper; switch( nFamily ) { case XML_STYLE_FAMILY_TEXT_PARAGRAPH: - xPropMapper = GetParaPropMapper()->getPropertySetMapper(); + xPropMapper = GetParaPropMapper(); break; case XML_STYLE_FAMILY_TEXT_TEXT: - xPropMapper = GetTextPropMapper()->getPropertySetMapper(); + xPropMapper = GetTextPropMapper(); break; - case XML_STYLE_FAMILY_SD_GRAPHICS_ID: - xPropMapper = GetAutoFramePropMapper()->getPropertySetMapper(); + case XML_STYLE_FAMILY_TEXT_FRAME: + xPropMapper = GetAutoFramePropMapper(); break; case XML_STYLE_FAMILY_TEXT_SECTION: - xPropMapper = GetSectionPropMapper()->getPropertySetMapper(); + xPropMapper = GetSectionPropMapper(); break; } DBG_ASSERT( xPropMapper.is(), "There is the property mapper?" ); @@ -538,8 +546,10 @@ XMLTextParagraphExport::XMLTextParagraphExport( pFieldExport( 0 ), pPageTextFrameIdxs( 0 ), pPageGraphicIdxs( 0 ), + pPageShapeIdxs( 0 ), pFrameTextFrameIdxs( 0 ), pFrameGraphicIdxs( 0 ), + pFrameShapeIdxs( 0 ), sParagraphService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Paragraph")), sTableService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextTable")), sTextFieldService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextField")), @@ -548,6 +558,7 @@ XMLTextParagraphExport::XMLTextParagraphExport( sTextEmbeddedService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextEmbeddedObject")), sTextEndnoteService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Endnote")), sTextContentService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextContent")), + sShapeService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.Shape")), sParaStyleName(RTL_CONSTASCII_USTRINGPARAM("ParaStyleName")), sParaConditionalStyleName(RTL_CONSTASCII_USTRINGPARAM("ParaConditionalStyleName")), sParaChapterNumberingLevel(RTL_CONSTASCII_USTRINGPARAM("ParaChapterNumberingLevel")), @@ -633,7 +644,7 @@ XMLTextParagraphExport::XMLTextParagraphExport( OUString sFamily( RTL_CONSTASCII_USTRINGPARAM(sXML_paragraph) ); OUString sPrefix( 'P' ); rAutoStylePool.AddFamily( XML_STYLE_FAMILY_TEXT_PARAGRAPH, sFamily, - xPropMapper, sPrefix ); + xParaPropMapper, sPrefix ); xPropMapper = new XMLTextPropertySetMapper( TEXT_PROP_MAP_TEXT ); xTextPropMapper = new XMLTextExportPropertySetMapper( xPropMapper, @@ -641,15 +652,15 @@ XMLTextParagraphExport::XMLTextParagraphExport( sFamily = OUString( RTL_CONSTASCII_USTRINGPARAM(sXML_text) ); sPrefix = OUString( 'T' ); rAutoStylePool.AddFamily( XML_STYLE_FAMILY_TEXT_TEXT, sFamily, - xPropMapper, sPrefix ); + xTextPropMapper, sPrefix ); xPropMapper = new XMLTextPropertySetMapper( TEXT_PROP_MAP_AUTO_FRAME ); xAutoFramePropMapper = new XMLTextExportPropertySetMapper( xPropMapper, GetExport() ); sFamily = OUString( RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_NAME) ); - sPrefix = OUString( 'G' ); - rAutoStylePool.AddFamily( XML_STYLE_FAMILY_SD_GRAPHICS_ID, sFamily, - xPropMapper, sPrefix ); + sPrefix = OUString( RTL_CONSTASCII_USTRINGPARAM( "fr" ) ); + rAutoStylePool.AddFamily( XML_STYLE_FAMILY_TEXT_FRAME, sFamily, + xAutoFramePropMapper, sPrefix ); xPropMapper = new XMLTextPropertySetMapper( TEXT_PROP_MAP_SECTION ); xSectionPropMapper = new XMLTextExportPropertySetMapper( xPropMapper, @@ -657,7 +668,7 @@ XMLTextParagraphExport::XMLTextParagraphExport( sFamily = OUString( RTL_CONSTASCII_USTRINGPARAM( sXML_section ) ); sPrefix = OUString( RTL_CONSTASCII_USTRINGPARAM( "Sect" ) ); rAutoStylePool.AddFamily( XML_STYLE_FAMILY_TEXT_SECTION, sFamily, - xPropMapper, sPrefix ); + xSectionPropMapper, sPrefix ); xPropMapper = new XMLTextPropertySetMapper( TEXT_PROP_MAP_FRAME ); xFramePropMapper = new XMLTextExportPropertySetMapper( xPropMapper, @@ -674,8 +685,18 @@ XMLTextParagraphExport::~XMLTextParagraphExport() delete pListAutoPool; delete pPageTextFrameIdxs; delete pPageGraphicIdxs; + delete pPageShapeIdxs; delete pFrameTextFrameIdxs; delete pFrameGraphicIdxs; + delete pFrameShapeIdxs; +} + +SvXMLExportPropertyMapper *XMLTextParagraphExport::CreateShapeExtPropMapper( + SvXMLExport& rExport ) +{ + UniReference < XMLPropertySetMapper > xPropMapper = + new XMLTextPropertySetMapper( TEXT_PROP_MAP_SHAPE ); + return new XMLTextExportPropertySetMapper( xPropMapper, rExport ); } void XMLTextParagraphExport::collectFrames() @@ -746,6 +767,43 @@ void XMLTextParagraphExport::collectFrames() } } } + + Reference < XDrawPageSupplier > xDPS( GetExport().GetModel(), + UNO_QUERY ); + if( xDPS.is() ) + { + xShapes = Reference < XIndexAccess >( xDPS->getDrawPage(), + UNO_QUERY ); + sal_Int32 nCount = xShapes->getCount(); + for( sal_Int32 i = 0; i < nCount; i++ ) + { + Any aAny = xShapes->getByIndex( i ); + Reference < XShape > xShape; + aAny >>= xShape; + if( !xShape.is() ) + continue; + + Reference < XPropertySet > xPropSet( xShape, UNO_QUERY ); + + aAny = xPropSet->getPropertyValue( sAnchorType ); + TextContentAnchorType eAnchor; + aAny >>= eAnchor; + + switch( eAnchor ) + { + case TextContentAnchorType_AT_PAGE: + if( !pPageShapeIdxs ) + pPageShapeIdxs = new SvLongs; + pPageShapeIdxs->Insert( i, pPageShapeIdxs->Count() ); + break; + case TextContentAnchorType_AT_FRAME: + if( !pFrameShapeIdxs ) + pFrameShapeIdxs = new SvLongs; + pFrameShapeIdxs->Insert( i, pFrameShapeIdxs->Count() ); + break; + } + } + } } void XMLTextParagraphExport::exportPageFrames( sal_Bool bAutoStyles ) @@ -771,6 +829,17 @@ void XMLTextParagraphExport::exportPageFrames( sal_Bool bAutoStyles ) exportTextGraphic( xTxtCntnt, bAutoStyles ); } } + if( pPageShapeIdxs ) + { + for( sal_Int32 i = 0; i < pPageShapeIdxs->Count(); i++ ) + { + Any aAny = xShapes->getByIndex( (*pPageShapeIdxs)[i] ); + Reference < XShape > xShape; + aAny >>= xShape; + Reference < XTextContent > xTxtCntnt( xShape, UNO_QUERY ); + exportShape( xTxtCntnt, bAutoStyles ); + } + } } void XMLTextParagraphExport::exportText( @@ -836,6 +905,10 @@ void XMLTextParagraphExport::exportTextContentEnumeration( { exportTextEmbedded( xTxtCntnt, bAutoStyles ); } + else if( xServiceInfo->supportsService( sShapeService ) ) + { + exportShape( xTxtCntnt, bAutoStyles ); + } else { DBG_ASSERT( !xTxtCntnt.is(), "unknown text content" ); @@ -1140,9 +1213,12 @@ void XMLTextParagraphExport::exportTextMark( // else: no styles. (see above) } -void XMLTextParagraphExport::addTextFrameAttributes( - const Reference < XPropertySet >& rPropSet ) +sal_Int32 XMLTextParagraphExport::addTextFrameAttributes( + const Reference < XPropertySet >& rPropSet, + sal_Bool bShape ) { + sal_Int32 nShapeFeatures = SEF_DEFAULT; + // draw:name Reference < XNamed > xNamed( rPropSet, UNO_QUERY ); if( xNamed.is() ) @@ -1176,41 +1252,56 @@ void XMLTextParagraphExport::addTextFrameAttributes( sValue.makeStringAndClear() ); } - // svg:x - sal_Int16 nHoriOrient = HoriOrientation::NONE; - aAny = rPropSet->getPropertyValue( sHoriOrient ); - aAny >>= nHoriOrient; - if( HoriOrientation::NONE == nHoriOrient ) + if( !bShape ) { - sal_Int32 nPos = 0; - Any aAny = rPropSet->getPropertyValue( sHoriOrientPosition ); - aAny >>= nPos; - GetExport().GetMM100UnitConverter().convertMeasure( sValue, nPos ); - GetExport().AddAttribute( XML_NAMESPACE_SVG, sXML_x, - sValue.makeStringAndClear() ); + // svg:x + sal_Int16 nHoriOrient = HoriOrientation::NONE; + aAny = rPropSet->getPropertyValue( sHoriOrient ); + aAny >>= nHoriOrient; + if( HoriOrientation::NONE == nHoriOrient ) + { + sal_Int32 nPos = 0; + Any aAny = rPropSet->getPropertyValue( sHoriOrientPosition ); + aAny >>= nPos; + GetExport().GetMM100UnitConverter().convertMeasure( sValue, nPos ); + GetExport().AddAttribute( XML_NAMESPACE_SVG, sXML_x, + sValue.makeStringAndClear() ); + } } + else if( TextContentAnchorType_AS_CHARACTER == eAnchor ) + nShapeFeatures = (nShapeFeatures & ~SEF_EXPORT_X); - // svg:y - sal_Int16 nVertOrient = VertOrientation::NONE; - aAny = rPropSet->getPropertyValue( sVertOrient ); - aAny >>= nVertOrient; - if( VertOrientation::NONE == nVertOrient ) + if( !bShape || TextContentAnchorType_AS_CHARACTER == eAnchor ) { - sal_Int32 nPos = 0; - Any aAny = rPropSet->getPropertyValue( sVertOrientPosition ); - aAny >>= nPos; - GetExport().GetMM100UnitConverter().convertMeasure( sValue, nPos ); - GetExport().AddAttribute( XML_NAMESPACE_SVG, sXML_y, - sValue.makeStringAndClear() ); + // svg:y + sal_Int16 nVertOrient = VertOrientation::NONE; + aAny = rPropSet->getPropertyValue( sVertOrient ); + aAny >>= nVertOrient; + if( VertOrientation::NONE == nVertOrient ) + { + sal_Int32 nPos = 0; + Any aAny = rPropSet->getPropertyValue( sVertOrientPosition ); + aAny >>= nPos; + GetExport().GetMM100UnitConverter().convertMeasure( sValue, nPos ); + GetExport().AddAttribute( XML_NAMESPACE_SVG, sXML_y, + sValue.makeStringAndClear() ); + } + else if( bShape ) + nShapeFeatures = (nShapeFeatures & ~SEF_EXPORT_Y); } + Reference< XPropertySetInfo > xPropSetInfo = rPropSet->getPropertySetInfo(); + // svg:width sal_Int8 nRelWidth = 0; - aAny = rPropSet->getPropertyValue( sRelativeWidth ); - aAny >>= nRelWidth; - DBG_ASSERT( nRelWidth >= 0 && nRelWidth <= 100, - "Got illegal relative width from API" ); + if( xPropSetInfo->hasPropertyByName( sRelativeWidth ) ) + { + aAny = rPropSet->getPropertyValue( sRelativeWidth ); + aAny >>= nRelWidth; + DBG_ASSERT( nRelWidth >= 0 && nRelWidth <= 100, + "Got illegal relative width from API" ); + } if( nRelWidth > 0 ) { // TODO: instead of checking this value for 255 a new property @@ -1219,21 +1310,26 @@ void XMLTextParagraphExport::addTextFrameAttributes( GetExport().GetMM100UnitConverter().convertPercent( sValue, nRelWidth ); } - else + else if( xPropSetInfo->hasPropertyByName( sWidth ) ) + { sal_Int32 nWidth = 0; aAny = rPropSet->getPropertyValue( sWidth ); aAny >>= nWidth; GetExport().GetMM100UnitConverter().convertMeasure( sValue, nWidth ); } - GetExport().AddAttribute( XML_NAMESPACE_SVG, sXML_width, - sValue.makeStringAndClear() ); + if( sValue.getLength() ) + GetExport().AddAttribute( XML_NAMESPACE_SVG, sXML_width, + sValue.makeStringAndClear() ); // svg:height or fo:min-height - aAny = rPropSet->getPropertyValue( sSizeRelative ); - sal_Bool bSyncHeight = *(sal_Bool *)aAny.getValue(); + sal_Bool bSyncHeight = sal_False; + if( xPropSetInfo->hasPropertyByName( sSizeRelative ) ) + { + aAny = rPropSet->getPropertyValue( sSizeRelative ); + bSyncHeight = *(sal_Bool *)aAny.getValue(); + } - Reference< XPropertySetInfo > xPropSetInfo = rPropSet->getPropertySetInfo(); sal_Int16 nSizeType = SizeType::FIX; if( xPropSetInfo->hasPropertyByName( sSizeType ) ) { @@ -1247,14 +1343,18 @@ void XMLTextParagraphExport::addTextFrameAttributes( if( !bSyncHeight && SizeType::VARIABLE != nSizeType ) { sal_Int8 nRelHeight = 0; - aAny = rPropSet->getPropertyValue( sRelativeHeight ); - aAny >>= nRelHeight; + if( xPropSetInfo->hasPropertyByName( sRelativeHeight ) ) + { + aAny = rPropSet->getPropertyValue( sRelativeHeight ); + aAny >>= nRelHeight; + } if( nRelHeight > 0 ) { GetExport().GetMM100UnitConverter().convertPercent( sValue, nRelHeight ); } - else + else if( xPropSetInfo->hasPropertyByName( sHeight ) ) + { sal_Int32 nHeight = 0; aAny = rPropSet->getPropertyValue( sHeight ); @@ -1262,13 +1362,18 @@ void XMLTextParagraphExport::addTextFrameAttributes( GetExport().GetMM100UnitConverter().convertMeasure( sValue, nHeight ); } - if( SizeType::MIN == nSizeType ) - GetExport().AddAttribute( XML_NAMESPACE_FO, sXML_min_height, - sValue.makeStringAndClear() ); - else - GetExport().AddAttribute( XML_NAMESPACE_SVG, sXML_height, - sValue.makeStringAndClear() ); + if( sValue.getLength() ) + { + if( SizeType::MIN == nSizeType ) + GetExport().AddAttribute( XML_NAMESPACE_FO, sXML_min_height, + sValue.makeStringAndClear() ); + else + GetExport().AddAttribute( XML_NAMESPACE_SVG, sXML_height, + sValue.makeStringAndClear() ); + } } + + return nShapeFeatures; } void XMLTextParagraphExport::_exportTextFrame( @@ -1287,11 +1392,11 @@ void XMLTextParagraphExport::_exportTextFrame( } OUString sAutoStyle( sStyle ); - sAutoStyle = Find( XML_STYLE_FAMILY_SD_GRAPHICS_ID, rPropSet, sStyle ); + sAutoStyle = Find( XML_STYLE_FAMILY_TEXT_FRAME, rPropSet, sStyle ); if( sAutoStyle.getLength() ) GetExport().AddAttribute( XML_NAMESPACE_DRAW, sXML_style_name, sAutoStyle ); - addTextFrameAttributes( rPropSet ); + addTextFrameAttributes( rPropSet, sal_False ); // draw:chain-next-name if( rPropSetInfo->hasPropertyByName( sChainNextName ) ) @@ -1319,7 +1424,7 @@ void XMLTextParagraphExport::exportTextFrame( { Reference < XTextFrame > xTxtFrame( rTxtCntnt, UNO_QUERY ); Reference < XText > xTxt = xTxtFrame->getText(); - Add( XML_STYLE_FAMILY_SD_GRAPHICS_ID, xPropSet ); + Add( XML_STYLE_FAMILY_TEXT_FRAME, xPropSet ); exportText( xTxt, bAutoStyles ); } else @@ -1357,11 +1462,11 @@ void XMLTextParagraphExport::_exportTextGraphic( } OUString sAutoStyle( sStyle ); - sAutoStyle = Find( XML_STYLE_FAMILY_SD_GRAPHICS_ID, rPropSet, sStyle ); + sAutoStyle = Find( XML_STYLE_FAMILY_TEXT_FRAME, rPropSet, sStyle ); if( sAutoStyle.getLength() ) GetExport().AddAttribute( XML_NAMESPACE_DRAW, sXML_style_name, sAutoStyle ); - addTextFrameAttributes( rPropSet ); + addTextFrameAttributes( rPropSet, sal_False ); // xlink:href OUString sURL; @@ -1406,7 +1511,7 @@ void XMLTextParagraphExport::exportTextGraphic( if( bAutoStyles ) { - Add( XML_STYLE_FAMILY_SD_GRAPHICS_ID, xPropSet ); + Add( XML_STYLE_FAMILY_TEXT_FRAME, xPropSet ); } else { @@ -1430,6 +1535,24 @@ void XMLTextParagraphExport::exportTextGraphic( } } +void XMLTextParagraphExport::exportShape( + const Reference < XTextContent > & rTxtCntnt, + sal_Bool bAutoStyles ) +{ + Reference < XShape > xShape( rTxtCntnt, UNO_QUERY ); + + if( bAutoStyles ) + { + GetExport().GetShapeExport()->collectShapeAutoStyles( xShape ); + } + else + { + Reference < XPropertySet > xPropSet( rTxtCntnt, UNO_QUERY ); + sal_Int32 nFeatures = addTextFrameAttributes( xPropSet, sal_True ); + GetExport().GetShapeExport()->exportShape( xShape, nFeatures ); + } +} + void XMLTextParagraphExport::exportTextEmbedded( const Reference < XTextContent > & rTxtCntnt, sal_Bool bAutoStyles ) @@ -1685,27 +1808,21 @@ void XMLTextParagraphExport::exportTextDeclarations() void XMLTextParagraphExport::exportTextAutoStyles() { GetAutoStylePool().exportXML( XML_STYLE_FAMILY_TEXT_PARAGRAPH, - *GetParaPropMapper().get(), GetExport().GetDocHandler(), GetExport().GetMM100UnitConverter(), GetExport().GetNamespaceMap() ); GetAutoStylePool().exportXML( XML_STYLE_FAMILY_TEXT_TEXT, - *GetTextPropMapper().get(), GetExport().GetDocHandler(), GetExport().GetMM100UnitConverter(), GetExport().GetNamespaceMap() ); -/* - GetAutoStylePool().exportXML( XML_STYLE_FAMILY_SD_GRAPHICS_ID, - *GetAutoFramePropMapper().get(), + GetAutoStylePool().exportXML( XML_STYLE_FAMILY_TEXT_FRAME, GetExport().GetDocHandler(), GetExport().GetMM100UnitConverter(), GetExport().GetNamespaceMap() ); -*/ GetAutoStylePool().exportXML( XML_STYLE_FAMILY_TEXT_SECTION, - *GetSectionPropMapper().get(), GetExport().GetDocHandler(), GetExport().GetMM100UnitConverter(), GetExport().GetNamespaceMap() ); diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx index 5a7a4aa9c8df..d94ae7e30f1f 100644 --- a/xmloff/source/text/txtparai.cxx +++ b/xmloff/source/text/txtparai.cxx @@ -2,9 +2,9 @@ * * $RCSfile: txtparai.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: dvo $ $Date: 2000-11-02 15:51:18 $ + * last change: $Author: mib $ $Date: 2000-11-07 13:33:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -89,6 +89,9 @@ #ifndef _COM_SUN_STAR_TEXT_CONTROLCHARACTER_HPP_ #include <com/sun/star/text/ControlCharacter.hpp> #endif +#ifndef _COM_SUN_STAR_DRAWING_XSHAPES_HPP_ +#include <com/sun/star/drawing/XShapes.hpp> +#endif #ifndef _XMLOFF_XMLICTXT_HXX @@ -132,6 +135,7 @@ using namespace ::rtl; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::text; +using namespace ::com::sun::star::drawing; // --------------------------------------------------------------------- @@ -779,7 +783,13 @@ SvXMLImportContext *XMLImpSpanContext_Impl::CreateChildContext( // text field found: white space! rIgnoreLeadingSpace = sal_False; } - else + else if( !rImport.GetTextImport()->IsInHeaderFooter() ) + { + Reference < XShapes > xShapes; + pContext = rImport.GetShapeImport()->CreateGroupChildContext( + rImport, nPrefix, rLocalName, xAttrList, xShapes ); + } + if( !pContext ) { // ignore unknown content pContext = diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx index 1943e86af1e2..635a212b88ee 100644 --- a/xmloff/source/text/txtprmap.cxx +++ b/xmloff/source/text/txtprmap.cxx @@ -2,9 +2,9 @@ * * $RCSfile: txtprmap.cxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: dvo $ $Date: 2000-11-02 15:51:18 $ + * last change: $Author: mib $ $Date: 2000-11-07 13:33:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -62,18 +62,6 @@ #ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> #endif -#ifndef _COM_SUN_STAR_TABLE_BORDERLINE_HPP_ -#include <com/sun/star/table/BorderLine.hpp> -#endif -#ifndef _COM_SUN_STAR_TEXT_SIZETYPE_HPP_ -#include <com/sun/star/text/SizeType.hpp> -#endif -#ifndef _COM_SUN_STAR_TEXT_WRAPTEXTMODE_HPP_ -#include <com/sun/star/text/WrapTextMode.hpp> -#endif -#ifndef _COM_SUN_STAR_TEXT_TEXTCONTENTANCHORTYPE_HPP -#include <com/sun/star/text/TextContentAnchorType.hpp> -#endif #ifndef _XMLOFF_XMLNMSPE_HXX #include "xmlnmspe.hxx" @@ -88,13 +76,8 @@ #include "txtprmap.hxx" #endif -//using namespace ::rtl; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; -//using namespace ::com::sun::star::style; -//using namespace ::com::sun::star::container; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::text; #define M_E( a, p, l, t, c ) \ { a, XML_NAMESPACE_##p, sXML_##l, t, c } @@ -501,6 +484,35 @@ XMLPropertyMapEntry aXMLFramePropMap[] = { 0, 0, 0, 0 } }; +XMLPropertyMapEntry aXMLShapePropMap[] = +{ + // RES_LR_SPACE + M_E( "LeftMargin", FO, margin_left, XML_TYPE_MEASURE, 0), + M_E( "RightMargin", FO, margin_right, XML_TYPE_MEASURE, 0 ), + // RES_UL_SPACE + M_E( "TopMargin", FO, margin_top, XML_TYPE_MEASURE, 0 ), + M_E( "BottomMargin", FO, margin_bottom, XML_TYPE_MEASURE, 0 ), + // RES_SURROUND + M_E( "TextWrap", STYLE, wrap, XML_TYPE_TEXT_WRAP, CTF_WRAP ), + M_E( "SurroundAnchorOnly", STYLE, number_wrapped_paragraphs, XML_TYPE_TEXT_PARAGRAPH_ONLY, CTF_WRAP_PARAGRAPH_ONLY ), + M_E( "SurroundContour", STYLE, wrap_contour, XML_TYPE_BOOL, CTF_WRAP_CONTOUR ), + M_E( "ContourOutside", STYLE, wrap_contour_mode, XML_TYPE_TEXT_WRAP_OUTSIDE, CTF_WRAP_CONTOUR_MODE ), + // RES_VERT_ORIENT + M_E( "VertOrient", STYLE, vertical_pos, XML_TYPE_TEXT_VERTICAL_POS, CTF_VERTICALPOS ), + M_E( "VertOrient", STYLE, vertical_rel, XML_TYPE_TEXT_VERTICAL_REL_AS_CHAR|MID_FLAG_MULTI_PROPERTY, CTF_VERTICALREL_ASCHAR ), + M_E( "VertOrientRelation", STYLE, vertical_rel, XML_TYPE_TEXT_VERTICAL_REL, CTF_VERTICALREL ), + M_E( "VertOrientRelation", STYLE, vertical_rel, XML_TYPE_TEXT_VERTICAL_REL_PAGE|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_VERTICALREL_PAGE ), + M_E( "VertOrientRelation", STYLE, vertical_rel, XML_TYPE_TEXT_VERTICAL_REL_FRAME|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_VERTICALREL_FRAME ), + // RES_HORI_ORIENT + M_E( "HoriOrient", STYLE, horizontal_pos, XML_TYPE_TEXT_HORIZONTAL_POS|MID_FLAG_MULTI_PROPERTY, CTF_HORIZONTALPOS ), + M_E( "PageToggle", STYLE, horizontal_pos, XML_TYPE_TEXT_HORIZONTAL_MIRROR, CTF_HORIZONTALMIRROR ), + M_E( "HoriOrient", STYLE, horizontal_pos, XML_TYPE_TEXT_HORIZONTAL_POS_MIRRORED|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_HORIZONTALPOS_MIRRORED ), + M_E( "HoriOrientRelation", STYLE, horizontal_rel, XML_TYPE_TEXT_HORIZONTAL_REL, CTF_HORIZONTALREL ), + M_E( "HoriOrientRelation", STYLE, horizontal_rel, XML_TYPE_TEXT_HORIZONTAL_REL_FRAME|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_HORIZONTALREL_FRAME ), + M_E( "UserDefinedAttributes", TEXT, xmlns, XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM, 0 ), + { 0, 0, 0, 0 } +}; + XMLPropertyMapEntry aXMLSectionPropMap[] = { M_E( "TextColumns", STYLE, columns, MID_FLAG_ELEMENT_ITEM|XML_TYPE_TEXT_COLUMNS, CTF_TEXTCOLUMNS ), @@ -508,494 +520,6 @@ XMLPropertyMapEntry aXMLSectionPropMap[] = { 0, 0, 0, 0 } }; -void XMLTextPropertySetMapper::ContextFilter( - ::std::vector< XMLPropertyState >& rProperties, - Reference< XPropertySet > rPropSet ) const -{ - // filter char height point/percent - XMLPropertyState* pCharHeightState = NULL; - XMLPropertyState* pCharPropHeightState = NULL; - XMLPropertyState* pCharDiffHeightState = NULL; - - // filter left margin measure/percent - XMLPropertyState* pParaLeftMarginState = NULL; - XMLPropertyState* pParaLeftMarginRelState = NULL; - - // filter right margin measure/percent - XMLPropertyState* pParaRightMarginState = NULL; - XMLPropertyState* pParaRightMarginRelState = NULL; - - // filter first line indent measure/percent - XMLPropertyState* pParaFirstLineState = NULL; - XMLPropertyState* pParaFirstLineRelState = NULL; - - // filter ParaTopMargin/Relative - XMLPropertyState* pParaTopMarginState = NULL; - XMLPropertyState* pParaTopMarginRelState = NULL; - - // filter ParaTopMargin/Relative - XMLPropertyState* pParaBottomMarginState = NULL; - XMLPropertyState* pParaBottomMarginRelState = NULL; - - // filter (Left|Right|Top|Bottom|)BorderWidth - XMLPropertyState* pAllBorderWidthState = NULL; - XMLPropertyState* pLeftBorderWidthState = NULL; - XMLPropertyState* pRightBorderWidthState = NULL; - XMLPropertyState* pTopBorderWidthState = NULL; - XMLPropertyState* pBottomBorderWidthState = NULL; - - // filter (Left|Right|Top|)BorderDistance - XMLPropertyState* pAllBorderDistanceState = NULL; - XMLPropertyState* pLeftBorderDistanceState = NULL; - XMLPropertyState* pRightBorderDistanceState = NULL; - XMLPropertyState* pTopBorderDistanceState = NULL; - XMLPropertyState* pBottomBorderDistanceState = NULL; - - // filter (Left|Right|Top|Bottom|)Border - XMLPropertyState* pAllBorderState = NULL; - XMLPropertyState* pLeftBorderState = NULL; - XMLPropertyState* pRightBorderState = NULL; - XMLPropertyState* pTopBorderState = NULL; - XMLPropertyState* pBottomBorderState = NULL; - - // filter width/height properties - XMLPropertyState* pWidthAbsState = NULL; - XMLPropertyState* pWidthMinAbsState = NULL; - XMLPropertyState* pWidthRelState = NULL; - XMLPropertyState* pWidthMinRelState = NULL; - XMLPropertyState* pHeightAbsState = NULL; - XMLPropertyState* pHeightMinAbsState = NULL; - XMLPropertyState* pHeightRelState = NULL; - XMLPropertyState* pHeightMinRelState = NULL; - XMLPropertyState* pSizeTypeState = NULL; - XMLPropertyState* pSyncHeightState = NULL; - - // wrap - XMLPropertyState* pWrapState = NULL; - XMLPropertyState* pWrapContourState = NULL; - XMLPropertyState* pWrapContourModeState = NULL; - XMLPropertyState* pWrapParagraphOnlyState = NULL; - - // anchor - XMLPropertyState* pAnchorTypeState = NULL; - XMLPropertyState* pAnchorPageNumberState = NULL; - - // horizontal position and relation - XMLPropertyState* pHoriOrientState = NULL; - XMLPropertyState* pHoriOrientMirroredState = NULL; - XMLPropertyState* pHoriOrientRelState = NULL; - XMLPropertyState* pHoriOrientRelFrameState = NULL; - XMLPropertyState* pHoriOrientMirrorState = NULL; - - // vertical position and relation - XMLPropertyState* pVertOrientState = NULL; - XMLPropertyState* pVertOrientRelState = NULL; - XMLPropertyState* pVertOrientRelPageState = NULL; - XMLPropertyState* pVertOrientRelFrameState = NULL; - XMLPropertyState* pVertOrientRelAsCharState = NULL; - - sal_Bool bNeedsAnchor = sal_False; - - for( ::std::vector< XMLPropertyState >::iterator propertie = rProperties.begin(); - propertie != rProperties.end(); - propertie++ ) - { - switch( GetEntryContextId( propertie->mnIndex ) ) - { - case CTF_CHARHEIGHT: pCharHeightState = propertie; break; - case CTF_CHARHEIGHT_REL: pCharPropHeightState = propertie; break; - case CTF_CHARHEIGHT_DIFF: pCharDiffHeightState = propertie; break; - case CTF_PARALEFTMARGIN: pParaLeftMarginState = propertie; break; - case CTF_PARALEFTMARGIN_REL: pParaLeftMarginRelState = propertie; break; - case CTF_PARARIGHTMARGIN: pParaRightMarginState = propertie; break; - case CTF_PARARIGHTMARGIN_REL: pParaRightMarginRelState = propertie; break; - case CTF_PARAFIRSTLINE: pParaFirstLineState = propertie; break; - case CTF_PARAFIRSTLINE_REL: pParaFirstLineRelState = propertie; break; - case CTF_PARATOPMARGIN: pParaTopMarginState = propertie; break; - case CTF_PARATOPMARGIN_REL: pParaTopMarginRelState = propertie; break; - case CTF_PARABOTTOMMARGIN: pParaBottomMarginState = propertie; break; - case CTF_PARABOTTOMMARGIN_REL: pParaBottomMarginRelState = propertie; break; - case CTF_ALLBORDERWIDTH: pAllBorderWidthState = propertie; break; - case CTF_LEFTBORDERWIDTH: pLeftBorderWidthState = propertie; break; - case CTF_RIGHTBORDERWIDTH: pRightBorderWidthState = propertie; break; - case CTF_TOPBORDERWIDTH: pTopBorderWidthState = propertie; break; - case CTF_BOTTOMBORDERWIDTH: pBottomBorderWidthState = propertie; break; - case CTF_ALLBORDERDISTANCE: pAllBorderDistanceState = propertie; break; - case CTF_LEFTBORDERDISTANCE: pLeftBorderDistanceState = propertie; break; - case CTF_RIGHTBORDERDISTANCE: pRightBorderDistanceState = propertie; break; - case CTF_TOPBORDERDISTANCE: pTopBorderDistanceState = propertie; break; - case CTF_BOTTOMBORDERDISTANCE: pBottomBorderDistanceState = propertie; break; - case CTF_ALLBORDER: pAllBorderState = propertie; break; - case CTF_LEFTBORDER: pLeftBorderState = propertie; break; - case CTF_RIGHTBORDER: pRightBorderState = propertie; break; - case CTF_TOPBORDER: pTopBorderState = propertie; break; - case CTF_BOTTOMBORDER: pBottomBorderState = propertie; break; - - case CTF_FRAMEWIDTH_ABS: pWidthAbsState = propertie; break; - case CTF_FRAMEWIDTH_REL: pWidthRelState = propertie; break; - case CTF_FRAMEHEIGHT_ABS: pHeightAbsState = propertie; break; - case CTF_FRAMEHEIGHT_MIN_ABS: pHeightMinAbsState = propertie; break; - case CTF_FRAMEHEIGHT_REL: pHeightRelState = propertie; break; - case CTF_FRAMEHEIGHT_MIN_REL: pHeightMinRelState = propertie; break; - case CTF_SIZETYPE: pSizeTypeState = propertie; break; - case CTF_SYNCHEIGHT: pSyncHeightState = propertie; break; - - case CTF_WRAP: pWrapState = propertie; break; - case CTF_WRAP_CONTOUR: pWrapContourState = propertie; break; - case CTF_WRAP_CONTOUR_MODE: pWrapContourModeState = propertie; break; - case CTF_WRAP_PARAGRAPH_ONLY: pWrapParagraphOnlyState = propertie; break; - case CTF_ANCHORTYPE: pAnchorTypeState = propertie; break; - case CTF_ANCHORPAGENUMBER: pAnchorPageNumberState = propertie; bNeedsAnchor = sal_True; break; - - case CTF_HORIZONTALPOS: pHoriOrientState = propertie; bNeedsAnchor = sal_True; break; - case CTF_HORIZONTALPOS_MIRRORED: pHoriOrientMirroredState = propertie; bNeedsAnchor = sal_True; break; - case CTF_HORIZONTALREL: pHoriOrientRelState = propertie; bNeedsAnchor = sal_True; break; - case CTF_HORIZONTALREL_FRAME: pHoriOrientRelFrameState = propertie; bNeedsAnchor = sal_True; break; - case CTF_HORIZONTALMIRROR: pHoriOrientMirrorState = propertie; bNeedsAnchor = sal_True; break; - case CTF_VERTICALPOS: pVertOrientState = propertie; bNeedsAnchor = sal_True; break; - case CTF_VERTICALREL: pVertOrientRelState = propertie; bNeedsAnchor = sal_True; break; - case CTF_VERTICALREL_PAGE: pVertOrientRelPageState = propertie; bNeedsAnchor = sal_True; break; - case CTF_VERTICALREL_FRAME: pVertOrientRelFrameState = propertie; bNeedsAnchor = sal_True; break; - case CTF_VERTICALREL_ASCHAR: pVertOrientRelAsCharState = propertie; bNeedsAnchor = sal_True; break; - } - } - - if( pCharHeightState && pCharPropHeightState ) - { - sal_Int32 nTemp; - pCharPropHeightState->maValue >>= nTemp; - if( nTemp == 100 ) - { - pCharPropHeightState->mnIndex = -1; - pCharPropHeightState->maValue.clear(); - } - else - { - pCharHeightState->mnIndex = -1; - pCharHeightState->maValue.clear(); - } - } - if( pCharHeightState && pCharDiffHeightState ) - { - float nTemp; - pCharDiffHeightState->maValue >>= nTemp; - if( nTemp == 0. ) - { - pCharDiffHeightState->mnIndex = -1; - pCharDiffHeightState->maValue.clear(); - } - else - { - pCharHeightState->mnIndex = -1; - pCharHeightState->maValue.clear(); - } - } - - if( pParaLeftMarginState && pParaLeftMarginRelState ) - { - sal_Int32 nTemp; - pParaLeftMarginRelState->maValue >>= nTemp; - if( nTemp == 100 ) - { - pParaLeftMarginRelState->mnIndex = -1; - pParaLeftMarginRelState->maValue.clear(); - } - else - { - pParaLeftMarginState->mnIndex = -1; - pParaLeftMarginState->maValue.clear(); - } - - } - - if( pParaRightMarginState && pParaRightMarginRelState ) - { - sal_Int32 nTemp; - pParaRightMarginRelState->maValue >>= nTemp; - if( nTemp == 100 ) - { - pParaRightMarginRelState->mnIndex = -1; - pParaRightMarginRelState->maValue.clear(); - } - else - { - pParaRightMarginState->mnIndex = -1; - pParaRightMarginState->maValue.clear(); - } - } - - if( pParaFirstLineState && pParaFirstLineRelState ) - { - sal_Int32 nTemp; - pParaFirstLineRelState->maValue >>= nTemp; - if( nTemp == 100 ) - { - pParaFirstLineRelState->mnIndex = -1; - pParaFirstLineRelState->maValue.clear(); - } - else - { - pParaFirstLineState->mnIndex = -1; - pParaFirstLineState->maValue.clear(); - } - } - - if( pParaTopMarginState && pParaTopMarginRelState ) - { - sal_Int32 nTemp; - pParaTopMarginRelState->maValue >>= nTemp; - if( nTemp == 100 ) - { - pParaTopMarginRelState->mnIndex = -1; - pParaTopMarginRelState->maValue.clear(); - } - else - { - pParaTopMarginState->mnIndex = -1; - pParaTopMarginState->maValue.clear(); - } - - } - - if( pParaBottomMarginState && pParaBottomMarginRelState ) - { - sal_Int32 nTemp; - pParaBottomMarginRelState->maValue >>= nTemp; - if( nTemp == 100 ) - { - pParaBottomMarginRelState->mnIndex = -1; - pParaBottomMarginRelState->maValue.clear(); - } - else - { - pParaBottomMarginState->mnIndex = -1; - pParaBottomMarginState->maValue.clear(); - } - - } - - if( pAllBorderWidthState ) - { - if( pLeftBorderWidthState && pRightBorderWidthState && pTopBorderWidthState && pBottomBorderWidthState ) - { - table::BorderLine aLeft, aRight, aTop, aBottom; - - pLeftBorderWidthState->maValue >>= aLeft; - pRightBorderWidthState->maValue >>= aRight; - pTopBorderWidthState->maValue >>= aTop; - pBottomBorderWidthState->maValue >>= aBottom; - if( aLeft.Color == aRight.Color && aLeft.InnerLineWidth == aRight.InnerLineWidth && - aLeft.OuterLineWidth == aRight.OuterLineWidth && aLeft.LineDistance == aRight.LineDistance && - aLeft.Color == aTop.Color && aLeft.InnerLineWidth == aTop.InnerLineWidth && - aLeft.OuterLineWidth == aTop.OuterLineWidth && aLeft.LineDistance == aTop.LineDistance && - aLeft.Color == aBottom.Color && aLeft.InnerLineWidth == aBottom.InnerLineWidth && - aLeft.OuterLineWidth == aBottom.OuterLineWidth && aLeft.LineDistance == aBottom.LineDistance ) - { - pLeftBorderWidthState->mnIndex = -1; - pLeftBorderWidthState->maValue.clear(); - pRightBorderWidthState->mnIndex = -1; - pRightBorderWidthState->maValue.clear(); - pTopBorderWidthState->mnIndex = -1; - pTopBorderWidthState->maValue.clear(); - pBottomBorderWidthState->mnIndex = -1; - pBottomBorderWidthState->maValue.clear(); - } - else - { - pAllBorderWidthState->mnIndex = -1; - pAllBorderWidthState->maValue.clear(); - } - } - else - { - pAllBorderWidthState->mnIndex = -1; - pAllBorderWidthState->maValue.clear(); - } - } - - if( pAllBorderDistanceState ) - { - if( pLeftBorderDistanceState && pRightBorderDistanceState && pTopBorderDistanceState && pBottomBorderDistanceState ) - { - sal_Int32 aLeft, aRight, aTop, aBottom; - - pLeftBorderDistanceState->maValue >>= aLeft; - pRightBorderDistanceState->maValue >>= aRight; - pTopBorderDistanceState->maValue >>= aTop; - pBottomBorderDistanceState->maValue >>= aBottom; - if( aLeft == aRight && aLeft == aTop && aLeft == aBottom ) - { - pLeftBorderDistanceState->mnIndex = -1; - pLeftBorderDistanceState->maValue.clear(); - pRightBorderDistanceState->mnIndex = -1; - pRightBorderDistanceState->maValue.clear(); - pTopBorderDistanceState->mnIndex = -1; - pTopBorderDistanceState->maValue.clear(); - pBottomBorderDistanceState->mnIndex = -1; - pBottomBorderDistanceState->maValue.clear(); - } - else - { - pAllBorderDistanceState->mnIndex = -1; - pAllBorderDistanceState->maValue.clear(); - } - } - else - { - pAllBorderDistanceState->mnIndex = -1; - pAllBorderDistanceState->maValue.clear(); - } - } - - if( pAllBorderState ) - { - if( pLeftBorderState && pRightBorderState && pTopBorderState && pBottomBorderState ) - { - table::BorderLine aLeft, aRight, aTop, aBottom; - - pLeftBorderState->maValue >>= aLeft; - pRightBorderState->maValue >>= aRight; - pTopBorderState->maValue >>= aTop; - pBottomBorderState->maValue >>= aBottom; - if( aLeft.Color == aRight.Color && aLeft.InnerLineWidth == aRight.InnerLineWidth && - aLeft.OuterLineWidth == aRight.OuterLineWidth && aLeft.LineDistance == aRight.LineDistance && - aLeft.Color == aTop.Color && aLeft.InnerLineWidth == aTop.InnerLineWidth && - aLeft.OuterLineWidth == aTop.OuterLineWidth && aLeft.LineDistance == aTop.LineDistance && - aLeft.Color == aBottom.Color && aLeft.InnerLineWidth == aBottom.InnerLineWidth && - aLeft.OuterLineWidth == aBottom.OuterLineWidth && aLeft.LineDistance == aBottom.LineDistance ) - { - pLeftBorderState->mnIndex = -1; - pLeftBorderState->maValue.clear(); - pRightBorderState->mnIndex = -1; - pRightBorderState->maValue.clear(); - pTopBorderState->mnIndex = -1; - pTopBorderState->maValue.clear(); - pBottomBorderState->mnIndex = -1; - pBottomBorderState->maValue.clear(); - } - else - { - pAllBorderState->mnIndex = -1; - pAllBorderState->maValue.clear(); - } - } - else - { - pAllBorderState->mnIndex = -1; - pAllBorderState->maValue.clear(); - } - } - - if( pWidthAbsState && pWidthRelState ) - { - sal_Int16 nRelWidth = 0; - pWidthRelState->maValue >>= nRelWidth; - if( nRelWidth > 0 ) - pWidthAbsState->mnIndex = -1; - // TODO: instead of checking this value for 255 a new property - // must be introduced like for heights. - if( nRelWidth == 255 ) - pWidthRelState->mnIndex = -1; - } - - if( pHeightAbsState && pHeightRelState ) - { - DBG_ASSERT( pHeightMinAbsState, "no min abs state" ); - DBG_ASSERT( pHeightMinRelState, "no min rel state" ); - sal_Int32 nSizeType = SizeType::FIX; - if( pSizeTypeState ) - pSizeTypeState->maValue >>= nSizeType; - - if( SizeType::VARIABLE == nSizeType || - ( pSyncHeightState && - *(sal_Bool *)pSyncHeightState->maValue.getValue() ) ) - { - pHeightAbsState->mnIndex = -1; - pHeightMinAbsState->mnIndex = -1; - pHeightRelState->mnIndex = -1; - pHeightMinRelState->mnIndex = -1; - } - else - { - sal_Int16 nRelHeight = 0; - pHeightRelState->maValue >>= nRelHeight; - sal_Bool bRel = (nRelHeight > 0); - sal_Bool bMin = (SizeType::MIN == nSizeType); - if( bRel || bMin ) - pHeightAbsState->mnIndex = -1; - if( bRel || !bMin ) - pHeightMinAbsState->mnIndex = -1; - if( !bRel || bMin ) - pHeightRelState->mnIndex = -1; - if( !bRel || !bMin ) - pHeightMinRelState->mnIndex = -1; - } - } - if( pSizeTypeState ) - pSizeTypeState->mnIndex = -1; - if( pSyncHeightState ) - pSyncHeightState->mnIndex = -1; - - if( pWrapState ) - { - WrapTextMode eVal; - pWrapState->maValue >>= eVal; - switch( eVal ) - { - case WrapTextMode_NONE: - case WrapTextMode_THROUGHT: - if( pWrapContourState ) - pWrapContourState->mnIndex = -1; - if( pWrapParagraphOnlyState ) - pWrapParagraphOnlyState->mnIndex = -1; - break; - } - if( pWrapContourModeState && - (!pWrapContourState || - !*(sal_Bool *)pWrapContourState ->maValue.getValue() ) ) - pWrapContourModeState->mnIndex = -1; - } - - TextContentAnchorType eAnchor = TextContentAnchorType_AT_PARAGRAPH; - if( pAnchorTypeState ) - pAnchorTypeState->maValue >>= eAnchor; - else if( bNeedsAnchor ) - { - Any aAny = rPropSet->getPropertyValue( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ) ); - aAny >>= eAnchor; - } - - if( pAnchorPageNumberState && TextContentAnchorType_AT_PAGE != eAnchor ) - pAnchorPageNumberState->mnIndex = -1; - - if( pHoriOrientState && pHoriOrientMirroredState ) - { - if( pHoriOrientMirrorState && - *(sal_Bool *)pHoriOrientMirrorState->maValue.getValue() ) - pHoriOrientState->mnIndex = -1; - else - pHoriOrientMirroredState->mnIndex = -1; - } - if( pHoriOrientMirrorState ) - pHoriOrientMirrorState->mnIndex = -1; - - if( pHoriOrientRelState && TextContentAnchorType_AT_FRAME == eAnchor ) - pHoriOrientRelState->mnIndex = -1; - if( pHoriOrientRelFrameState && TextContentAnchorType_AT_FRAME != eAnchor ) - pHoriOrientRelFrameState->mnIndex = -1;; - - if( pVertOrientRelState && TextContentAnchorType_AT_PARAGRAPH != eAnchor && - TextContentAnchorType_AT_CHARACTER != eAnchor ) - pVertOrientRelState->mnIndex = -1; - if( pVertOrientRelPageState && TextContentAnchorType_AT_PAGE != eAnchor ) - pVertOrientRelPageState->mnIndex = -1; - if( pVertOrientRelFrameState && TextContentAnchorType_AT_FRAME != eAnchor ) - pVertOrientRelFrameState->mnIndex = -1; - if( pVertOrientRelAsCharState && TextContentAnchorType_AS_CHARACTER != eAnchor ) - pVertOrientRelAsCharState->mnIndex = -1; -} - XMLPropertyMapEntry *lcl_txtprmap_getMap( sal_uInt16 nType ) { XMLPropertyMapEntry *pMap = 0; @@ -1014,6 +538,9 @@ XMLPropertyMapEntry *lcl_txtprmap_getMap( sal_uInt16 nType ) pMap = &(aXMLFramePropMap[12]); DBG_ASSERT( pMap->msXMLName == sXML_margin_left, "frame map changed" ); break; + case TEXT_PROP_MAP_SHAPE: + pMap = aXMLShapePropMap; + break; case TEXT_PROP_MAP_SECTION: pMap = aXMLSectionPropMap; break; diff --git a/xmloff/source/text/txtstyle.cxx b/xmloff/source/text/txtstyle.cxx index 19434f5132aa..d49e051b30e4 100644 --- a/xmloff/source/text/txtstyle.cxx +++ b/xmloff/source/text/txtstyle.cxx @@ -2,9 +2,9 @@ * * $RCSfile: txtstyle.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: mib $ $Date: 2000-10-18 11:18:30 $ + * last change: $Author: mib $ $Date: 2000-11-07 13:33:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -184,8 +184,10 @@ void XMLTextParagraphExport::exportTextStyles( sal_Bool bUsed ) bUsed, XML_STYLE_FAMILY_TEXT_PARAGRAPH ); exportStyleFamily( "CharacterStyles", sXML_text, GetTextPropMapper(), bUsed, XML_STYLE_FAMILY_TEXT_TEXT ); + // get shape export to make sure the the frame family is added correctly. + GetExport().GetShapeExport(); exportStyleFamily( "FrameStyles", XML_STYLE_FAMILY_SD_GRAPHICS_NAME, GetFramePropMapper(), - bUsed, XML_STYLE_FAMILY_SD_GRAPHICS_ID ); + bUsed, XML_STYLE_FAMILY_TEXT_FRAME ); exportNumStyles( bUsed ); exportTextFootnoteConfiguration(); } |