diff options
author | Christian Lippka <cl@openoffice.org> | 2001-02-08 13:45:43 +0000 |
---|---|---|
committer | Christian Lippka <cl@openoffice.org> | 2001-02-08 13:45:43 +0000 |
commit | c926c2727838584ed5ab870bbb97b8381c58700c (patch) | |
tree | d9bc37c9a8434d10fb18de5d5719a3719ee10413 /xmloff | |
parent | 86ad6979ffcf609e22c06e741ecac2fc7826763e (diff) |
#83528# merging control styles with shape styles
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/draw/sdxmlexp.cxx | 7 | ||||
-rw-r--r-- | xmloff/source/draw/shapeexport.cxx | 36 | ||||
-rw-r--r-- | xmloff/source/draw/shapeimport.cxx | 12 | ||||
-rw-r--r-- | xmloff/source/draw/ximpshap.cxx | 75 |
4 files changed, 93 insertions, 37 deletions
diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx index 31ddff1e0ad9..74aa9068db09 100644 --- a/xmloff/source/draw/sdxmlexp.cxx +++ b/xmloff/source/draw/sdxmlexp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: sdxmlexp.cxx,v $ * - * $Revision: 1.45 $ + * $Revision: 1.46 $ * - * last change: $Author: cl $ $Date: 2001-02-02 11:14:37 $ + * last change: $Author: cl $ $Date: 2001-02-08 14:45:42 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1818,9 +1818,6 @@ void SdXMLExport::_ExportAutoStyles() // ...for chart GetChartExport()->exportAutoStyles(); - - // .. for forms - GetFormExport()->exportAutoStyles(); } ////////////////////////////////////////////////////////////////////////////// diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index 85bdb047a7e6..2862218d0c42 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -2,9 +2,9 @@ * * $RCSfile: shapeexport.cxx,v $ * - * $Revision: 1.17 $ + * $Revision: 1.18 $ * - * last change: $Author: cl $ $Date: 2001-02-07 16:26:36 $ + * last change: $Author: cl $ $Date: 2001-02-08 14:45:43 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -67,10 +67,18 @@ #include <com/sun/star/chart/XChartDocument.hpp> #endif +#ifndef _COM_SUN_STAR_DRAWING_XCONTROLSHAPE_HPP_ +#include <com/sun/star/drawing/XControlShape.hpp> +#endif + #ifndef _COM_SUN_STAR_STYLE_XSTYLE_HPP_ #include <com/sun/star/style/XStyle.hpp> #endif +#ifndef _XMLOFF_PROPERTYSETMERGER_HXX_ +#include "PropertySetMerger.hxx" +#endif + #ifndef _XMLOFF_SHAPEEXPORT_HXX #include "shapeexport.hxx" #endif @@ -138,6 +146,12 @@ XMLShapeExport::XMLShapeExport(SvXMLExport& rExp, // chain text attributes xPropertySetMapper->ChainExportMapper(XMLTextParagraphExport::CreateCharExtPropMapper(rExp)); +/* + // chain form attributes + const UniReference< SvXMLExportPropertyMapper> xFormMapper( rExp.GetFormExport()->getStylePropertyMapper().getBodyPtr() ); + xPropertySetMapper->ChainExportMapper(xFormMapper); +*/ + rExport.GetAutoStylePool()->AddFamily( XML_STYLE_FAMILY_SD_GRAPHICS_ID, OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_NAME)), @@ -206,6 +220,24 @@ void XMLShapeExport::collectShapeAutoStyles(const uno::Reference< drawing::XShap aParentName += xStyle->getName(); } + // if this shape is a control shape we merge the styles + // from this shape with the styles from the controls model + if( aShapeInfo.meShapeType == XmlShapeTypeDrawControlShape ) + { + do + { + uno::Reference< drawing::XControlShape > xControl( xShape, uno::UNO_QUERY ); + if( !xControl.is() ) + break; + + uno::Reference< beans::XPropertySet > xControlModel( xControl->getControl(), uno::UNO_QUERY ); + if( !xControlModel.is() ) + break; + + xPropSet = PropertySetMerger_CreateInstance( xPropSet, xControlModel ); + } while(0); + } + // filter propset std::vector< XMLPropertyState > xPropStates = GetPropertySetMapper()->Filter( xPropSet ); diff --git a/xmloff/source/draw/shapeimport.cxx b/xmloff/source/draw/shapeimport.cxx index 28fcbe7177d5..eb961cb55b3b 100644 --- a/xmloff/source/draw/shapeimport.cxx +++ b/xmloff/source/draw/shapeimport.cxx @@ -2,9 +2,9 @@ * * $RCSfile: shapeimport.cxx,v $ * - * $Revision: 1.24 $ + * $Revision: 1.25 $ * - * last change: $Author: mh $ $Date: 2001-02-01 16:29:47 $ + * last change: $Author: cl $ $Date: 2001-02-08 14:45:43 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -120,9 +120,11 @@ using namespace ::com::sun::star; ////////////////////////////////////////////////////////////////////////////// XMLShapeImportHelper::XMLShapeImportHelper( + SvXMLImport& rImporter, const uno::Reference< frame::XModel>& rModel, SvXMLImportPropertyMapper *pExtMapper ) : mxModel(rModel), + mrImporter( rImporter ), mpPropertySetMapper(0L), mpPresPagePropsMapper(0L), mpStylesContext(0L), @@ -174,6 +176,12 @@ XMLShapeImportHelper::XMLShapeImportHelper( // chain text attributes mpPropertySetMapper->ChainImportMapper(XMLTextImportHelper::CreateCharExtPropMapper()); +/* + // chain form attributes + const UniReference< SvXMLImportPropertyMapper> xFormMapper( rImporter.GetFormImport()->getStylePropertyMapper().getBodyPtr() ); + mpPropertySetMapper->ChainImportMapper(xFormMapper); +*/ + // construct PresPagePropsMapper xMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLSDPresPageProps, mpSdPropHdlFactory); mpPresPagePropsMapper = new SvXMLImportPropertyMapper( xMapper ); diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx index 6dffb0768cc1..0c77476495f6 100644 --- a/xmloff/source/draw/ximpshap.cxx +++ b/xmloff/source/draw/ximpshap.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ximpshap.cxx,v $ * - * $Revision: 1.23 $ + * $Revision: 1.24 $ * - * last change: $Author: cl $ $Date: 2001-02-07 16:26:36 $ + * last change: $Author: cl $ $Date: 2001-02-08 14:45:43 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -115,6 +115,10 @@ #include <com/sun/star/drawing/ConnectorType.hpp> #endif +#ifndef _XMLOFF_PROPERTYSETMERGER_HXX_ +#include "PropertySetMerger.hxx" +#endif + #ifndef _XMLOFF_FAMILIES_HXX_ #include "families.hxx" #endif @@ -312,47 +316,62 @@ void SdXMLShapeContext::SetRotation() void SdXMLShapeContext::SetStyle() { - // set style on shape - if(maDrawStyleName.getLength() && mxShape.is()) + do { + // set style on shape + if(maDrawStyleName.getLength() == 0 || !mxShape.is()) + break; + const SvXMLStyleContext* pStyle = 0L; sal_Bool bAutoStyle(FALSE); if(GetImport().GetShapeImport()->GetAutoStylesContext()) - pStyle = GetImport().GetShapeImport()->GetAutoStylesContext()->FindStyleChildContext( - mnStyleFamily, maDrawStyleName); + pStyle = GetImport().GetShapeImport()->GetAutoStylesContext()->FindStyleChildContext(mnStyleFamily, maDrawStyleName); if(pStyle) bAutoStyle = TRUE; if(!pStyle && GetImport().GetShapeImport()->GetStylesContext()) - pStyle = GetImport().GetShapeImport()->GetStylesContext()-> - FindStyleChildContext(mnStyleFamily, maDrawStyleName); + pStyle = GetImport().GetShapeImport()->GetStylesContext()->FindStyleChildContext(mnStyleFamily, maDrawStyleName); + + if(NULL == pStyle || !pStyle->ISA(XMLShapeStyleContext) ) + break; - if(pStyle && pStyle->ISA(XMLShapeStyleContext) ) + uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY); + if( !xPropSet.is() ) + break; + + XMLPropStyleContext* pDocStyle = + PTR_CAST( XMLShapeStyleContext, pStyle ); + + if( pDocStyle->GetStyle().is() ) { - uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY); - if(xPropSet.is() ) - { - XMLPropStyleContext* pDocStyle = - PTR_CAST( XMLShapeStyleContext, pStyle ); + // set style on object + uno::Any aAny; + aAny <<= pDocStyle->GetStyle(); + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Style")), aAny); + } - if( pDocStyle->GetStyle().is() ) - { - // set style on object - uno::Any aAny; - aAny <<= pDocStyle->GetStyle(); - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Style")), aAny); - } + // we are finished if this is not a auto style + if(!bAutoStyle) + break; - if(bAutoStyle) - { - // set PropertySet on object - pDocStyle->FillPropertySet(xPropSet); - } - } + // check if this is a control shape + // if so we must split the style for the shape and its control model + uno::Reference< drawing::XControlShape > xControl( mxShape, uno::UNO_QUERY ); + if( xControl.is() ) + { + uno::Reference< beans::XPropertySet > xControlModel( xControl->getControl(), uno::UNO_QUERY ); + if( !xControlModel.is() ) + break; + + xPropSet = PropertySetMerger_CreateInstance( xPropSet, xControlModel ); } - } + + // set PropertySet on object + pDocStyle->FillPropertySet(xPropSet); + + } while(0); } void SdXMLShapeContext::SetLayer() |