diff options
Diffstat (limited to 'xmloff')
29 files changed, 445 insertions, 230 deletions
diff --git a/xmloff/inc/xmloff/PageMasterStyleMap.hxx b/xmloff/inc/xmloff/PageMasterStyleMap.hxx index d81bd80daa..a555fce37f 100644 --- a/xmloff/inc/xmloff/PageMasterStyleMap.hxx +++ b/xmloff/inc/xmloff/PageMasterStyleMap.hxx @@ -84,6 +84,11 @@ #define CTF_PM_PRINT_HEADERS (CTF_PM_PRINTMASK|(XML_PM_CTF_START + 0x0017)) #define CTF_PM_PRINT_OBJECTS (CTF_PM_PRINTMASK|(XML_PM_CTF_START + 0x0018)) #define CTF_PM_PRINT_ZEROVALUES (CTF_PM_PRINTMASK|(XML_PM_CTF_START + 0x0019)) +#define CTF_PM_MARGINALL (XML_PM_CTF_START + 0x001A) +#define CTF_PM_MARGINTOP (XML_PM_CTF_START + 0x001B) +#define CTF_PM_MARGINBOTTOM (XML_PM_CTF_START + 0x001C) +#define CTF_PM_MARGINLEFT (XML_PM_CTF_START + 0x001D) +#define CTF_PM_MARGINRIGHT (XML_PM_CTF_START + 0x001E) #define CTF_PM_PAGEUSAGE (XML_PM_CTF_START + 0x0031) #define CTF_PM_GRAPHICPOSITION (XML_PM_CTF_START + 0x0032) @@ -119,6 +124,12 @@ #define CTF_PM_HEADERGRAPHICPOSITION (CTF_PM_HEADERFLAG|(XML_PM_CTF_START + 0x0034)) #define CTF_PM_HEADERGRAPHICFILTER (CTF_PM_HEADERFLAG|(XML_PM_CTF_START + 0x0035)) #define CTF_PM_HEADERGRAPHICURL (CTF_PM_HEADERFLAG|(XML_PM_CTF_START + 0x0036)) +#define CTF_PM_HEADERMARGINALL (CTF_PM_HEADERFLAG|CTF_PM_MARGINALL) +#define CTF_PM_HEADERMARGINTOP (CTF_PM_HEADERFLAG|CTF_PM_MARGINTOP) +#define CTF_PM_HEADERMARGINBOTTOM (CTF_PM_HEADERFLAG|CTF_PM_MARGINBOTTOM) +#define CTF_PM_HEADERMARGINLEFT (CTF_PM_HEADERFLAG|CTF_PM_MARGINLEFT) +#define CTF_PM_HEADERMARGINRIGHT (CTF_PM_HEADERFLAG|CTF_PM_MARGINRIGHT) + // footer #define CTF_PM_FOOTERBORDERALL (CTF_PM_FOOTERFLAG|CTF_PM_BORDERALL) #define CTF_PM_FOOTERBORDERTOP (CTF_PM_FOOTERFLAG|CTF_PM_BORDERTOP) @@ -141,6 +152,12 @@ #define CTF_PM_FOOTERGRAPHICPOSITION (CTF_PM_FOOTERFLAG|(XML_PM_CTF_START + 0x0034)) #define CTF_PM_FOOTERGRAPHICFILTER (CTF_PM_FOOTERFLAG|(XML_PM_CTF_START + 0x0035)) #define CTF_PM_FOOTERGRAPHICURL (CTF_PM_FOOTERFLAG|(XML_PM_CTF_START + 0x0036)) +#define CTF_PM_FOOTERMARGINALL (CTF_PM_FOOTERFLAG|CTF_PM_MARGINALL) +#define CTF_PM_FOOTERMARGINTOP (CTF_PM_FOOTERFLAG|CTF_PM_MARGINTOP) +#define CTF_PM_FOOTERMARGINBOTTOM (CTF_PM_FOOTERFLAG|CTF_PM_MARGINBOTTOM) +#define CTF_PM_FOOTERMARGINLEFT (CTF_PM_FOOTERFLAG|CTF_PM_MARGINLEFT) +#define CTF_PM_FOOTERMARGINRIGHT (CTF_PM_FOOTERFLAG|CTF_PM_MARGINRIGHT) + #define CTF_PM_FTN_HEIGTH (XML_PM_CTF_START + 0x0060) #define CTF_PM_FTN_LINE_WEIGTH (XML_PM_CTF_START + 0x0061) #define CTF_PM_FTN_LINE_COLOR (XML_PM_CTF_START + 0x0062) diff --git a/xmloff/inc/xmloff/txtprmap.hxx b/xmloff/inc/xmloff/txtprmap.hxx index 6d0e3faca6..44121534ef 100644 --- a/xmloff/inc/xmloff/txtprmap.hxx +++ b/xmloff/inc/xmloff/txtprmap.hxx @@ -172,7 +172,6 @@ #define CTF_SHAPE_VERTICALREL (XML_TEXT_CTF_START + 136) #define CTF_SHAPE_VERTICALREL_PAGE (XML_TEXT_CTF_START + 137) #define CTF_SHAPE_VERTICALREL_FRAME (XML_TEXT_CTF_START + 138) -// <-- #define CTF_PARA_ADJUSTLAST (XML_TEXT_CTF_START + 139) #define CTF_DEFAULT_OUTLINE_LEVEL (XML_TEXT_CTF_START + 140) #define CTF_OLD_FLOW_WITH_TEXT (XML_TEXT_CTF_START + 141) @@ -180,6 +179,14 @@ #define CTF_TEXT_DISPLAY (XML_TEXT_CTF_START + 143) #define CTF_TEXT_CLIP (XML_TEXT_CTF_START + 144) #define CTF_TEXT_CLIP11 (XML_TEXT_CTF_START + 145) +#define CTF_PARAMARGINALL (XML_TEXT_CTF_START + 146) +#define CTF_PARAMARGINALL_REL (XML_TEXT_CTF_START + 147) +#define CTF_MARGINALL (XML_TEXT_CTF_START + 148) +#define CTF_MARGINLEFT (XML_TEXT_CTF_START + 149) +#define CTF_MARGINRIGHT (XML_TEXT_CTF_START + 150) +#define CTF_MARGINTOP (XML_TEXT_CTF_START + 151) +#define CTF_MARGINBOTTOM (XML_TEXT_CTF_START + 152) + #define TEXT_PROP_MAP_TEXT 0 #define TEXT_PROP_MAP_PARA 1 #define TEXT_PROP_MAP_FRAME 2 diff --git a/xmloff/inc/xmloff/xmlmetai.hxx b/xmloff/inc/xmloff/xmlmetai.hxx index fff0fc3bad..900521ee0f 100644 --- a/xmloff/inc/xmloff/xmlmetai.hxx +++ b/xmloff/inc/xmloff/xmlmetai.hxx @@ -26,8 +26,8 @@ * ************************************************************************/ -#ifndef _XMLOFF_XMLMETAI_HXX -#define _XMLOFF_XMLMETAI_HXX +#ifndef XMLOFF_XMLMETAI_HXX +#define XMLOFF_XMLMETAI_HXX #include "sal/config.h" #include "xmloff/dllapi.h" @@ -70,12 +70,6 @@ public: virtual void EndElement(); -protected: - /// initialize DocumentProperties object with DOM and base URL - void initDocumentProperties(); - // set the BuildId property at the importer - void setBuildId(const ::rtl::OUString & i_rBuildId); - public: static void setBuildId(const ::rtl::OUString & rGenerator, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& xImportInfo ); diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx index 932daebdd1..944308a6d4 100644 --- a/xmloff/inc/xmloff/xmltoken.hxx +++ b/xmloff/inc/xmloff/xmltoken.hxx @@ -3137,6 +3137,8 @@ namespace xmloff { namespace token { XML_MIN_VALUE, XML_MAX_VALUE, + XML_MARGIN, // #i117001# + XML_TOKEN_END }; diff --git a/xmloff/source/chart/SchXMLAxisContext.cxx b/xmloff/source/chart/SchXMLAxisContext.cxx index b4efdbbe40..149b6e1ff2 100644 --- a/xmloff/source/chart/SchXMLAxisContext.cxx +++ b/xmloff/source/chart/SchXMLAxisContext.cxx @@ -178,18 +178,18 @@ Reference< drawing::XShape > SchXMLAxisContext::getTitleShape() { case SCH_XML_AXIS_X: if( m_aCurrentAxis.nAxisIndex == 0 ) - aPropName = OUString::createFromAscii( "HasXAxisTitle" ); + aPropName = OUString(RTL_CONSTASCII_USTRINGPARAM( "HasXAxisTitle" )); else - aPropName = OUString::createFromAscii( "HasSecondaryXAxisTitle" ); + aPropName = OUString(RTL_CONSTASCII_USTRINGPARAM( "HasSecondaryXAxisTitle" )); break; case SCH_XML_AXIS_Y: if( m_aCurrentAxis.nAxisIndex == 0 ) - aPropName = OUString::createFromAscii( "HasYAxisTitle" ); + aPropName = OUString(RTL_CONSTASCII_USTRINGPARAM( "HasYAxisTitle" )); else - aPropName = OUString::createFromAscii( "HasSecondaryYAxisTitle" ); + aPropName = OUString(RTL_CONSTASCII_USTRINGPARAM( "HasSecondaryYAxisTitle" )); break; case SCH_XML_AXIS_Z: - aPropName = OUString::createFromAscii( "HasZAxisTitle" ); + aPropName = OUString(RTL_CONSTASCII_USTRINGPARAM( "HasZAxisTitle" )); break; case SCH_XML_AXIS_UNDEF: OSL_TRACE( "Invalid axis" ); @@ -212,21 +212,21 @@ void SchXMLAxisContext::CreateGrid( OUString sAutoStyleName, bool bIsMajor ) { case SCH_XML_AXIS_X: if( bIsMajor ) - aPropName = OUString::createFromAscii("HasXAxisGrid"); + aPropName = OUString(RTL_CONSTASCII_USTRINGPARAM("HasXAxisGrid")); else - aPropName = OUString::createFromAscii("HasXAxisHelpGrid"); + aPropName = OUString(RTL_CONSTASCII_USTRINGPARAM("HasXAxisHelpGrid")); break; case SCH_XML_AXIS_Y: if( bIsMajor ) - aPropName = OUString::createFromAscii("HasYAxisGrid"); + aPropName = OUString(RTL_CONSTASCII_USTRINGPARAM("HasYAxisGrid")); else - aPropName = OUString::createFromAscii("HasYAxisHelpGrid"); + aPropName = OUString(RTL_CONSTASCII_USTRINGPARAM("HasYAxisHelpGrid")); break; case SCH_XML_AXIS_Z: if( bIsMajor ) - aPropName = OUString::createFromAscii("HasZAxisGrid"); + aPropName = OUString(RTL_CONSTASCII_USTRINGPARAM("HasZAxisGrid")); else - aPropName = OUString::createFromAscii("HasZAxisHelpGrid"); + aPropName = OUString(RTL_CONSTASCII_USTRINGPARAM("HasZAxisHelpGrid")); break; case SCH_XML_AXIS_UNDEF: OSL_TRACE( "Invalid axis" ); @@ -418,21 +418,21 @@ void SchXMLAxisContext::CreateAxis() { case SCH_XML_AXIS_X: if( m_aCurrentAxis.nAxisIndex == 0 ) - aPropName = OUString::createFromAscii("HasXAxis"); + aPropName = OUString(RTL_CONSTASCII_USTRINGPARAM("HasXAxis")); else - aPropName = OUString::createFromAscii("HasSecondaryXAxis"); + aPropName = OUString(RTL_CONSTASCII_USTRINGPARAM("HasSecondaryXAxis")); break; case SCH_XML_AXIS_Y: if( m_aCurrentAxis.nAxisIndex == 0 ) - aPropName = OUString::createFromAscii("HasYAxis"); + aPropName = OUString(RTL_CONSTASCII_USTRINGPARAM("HasYAxis")); else - aPropName = OUString::createFromAscii("HasSecondaryYAxis"); + aPropName = OUString(RTL_CONSTASCII_USTRINGPARAM("HasSecondaryYAxis")); break; case SCH_XML_AXIS_Z: if( m_aCurrentAxis.nAxisIndex == 0 ) - aPropName = OUString::createFromAscii("HasXAxis"); + aPropName = OUString(RTL_CONSTASCII_USTRINGPARAM("HasXAxis")); else - aPropName = OUString::createFromAscii("HasSecondaryXAxis"); + aPropName = OUString(RTL_CONSTASCII_USTRINGPARAM("HasSecondaryXAxis")); break; case SCH_XML_AXIS_UNDEF: OSL_TRACE( "Invalid axis" ); @@ -468,7 +468,7 @@ void SchXMLAxisContext::CreateAxis() { try { - xDiaProp->setPropertyValue( OUString::createFromAscii( "HasXAxis" ), uno::makeAny(sal_True) ); + xDiaProp->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM( "HasXAxis" )), uno::makeAny(sal_True) ); } catch( beans::UnknownPropertyException & ) { @@ -486,13 +486,13 @@ void SchXMLAxisContext::CreateAxis() m_xAxisProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "LineColor" )), uno::makeAny( COL_BLACK )); - m_xAxisProps->setPropertyValue( OUString::createFromAscii( "DisplayLabels" ), aFalseBool ); + m_xAxisProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM( "DisplayLabels" )), aFalseBool ); // #88077# AutoOrigin 'on' is default - m_xAxisProps->setPropertyValue( OUString::createFromAscii( "AutoOrigin" ), aTrueBool ); + m_xAxisProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM( "AutoOrigin" )), aTrueBool ); if( m_bAxisTypeImported ) - m_xAxisProps->setPropertyValue( OUString::createFromAscii( "AxisType" ), uno::makeAny(m_nAxisType) ); + m_xAxisProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM( "AxisType" )), uno::makeAny(m_nAxisType) ); if( m_aAutoStyleName.getLength()) { @@ -548,7 +548,7 @@ void SchXMLAxisContext::CreateAxis() Reference< beans::XPropertySet > xNewAxisProp( xAxis, uno::UNO_QUERY ); if( xNewAxisProp.is() ) { - xNewAxisProp->setPropertyValue( OUString::createFromAscii("LineStyle") + xNewAxisProp->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("LineStyle")) , uno::makeAny(drawing::LineStyle_NONE)); } } @@ -794,31 +794,31 @@ void SchXMLAxisContext::CorrectAxisPositions( const Reference< chart2::XChartDoc chart2::ScaleData aMainXScale = xMainXAxis->getScaleData(); if( 0 == rChartTypeServiceName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.chart2.ScatterChartType" ) ) ) { - xMainYAxisProp->setPropertyValue( OUString::createFromAscii("CrossoverPosition") + xMainYAxisProp->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CrossoverPosition")) , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_VALUE) ); double fCrossoverValue = 0.0; aMainXScale.Origin >>= fCrossoverValue; - xMainYAxisProp->setPropertyValue( OUString::createFromAscii("CrossoverValue") + xMainYAxisProp->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CrossoverValue")) , uno::makeAny( fCrossoverValue ) ); if( aMainXScale.Orientation == chart2::AxisOrientation_REVERSE ) { - xMainYAxisProp->setPropertyValue( OUString::createFromAscii("LabelPosition") + xMainYAxisProp->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("LabelPosition")) , uno::makeAny( ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END) ); - xMainYAxisProp->setPropertyValue( OUString::createFromAscii("MarkPosition") + xMainYAxisProp->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("MarkPosition")) , uno::makeAny( ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS) ); if( xSecondaryYAxisProp.is() ) - xSecondaryYAxisProp->setPropertyValue( OUString::createFromAscii("CrossoverPosition") + xSecondaryYAxisProp->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CrossoverPosition")) , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_START) ); } else { - xMainYAxisProp->setPropertyValue( OUString::createFromAscii("LabelPosition") + xMainYAxisProp->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("LabelPosition")) , uno::makeAny( ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START) ); - xMainYAxisProp->setPropertyValue( OUString::createFromAscii("MarkPosition") + xMainYAxisProp->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("MarkPosition")) , uno::makeAny( ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS) ); if( xSecondaryYAxisProp.is() ) - xSecondaryYAxisProp->setPropertyValue( OUString::createFromAscii("CrossoverPosition") + xSecondaryYAxisProp->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CrossoverPosition")) , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_END) ); } } @@ -826,48 +826,48 @@ void SchXMLAxisContext::CorrectAxisPositions( const Reference< chart2::XChartDoc { if( aMainXScale.Orientation == chart2::AxisOrientation_REVERSE ) { - xMainYAxisProp->setPropertyValue( OUString::createFromAscii("CrossoverPosition") + xMainYAxisProp->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CrossoverPosition")) , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_END) ); if( xSecondaryYAxisProp.is() ) - xSecondaryYAxisProp->setPropertyValue( OUString::createFromAscii("CrossoverPosition") + xSecondaryYAxisProp->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CrossoverPosition")) , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_START) ); } else { - xMainYAxisProp->setPropertyValue( OUString::createFromAscii("CrossoverPosition") + xMainYAxisProp->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CrossoverPosition")) , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_START) ); if( xSecondaryYAxisProp.is() ) - xSecondaryYAxisProp->setPropertyValue( OUString::createFromAscii("CrossoverPosition") + xSecondaryYAxisProp->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CrossoverPosition")) , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_END) ); } } chart2::ScaleData aMainYScale = xMainYAxis->getScaleData(); - xMainXAxisProp->setPropertyValue( OUString::createFromAscii("CrossoverPosition") + xMainXAxisProp->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CrossoverPosition")) , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_VALUE) ); double fCrossoverValue = 0.0; aMainYScale.Origin >>= fCrossoverValue; - xMainXAxisProp->setPropertyValue( OUString::createFromAscii("CrossoverValue") + xMainXAxisProp->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CrossoverValue")) , uno::makeAny( fCrossoverValue ) ); if( aMainYScale.Orientation == chart2::AxisOrientation_REVERSE ) { - xMainXAxisProp->setPropertyValue( OUString::createFromAscii("LabelPosition") + xMainXAxisProp->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("LabelPosition")) , uno::makeAny( ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END) ); - xMainXAxisProp->setPropertyValue( OUString::createFromAscii("MarkPosition") + xMainXAxisProp->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("MarkPosition")) , uno::makeAny( ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS) ); if( xSecondaryXAxisProp.is() ) - xSecondaryXAxisProp->setPropertyValue( OUString::createFromAscii("CrossoverPosition") + xSecondaryXAxisProp->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CrossoverPosition")) , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_START) ); } else { - xMainXAxisProp->setPropertyValue( OUString::createFromAscii("LabelPosition") + xMainXAxisProp->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("LabelPosition")) , uno::makeAny( ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START) ); - xMainXAxisProp->setPropertyValue( OUString::createFromAscii("MarkPosition") + xMainXAxisProp->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("MarkPosition")) , uno::makeAny( ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS) ); if( xSecondaryXAxisProp.is() ) - xSecondaryXAxisProp->setPropertyValue( OUString::createFromAscii("CrossoverPosition") + xSecondaryXAxisProp->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CrossoverPosition")) , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_END) ); } } @@ -990,7 +990,7 @@ void DateScaleContext::StartElement( const Reference< xml::sax::XAttributeList > bool bSetNewIncrement=false; chart::TimeIncrement aIncrement; - m_xAxisProps->getPropertyValue( OUString::createFromAscii( "TimeIncrement" )) >>= aIncrement; + m_xAxisProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM( "TimeIncrement" ))) >>= aIncrement; for( sal_Int16 i = 0; i < nAttrCount; i++ ) { @@ -1047,7 +1047,7 @@ void DateScaleContext::StartElement( const Reference< xml::sax::XAttributeList > } if( bSetNewIncrement ) - m_xAxisProps->setPropertyValue( OUString::createFromAscii( "TimeIncrement" ), uno::makeAny( aIncrement ) ); + m_xAxisProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM( "TimeIncrement" )), uno::makeAny( aIncrement ) ); } // ======================================== diff --git a/xmloff/source/chart/SchXMLChartContext.cxx b/xmloff/source/chart/SchXMLChartContext.cxx index 6373aa05c8..8f8341e25e 100644 --- a/xmloff/source/chart/SchXMLChartContext.cxx +++ b/xmloff/source/chart/SchXMLChartContext.cxx @@ -683,7 +683,7 @@ void lcl_ApplyDataFromRectangularRangeToDiagram( -1, uno::makeAny( bHasCateories ), beans::PropertyState_DIRECT_VALUE ); aArgs[ aArgs.getLength() - 1 ] = beans::PropertyValue( - ::rtl::OUString::createFromAscii("UseCategoriesAsX"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UseCategoriesAsX")), -1, uno::makeAny( sal_False ),//categories in ODF files are not to be used as x values (independent from what is offered in our ui) beans::PropertyState_DIRECT_VALUE ); diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index d0fece3800..55ae80a7d2 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -2316,7 +2316,7 @@ void SchXMLExportHelper_Impl::exportDateScale( const Reference< beans::XProperty return; chart::TimeIncrement aIncrement; - if( (xAxisProps->getPropertyValue( OUString::createFromAscii( "TimeIncrement" )) >>= aIncrement) ) + if( (xAxisProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM( "TimeIncrement" ))) >>= aIncrement) ) { sal_Int32 nTimeResolution = ::com::sun::star::chart::TimeUnit::DAY; if( aIncrement.TimeResolution >>= nTimeResolution ) @@ -2440,7 +2440,7 @@ void SchXMLExportHelper_Impl::exportAxis( bool bHasTitle, bool bHasMajorGrid, bool bHasMinorGrid, bool bExportContent ) { - static const OUString sNumFormat( OUString::createFromAscii( "NumberFormat" )); + static const OUString sNumFormat( OUString(RTL_CONSTASCII_USTRINGPARAM( "NumberFormat" ))); std::vector< XMLPropertyState > aPropertyStates; SvXMLElementExport* pAxis = NULL; diff --git a/xmloff/source/chart/SchXMLLegendContext.cxx b/xmloff/source/chart/SchXMLLegendContext.cxx index 8d590c6a96..38c8f69b7d 100644 --- a/xmloff/source/chart/SchXMLLegendContext.cxx +++ b/xmloff/source/chart/SchXMLLegendContext.cxx @@ -114,7 +114,7 @@ void SchXMLLegendContext::StartElement( const uno::Reference< xml::sax::XAttribu { try { - xDocProp->setPropertyValue( rtl::OUString::createFromAscii( "HasLegend" ), uno::makeAny( sal_True ) ); + xDocProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasLegend" )), uno::makeAny( sal_True ) ); } catch( beans::UnknownPropertyException ) { @@ -160,7 +160,7 @@ void SchXMLLegendContext::StartElement( const uno::Reference< xml::sax::XAttribu try { if( SchXMLEnumConverter::getLegendPositionConverter().importXML( aValue, aAny, GetImport().GetMM100UnitConverter() ) ) - xLegendProps->setPropertyValue( rtl::OUString::createFromAscii( "Alignment" ), aAny ); + xLegendProps->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Alignment" )), aAny ); } catch( beans::UnknownPropertyException ) { @@ -205,7 +205,7 @@ void SchXMLLegendContext::StartElement( const uno::Reference< xml::sax::XAttribu xLegendShape->setPosition( aLegendPos ); if( bHasExpansion && nLegendExpansion!= chart::ChartLegendExpansion_CUSTOM ) - xLegendProps->setPropertyValue( rtl::OUString::createFromAscii( "Expansion" ), uno::makeAny(nLegendExpansion) ); + xLegendProps->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Expansion" )), uno::makeAny(nLegendExpansion) ); else if( bHasHeight && bHasWidth ) xLegendShape->setSize( aLegendSize ); diff --git a/xmloff/source/chart/SchXMLSeries2Context.cxx b/xmloff/source/chart/SchXMLSeries2Context.cxx index 14b330f378..0324d598bc 100644 --- a/xmloff/source/chart/SchXMLSeries2Context.cxx +++ b/xmloff/source/chart/SchXMLSeries2Context.cxx @@ -582,7 +582,7 @@ void SchXMLSeries2Context::EndElement() } else if( m_rGlobalSeriesImportInfo.aFirstFirstDomainAddress.getLength() ) { - DomainInfo aDomainInfo( OUString::createFromAscii("values-y"), m_rGlobalSeriesImportInfo.aFirstFirstDomainAddress, m_rGlobalSeriesImportInfo.nFirstFirstDomainIndex ) ; + DomainInfo aDomainInfo( OUString(RTL_CONSTASCII_USTRINGPARAM("values-y")), m_rGlobalSeriesImportInfo.aFirstFirstDomainAddress, m_rGlobalSeriesImportInfo.nFirstFirstDomainIndex ) ; aDomainInfos.push_back( aDomainInfo ); } } diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index 064fb96eda..b428e7c905 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -449,7 +449,6 @@ void SvXMLExport::_InitCtor() mpImpl->mbSaveBackwardCompatibleODF = bTemp; } } - // <-- } // Shapes in Writer cannot be named via context menu (#i51726#) diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index ef00f9bce3..b480c8a511 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -3135,6 +3135,8 @@ namespace xmloff { namespace token { TOKEN( "min-value", XML_MIN_VALUE ), TOKEN( "max-value", XML_MAX_VALUE ), + TOKEN( "margin", XML_MARGIN), + #if OSL_DEBUG_LEVEL > 0 { 0, NULL, NULL, XML_TOKEN_END } #else diff --git a/xmloff/source/draw/sdxmlimp.cxx b/xmloff/source/draw/sdxmlimp.cxx index 47fcac2a7f..cf68d47eba 100644 --- a/xmloff/source/draw/sdxmlimp.cxx +++ b/xmloff/source/draw/sdxmlimp.cxx @@ -444,6 +444,17 @@ void SAL_CALL SdXMLImport::initialize( const uno::Sequence< uno::Any >& aArgumen if( xInfoSetInfo->hasPropertyByName( msPreview ) ) xInfoSet->getPropertyValue( msPreview ) >>= mbPreview; + + ::rtl::OUString const sOrganizerMode( + RTL_CONSTASCII_USTRINGPARAM("OrganizerMode")); + if (xInfoSetInfo->hasPropertyByName(sOrganizerMode)) + { + sal_Bool bStyleOnly(sal_False); + if (xInfoSet->getPropertyValue(sOrganizerMode) >>= bStyleOnly) + { + mbLoadDoc = !bStyleOnly; + } + } } } @@ -753,7 +764,7 @@ SvXMLImportContext *SdXMLImport::CreateMetaContext(const OUString& rLocalName, { SvXMLImportContext* pContext = 0L; - if (!IsStylesOnlyMode() && (getImportFlags() & IMPORT_META)) + if (getImportFlags() & IMPORT_META) { uno::Reference<xml::sax::XDocumentHandler> xDocBuilder( mxServiceFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( @@ -761,9 +772,11 @@ SvXMLImportContext *SdXMLImport::CreateMetaContext(const OUString& rLocalName, uno::UNO_QUERY_THROW); uno::Reference<document::XDocumentPropertiesSupplier> xDPS( GetModel(), uno::UNO_QUERY_THROW); + uno::Reference<document::XDocumentProperties> const xDocProps( + (IsStylesOnlyMode()) ? 0 : xDPS->getDocumentProperties()); pContext = new SvXMLMetaDocumentContext(*this, XML_NAMESPACE_OFFICE, rLocalName, - xDPS->getDocumentProperties(), xDocBuilder); + xDocProps, xDocBuilder); } if(!pContext) diff --git a/xmloff/source/draw/shapeimport.cxx b/xmloff/source/draw/shapeimport.cxx index cf8c2a72b3..8c04bc6edc 100644 --- a/xmloff/source/draw/shapeimport.cxx +++ b/xmloff/source/draw/shapeimport.cxx @@ -883,7 +883,6 @@ void XMLShapeImportHelper::finishShape( aPosLayoutDir ); } } - // <-- } // helper functions for z-order sorting diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx index c699a038ec..c00ad37463 100644 --- a/xmloff/source/draw/ximpshap.cxx +++ b/xmloff/source/draw/ximpshap.cxx @@ -1927,7 +1927,7 @@ void SdXMLConnectorShapeContext::StartElement(const uno::Reference< xml::sax::XA if ( maPath.hasValue() ) { - // --> OD #i115492# + // #i115492# // Ignore svg:d attribute for text documents created by OpenOffice.org // versions before OOo 3.3, because these OOo versions are storing // svg:d values not using the correct unit. @@ -1953,7 +1953,6 @@ void SdXMLConnectorShapeContext::StartElement(const uno::Reference< xml::sax::XA { xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("PolyPolygonBezier") ), maPath ); } - // <-- } SdXMLShapeContext::StartElement(xAttrList); diff --git a/xmloff/source/forms/elementimport.cxx b/xmloff/source/forms/elementimport.cxx index 6247264730..051b7c289f 100644 --- a/xmloff/source/forms/elementimport.cxx +++ b/xmloff/source/forms/elementimport.cxx @@ -889,12 +889,12 @@ namespace xmloff if (!bRetrievedValues) { getValuePropertyNames(m_eElementType, nClassId, pCurrentValueProperty, pValueProperty); - ENSURE_OR_BREAK( pCurrentValueProperty && pValueProperty, "OControlImport::StartElement: illegal value property names!" ); + ENSURE_OR_BREAK( pValueProperty, "OControlImport::StartElement: illegal value property names!" ); bRetrievedValues = sal_True; } - OSL_ENSURE((PROPID_VALUE != aValueProps->Handle) || pValueProperty, + ENSURE_OR_BREAK((PROPID_VALUE != aValueProps->Handle) || pValueProperty, "OControlImport::StartElement: the control does not have a value property!"); - OSL_ENSURE((PROPID_CURRENT_VALUE != aValueProps->Handle) || pCurrentValueProperty, + ENSURE_OR_BREAK((PROPID_CURRENT_VALUE != aValueProps->Handle) || pCurrentValueProperty, "OControlImport::StartElement: the control does not have a current-value property!"); // transfer the name diff --git a/xmloff/source/meta/xmlmetai.cxx b/xmloff/source/meta/xmlmetai.cxx index 0278307eda..aa1155f2da 100644 --- a/xmloff/source/meta/xmlmetai.cxx +++ b/xmloff/source/meta/xmlmetai.cxx @@ -31,6 +31,7 @@ #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> #include <com/sun/star/xml/dom/XSAXDocumentBuilder.hpp> +#include <com/sun/star/xml/xpath/XXPathAPI.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertySetInfo.hpp> @@ -125,6 +126,71 @@ void XMLDocumentBuilderContext::EndElement() //=========================================================================== +static void +lcl_initDocumentProperties(SvXMLImport & rImport, + uno::Reference<xml::sax::XDocumentHandler> const& xDocBuilder, + uno::Reference<document::XDocumentProperties> const& xDocProps) +{ + uno::Sequence< uno::Any > aSeq(1); + uno::Reference< xml::dom::XSAXDocumentBuilder > const xDB(xDocBuilder, + uno::UNO_QUERY_THROW); + aSeq[0] <<= xDB->getDocument(); + uno::Reference< lang::XInitialization > const xInit(xDocProps, + uno::UNO_QUERY_THROW); + try { + xInit->initialize(aSeq); + rImport.SetStatistics(xDocProps->getDocumentStatistics()); + // convert all URLs from relative to absolute + xDocProps->setTemplateURL(rImport.GetAbsoluteReference( + xDocProps->getTemplateURL())); + xDocProps->setAutoloadURL(rImport.GetAbsoluteReference( + xDocProps->getAutoloadURL())); + SvXMLMetaDocumentContext::setBuildId( + xDocProps->getGenerator(), rImport.getImportInfo()); + } catch (uno::RuntimeException) { + throw; + } catch (uno::Exception & e) { + throw lang::WrappedTargetRuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "SvXMLMetaDocumentContext::initDocumentProperties: " + "properties init exception")), + rImport, makeAny(e)); + } +} + +static void +lcl_initGenerator(SvXMLImport & rImport, + uno::Reference<xml::sax::XDocumentHandler> const& xDocBuilder) +{ + uno::Reference< xml::dom::XSAXDocumentBuilder > const xDB(xDocBuilder, + uno::UNO_QUERY_THROW); + uno::Reference< xml::dom::XDocument > const xDoc(xDB->getDocument(), + uno::UNO_SET_THROW); + try { + uno::Reference< xml::xpath::XXPathAPI > const xPath( + rImport.getServiceFactory()->createInstance( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.xml.xpath.XPathAPI"))), + uno::UNO_QUERY_THROW ); + xPath->registerNS(GetXMLToken(XML_NP_OFFICE),GetXMLToken(XML_N_OFFICE)); + xPath->registerNS(GetXMLToken(XML_NP_META), GetXMLToken(XML_N_META)); + + ::rtl::OUString const expr(RTL_CONSTASCII_USTRINGPARAM( + "string(/office:document-meta/office:meta/meta:generator)")); + uno::Reference< xml::xpath::XXPathObject > const xObj( + xPath->eval(xDoc.get(), expr), uno::UNO_SET_THROW); + OUString const value(xObj->getString()); + SvXMLMetaDocumentContext::setBuildId(value, rImport.getImportInfo()); + } catch (uno::RuntimeException) { + throw; + } catch (uno::Exception & e) { + throw lang::WrappedTargetRuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "SvXMLMetaDocumentContext::initGenerator: exception")), + rImport, makeAny(e)); + } +} + SvXMLMetaDocumentContext::SvXMLMetaDocumentContext(SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLName, const uno::Reference<document::XDocumentProperties>& xDocProps, @@ -133,8 +199,9 @@ SvXMLMetaDocumentContext::SvXMLMetaDocumentContext(SvXMLImport& rImport, mxDocProps(xDocProps), mxDocBuilder(xDocBuilder) { - DBG_ASSERT(xDocProps.is(), "SvXMLMetaDocumentContext: no document props"); - DBG_ASSERT(xDocBuilder.is(), "SvXMLMetaDocumentContext: no document hdlr"); +// #i103539#: must always read meta.xml for generator, xDocProps unwanted then +// OSL_ENSURE(xDocProps.is(), "SvXMLMetaDocumentContext: no document props"); + OSL_ENSURE(xDocBuilder.is(), "SvXMLMetaDocumentContext: no document hdlr"); // here are no attributes } @@ -167,6 +234,7 @@ void SvXMLMetaDocumentContext::StartElement( mxDocBuilder->startElement( GetImport().GetNamespaceMap().GetQNameByKey(GetPrefix(), GetXMLToken(XML_DOCUMENT_META)), xAttrList); + } void SvXMLMetaDocumentContext::EndElement() @@ -176,43 +244,16 @@ void SvXMLMetaDocumentContext::EndElement() GetImport().GetNamespaceMap().GetQNameByKey(GetPrefix(), GetXMLToken(XML_DOCUMENT_META))); mxDocBuilder->endDocument(); - initDocumentProperties(); -} - -void SvXMLMetaDocumentContext::initDocumentProperties() -{ - uno::Sequence< uno::Any > aSeq(1); - uno::Reference< xml::dom::XSAXDocumentBuilder > xDB (mxDocBuilder, - uno::UNO_QUERY_THROW); - aSeq[0] <<= xDB->getDocument(); - uno::Reference< lang::XInitialization > xInit(mxDocProps, - uno::UNO_QUERY_THROW); - try { - xInit->initialize(aSeq); - GetImport().SetStatistics(mxDocProps->getDocumentStatistics()); - // convert all URLs from relative to absolute - mxDocProps->setTemplateURL(GetImport().GetAbsoluteReference( - mxDocProps->getTemplateURL())); - mxDocProps->setAutoloadURL(GetImport().GetAbsoluteReference( - mxDocProps->getAutoloadURL())); - setBuildId(mxDocProps->getGenerator()); - } catch (uno::RuntimeException) { - throw; - } catch (uno::Exception & e) { - throw lang::WrappedTargetRuntimeException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "SvXMLMetaDocumentContext::initDocumentProperties: " - "properties init exception")), - GetImport(), makeAny(e)); + if (mxDocProps.is()) + { + lcl_initDocumentProperties(GetImport(), mxDocBuilder, mxDocProps); + } + else + { + lcl_initGenerator(GetImport(), mxDocBuilder); } } -void SvXMLMetaDocumentContext::setBuildId(const ::rtl::OUString & i_rBuildId) -{ - SvXMLMetaDocumentContext::setBuildId( i_rBuildId, GetImport().getImportInfo() ); -} - -//static void SvXMLMetaDocumentContext::setBuildId(::rtl::OUString const& i_rBuildId, const uno::Reference<beans::XPropertySet>& xImportInfo ) { OUString sBuildId; diff --git a/xmloff/source/style/PageMasterExportPropMapper.cxx b/xmloff/source/style/PageMasterExportPropMapper.cxx index c59d61ced2..fa4442a8f6 100644 --- a/xmloff/source/style/PageMasterExportPropMapper.cxx +++ b/xmloff/source/style/PageMasterExportPropMapper.cxx @@ -85,6 +85,12 @@ void lcl_AddState(::std::vector< XMLPropertyState >& rPropState, sal_Int32 nInde struct XMLPropertyStateBuffer { + XMLPropertyState* pPMMarginAll; + XMLPropertyState* pPMMarginTop; + XMLPropertyState* pPMMarginBottom; + XMLPropertyState* pPMMarginLeft; + XMLPropertyState* pPMMarginRight; + XMLPropertyState* pPMBorderAll; XMLPropertyState* pPMBorderTop; XMLPropertyState* pPMBorderBottom; @@ -107,7 +113,13 @@ struct XMLPropertyStateBuffer void ContextFilter( ::std::vector< XMLPropertyState >& rPropState ); }; -XMLPropertyStateBuffer::XMLPropertyStateBuffer() : +XMLPropertyStateBuffer::XMLPropertyStateBuffer() + : pPMMarginAll( NULL ) + , pPMMarginTop( NULL ) + , pPMMarginBottom( NULL ) + , pPMMarginLeft( NULL ) + , pPMMarginRight( NULL ) + , pPMBorderAll( NULL ), pPMBorderTop( NULL ), pPMBorderBottom( NULL ), @@ -130,6 +142,31 @@ XMLPropertyStateBuffer::XMLPropertyStateBuffer() : void XMLPropertyStateBuffer::ContextFilter( ::std::vector< XMLPropertyState >& ) { + if (pPMMarginAll) + { + if (pPMMarginTop && pPMMarginBottom && pPMMarginLeft && pPMMarginRight) + { + sal_Int32 nTop = 0, nBottom = 0, nLeft = 0, nRight = 0; + + pPMMarginTop->maValue >>= nTop; + pPMMarginBottom->maValue >>= nBottom; + pPMMarginLeft->maValue >>= nLeft; + pPMMarginRight->maValue >>= nRight; + + if ((nTop == nBottom) && (nBottom == nLeft) && (nLeft == nRight)) + { + lcl_RemoveState( pPMMarginTop ); + lcl_RemoveState( pPMMarginBottom ); + lcl_RemoveState( pPMMarginLeft ); + lcl_RemoveState( pPMMarginRight ); + } + else + lcl_RemoveState( pPMMarginAll ); + } + else + lcl_RemoveState( pPMMarginAll ); + } + if( pPMBorderAll ) { if( pPMBorderTop && pPMBorderBottom && pPMBorderLeft && pPMBorderRight ) @@ -349,6 +386,11 @@ void XMLPageMasterExportPropMapper::ContextFilter( switch( nSimpleId ) { + case CTF_PM_MARGINALL: pBuffer->pPMMarginAll = pProp; break; + case CTF_PM_MARGINTOP: pBuffer->pPMMarginTop = pProp; break; + case CTF_PM_MARGINBOTTOM: pBuffer->pPMMarginBottom = pProp; break; + case CTF_PM_MARGINLEFT: pBuffer->pPMMarginLeft = pProp; break; + case CTF_PM_MARGINRIGHT: pBuffer->pPMMarginRight = pProp; break; case CTF_PM_BORDERALL: pBuffer->pPMBorderAll = pProp; break; case CTF_PM_BORDERTOP: pBuffer->pPMBorderTop = pProp; break; case CTF_PM_BORDERBOTTOM: pBuffer->pPMBorderBottom = pProp; break; diff --git a/xmloff/source/style/PageMasterImportPropMapper.cxx b/xmloff/source/style/PageMasterImportPropMapper.cxx index 048c5dc5e1..3785ea7fd6 100644 --- a/xmloff/source/style/PageMasterImportPropMapper.cxx +++ b/xmloff/source/style/PageMasterImportPropMapper.cxx @@ -29,7 +29,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_xmloff.hxx" - #include "PageMasterImportPropMapper.hxx" #include "PageMasterPropMapper.hxx" #include <xmloff/PageMasterStyleMap.hxx> @@ -126,7 +125,15 @@ void PageMasterImportPropertyMapper::finished(::std::vector< XMLPropertyState >& XMLPropertyState* pFooterHeight = NULL; XMLPropertyState* pFooterMinHeight = NULL; XMLPropertyState* pFooterDynamic = NULL; - sal_uInt16 i; // for the "for" loop + XMLPropertyState* pAllMarginProperty = NULL; + XMLPropertyState* pMargins[4] = { NULL, NULL, NULL, NULL }; + ::std::auto_ptr<XMLPropertyState> pNewMargins[4]; + XMLPropertyState* pAllHeaderMarginProperty = NULL; + XMLPropertyState* pHeaderMargins[4] = { NULL, NULL, NULL, NULL }; + ::std::auto_ptr<XMLPropertyState> pNewHeaderMargins[4]; + XMLPropertyState* pAllFooterMarginProperty = NULL; + XMLPropertyState* pFooterMargins[4] = { NULL, NULL, NULL, NULL }; + ::std::auto_ptr<XMLPropertyState> pNewFooterMargins[4]; ::std::vector< XMLPropertyState >::iterator aEnd = rProperties.end(); for (::std::vector< XMLPropertyState >::iterator aIter = rProperties.begin(); aIter != aEnd; ++aIter) @@ -186,12 +193,60 @@ void PageMasterImportPropertyMapper::finished(::std::vector< XMLPropertyState >& case CTF_PM_HEADERMINHEIGHT : pHeaderMinHeight = property; break; case CTF_PM_FOOTERHEIGHT : pFooterHeight = property; break; case CTF_PM_FOOTERMINHEIGHT : pFooterMinHeight = property; break; + case CTF_PM_MARGINALL : + pAllMarginProperty = property; break; + case CTF_PM_MARGINTOP : + pMargins[XML_LINE_TOP] = property; break; + case CTF_PM_MARGINBOTTOM: + pMargins[XML_LINE_BOTTOM] = property; break; + case CTF_PM_MARGINLEFT : + pMargins[XML_LINE_LEFT] = property; break; + case CTF_PM_MARGINRIGHT : + pMargins[XML_LINE_RIGHT] = property; break; + case CTF_PM_HEADERMARGINALL : + pAllHeaderMarginProperty = property; break; + case CTF_PM_HEADERMARGINTOP : + pHeaderMargins[XML_LINE_TOP] = property; break; + case CTF_PM_HEADERMARGINBOTTOM: + pHeaderMargins[XML_LINE_BOTTOM] = property; break; + case CTF_PM_HEADERMARGINLEFT : + pHeaderMargins[XML_LINE_LEFT] = property; break; + case CTF_PM_HEADERMARGINRIGHT : + pHeaderMargins[XML_LINE_RIGHT] = property; break; + case CTF_PM_FOOTERMARGINALL : + pAllFooterMarginProperty = property; break; + case CTF_PM_FOOTERMARGINTOP : + pFooterMargins[XML_LINE_TOP] = property; break; + case CTF_PM_FOOTERMARGINBOTTOM: + pFooterMargins[XML_LINE_BOTTOM] = property; break; + case CTF_PM_FOOTERMARGINLEFT : + pFooterMargins[XML_LINE_LEFT] = property; break; + case CTF_PM_FOOTERMARGINRIGHT : + pFooterMargins[XML_LINE_RIGHT] = property; break; } } } - for ( i = 0; i < 4; i++) + for (sal_uInt16 i = 0; i < 4; i++) { + if (pAllMarginProperty && !pMargins[i]) + { + pNewMargins[i].reset(new XMLPropertyState( + pAllMarginProperty->mnIndex + 1 + i, + pAllMarginProperty->maValue)); + } + if (pAllHeaderMarginProperty && !pHeaderMargins[i]) + { + pNewHeaderMargins[i].reset(new XMLPropertyState( + pAllHeaderMarginProperty->mnIndex + 1 + i, + pAllHeaderMarginProperty->maValue)); + } + if (pAllFooterMarginProperty && !pFooterMargins[i]) + { + pNewFooterMargins[i].reset(new XMLPropertyState( + pAllFooterMarginProperty->mnIndex + 1 + i, + pAllFooterMarginProperty->maValue)); + } if (pAllPaddingProperty && !pPadding[i]) pNewPadding[i] = new XMLPropertyState(pAllPaddingProperty->mnIndex + 1 + i, pAllPaddingProperty->maValue); if (pAllBorderProperty && !pBorders[i]) @@ -294,8 +349,20 @@ void PageMasterImportPropertyMapper::finished(::std::vector< XMLPropertyState >& aAny.setValue( &bValue, ::getBooleanCppuType() ); pFooterDynamic = new XMLPropertyState(pFooterMinHeight->mnIndex + 1, aAny); } - for (i = 0; i < 4; i++) + for (sal_uInt16 i = 0; i < 4; i++) { + if (pNewMargins[i].get()) + { + rProperties.push_back(*pNewMargins[i]); + } + if (pNewHeaderMargins[i].get()) + { + rProperties.push_back(*pNewHeaderMargins[i]); + } + if (pNewFooterMargins[i].get()) + { + rProperties.push_back(*pNewFooterMargins[i]); + } if (pNewPadding[i]) { rProperties.push_back(*pNewPadding[i]); diff --git a/xmloff/source/style/PageMasterStyleMap.cxx b/xmloff/source/style/PageMasterStyleMap.cxx index 7dafe3a766..8c5665284c 100644 --- a/xmloff/source/style/PageMasterStyleMap.cxx +++ b/xmloff/source/style/PageMasterStyleMap.cxx @@ -30,7 +30,7 @@ #include "precompiled_xmloff.hxx" #include <xmloff/PageMasterStyleMap.hxx> -#include "xmloff/xmlnmspe.hxx" +#include <xmloff/xmlnmspe.hxx> #include <xmloff/xmltoken.hxx> using namespace ::xmloff::token; @@ -53,10 +53,11 @@ const XMLPropertyMapEntry aXMLPageMasterStyleMap[] = PLMAP( "NumberingType", XML_NAMESPACE_STYLE, XML_NUM_LETTER_SYNC, XML_PM_TYPE_NUMLETTERSYNC, 0 ), PLMAP( "PrinterPaperTray", XML_NAMESPACE_STYLE, XML_PAPER_TRAY_NAME, XML_TYPE_STRING | MID_FLAG_PROPERTY_MAY_EXCEPT, 0 ), PLMAP( "IsLandscape", XML_NAMESPACE_STYLE, XML_PRINT_ORIENTATION, XML_PM_TYPE_PRINTORIENTATION, 0 ), - PLMAP( "TopMargin", XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_TYPE_MEASURE, 0 ), - PLMAP( "BottomMargin", XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_TYPE_MEASURE, 0 ), - PLMAP( "LeftMargin", XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_MEASURE, 0 ), - PLMAP( "RightMargin", XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_TYPE_MEASURE, 0 ), + PLMAP( "TopMargin", XML_NAMESPACE_FO, XML_MARGIN, XML_TYPE_MEASURE, CTF_PM_MARGINALL ), + PLMAP( "TopMargin", XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_TYPE_MEASURE, CTF_PM_MARGINTOP ), + PLMAP( "BottomMargin", XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_TYPE_MEASURE, CTF_PM_MARGINBOTTOM ), + PLMAP( "LeftMargin", XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_MEASURE, CTF_PM_MARGINLEFT ), + PLMAP( "RightMargin", XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_TYPE_MEASURE, CTF_PM_MARGINRIGHT ), PLMAP( "TopBorder", XML_NAMESPACE_FO, XML_BORDER, XML_TYPE_BORDER, CTF_PM_BORDERALL ), PLMAP( "TopBorder", XML_NAMESPACE_FO, XML_BORDER_TOP, XML_TYPE_BORDER, CTF_PM_BORDERTOP ), PLMAP( "BottomBorder", XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_TYPE_BORDER, CTF_PM_BORDERBOTTOM ), @@ -131,9 +132,10 @@ const XMLPropertyMapEntry aXMLPageMasterStyleMap[] = HFMAP( "HeaderHeight", XML_NAMESPACE_SVG, XML_HEIGHT, XML_TYPE_MEASURE, CTF_PM_HEADERHEIGHT ), HFMAP( "HeaderHeight", XML_NAMESPACE_FO, XML_MIN_HEIGHT, XML_TYPE_MEASURE, CTF_PM_HEADERMINHEIGHT ), HFMAP( "HeaderIsDynamicHeight", XML_NAMESPACE_STYLE, XML__EMPTY, XML_TYPE_BOOL, CTF_PM_HEADERDYNAMIC ), - HFMAP( "HeaderLeftMargin", XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_MEASURE, CTF_PM_HEADERFLAG ), - HFMAP( "HeaderRightMargin", XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_TYPE_MEASURE, CTF_PM_HEADERFLAG ), - HFMAP( "HeaderBodyDistance", XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_TYPE_MEASURE, CTF_PM_HEADERFLAG ), + HFMAP( "HeaderLeftMargin", XML_NAMESPACE_FO, XML_MARGIN, XML_TYPE_MEASURE, CTF_PM_HEADERMARGINALL ), + HFMAP( "HeaderLeftMargin", XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_MEASURE, CTF_PM_HEADERMARGINLEFT ), + HFMAP( "HeaderRightMargin", XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_TYPE_MEASURE, CTF_PM_HEADERMARGINRIGHT ), + HFMAP( "HeaderBodyDistance", XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_TYPE_MEASURE, CTF_PM_HEADERMARGINBOTTOM ), HFMAP( "HeaderTopBorder", XML_NAMESPACE_FO, XML_BORDER, XML_TYPE_BORDER, CTF_PM_HEADERBORDERALL ), HFMAP( "HeaderTopBorder", XML_NAMESPACE_FO, XML_BORDER_TOP, XML_TYPE_BORDER, CTF_PM_HEADERBORDERTOP ), HFMAP( "HeaderBottomBorder", XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_TYPE_BORDER, CTF_PM_HEADERBORDERBOTTOM ), @@ -161,9 +163,10 @@ const XMLPropertyMapEntry aXMLPageMasterStyleMap[] = HFMAP( "FooterHeight", XML_NAMESPACE_SVG, XML_HEIGHT, XML_TYPE_MEASURE, CTF_PM_FOOTERHEIGHT ), HFMAP( "FooterHeight", XML_NAMESPACE_FO, XML_MIN_HEIGHT, XML_TYPE_MEASURE, CTF_PM_FOOTERMINHEIGHT ), HFMAP( "FooterIsDynamicHeight", XML_NAMESPACE_STYLE, XML__EMPTY, XML_TYPE_BOOL, CTF_PM_FOOTERDYNAMIC ), - HFMAP( "FooterLeftMargin", XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_MEASURE, CTF_PM_FOOTERFLAG ), - HFMAP( "FooterRightMargin", XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_TYPE_MEASURE, CTF_PM_FOOTERFLAG ), - HFMAP( "FooterBodyDistance", XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_TYPE_MEASURE, CTF_PM_FOOTERFLAG ), + HFMAP( "FooterLeftMargin", XML_NAMESPACE_FO, XML_MARGIN, XML_TYPE_MEASURE, CTF_PM_FOOTERMARGINALL ), + HFMAP( "FooterLeftMargin", XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_MEASURE, CTF_PM_FOOTERMARGINLEFT ), + HFMAP( "FooterRightMargin", XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_TYPE_MEASURE, CTF_PM_FOOTERMARGINRIGHT ), + HFMAP( "FooterBodyDistance", XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_TYPE_MEASURE, CTF_PM_FOOTERMARGINTOP ), HFMAP( "FooterTopBorder", XML_NAMESPACE_FO, XML_BORDER, XML_TYPE_BORDER, CTF_PM_FOOTERBORDERALL ), HFMAP( "FooterTopBorder", XML_NAMESPACE_FO, XML_BORDER_TOP, XML_TYPE_BORDER, CTF_PM_FOOTERBORDERTOP ), HFMAP( "FooterBottomBorder", XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_TYPE_BORDER, CTF_PM_FOOTERBORDERBOTTOM ), diff --git a/xmloff/source/text/XMLIndexChapterInfoEntryContext.cxx b/xmloff/source/text/XMLIndexChapterInfoEntryContext.cxx index 24f5254f12..86e5998bd9 100644 --- a/xmloff/source/text/XMLIndexChapterInfoEntryContext.cxx +++ b/xmloff/source/text/XMLIndexChapterInfoEntryContext.cxx @@ -87,7 +87,6 @@ static const SvXMLEnumMapEntry aChapterDisplayMap[] = //---> i89791 // enabled for ODF 1.2, full index support in 3.0 { XML_PLAIN_NUMBER_AND_NAME, ChapterFormat::NO_PREFIX_SUFFIX }, - //<--- { XML_PLAIN_NUMBER, ChapterFormat::DIGIT }, { XML_TOKEN_INVALID, 0 } }; @@ -174,7 +173,6 @@ void XMLIndexChapterInfoEntryContext::StartElement( } } } - // <-- } if (bOutlineLevelOK) nValues++; diff --git a/xmloff/source/text/XMLIndexTOCContext.cxx b/xmloff/source/text/XMLIndexTOCContext.cxx index f412d1cf91..14a72b3afa 100644 --- a/xmloff/source/text/XMLIndexTOCContext.cxx +++ b/xmloff/source/text/XMLIndexTOCContext.cxx @@ -123,9 +123,9 @@ XMLIndexTOCContext::XMLIndexTOCContext( if (SvXMLUnitConverter::convertEnum(nTmp, rLocalName, aIndexTypeMap)) { // check for array index: - OSL_ENSURE(nTmp < (sizeof(aIndexServiceMap)/sizeof(sal_Char*)), "index out of range"); - OSL_ENSURE(sizeof(aIndexServiceMap) == - sizeof(aIndexSourceElementMap), + OSL_ENSURE(nTmp < (SAL_N_ELEMENTS(aIndexServiceMap)), "index out of range"); + OSL_ENSURE(SAL_N_ELEMENTS(aIndexServiceMap) == + SAL_N_ELEMENTS(aIndexSourceElementMap), "service and source element maps must be same size"); eIndexType = static_cast<IndexTypeEnum>(nTmp); diff --git a/xmloff/source/text/XMLSectionExport.cxx b/xmloff/source/text/XMLSectionExport.cxx index f579ce4428..2e91edec39 100644 --- a/xmloff/source/text/XMLSectionExport.cxx +++ b/xmloff/source/text/XMLSectionExport.cxx @@ -1341,7 +1341,6 @@ void XMLSectionExport::ExportIndexTemplateElement( rValues[i].Value >>= nLevel; bLevelOK = sal_True; break; -//<--- case TOK_TPARAM_BIBLIOGRAPHY_DATA: rValues[i].Value >>= nBibliographyData; bBibliographyDataOK = sal_True; @@ -1449,7 +1448,6 @@ void XMLSectionExport::ExportIndexTemplateElement( bChapterFormatOK = sal_False; } } -//<--- // ... and write Element if (eElement != XML_TOKEN_INVALID) @@ -1537,7 +1535,6 @@ void XMLSectionExport::ExportIndexTemplateElement( if (bLevelOK) GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_OUTLINE_LEVEL, OUString::valueOf((sal_Int32)nLevel)); -//<--- } //--->i53420 @@ -1552,7 +1549,6 @@ void XMLSectionExport::ExportIndexTemplateElement( GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_OUTLINE_LEVEL, OUString::valueOf((sal_Int32)nLevel)); } -//<--- // export template SvXMLElementExport aTemplateElement(GetExport(), XML_NAMESPACE_TEXT, GetXMLToken(eElement), diff --git a/xmloff/source/text/txtexppr.cxx b/xmloff/source/text/txtexppr.cxx index 0e8584b686..7d04488225 100644 --- a/xmloff/source/text/txtexppr.cxx +++ b/xmloff/source/text/txtexppr.cxx @@ -31,6 +31,9 @@ #include <tools/debug.hxx> #include <xmloff/txtprmap.hxx> #include <com/sun/star/table/BorderLine2.hpp> + +#include "txtexppr.hxx" + #include <com/sun/star/text/SizeType.hpp> #include <com/sun/star/text/WrapTextMode.hpp> #include <com/sun/star/text/TextContentAnchorType.hpp> @@ -38,7 +41,10 @@ #include <com/sun/star/awt/FontPitch.hpp> #include <com/sun/star/awt/FontUnderline.hpp> #include <com/sun/star/text/XChapterNumberingSupplier.hpp> -#include "txtexppr.hxx" + +#include <tools/debug.hxx> + +#include <xmloff/txtprmap.hxx> #include <xmloff/xmlexp.hxx> #include "XMLSectionFootnoteConfigExport.hxx" @@ -303,6 +309,26 @@ void XMLTextExportPropertySetMapper::ContextFontHeightFilter( // helper method; implementation below bool lcl_IsOutlineStyle(const SvXMLExport&, const OUString&); +static void +lcl_checkMultiProperty(XMLPropertyState *const pState, + XMLPropertyState *const pRelState) +{ + if (pState && pRelState) + { + sal_Int32 nTemp = 0; + pRelState->maValue >>= nTemp; + if (100 == nTemp) + { + pRelState->mnIndex = -1; + pRelState->maValue.clear(); + } + else + { + pState->mnIndex = -1; + pState->maValue.clear(); + } + } +} void XMLTextExportPropertySetMapper::ContextFilter( ::std::vector< XMLPropertyState >& rProperties, @@ -443,6 +469,9 @@ void XMLTextExportPropertySetMapper::ContextFilter( XMLPropertyState* pClip11State = NULL; XMLPropertyState* pClipState = NULL; + XMLPropertyState* pAllParaMargin = NULL; + XMLPropertyState* pAllMargin = NULL; + sal_Bool bNeedsAnchor = sal_False; for( ::std::vector< XMLPropertyState >::iterator aIter = rProperties.begin(); @@ -557,6 +586,8 @@ void XMLTextExportPropertySetMapper::ContextFilter( case CTF_NUMBERINGSTYLENAME: pListStyleName = propertie; break; case CTF_TEXT_CLIP11: pClip11State = propertie; break; case CTF_TEXT_CLIP: pClipState = propertie; break; + case CTF_PARAMARGINALL: pAllParaMargin = propertie; break; + case CTF_MARGINALL: pAllMargin = propertie; break; } } @@ -602,87 +633,21 @@ void XMLTextExportPropertySetMapper::ContextFilter( } } - if( pParaLeftMarginState && pParaLeftMarginRelState ) - { - sal_Int32 nTemp = 0; - 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 = 0; - 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 = 0; - pParaFirstLineRelState->maValue >>= nTemp; - if( nTemp == 100 ) - { - pParaFirstLineRelState->mnIndex = -1; - pParaFirstLineRelState->maValue.clear(); - } - else - { - pParaFirstLineState->mnIndex = -1; - pParaFirstLineState->maValue.clear(); - } - } + lcl_checkMultiProperty(pParaLeftMarginState, pParaLeftMarginRelState); + lcl_checkMultiProperty(pParaRightMarginState, pParaRightMarginRelState); + lcl_checkMultiProperty(pParaTopMarginState, pParaTopMarginRelState); + lcl_checkMultiProperty(pParaBottomMarginState, pParaBottomMarginRelState); + lcl_checkMultiProperty(pParaFirstLineState, pParaFirstLineRelState); - if( pParaTopMarginState && pParaTopMarginRelState ) + if (pAllParaMargin) { - sal_Int32 nTemp = 0; - pParaTopMarginRelState->maValue >>= nTemp; - if( nTemp == 100 ) - { - pParaTopMarginRelState->mnIndex = -1; - pParaTopMarginRelState->maValue.clear(); - } - else - { - pParaTopMarginState->mnIndex = -1; - pParaTopMarginState->maValue.clear(); - } - + pAllParaMargin->mnIndex = -1; // just export individual attributes... + pAllParaMargin->maValue.clear(); } - - if( pParaBottomMarginState && pParaBottomMarginRelState ) + if (pAllMargin) { - sal_Int32 nTemp = 0; - pParaBottomMarginRelState->maValue >>= nTemp; - if( nTemp == 100 ) - { - pParaBottomMarginRelState->mnIndex = -1; - pParaBottomMarginRelState->maValue.clear(); - } - else - { - pParaBottomMarginState->mnIndex = -1; - pParaBottomMarginState->maValue.clear(); - } - + pAllMargin->mnIndex = -1; // just export individual attributes... + pAllMargin->maValue.clear(); } if( pAllBorderWidthState ) diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index 5112a5a6b4..949adabd46 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -149,9 +149,8 @@ static SvXMLTokenMapEntry aTextElemTokenMap[] = { XML_NAMESPACE_OFFICE, XML_FORMS, XML_TOK_TEXT_FORMS }, { XML_NAMESPACE_TABLE, XML_CALCULATION_SETTINGS, XML_TOK_TEXT_CALCULATION_SETTINGS }, { XML_NAMESPACE_TEXT, XML_ALPHABETICAL_INDEX_AUTO_MARK_FILE, XML_TOK_TEXT_AUTOMARK }, - // --> FLR #i52127# + // #i52127# { XML_NAMESPACE_TEXT, XML_NUMBERED_PARAGRAPH, XML_TOK_TEXT_NUMBERED_PARAGRAPH }, - // <-- XML_TOKEN_MAP_END }; @@ -1447,9 +1446,7 @@ sal_Bool lcl_HasListStyle( OUString sStyleName, { bRet = sal_False; } - // <-- } - // <-- break; } else @@ -1463,7 +1460,6 @@ sal_Bool lcl_HasListStyle( OUString sStyleName, return bRet; } -// <-- OUString XMLTextImportHelper::SetStyleAndAttrs( SvXMLImport& rImport, const Reference < XTextCursor >& rCursor, diff --git a/xmloff/source/text/txtimppr.cxx b/xmloff/source/text/txtimppr.cxx index 7b5d99bec7..180ac0f3fe 100644 --- a/xmloff/source/text/txtimppr.cxx +++ b/xmloff/source/text/txtimppr.cxx @@ -316,7 +316,12 @@ void XMLTextImportPropertyMapper::finished( XMLPropertyState* pVertOrientRelAsChar = 0; XMLPropertyState* pBackTransparency = NULL; // transparency in % XMLPropertyState* pBackTransparent = NULL; // transparency as boolean - sal_uInt16 i; // for the "for" loop + XMLPropertyState* pAllParaMargin = 0; + XMLPropertyState* pParaMargins[4] = { 0, 0, 0, 0 }; + ::std::auto_ptr<XMLPropertyState> pNewParaMargins[4]; + XMLPropertyState* pAllMargin = 0; + XMLPropertyState* pMargins[4] = { 0, 0, 0, 0 }; + ::std::auto_ptr<XMLPropertyState> pNewMargins[4]; for( ::std::vector< XMLPropertyState >::iterator aIter = rProperties.begin(); aIter != rProperties.end(); @@ -384,7 +389,31 @@ void XMLTextImportPropertyMapper::finished( bHasAnyWidth = sal_True; break; case CTF_BACKGROUND_TRANSPARENCY: pBackTransparency = property; break; case CTF_BACKGROUND_TRANSPARENT: pBackTransparent = property; break; - + case CTF_PARAMARGINALL: + case CTF_PARAMARGINALL_REL: + pAllParaMargin = property; break; + case CTF_PARALEFTMARGIN: + case CTF_PARALEFTMARGIN_REL: + pParaMargins[XML_LINE_LEFT] = property; break; + case CTF_PARARIGHTMARGIN: + case CTF_PARARIGHTMARGIN_REL: + pParaMargins[XML_LINE_RIGHT] = property; break; + case CTF_PARATOPMARGIN: + case CTF_PARATOPMARGIN_REL: + pParaMargins[XML_LINE_TOP] = property; break; + case CTF_PARABOTTOMMARGIN: + case CTF_PARABOTTOMMARGIN_REL: + pParaMargins[XML_LINE_BOTTOM] = property; break; + case CTF_MARGINALL: + pAllMargin = property; break; + case CTF_MARGINLEFT: + pMargins[XML_LINE_LEFT] = property; break; + case CTF_MARGINRIGHT: + pMargins[XML_LINE_RIGHT] = property; break; + case CTF_MARGINTOP: + pMargins[XML_LINE_TOP] = property; break; + case CTF_MARGINBOTTOM: + pMargins[XML_LINE_BOTTOM] = property; break; } } @@ -401,8 +430,31 @@ void XMLTextImportPropertyMapper::finished( FontFinished( pFontFamilyNameCTL, pFontStyleNameCTL, pFontFamilyCTL, pFontPitchCTL, pFontCharSetCTL ); - for( i = 0; i < 4; i++ ) + for (sal_uInt16 i = 0; i < 4; i++) { + if (pAllParaMargin && !pParaMargins[i]) + { +#ifdef DBG_UTIL + sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId( + pAllParaMargin->mnIndex + (2*i) + 2 ); + OSL_ENSURE( nTmp >= CTF_PARALEFTMARGIN && + nTmp <= CTF_PARABOTTOMMARGIN_REL, + "wrong property context id" ); +#endif + pNewParaMargins[i].reset(new XMLPropertyState( + pAllParaMargin->mnIndex + (2*i) + 2, pAllParaMargin->maValue)); + } + if (pAllMargin && !pMargins[i]) + { +#ifdef DBG_UTIL + sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId( + pAllMargin->mnIndex + i + 1 ); + OSL_ENSURE( nTmp >= CTF_MARGINLEFT && nTmp <= CTF_MARGINBOTTOM, + "wrong property context id" ); +#endif + pNewMargins[i].reset(new XMLPropertyState( + pAllMargin->mnIndex + i + 1, pAllMargin->maValue)); + } if( pAllBorderDistance && !pBorderDistances[i] ) { #ifdef DBG_UTIL @@ -450,6 +502,16 @@ void XMLTextImportPropertyMapper::finished( pBorders[i]->maValue <<= aBorderLine; } } + + if (pAllParaMargin) + { + pAllParaMargin->mnIndex = -1; + } + if (pAllMargin) + { + pAllMargin->mnIndex = -1; + } + if( pAllBorderDistance ) pAllBorderDistance->mnIndex = -1; @@ -593,8 +655,16 @@ void XMLTextImportPropertyMapper::finished( delete pNewFontCharSetCTL; } - for( i=0; i<4; i++ ) + for (sal_uInt16 i=0; i<4; i++) { + if (pNewParaMargins[i].get()) + { + rProperties.push_back(*pNewParaMargins[i]); + } + if (pNewMargins[i].get()) + { + rProperties.push_back(*pNewMargins[i]); + } if( pNewBorderDistances[i] ) { rProperties.push_back( *pNewBorderDistances[i] ); diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx index 8cf954a868..66c80b95b1 100644 --- a/xmloff/source/text/txtprmap.cxx +++ b/xmloff/source/text/txtprmap.cxx @@ -28,11 +28,14 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_xmloff.hxx" + +#include <xmloff/txtprmap.hxx> + #include <tools/debug.hxx> -#include "xmloff/xmlnmspe.hxx" + +#include <xmloff/xmlnmspe.hxx> #include <xmloff/xmltoken.hxx> #include "txtprhdl.hxx" -#include <xmloff/txtprmap.hxx> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -88,6 +91,9 @@ XMLPropertyMapEntry aXMLParaPropMap[] = // RES_UNKNOWNATR_CONTAINER MP_E( "ParaUserDefinedAttributes", TEXT, XMLNS, XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM, 0 ), // RES_LR_SPACE + // !!! DO NOT REORDER THE MARGINS !!! + MP_E( "ParaLeftMargin", FO, MARGIN, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_PARAMARGINALL ), + MP_E( "ParaLeftMarginRelative", FO, MARGIN, XML_TYPE_PERCENT16, CTF_PARAMARGINALL_REL ), MP_E( "ParaLeftMargin", FO, MARGIN_LEFT, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_PARALEFTMARGIN ), MP_E( "ParaLeftMarginRelative", FO, MARGIN_LEFT, XML_TYPE_PERCENT16, CTF_PARALEFTMARGIN_REL ), MP_E( "ParaRightMargin", FO, MARGIN_RIGHT, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_PARARIGHTMARGIN ), @@ -575,11 +581,12 @@ XMLPropertyMapEntry aXMLFramePropMap[] = MG_ED( "VertOrientPosition", SVG, Y, XML_TYPE_MEASURE, 0 ), // ***** The map for automatic styles starts here ***** // RES_LR_SPACE - MG_E( "LeftMargin", FO, MARGIN_LEFT, XML_TYPE_MEASURE, 0), - MG_E( "RightMargin", FO, MARGIN_RIGHT, XML_TYPE_MEASURE, 0 ), + MG_E( "LeftMargin", FO, MARGIN, XML_TYPE_MEASURE, CTF_MARGINALL ), + MG_E( "LeftMargin", FO, MARGIN_LEFT, XML_TYPE_MEASURE, CTF_MARGINLEFT ), + MG_E( "RightMargin", FO, MARGIN_RIGHT, XML_TYPE_MEASURE, CTF_MARGINRIGHT ), // RES_UL_SPACE - MG_E( "TopMargin", FO, MARGIN_TOP, XML_TYPE_MEASURE, 0 ), - MG_E( "BottomMargin", FO, MARGIN_BOTTOM, XML_TYPE_MEASURE, 0 ), + MG_E( "TopMargin", FO, MARGIN_TOP, XML_TYPE_MEASURE, CTF_MARGINTOP ), + MG_E( "BottomMargin", FO, MARGIN_BOTTOM, XML_TYPE_MEASURE, CTF_MARGINBOTTOM ), // RES_PAGEDESC // not required // RES_BREAK @@ -844,7 +851,7 @@ XMLPropertyMapEntry *lcl_txtprmap_getMap( sal_uInt16 nType ) break; case TEXT_PROP_MAP_SHAPE_PARA: pMap = &(aXMLParaPropMap[1]); - DBG_ASSERT( pMap->meXMLName == XML_MARGIN_LEFT, "shape para map changed" ); + OSL_ENSURE( pMap->meXMLName == XML_MARGIN, "shape para map changed" ); break; case TEXT_PROP_MAP_PARA: pMap = aXMLParaPropMap; @@ -854,7 +861,7 @@ XMLPropertyMapEntry *lcl_txtprmap_getMap( sal_uInt16 nType ) break; case TEXT_PROP_MAP_AUTO_FRAME: pMap = &(aXMLFramePropMap[13]); - DBG_ASSERT( pMap->meXMLName == XML_MARGIN_LEFT, "frame map changed" ); + OSL_ENSURE( pMap->meXMLName == XML_MARGIN, "frame map changed" ); break; case TEXT_PROP_MAP_SHAPE: pMap = aXMLShapePropMap; diff --git a/xmloff/source/transform/Oasis2OOo.cxx b/xmloff/source/transform/Oasis2OOo.cxx index 8d4509a336..f481369fb3 100644 --- a/xmloff/source/transform/Oasis2OOo.cxx +++ b/xmloff/source/transform/Oasis2OOo.cxx @@ -1198,7 +1198,6 @@ void XMLTableTransformerContext_Impl::StartElement( Reference< XAttributeList > xAttrList( rAttrList ); XMLMutableAttributeList *pMutableAttrList = 0; - // <-- sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; for( sal_Int16 i=0; i < nAttrCount; i++ ) diff --git a/xmloff/source/transform/StyleOASISTContext.cxx b/xmloff/source/transform/StyleOASISTContext.cxx index 3bbb3ad90b..982d2ecf8d 100644 --- a/xmloff/source/transform/StyleOASISTContext.cxx +++ b/xmloff/source/transform/StyleOASISTContext.cxx @@ -520,7 +520,6 @@ void XMLPropertiesTContext_Impl::StartElement( } } pAttrList->AddAttribute( rAttrName, aNewAttrValue ); - // <-- // create old draw:mirror for drawing graphic objects OUString aAttrValue( GetXMLToken( IsXMLToken( rAttrValue, XML_HORIZONTAL ) ? XML_TRUE : XML_FALSE ) ); diff --git a/xmloff/source/transform/TransformerBase.cxx b/xmloff/source/transform/TransformerBase.cxx index 8e8eb34df3..24f67ad702 100644 --- a/xmloff/source/transform/TransformerBase.cxx +++ b/xmloff/source/transform/TransformerBase.cxx @@ -325,7 +325,7 @@ void SAL_CALL XMLTransformerBase::startElement( const OUString& rName, } void SAL_CALL XMLTransformerBase::endElement( const OUString& -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 0 rName #endif ) @@ -336,7 +336,7 @@ rName // Get topmost context ::rtl::Reference< XMLTransformerContext > xContext = m_pContexts->back(); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 0 OSL_ENSURE( xContext->GetQName() == rName, "XMLTransformerBase::endElement: popped context has wrong lname" ); #endif @@ -433,7 +433,7 @@ void SAL_CALL XMLTransformerBase::initialize( const Sequence< Any >& aArguments for( sal_Int32 nIndex = 0; nIndex < nAnyCount; nIndex++, pAny++ ) { - // #b6236750# use isAssignableFrom instead of comparing the types to + // use isAssignableFrom instead of comparing the types to // allow XExtendedDocumentHandler instead of XDocumentHandler (used in // writeOasis2OOoLibraryElement in sfx2). // The Any shift operator can't be used to query the type because it |