diff options
author | Zolnai Tamás <zolnaitamas2000@gmail.com> | 2013-08-13 14:18:35 +0200 |
---|---|---|
committer | Zolnai Tamás <zolnaitamas2000@gmail.com> | 2013-08-18 09:49:49 +0200 |
commit | 47e24bfed80342ae3f1c45e745b717aa8f557ec0 (patch) | |
tree | 2dc04af39ac4592bc8ef3b19df9bb447dac55bb5 /xmloff | |
parent | 54d13384deaeb545011c12720a131554bf40da7d (diff) |
CharBrd 8.1: ODF filters
Change-Id: Ib1a79678ffce7764638378b4002f5e87ae749d00
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/text/txtexppr.cxx | 314 | ||||
-rw-r--r-- | xmloff/source/text/txtimppr.cxx | 163 | ||||
-rw-r--r-- | xmloff/source/text/txtprmap.cxx | 40 |
3 files changed, 350 insertions, 167 deletions
diff --git a/xmloff/source/text/txtexppr.cxx b/xmloff/source/text/txtexppr.cxx index 41c1397b24d9..7c978f868145 100644 --- a/xmloff/source/text/txtexppr.cxx +++ b/xmloff/source/text/txtexppr.cxx @@ -287,6 +287,8 @@ void XMLTextExportPropertySetMapper::ContextFontHeightFilter( } +namespace { + // helper method; implementation below static bool lcl_IsOutlineStyle(const SvXMLExport&, const OUString&); @@ -311,6 +313,143 @@ lcl_checkMultiProperty(XMLPropertyState *const pState, } } +static void lcl_FilterBorders( + XMLPropertyState* pAllBorderWidthState, XMLPropertyState* pLeftBorderWidthState, + XMLPropertyState* pRightBorderWidthState, XMLPropertyState* pTopBorderWidthState, + XMLPropertyState* pBottomBorderWidthState, XMLPropertyState* pAllBorderDistanceState, + XMLPropertyState* pLeftBorderDistanceState, XMLPropertyState* pRightBorderDistanceState, + XMLPropertyState* pTopBorderDistanceState, XMLPropertyState* pBottomBorderDistanceState, + XMLPropertyState* pAllBorderState, XMLPropertyState* pLeftBorderState, + XMLPropertyState* pRightBorderState,XMLPropertyState* pTopBorderState, + XMLPropertyState* pBottomBorderState ) +{ + if( pAllBorderWidthState ) + { + if( pLeftBorderWidthState && pRightBorderWidthState && pTopBorderWidthState && pBottomBorderWidthState ) + { + table::BorderLine2 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.LineStyle == aRight.LineStyle && + aLeft.LineWidth == aRight.LineWidth && + aLeft.Color == aTop.Color && aLeft.InnerLineWidth == aTop.InnerLineWidth && + aLeft.OuterLineWidth == aTop.OuterLineWidth && aLeft.LineDistance == aTop.LineDistance && + aLeft.LineStyle == aTop.LineStyle && + aLeft.LineWidth == aTop.LineWidth && + aLeft.Color == aBottom.Color && aLeft.InnerLineWidth == aBottom.InnerLineWidth && + aLeft.OuterLineWidth == aBottom.OuterLineWidth && aLeft.LineDistance == aBottom.LineDistance && + aLeft.LineStyle == aBottom.LineStyle && + aLeft.LineWidth == aBottom.LineWidth ) + { + 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 = 0, aRight = 0, aTop = 0, aBottom = 0; + + 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::BorderLine2 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.LineStyle == aRight.LineStyle && + aLeft.LineWidth == aRight.LineWidth && + aLeft.Color == aTop.Color && aLeft.InnerLineWidth == aTop.InnerLineWidth && + aLeft.OuterLineWidth == aTop.OuterLineWidth && aLeft.LineDistance == aTop.LineDistance && + aLeft.LineStyle == aTop.LineStyle && + aLeft.LineWidth == aTop.LineWidth && + aLeft.Color == aBottom.Color && aLeft.InnerLineWidth == aBottom.InnerLineWidth && + aLeft.OuterLineWidth == aBottom.OuterLineWidth && aLeft.LineDistance == aBottom.LineDistance && + aLeft.LineWidth == aBottom.LineWidth && + aLeft.LineStyle == aBottom.LineStyle ) + { + 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(); + } + } +} + +} + void XMLTextExportPropertySetMapper::ContextFilter( ::std::vector< XMLPropertyState >& rProperties, Reference< XPropertySet > rPropSet ) const @@ -387,6 +526,27 @@ void XMLTextExportPropertySetMapper::ContextFilter( XMLPropertyState* pTopBorderState = NULL; XMLPropertyState* pBottomBorderState = NULL; + // filter Char(Left|Right|Top|Bottom|)BorderWidth + XMLPropertyState* pCharAllBorderWidthState = NULL; + XMLPropertyState* pCharLeftBorderWidthState = NULL; + XMLPropertyState* pCharRightBorderWidthState = NULL; + XMLPropertyState* pCharTopBorderWidthState = NULL; + XMLPropertyState* pCharBottomBorderWidthState = NULL; + + // filter Char(Left|Right|Top|)BorderDistance + XMLPropertyState* pCharAllBorderDistanceState = NULL; + XMLPropertyState* pCharLeftBorderDistanceState = NULL; + XMLPropertyState* pCharRightBorderDistanceState = NULL; + XMLPropertyState* pCharTopBorderDistanceState = NULL; + XMLPropertyState* pCharBottomBorderDistanceState = NULL; + + // filter Char(Left|Right|Top|Bottom|)Border + XMLPropertyState* pCharAllBorderState = NULL; + XMLPropertyState* pCharLeftBorderState = NULL; + XMLPropertyState* pCharRightBorderState = NULL; + XMLPropertyState* pCharTopBorderState = NULL; + XMLPropertyState* pCharBottomBorderState = NULL; + // filter height properties XMLPropertyState* pHeightMinAbsState = NULL; XMLPropertyState* pHeightMinRelState = NULL; @@ -486,6 +646,7 @@ void XMLTextExportPropertySetMapper::ContextFilter( 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; @@ -502,6 +663,22 @@ void XMLTextExportPropertySetMapper::ContextFilter( case CTF_TOPBORDER: pTopBorderState = propertie; break; case CTF_BOTTOMBORDER: pBottomBorderState = propertie; break; + case CTF_CHARALLBORDERWIDTH: pCharAllBorderWidthState = propertie; break; + case CTF_CHARLEFTBORDERWIDTH: pCharLeftBorderWidthState = propertie; break; + case CTF_CHARRIGHTBORDERWIDTH: pCharRightBorderWidthState = propertie; break; + case CTF_CHARTOPBORDERWIDTH: pCharTopBorderWidthState = propertie; break; + case CTF_CHARBOTTOMBORDERWIDTH: pCharBottomBorderWidthState = propertie; break; + case CTF_CHARALLBORDERDISTANCE: pCharAllBorderDistanceState = propertie; break; + case CTF_CHARLEFTBORDERDISTANCE: pCharLeftBorderDistanceState = propertie; break; + case CTF_CHARRIGHTBORDERDISTANCE: pCharRightBorderDistanceState = propertie; break; + case CTF_CHARTOPBORDERDISTANCE: pCharTopBorderDistanceState = propertie; break; + case CTF_CHARBOTTOMBORDERDISTANCE: pCharBottomBorderDistanceState = propertie; break; + case CTF_CHARALLBORDER: pCharAllBorderState = propertie; break; + case CTF_CHARLEFTBORDER: pCharLeftBorderState = propertie; break; + case CTF_CHARRIGHTBORDER: pCharRightBorderState = propertie; break; + case CTF_CHARTOPBORDER: pCharTopBorderState = propertie; break; + case CTF_CHARBOTTOMBORDER: pCharBottomBorderState = propertie; break; + case CTF_FRAMEHEIGHT_MIN_ABS: pHeightMinAbsState = propertie; break; case CTF_FRAMEHEIGHT_MIN_REL: pHeightMinRelState = propertie; break; case CTF_FRAMEHEIGHT_ABS: pHeightAbsState = propertie; break; @@ -639,129 +816,19 @@ void XMLTextExportPropertySetMapper::ContextFilter( pAllMargin->maValue.clear(); } - if( pAllBorderWidthState ) - { - if( pLeftBorderWidthState && pRightBorderWidthState && pTopBorderWidthState && pBottomBorderWidthState ) - { - table::BorderLine2 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.LineStyle == aRight.LineStyle && - aLeft.LineWidth == aRight.LineWidth && - aLeft.Color == aTop.Color && aLeft.InnerLineWidth == aTop.InnerLineWidth && - aLeft.OuterLineWidth == aTop.OuterLineWidth && aLeft.LineDistance == aTop.LineDistance && - aLeft.LineStyle == aTop.LineStyle && - aLeft.LineWidth == aTop.LineWidth && - aLeft.Color == aBottom.Color && aLeft.InnerLineWidth == aBottom.InnerLineWidth && - aLeft.OuterLineWidth == aBottom.OuterLineWidth && aLeft.LineDistance == aBottom.LineDistance && - aLeft.LineStyle == aBottom.LineStyle && - aLeft.LineWidth == aBottom.LineWidth ) - { - 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 = 0, aRight = 0, aTop = 0, aBottom = 0; - - 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::BorderLine2 aLeft, aRight, aTop, aBottom; + lcl_FilterBorders( + pAllBorderWidthState, pLeftBorderWidthState, pRightBorderWidthState, + pTopBorderWidthState, pBottomBorderWidthState, pAllBorderDistanceState, + pLeftBorderDistanceState, pRightBorderDistanceState, pTopBorderDistanceState, + pBottomBorderDistanceState, pAllBorderState, pLeftBorderState, + pRightBorderState, pTopBorderState, pBottomBorderState); - 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.LineStyle == aRight.LineStyle && - aLeft.LineWidth == aRight.LineWidth && - aLeft.Color == aTop.Color && aLeft.InnerLineWidth == aTop.InnerLineWidth && - aLeft.OuterLineWidth == aTop.OuterLineWidth && aLeft.LineDistance == aTop.LineDistance && - aLeft.LineStyle == aTop.LineStyle && - aLeft.LineWidth == aTop.LineWidth && - aLeft.Color == aBottom.Color && aLeft.InnerLineWidth == aBottom.InnerLineWidth && - aLeft.OuterLineWidth == aBottom.OuterLineWidth && aLeft.LineDistance == aBottom.LineDistance && - aLeft.LineWidth == aBottom.LineWidth && - aLeft.LineStyle == aBottom.LineStyle ) - { - 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(); - } - } + lcl_FilterBorders( + pCharAllBorderWidthState, pCharLeftBorderWidthState, pCharRightBorderWidthState, + pCharTopBorderWidthState, pCharBottomBorderWidthState, pCharAllBorderDistanceState, + pCharLeftBorderDistanceState, pCharRightBorderDistanceState, pCharTopBorderDistanceState, + pCharBottomBorderDistanceState, pCharAllBorderState, pCharLeftBorderState, + pCharRightBorderState, pCharTopBorderState, pCharBottomBorderState); sal_Int16 nSizeType = SizeType::FIX; if( pSizeTypeState ) @@ -963,6 +1030,7 @@ void XMLTextExportPropertySetMapper::ContextFilter( SvXMLExportPropertyMapper::ContextFilter(rProperties,rPropSet); } +namespace { static bool lcl_IsOutlineStyle(const SvXMLExport &rExport, const OUString & rName) { @@ -986,4 +1054,6 @@ static bool lcl_IsOutlineStyle(const SvXMLExport &rExport, const OUString & rNam return rName == sOutlineName; } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/text/txtimppr.cxx b/xmloff/source/text/txtimppr.cxx index 40f5dc21bc3e..1e7ec03323dc 100644 --- a/xmloff/source/text/txtimppr.cxx +++ b/xmloff/source/text/txtimppr.cxx @@ -247,6 +247,7 @@ void XMLTextImportPropertyMapper::FontDefaultsCheck( } } +namespace { //fdo#58730 The [UL|LR]Space class has a deficiency where "100%" also serves as //a flag that the value is an absolute value so we can't truly handle an //up/lower space property which wants to specify its 200% upper but 100% lower @@ -267,6 +268,67 @@ isNotDefaultRelSize(const XMLPropertyState* pRelState, const UniReference<XMLPro return true; } +static void lcl_SeparateBorder( + sal_uInt16 nIndex, XMLPropertyState* pAllBorderDistance, + XMLPropertyState* pBorderDistances[4], XMLPropertyState* pNewBorderDistances[4], + XMLPropertyState* pAllBorder, XMLPropertyState* pBorders[4], + XMLPropertyState* pNewBorders[4], XMLPropertyState* pAllBorderWidth, + XMLPropertyState* pBorderWidths[4] +#ifdef DBG_UTIL + , const UniReference< XMLPropertySetMapper >& rMapper +#endif +) +{ + if( pAllBorderDistance && !pBorderDistances[nIndex] ) + { +#ifdef DBG_UTIL + sal_Int16 nTmp = rMapper->GetEntryContextId( + pAllBorderDistance->mnIndex + nIndex + 1 ); + DBG_ASSERT( nTmp >= CTF_LEFTBORDERDISTANCE && + nTmp <= CTF_BOTTOMBORDERDISTANCE, + "wrong property context id" ); +#endif + pNewBorderDistances[nIndex] = + new XMLPropertyState( pAllBorderDistance->mnIndex + nIndex + 1, + pAllBorderDistance->maValue ); + pBorderDistances[nIndex] = pNewBorderDistances[nIndex]; + } + if( pAllBorder && !pBorders[nIndex] ) + { +#ifdef DBG_UTIL + sal_Int16 nTmp = rMapper->GetEntryContextId( + pAllBorder->mnIndex + nIndex + 1 ); + DBG_ASSERT( nTmp >= CTF_LEFTBORDER && nTmp <= CTF_BOTTOMBORDER, + "wrong property context id" ); +#endif + pNewBorders[nIndex] = new XMLPropertyState( pAllBorder->mnIndex + nIndex + 1, + pAllBorder->maValue ); + pBorders[nIndex] = pNewBorders[nIndex]; + } + if( !pBorderWidths[nIndex] ) + pBorderWidths[nIndex] = pAllBorderWidth; + else + pBorderWidths[nIndex]->mnIndex = -1; + + if( pBorders[nIndex] && pBorderWidths[nIndex] ) + { + table::BorderLine2 aBorderLine; + pBorders[nIndex]->maValue >>= aBorderLine; + + table::BorderLine2 aBorderLineWidth; + pBorderWidths[nIndex]->maValue >>= aBorderLineWidth; + + aBorderLine.OuterLineWidth = aBorderLineWidth.OuterLineWidth; + aBorderLine.InnerLineWidth = aBorderLineWidth.InnerLineWidth; + aBorderLine.LineDistance = aBorderLineWidth.LineDistance; + aBorderLine.LineWidth = aBorderLineWidth.LineWidth; + + pBorders[nIndex]->maValue <<= aBorderLine; + } +} + +} + void XMLTextImportPropertyMapper::finished( ::std::vector< XMLPropertyState >& rProperties, sal_Int32 /*nStartIndex*/, sal_Int32 /*nEndIndex*/ ) const @@ -311,6 +373,14 @@ void XMLTextImportPropertyMapper::finished( XMLPropertyState* pNewBorders[4] = { 0, 0, 0, 0 }; XMLPropertyState* pAllBorderWidth = 0; XMLPropertyState* pBorderWidths[4] = { 0, 0, 0, 0 }; + XMLPropertyState* pCharAllBorderDistance = 0; + XMLPropertyState* pCharBorderDistances[4] = { 0, 0, 0, 0 }; + XMLPropertyState* pCharNewBorderDistances[4] = { 0, 0, 0, 0 }; + XMLPropertyState* pCharAllBorder = 0; + XMLPropertyState* pCharBorders[4] = { 0, 0, 0, 0 }; + XMLPropertyState* pCharNewBorders[4] = { 0, 0, 0, 0 }; + XMLPropertyState* pCharAllBorderWidth = 0; + XMLPropertyState* pCharBorderWidths[4] = { 0, 0, 0, 0 }; XMLPropertyState* pVertOrient = 0; XMLPropertyState* pVertOrientRelAsChar = 0; XMLPropertyState* pBackTransparency = NULL; // transparency in % @@ -364,12 +434,28 @@ void XMLTextImportPropertyMapper::finished( case CTF_RIGHTBORDER: pBorders[XML_LINE_RIGHT] = property; break; case CTF_TOPBORDER: pBorders[XML_LINE_TOP] = property; break; case CTF_BOTTOMBORDER: pBorders[XML_LINE_BOTTOM] = property; break; - case CTF_ALLBORDERWIDTH: pAllBorderWidth = property; break; case CTF_LEFTBORDERWIDTH: pBorderWidths[XML_LINE_LEFT] = property; break; case CTF_RIGHTBORDERWIDTH: pBorderWidths[XML_LINE_RIGHT] = property; break; case CTF_TOPBORDERWIDTH: pBorderWidths[XML_LINE_TOP] = property; break; case CTF_BOTTOMBORDERWIDTH: pBorderWidths[XML_LINE_BOTTOM] = property; break; + + case CTF_CHARALLBORDERDISTANCE: pCharAllBorderDistance = property; break; + case CTF_CHARLEFTBORDERDISTANCE: pCharBorderDistances[XML_LINE_LEFT] = property; break; + case CTF_CHARRIGHTBORDERDISTANCE: pCharBorderDistances[XML_LINE_RIGHT] = property; break; + case CTF_CHARTOPBORDERDISTANCE: pCharBorderDistances[XML_LINE_TOP] = property; break; + case CTF_CHARBOTTOMBORDERDISTANCE: pCharBorderDistances[XML_LINE_BOTTOM] = property; break; + case CTF_CHARALLBORDER: pCharAllBorder = property; break; + case CTF_CHARLEFTBORDER: pCharBorders[XML_LINE_LEFT] = property; break; + case CTF_CHARRIGHTBORDER: pCharBorders[XML_LINE_RIGHT] = property; break; + case CTF_CHARTOPBORDER: pCharBorders[XML_LINE_TOP] = property; break; + case CTF_CHARBOTTOMBORDER: pCharBorders[XML_LINE_BOTTOM] = property; break; + case CTF_CHARALLBORDERWIDTH: pCharAllBorderWidth = property; break; + case CTF_CHARLEFTBORDERWIDTH: pCharBorderWidths[XML_LINE_LEFT] = property; break; + case CTF_CHARRIGHTBORDERWIDTH: pCharBorderWidths[XML_LINE_RIGHT] = property; break; + case CTF_CHARTOPBORDERWIDTH: pCharBorderWidths[XML_LINE_TOP] = property; break; + case CTF_CHARBOTTOMBORDERWIDTH: pCharBorderWidths[XML_LINE_BOTTOM] = property; break; + case CTF_ANCHORTYPE: break; case CTF_VERTICALPOS: pVertOrient = property; break; case CTF_VERTICALREL_ASCHAR: pVertOrientRelAsChar = property; break; @@ -459,52 +545,24 @@ void XMLTextImportPropertyMapper::finished( pNewMargins[i].reset(new XMLPropertyState( pAllMargin->mnIndex + i + 1, pAllMargin->maValue)); } - if( pAllBorderDistance && !pBorderDistances[i] ) - { + + lcl_SeparateBorder( + i, pAllBorderDistance, pBorderDistances, pNewBorderDistances, + pAllBorder, pBorders, pNewBorders, + pAllBorderWidth, pBorderWidths #ifdef DBG_UTIL - sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId( - pAllBorderDistance->mnIndex + i + 1 ); - DBG_ASSERT( nTmp >= CTF_LEFTBORDERDISTANCE && - nTmp <= CTF_BOTTOMBORDERDISTANCE, - "wrong property context id" ); + , getPropertySetMapper() #endif - pNewBorderDistances[i] = - new XMLPropertyState( pAllBorderDistance->mnIndex + i + 1, - pAllBorderDistance->maValue ); - pBorderDistances[i] = pNewBorderDistances[i]; - } - if( pAllBorder && !pBorders[i] ) - { + ); + + lcl_SeparateBorder( + i, pCharAllBorderDistance, pCharBorderDistances, + pCharNewBorderDistances, pCharAllBorder, pCharBorders, + pCharNewBorders, pCharAllBorderWidth, pCharBorderWidths #ifdef DBG_UTIL - sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId( - pAllBorder->mnIndex + i + 1 ); - DBG_ASSERT( nTmp >= CTF_LEFTBORDER && nTmp <= CTF_BOTTOMBORDER, - "wrong property context id" ); + , getPropertySetMapper() #endif - pNewBorders[i] = new XMLPropertyState( pAllBorder->mnIndex + i + 1, - pAllBorder->maValue ); - pBorders[i] = pNewBorders[i]; - } - if( !pBorderWidths[i] ) - pBorderWidths[i] = pAllBorderWidth; - else - pBorderWidths[i]->mnIndex = -1; - - if( pBorders[i] && pBorderWidths[i] ) - { - table::BorderLine2 aBorderLine; - pBorders[i]->maValue >>= aBorderLine; - - table::BorderLine2 aBorderLineWidth; - pBorderWidths[i]->maValue >>= aBorderLineWidth; - - aBorderLine.OuterLineWidth = aBorderLineWidth.OuterLineWidth; - aBorderLine.InnerLineWidth = aBorderLineWidth.InnerLineWidth; - aBorderLine.LineDistance = aBorderLineWidth.LineDistance; - aBorderLine.LineWidth = aBorderLineWidth.LineWidth; - - pBorders[i]->maValue <<= aBorderLine; - } + ); } if (pAllParaMargin) @@ -525,6 +583,15 @@ void XMLTextImportPropertyMapper::finished( if( pAllBorderWidth ) pAllBorderWidth->mnIndex = -1; + if( pCharAllBorderDistance ) + pCharAllBorderDistance->mnIndex = -1; + + if( pCharAllBorder ) + pCharAllBorder->mnIndex = -1; + + if( pCharAllBorderWidth ) + pCharAllBorderWidth->mnIndex = -1; + if( pVertOrient && pVertOrientRelAsChar ) { sal_Int16 nVertOrient; @@ -679,6 +746,16 @@ void XMLTextImportPropertyMapper::finished( rProperties.push_back( *pNewBorders[i] ); delete pNewBorders[i]; } + if( pCharNewBorderDistances[i] ) + { + rProperties.push_back( *pCharNewBorderDistances[i] ); + delete pCharNewBorderDistances[i]; + } + if( pCharNewBorders[i] ) + { + rProperties.push_back( *pCharNewBorders[i] ); + delete pCharNewBorders[i]; + } } if( bHasAnyHeight ) diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx index 21e5aaf2f0e5..64430eeee9fb 100644 --- a/xmloff/source/text/txtprmap.cxx +++ b/xmloff/source/text/txtprmap.cxx @@ -44,6 +44,8 @@ using namespace ::xmloff::token; _M_E( a, p, l, (t|XML_TYPE_PROP_TEXT), c ) #define MT_ED( a, p, l, t, c ) \ _M_ED( a, p, l, (t|XML_TYPE_PROP_TEXT), c ) +#define MT_EV( a, p, l, t, c, v ) \ + _M_EV( a, p, l, (t|XML_TYPE_PROP_TEXT), c, v ) // paragraph properties #define MP_E( a, p, l, t, c ) \ @@ -218,7 +220,24 @@ XMLPropertyMapEntry aXMLParaPropMap[] = MT_E( "CharOverline", STYLE, TEXT_OVERLINE_WIDTH, XML_TYPE_TEXT_OVERLINE_WIDTH|MID_FLAG_MERGE_PROPERTY, 0 ), MT_E( "CharOverlineColor", STYLE, TEXT_OVERLINE_COLOR, XML_TYPE_TEXT_OVERLINE_COLOR|MID_FLAG_MULTI_PROPERTY, 0 ), MT_E( "CharOverlineHasColor", STYLE, TEXT_OVERLINE_COLOR, XML_TYPE_TEXT_OVERLINE_HASCOLOR|MID_FLAG_MERGE_ATTRIBUTE, 0 ), - + // RES_CHRATR_BOX + MT_EV( "CharLeftBorder", STYLE, BORDER_LINE_WIDTH, XML_TYPE_BORDER_WIDTH, CTF_CHARALLBORDERWIDTH, SvtSaveOptions::ODFVER_012_EXT_COMPAT ), + MT_EV( "CharLeftBorder", STYLE, BORDER_LINE_WIDTH_LEFT, XML_TYPE_BORDER_WIDTH, CTF_CHARLEFTBORDERWIDTH, SvtSaveOptions::ODFVER_012_EXT_COMPAT ), + MT_EV( "CharRightBorder", STYLE, BORDER_LINE_WIDTH_RIGHT, XML_TYPE_BORDER_WIDTH, CTF_CHARRIGHTBORDERWIDTH, SvtSaveOptions::ODFVER_012_EXT_COMPAT ), + MT_EV( "CharTopBorder", STYLE, BORDER_LINE_WIDTH_TOP, XML_TYPE_BORDER_WIDTH, CTF_CHARTOPBORDERWIDTH, SvtSaveOptions::ODFVER_012_EXT_COMPAT ), + MT_EV( "CharBottomBorder", STYLE, BORDER_LINE_WIDTH_BOTTOM, XML_TYPE_BORDER_WIDTH, CTF_CHARBOTTOMBORDERWIDTH, SvtSaveOptions::ODFVER_012_EXT_COMPAT ), + + MT_EV( "CharLeftBorderDistance", FO, PADDING, XML_TYPE_MEASURE, CTF_CHARALLBORDERDISTANCE, SvtSaveOptions::ODFVER_012_EXT_COMPAT ), + MT_EV( "CharLeftBorderDistance", FO, PADDING_LEFT, XML_TYPE_MEASURE, CTF_CHARLEFTBORDERDISTANCE, SvtSaveOptions::ODFVER_012_EXT_COMPAT ), + MT_EV( "CharRightBorderDistance", FO, PADDING_RIGHT, XML_TYPE_MEASURE, CTF_CHARRIGHTBORDERDISTANCE, SvtSaveOptions::ODFVER_012_EXT_COMPAT ), + MT_EV( "CharTopBorderDistance", FO, PADDING_TOP, XML_TYPE_MEASURE, CTF_CHARTOPBORDERDISTANCE, SvtSaveOptions::ODFVER_012_EXT_COMPAT ), + MT_EV( "CharBottomBorderDistance",FO, PADDING_BOTTOM, XML_TYPE_MEASURE, CTF_CHARBOTTOMBORDERDISTANCE, SvtSaveOptions::ODFVER_012_EXT_COMPAT ), + + MT_EV( "CharLeftBorder", FO, BORDER, XML_TYPE_BORDER, CTF_CHARALLBORDER, SvtSaveOptions::ODFVER_012_EXT_COMPAT ), + MT_EV( "CharLeftBorder", FO, BORDER_LEFT, XML_TYPE_BORDER, CTF_CHARLEFTBORDER, SvtSaveOptions::ODFVER_012_EXT_COMPAT ), + MT_EV( "CharRightBorder", FO, BORDER_RIGHT, XML_TYPE_BORDER, CTF_CHARRIGHTBORDER, SvtSaveOptions::ODFVER_012_EXT_COMPAT ), + MT_EV( "CharTopBorder", FO, BORDER_TOP, XML_TYPE_BORDER, CTF_CHARTOPBORDER, SvtSaveOptions::ODFVER_012_EXT_COMPAT ), + MT_EV( "CharBottomBorder", FO, BORDER_BOTTOM, XML_TYPE_BORDER, CTF_CHARBOTTOMBORDER, SvtSaveOptions::ODFVER_012_EXT_COMPAT ), // RES_TXTATR_INETFMT // TODO // RES_TXTATR_REFMARK @@ -525,7 +544,24 @@ XMLPropertyMapEntry aXMLTextPropMap[] = MT_E( "CharOverline", STYLE, TEXT_OVERLINE_WIDTH, XML_TYPE_TEXT_OVERLINE_WIDTH|MID_FLAG_MERGE_PROPERTY, 0 ), MT_E( "CharOverlineColor", STYLE, TEXT_OVERLINE_COLOR, XML_TYPE_TEXT_OVERLINE_COLOR|MID_FLAG_MULTI_PROPERTY, 0 ), MT_E( "CharOverlineHasColor", STYLE, TEXT_OVERLINE_COLOR, XML_TYPE_TEXT_OVERLINE_HASCOLOR|MID_FLAG_MERGE_ATTRIBUTE, 0 ), - + // RES_CHRATR_BOX + MT_EV( "CharLeftBorder", STYLE, BORDER_LINE_WIDTH, XML_TYPE_BORDER_WIDTH, CTF_CHARALLBORDERWIDTH, SvtSaveOptions::ODFVER_012_EXT_COMPAT ), + MT_EV( "CharLeftBorder", STYLE, BORDER_LINE_WIDTH_LEFT, XML_TYPE_BORDER_WIDTH, CTF_CHARLEFTBORDERWIDTH, SvtSaveOptions::ODFVER_012_EXT_COMPAT ), + MT_EV( "CharRightBorder", STYLE, BORDER_LINE_WIDTH_RIGHT, XML_TYPE_BORDER_WIDTH, CTF_CHARRIGHTBORDERWIDTH, SvtSaveOptions::ODFVER_012_EXT_COMPAT ), + MT_EV( "CharTopBorder", STYLE, BORDER_LINE_WIDTH_TOP, XML_TYPE_BORDER_WIDTH, CTF_CHARTOPBORDERWIDTH, SvtSaveOptions::ODFVER_012_EXT_COMPAT ), + MT_EV( "CharBottomBorder", STYLE, BORDER_LINE_WIDTH_BOTTOM, XML_TYPE_BORDER_WIDTH, CTF_CHARBOTTOMBORDERWIDTH, SvtSaveOptions::ODFVER_012_EXT_COMPAT ), + + MT_EV( "CharLeftBorderDistance", FO, PADDING, XML_TYPE_MEASURE, CTF_CHARALLBORDERDISTANCE, SvtSaveOptions::ODFVER_012_EXT_COMPAT ), + MT_EV( "CharLeftBorderDistance", FO, PADDING_LEFT, XML_TYPE_MEASURE, CTF_CHARLEFTBORDERDISTANCE, SvtSaveOptions::ODFVER_012_EXT_COMPAT ), + MT_EV( "CharRightBorderDistance", FO, PADDING_RIGHT, XML_TYPE_MEASURE, CTF_CHARRIGHTBORDERDISTANCE, SvtSaveOptions::ODFVER_012_EXT_COMPAT ), + MT_EV( "CharTopBorderDistance", FO, PADDING_TOP, XML_TYPE_MEASURE, CTF_CHARTOPBORDERDISTANCE, SvtSaveOptions::ODFVER_012_EXT_COMPAT ), + MT_EV( "CharBottomBorderDistance",FO, PADDING_BOTTOM, XML_TYPE_MEASURE, CTF_CHARBOTTOMBORDERDISTANCE, SvtSaveOptions::ODFVER_012_EXT_COMPAT ), + + MT_EV( "CharLeftBorder", FO, BORDER, XML_TYPE_BORDER, CTF_CHARALLBORDER, SvtSaveOptions::ODFVER_012_EXT_COMPAT ), + MT_EV( "CharLeftBorder", FO, BORDER_LEFT, XML_TYPE_BORDER, CTF_CHARLEFTBORDER, SvtSaveOptions::ODFVER_012_EXT_COMPAT ), + MT_EV( "CharRightBorder", FO, BORDER_RIGHT, XML_TYPE_BORDER, CTF_CHARRIGHTBORDER, SvtSaveOptions::ODFVER_012_EXT_COMPAT ), + MT_EV( "CharTopBorder", FO, BORDER_TOP, XML_TYPE_BORDER, CTF_CHARTOPBORDER, SvtSaveOptions::ODFVER_012_EXT_COMPAT ), + MT_EV( "CharBottomBorder", FO, BORDER_BOTTOM, XML_TYPE_BORDER, CTF_CHARBOTTOMBORDER, SvtSaveOptions::ODFVER_012_EXT_COMPAT ), // RES_TXTATR_INETFMT MT_E( "HyperLinkURL", TEXT, XMLNS, XML_TYPE_STRING|MID_FLAG_NO_PROPERTY_IMPORT, CTF_HYPERLINK_URL ), // RES_TXTATR_REFMARK |