diff options
author | Sascha Ballach <sab@openoffice.org> | 2000-10-27 02:56:15 +0000 |
---|---|---|
committer | Sascha Ballach <sab@openoffice.org> | 2000-10-27 02:56:15 +0000 |
commit | e520cb6557ecb4f033b0452fa007ba61b4521c6a (patch) | |
tree | 2e4e0764ea88226d73f31796774044ca99a5cd0f /xmloff | |
parent | e2d5e7a44e94e8c6ddaa26400a749e2b7d1746ce (diff) |
increase the performance and merge the border with border_width
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/style/PageMasterImportPropMapper.cxx | 351 |
1 files changed, 193 insertions, 158 deletions
diff --git a/xmloff/source/style/PageMasterImportPropMapper.cxx b/xmloff/source/style/PageMasterImportPropMapper.cxx index a6e1ef8c3a5a..eef2ca35e193 100644 --- a/xmloff/source/style/PageMasterImportPropMapper.cxx +++ b/xmloff/source/style/PageMasterImportPropMapper.cxx @@ -2,9 +2,9 @@ * * $RCSfile: PageMasterImportPropMapper.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: sab $ $Date: 2000-10-26 10:35:27 $ + * last change: $Author: sab $ $Date: 2000-10-27 03:56:15 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -72,8 +72,16 @@ #endif #ifndef _XMLOFF_PROPMAPPINGTYPES_HXX -#include <xmloff/maptype.hxx> +#include "maptype.hxx" #endif +#ifndef _COM_SUN_STAR_TABLE_BORDERLINE_HPP_ +#include <com/sun/star/table/BorderLine.hpp> +#endif + +#define XML_LINE_LEFT 0 +#define XML_LINE_RIGHT 0 +#define XML_LINE_TOP 0 +#define XML_LINE_BOTTOM 0 using namespace ::com::sun::star; @@ -111,212 +119,239 @@ void PageMasterImportPropertyMapper::finished(::std::vector< XMLPropertyState >& { SvXMLImportPropertyMapper::finished(rProperties, nStartIndex, nEndIndex); XMLPropertyState* pAllPaddingProperty = NULL; + XMLPropertyState* pPadding[4] = { NULL, NULL, NULL, NULL }; + XMLPropertyState* pNewPadding[4] = { NULL, NULL, NULL, NULL }; XMLPropertyState* pAllBorderProperty = NULL; + XMLPropertyState* pBorders[4] = { NULL, NULL, NULL, NULL }; + XMLPropertyState* pNewBorders[4] = { NULL, NULL, NULL, NULL }; XMLPropertyState* pAllBorderWidthProperty = NULL; + XMLPropertyState* pBorderWidths[4] = { NULL, NULL, NULL, NULL }; XMLPropertyState* pAllHeaderPaddingProperty = NULL; + XMLPropertyState* pHeaderPadding[4] = { NULL, NULL, NULL, NULL }; + XMLPropertyState* pHeaderNewPadding[4] = { NULL, NULL, NULL, NULL }; XMLPropertyState* pAllHeaderBorderProperty = NULL; + XMLPropertyState* pHeaderBorders[4] = { NULL, NULL, NULL, NULL }; + XMLPropertyState* pHeaderNewBorders[4] = { NULL, NULL, NULL, NULL }; XMLPropertyState* pAllHeaderBorderWidthProperty = NULL; + XMLPropertyState* pHeaderBorderWidths[4] = { NULL, NULL, NULL, NULL }; XMLPropertyState* pAllFooterPaddingProperty = NULL; + XMLPropertyState* pFooterPadding[4] = { NULL, NULL, NULL, NULL }; + XMLPropertyState* pFooterNewPadding[4] = { NULL, NULL, NULL, NULL }; XMLPropertyState* pAllFooterBorderProperty = NULL; + XMLPropertyState* pFooterBorders[4] = { NULL, NULL, NULL, NULL }; + XMLPropertyState* pFooterNewBorders[4] = { NULL, NULL, NULL, NULL }; XMLPropertyState* pAllFooterBorderWidthProperty = NULL; + XMLPropertyState* pFooterBorderWidths[4] = { NULL, NULL, NULL, NULL }; XMLPropertyState* pHeaderHeight = NULL; XMLPropertyState* pHeaderMinHeight = NULL; + XMLPropertyState* pHeaderDynamic = NULL; XMLPropertyState* pFooterHeight = NULL; XMLPropertyState* pFooterMinHeight = NULL; - ::std::vector< XMLPropertyState >::iterator i = rProperties.begin(); - for (i; i != rProperties.end(); i++) + XMLPropertyState* pFooterDynamic = NULL; + ::std::vector< XMLPropertyState >::iterator property = rProperties.begin(); + for (property; property != rProperties.end(); property++) { - sal_Int16 nContextID = getPropertySetMapper()->GetEntryContextId(i->mnIndex); - switch (nContextID) + sal_Int16 nContextID = getPropertySetMapper()->GetEntryContextId(property->mnIndex); + if (property->mnIndex >= nStartIndex && property->mnIndex < nEndIndex) { - case CTF_PM_PADDINGALL : - { - pAllPaddingProperty = new XMLPropertyState(i->mnIndex, i->maValue); - } - break; - case CTF_PM_BORDERALL : - { - pAllBorderProperty = new XMLPropertyState(i->mnIndex, i->maValue); - } - break; - case CTF_PM_BORDERWIDTHALL : - { - pAllBorderWidthProperty = new XMLPropertyState(i->mnIndex, i->maValue); - } - break; - case CTF_PM_HEADERPADDINGALL : - { - pAllHeaderPaddingProperty = new XMLPropertyState(i->mnIndex, i->maValue); - } - break; - case CTF_PM_HEADERBORDERALL : - { - pAllHeaderBorderProperty = new XMLPropertyState(i->mnIndex, i->maValue); - } - break; - case CTF_PM_HEADERBORDERWIDTHALL : - { - pAllHeaderBorderWidthProperty = new XMLPropertyState(i->mnIndex, i->maValue); - } - break; - case CTF_PM_FOOTERPADDINGALL : - { - pAllFooterPaddingProperty = new XMLPropertyState(i->mnIndex, i->maValue); - } - break; - case CTF_PM_FOOTERBORDERALL : - { - pAllFooterBorderProperty = new XMLPropertyState(i->mnIndex, i->maValue); - } - break; - case CTF_PM_FOOTERBORDERWIDTHALL : - { - pAllFooterBorderWidthProperty = new XMLPropertyState(i->mnIndex, i->maValue); - } - break; - case CTF_PM_HEADERHEIGHT : + switch (nContextID) { - pHeaderHeight = new XMLPropertyState(i->mnIndex, i->maValue); + case CTF_PM_PADDINGALL : pAllPaddingProperty = property; break; + case CTF_PM_PADDINGLEFT : pPadding[XML_LINE_LEFT] = property; break; + case CTF_PM_PADDINGRIGHT : pPadding[XML_LINE_RIGHT] = property; break; + case CTF_PM_PADDINGTOP : pPadding[XML_LINE_TOP] = property; break; + case CTF_PM_PADDINGBOTTOM : pPadding[XML_LINE_BOTTOM] = property; break; + case CTF_PM_BORDERALL : pAllBorderProperty = property; break; + case CTF_PM_BORDERLEFT : pBorders[XML_LINE_LEFT] = property; break; + case CTF_PM_BORDERRIGHT : pBorders[XML_LINE_RIGHT] = property; break; + case CTF_PM_BORDERTOP : pBorders[XML_LINE_TOP] = property; break; + case CTF_PM_BORDERBOTTOM : pBorders[XML_LINE_BOTTOM] = property; break; + case CTF_PM_BORDERWIDTHALL : pAllBorderWidthProperty = property; break; + case CTF_PM_BORDERWIDTHLEFT : pBorderWidths[XML_LINE_LEFT] = property; break; + case CTF_PM_BORDERWIDTHRIGHT : pBorderWidths[XML_LINE_RIGHT] = property; break; + case CTF_PM_BORDERWIDTHTOP : pBorderWidths[XML_LINE_TOP] = property; break; + case CTF_PM_BORDERWIDTHBOTTOM : pBorderWidths[XML_LINE_BOTTOM] = property; break; + case CTF_PM_HEADERPADDINGALL : pAllHeaderPaddingProperty = property; break; + case CTF_PM_HEADERPADDINGLEFT : pHeaderPadding[XML_LINE_LEFT] = property; break; + case CTF_PM_HEADERPADDINGRIGHT : pHeaderPadding[XML_LINE_RIGHT] = property; break; + case CTF_PM_HEADERPADDINGTOP : pHeaderPadding[XML_LINE_TOP] = property; break; + case CTF_PM_HEADERPADDINGBOTTOM : pHeaderPadding[XML_LINE_BOTTOM] = property; break; + case CTF_PM_HEADERBORDERALL : pAllHeaderBorderProperty = property; break; + case CTF_PM_HEADERBORDERLEFT : pHeaderBorders[XML_LINE_LEFT] = property; break; + case CTF_PM_HEADERBORDERRIGHT : pHeaderBorders[XML_LINE_RIGHT] = property; break; + case CTF_PM_HEADERBORDERTOP : pHeaderBorders[XML_LINE_TOP] = property; break; + case CTF_PM_HEADERBORDERBOTTOM : pHeaderBorders[XML_LINE_BOTTOM] = property; break; + case CTF_PM_HEADERBORDERWIDTHALL : pAllHeaderBorderWidthProperty = property; break; + case CTF_PM_HEADERBORDERWIDTHLEFT : pHeaderBorderWidths[XML_LINE_LEFT] = property; break; + case CTF_PM_HEADERBORDERWIDTHRIGHT : pHeaderBorderWidths[XML_LINE_RIGHT] = property; break; + case CTF_PM_HEADERBORDERWIDTHTOP : pHeaderBorderWidths[XML_LINE_TOP] = property; break; + case CTF_PM_HEADERBORDERWIDTHBOTTOM : pHeaderBorderWidths[XML_LINE_BOTTOM] = property; break; + case CTF_PM_FOOTERPADDINGALL : pAllFooterPaddingProperty = property; break; + case CTF_PM_FOOTERPADDINGLEFT : pFooterPadding[XML_LINE_LEFT] = property; break; + case CTF_PM_FOOTERPADDINGRIGHT : pFooterPadding[XML_LINE_RIGHT] = property; break; + case CTF_PM_FOOTERPADDINGTOP : pFooterPadding[XML_LINE_TOP] = property; break; + case CTF_PM_FOOTERPADDINGBOTTOM : pFooterPadding[XML_LINE_BOTTOM] = property; break; + case CTF_PM_FOOTERBORDERALL : pAllFooterBorderProperty = property; break; + case CTF_PM_FOOTERBORDERLEFT : pFooterBorders[XML_LINE_LEFT] = property; break; + case CTF_PM_FOOTERBORDERRIGHT : pFooterBorders[XML_LINE_RIGHT] = property; break; + case CTF_PM_FOOTERBORDERTOP : pFooterBorders[XML_LINE_TOP] = property; break; + case CTF_PM_FOOTERBORDERBOTTOM : pFooterBorders[XML_LINE_BOTTOM] = property; break; + case CTF_PM_FOOTERBORDERWIDTHALL : pAllFooterBorderWidthProperty = property; break; + case CTF_PM_FOOTERBORDERWIDTHLEFT : pFooterBorderWidths[XML_LINE_LEFT] = property; break; + case CTF_PM_FOOTERBORDERWIDTHRIGHT : pFooterBorderWidths[XML_LINE_RIGHT] = property; break; + case CTF_PM_FOOTERBORDERWIDTHTOP : pFooterBorderWidths[XML_LINE_TOP] = property; break; + case CTF_PM_FOOTERBORDERWIDTHBOTTOM : pFooterBorderWidths[XML_LINE_BOTTOM] = property; break; + case CTF_PM_HEADERHEIGHT : pHeaderHeight = property; break; + case CTF_PM_HEADERMINHEIGHT : pHeaderMinHeight = property; break; + case CTF_PM_FOOTERHEIGHT : pFooterHeight = property; break; + case CTF_PM_FOOTERMINHEIGHT : pFooterMinHeight = property; break; } - break; - case CTF_PM_HEADERMINHEIGHT : - { - pHeaderMinHeight = new XMLPropertyState(i->mnIndex, i->maValue); - } - break; - case CTF_PM_FOOTERHEIGHT : - { - pFooterHeight = new XMLPropertyState(i->mnIndex, i->maValue); - } - break; - case CTF_PM_FOOTERMINHEIGHT : - { - pFooterMinHeight = new XMLPropertyState(i->mnIndex, i->maValue); - } - break; - } - } - if (pAllPaddingProperty) - { - sal_Int32 nIndex = pAllPaddingProperty->mnIndex + 2; - XMLPropertyState aNewProperty (nIndex, pAllPaddingProperty->maValue); - for (sal_Int16 j = 0; j < 3; j++) - { - aNewProperty.mnIndex = nIndex++; - rProperties.push_back(aNewProperty); - } - } - if (pAllBorderProperty) - { - sal_Int32 nIndex = pAllBorderProperty->mnIndex + 2; - XMLPropertyState aNewProperty (nIndex, pAllBorderProperty->maValue); - for (sal_Int16 j = 0; j < 3; j++) - { - aNewProperty.mnIndex = nIndex++; - rProperties.push_back(aNewProperty); - } - } - if (pAllBorderWidthProperty) - { - sal_Int32 nIndex = pAllBorderWidthProperty->mnIndex + 2; - XMLPropertyState aNewProperty (nIndex, pAllBorderWidthProperty->maValue); - for (sal_Int16 j = 0; j < 3; j++) - { - aNewProperty.mnIndex = nIndex++; - rProperties.push_back(aNewProperty); - } - } - if (pAllHeaderPaddingProperty) - { - sal_Int32 nIndex = pAllHeaderPaddingProperty->mnIndex + 2; - XMLPropertyState aNewProperty (nIndex, pAllHeaderPaddingProperty->maValue); - for (sal_Int16 j = 0; j < 3; j++) - { - aNewProperty.mnIndex = nIndex++; - rProperties.push_back(aNewProperty); - } - } - if (pAllHeaderBorderProperty) - { - sal_Int32 nIndex = pAllHeaderBorderProperty->mnIndex + 2; - XMLPropertyState aNewProperty (nIndex, pAllHeaderBorderProperty->maValue); - for (sal_Int16 j = 0; j < 3; j++) - { - aNewProperty.mnIndex = nIndex++; - rProperties.push_back(aNewProperty); } } - if (pAllHeaderBorderWidthProperty) + + for (sal_uInt16 i = 0; i < 4; i++) { - sal_Int32 nIndex = pAllHeaderBorderWidthProperty->mnIndex + 2; - XMLPropertyState aNewProperty (nIndex, pAllHeaderBorderWidthProperty->maValue); - for (sal_Int16 j = 0; j < 3; j++) + if (pAllPaddingProperty && !pPadding[i]) + pNewPadding[i] = new XMLPropertyState(pAllPaddingProperty->mnIndex + 1 + i, pAllPaddingProperty->maValue); + if (pAllBorderProperty && !pBorders[i]) { - aNewProperty.mnIndex = nIndex++; - rProperties.push_back(aNewProperty); + pNewBorders[i] = new XMLPropertyState(pAllBorderProperty->mnIndex + 1 + i, pAllBorderProperty->maValue); + pBorders[i] = pNewBorders[i]; } - } - if (pAllFooterPaddingProperty) - { - sal_Int32 nIndex = pAllFooterPaddingProperty->mnIndex + 2; - XMLPropertyState aNewProperty (nIndex, pAllFooterPaddingProperty->maValue); - for (sal_Int16 j = 0; j < 3; j++) + if( !pBorderWidths[i] ) + pBorderWidths[i] = pAllBorderWidthProperty; + else + pBorderWidths[i]->mnIndex = -1; + if( pBorders[i] ) { - aNewProperty.mnIndex = nIndex++; - rProperties.push_back(aNewProperty); + table::BorderLine aBorderLine; + pBorders[i]->maValue >>= aBorderLine; + if( pBorderWidths[i] ) + { + table::BorderLine aBorderLineWidth; + pBorderWidths[i]->maValue >>= aBorderLineWidth; + aBorderLine.OuterLineWidth = aBorderLineWidth.OuterLineWidth; + aBorderLine.InnerLineWidth = aBorderLineWidth.InnerLineWidth; + aBorderLine.LineDistance = aBorderLineWidth.LineDistance; + pBorders[i]->maValue <<= aBorderLine; + } } - } - if (pAllFooterBorderProperty) - { - sal_Int32 nIndex = pAllFooterBorderProperty->mnIndex + 2; - XMLPropertyState aNewProperty (nIndex, pAllFooterBorderProperty->maValue); - for (sal_Int16 j = 0; j < 3; j++) + if (pAllHeaderPaddingProperty && !pHeaderPadding[i]) + pHeaderNewPadding[i] = new XMLPropertyState(pAllHeaderPaddingProperty->mnIndex + 1 + i, pAllHeaderPaddingProperty->maValue); + if (pAllHeaderBorderProperty && !pHeaderBorders[i]) + pHeaderNewBorders[i] = new XMLPropertyState(pAllHeaderBorderProperty->mnIndex + 1 + i, pAllHeaderBorderProperty->maValue); + if( !pHeaderBorderWidths[i] ) + pHeaderBorderWidths[i] = pAllHeaderBorderWidthProperty; + else + pHeaderBorderWidths[i]->mnIndex = -1; + if( pHeaderBorders[i] ) { - aNewProperty.mnIndex = nIndex++; - rProperties.push_back(aNewProperty); + table::BorderLine aBorderLine; + pHeaderBorders[i]->maValue >>= aBorderLine; + if( pHeaderBorderWidths[i] ) + { + table::BorderLine aBorderLineWidth; + pHeaderBorderWidths[i]->maValue >>= aBorderLineWidth; + aBorderLine.OuterLineWidth = aBorderLineWidth.OuterLineWidth; + aBorderLine.InnerLineWidth = aBorderLineWidth.InnerLineWidth; + aBorderLine.LineDistance = aBorderLineWidth.LineDistance; + pHeaderBorders[i]->maValue <<= aBorderLine; + } } - } - if (pAllFooterBorderWidthProperty) - { - sal_Int32 nIndex = pAllFooterBorderWidthProperty->mnIndex + 2; - XMLPropertyState aNewProperty (nIndex, pAllFooterBorderWidthProperty->maValue); - for (sal_Int16 j = 0; j < 3; j++) + if (pAllFooterPaddingProperty && !pFooterPadding[i]) + pFooterNewPadding[i] = new XMLPropertyState(pAllFooterPaddingProperty->mnIndex + 1 + i, pAllFooterPaddingProperty->maValue); + if (pAllFooterBorderProperty && !pFooterBorders[i]) + pFooterNewBorders[i] = new XMLPropertyState(pAllFooterBorderProperty->mnIndex + 1 + i, pAllFooterBorderProperty->maValue); + if( !pFooterBorderWidths[i] ) + pFooterBorderWidths[i] = pAllFooterBorderWidthProperty; + else + pFooterBorderWidths[i]->mnIndex = -1; + if( pFooterBorders[i] ) { - aNewProperty.mnIndex = nIndex++; - rProperties.push_back(aNewProperty); + table::BorderLine aBorderLine; + pFooterBorders[i]->maValue >>= aBorderLine; + if( pFooterBorderWidths[i] ) + { + table::BorderLine aBorderLineWidth; + pFooterBorderWidths[i]->maValue >>= aBorderLineWidth; + aBorderLine.OuterLineWidth = aBorderLineWidth.OuterLineWidth; + aBorderLine.InnerLineWidth = aBorderLineWidth.InnerLineWidth; + aBorderLine.LineDistance = aBorderLineWidth.LineDistance; + pFooterBorders[i]->maValue <<= aBorderLine; + } } } + if (pHeaderHeight) { sal_Bool bValue(sal_False); uno::Any aAny; aAny.setValue( &bValue, ::getBooleanCppuType() ); - XMLPropertyState aNewProperty(pHeaderHeight->mnIndex + 2, aAny); - rProperties.push_back(aNewProperty); + pHeaderDynamic = new XMLPropertyState(pHeaderHeight->mnIndex + 2, aAny); } if (pHeaderMinHeight) { sal_Bool bValue(sal_True); uno::Any aAny; aAny.setValue( &bValue, ::getBooleanCppuType() ); - XMLPropertyState aNewProperty(pHeaderMinHeight->mnIndex + 1, aAny); - rProperties.push_back(aNewProperty); + pHeaderDynamic = new XMLPropertyState(pHeaderMinHeight->mnIndex + 1, aAny); } if (pFooterHeight) { sal_Bool bValue(sal_False); uno::Any aAny; aAny.setValue( &bValue, ::getBooleanCppuType() ); - XMLPropertyState aNewProperty(pFooterHeight->mnIndex + 2, aAny); - rProperties.push_back(aNewProperty); + pFooterDynamic = new XMLPropertyState(pFooterHeight->mnIndex + 2, aAny); } if (pFooterMinHeight) { sal_Bool bValue(sal_True); uno::Any aAny; aAny.setValue( &bValue, ::getBooleanCppuType() ); - XMLPropertyState aNewProperty(pFooterMinHeight->mnIndex + 1, aAny); - rProperties.push_back(aNewProperty); + pFooterDynamic = new XMLPropertyState(pFooterMinHeight->mnIndex + 1, aAny); + } + for (i = 0; i < 4; i++) + { + if (pNewPadding[i]) + { + rProperties.push_back(*pNewPadding[i]); + delete pNewPadding[i]; + } + if (pNewBorders[i]) + { + rProperties.push_back(*pNewBorders[i]); + delete pNewBorders[i]; + } + if (pHeaderNewPadding[i]) + { + rProperties.push_back(*pHeaderNewPadding[i]); + delete pHeaderNewPadding[i]; + } + if (pHeaderNewBorders[i]) + { + rProperties.push_back(*pHeaderNewBorders[i]); + delete pHeaderNewBorders[i]; + } + if (pFooterNewPadding[i]) + { + rProperties.push_back(*pFooterNewPadding[i]); + delete pFooterNewPadding[i]; + } + if (pFooterNewBorders[i]) + { + rProperties.push_back(*pFooterNewBorders[i]); + delete pFooterNewBorders[i]; + } + } + if(pHeaderDynamic) + { + rProperties.push_back(*pHeaderDynamic); + delete pHeaderDynamic; + } + if(pFooterDynamic) + { + rProperties.push_back(*pFooterDynamic); + delete pFooterDynamic; } } |