24#include <osl/thread.h>
25#include <com/sun/star/awt/FontFamily.hpp>
26#include <com/sun/star/awt/FontPitch.hpp>
27#include <com/sun/star/drawing/FillStyle.hpp>
28#include <com/sun/star/table/BorderLine2.hpp>
29#include <com/sun/star/text/VertOrientation.hpp>
30#include <com/sun/star/text/SizeType.hpp>
37#define XML_LINE_LEFT 0
38#define XML_LINE_RIGHT 1
40#define XML_LINE_BOTTOM 3
50 ::std::vector< XMLPropertyState >& rProperties,
51 const OUString& rValue,
62 if(
GetImport().GetFontDecls() !=
nullptr )
95 ) &&
"illegal property map" );
97 GetImport().GetFontDecls()->FillProperties(
121 if( SvXMLImport::OOo_2x ==
GetImport().getGeneratorVersion() )
123 bool bHidden =
false;
131 rProperties, rValue, rUnitConverter, rNamespaceMap );
140 SvXMLImport& rImp ) :
142 m_nSizeTypeIndex( -2 ),
143 m_nWidthTypeIndex( -2 )
158 if( pFontFamilyNameState && pFontFamilyNameState->
mnIndex != -1 )
162 if(
sName.isEmpty() )
163 pFontFamilyNameState->
mnIndex = -1;
165 if( !pFontFamilyNameState || pFontFamilyNameState->
mnIndex == -1 )
167 if( pFontStyleNameState )
168 pFontStyleNameState->
mnIndex = -1;
169 if( pFontFamilyState )
170 pFontFamilyState->
mnIndex = -1;
171 if( pFontPitchState )
173 if( pFontCharsetState )
174 pFontCharsetState->
mnIndex = -1;
190 std::optional<XMLPropertyState>* ppNewFontStyleName,
191 std::optional<XMLPropertyState>* ppNewFontFamily,
192 std::optional<XMLPropertyState>* ppNewFontPitch,
193 std::optional<XMLPropertyState>* ppNewFontCharSet )
const
195 if( pFontFamilyName )
199 if( !pFontStyleName )
202 #if OSL_DEBUG_LEVEL > 0 && !defined NDEBUG
204 pFontFamilyName->
mnIndex + 1 );
207 ppNewFontStyleName->emplace( pFontFamilyName->
mnIndex + 1, aAny );
212 aAny <<= sal_Int16(css::awt::FontFamily::DONTKNOW);
214 #if OSL_DEBUG_LEVEL > 0 && !defined NDEBUG
216 pFontFamilyName->
mnIndex + 2 );
219 ppNewFontFamily->emplace( pFontFamilyName->
mnIndex + 2, aAny );
224 aAny <<= sal_Int16(css::awt::FontPitch::DONTKNOW);
225 #if OSL_DEBUG_LEVEL > 0 && !defined NDEBUG
227 pFontFamilyName->
mnIndex + 3 );
230 ppNewFontPitch->emplace( pFontFamilyName->
mnIndex + 3, aAny );
235 aAny <<= static_cast<sal_Int16>(osl_getThreadTextEncoding());
236 #if OSL_DEBUG_LEVEL > 0 && !defined NDEBUG
238 pFontFamilyName->
mnIndex + 4 );
241 ppNewFontCharSet->emplace( pFontFamilyName->
mnIndex + 4, aAny );
275void lcl_SeparateBorder(
281#
if OSL_DEBUG_LEVEL > 0 && !defined NDEBUG
286 if( pAllBorderDistance && !pBorderDistances[nIndex] )
288#if OSL_DEBUG_LEVEL > 0 && !defined NDEBUG
289 sal_Int16 nTmp = rMapper->GetEntryContextId(
290 pAllBorderDistance->
mnIndex + nIndex + 1 );
292 rMapper->GetEntryContextId(pAllBorderDistance->
mnIndex))
303 pNewBorderDistances[
nIndex] =
308 if( pAllBorder && !pBorders[nIndex] )
310#if OSL_DEBUG_LEVEL > 0 && !defined NDEBUG
311 sal_Int16 nTmp = rMapper->GetEntryContextId(
312 pAllBorder->
mnIndex + nIndex + 1 );
314 rMapper->GetEntryContextId(pAllBorder->
mnIndex))
327 if( !pBorderWidths[nIndex] )
328 pBorderWidths[
nIndex] = pAllBorderWidth;
332 if( !(pBorders[nIndex] && pBorderWidths[nIndex]) )
335 table::BorderLine2 aBorderLine;
338 table::BorderLine2 aBorderLineWidth;
339 pBorderWidths[
nIndex]->maValue >>= aBorderLineWidth;
341 aBorderLine.OuterLineWidth = aBorderLineWidth.OuterLineWidth;
342 aBorderLine.InnerLineWidth = aBorderLineWidth.InnerLineWidth;
343 aBorderLine.LineDistance = aBorderLineWidth.LineDistance;
344 aBorderLine.LineWidth = aBorderLineWidth.LineWidth;
352 ::std::vector< XMLPropertyState >& rProperties,
353 sal_Int32 , sal_Int32 )
const
355 bool bHasAnyHeight =
false;
356 bool bHasAnyMinHeight =
false;
357 bool bHasAnyWidth =
false;
358 bool bHasAnyMinWidth =
false;
365 std::optional<XMLPropertyState> pNewFontStyleName;
366 std::optional<XMLPropertyState> pNewFontFamily;
367 std::optional<XMLPropertyState> pNewFontPitch;
368 std::optional<XMLPropertyState> pNewFontCharSet;
374 std::optional<XMLPropertyState> pNewFontStyleNameCJK;
375 std::optional<XMLPropertyState> pNewFontFamilyCJK;
376 std::optional<XMLPropertyState> pNewFontPitchCJK;
377 std::optional<XMLPropertyState> pNewFontCharSetCJK;
383 std::optional<XMLPropertyState> pNewFontStyleNameCTL;
384 std::optional<XMLPropertyState> pNewFontFamilyCTL;
385 std::optional<XMLPropertyState> pNewFontPitchCTL;
386 std::optional<XMLPropertyState> pNewFontCharSetCTL;
388 XMLPropertyState* pBorderDistances[4] = {
nullptr,
nullptr,
nullptr,
nullptr };
389 XMLPropertyState* pNewBorderDistances[4] = {
nullptr,
nullptr,
nullptr,
nullptr };
394 XMLPropertyState* pBorderWidths[4] = {
nullptr,
nullptr,
nullptr,
nullptr };
396 XMLPropertyState* pCharBorderDistances[4] = {
nullptr,
nullptr,
nullptr,
nullptr };
397 XMLPropertyState* pCharNewBorderDistances[4] = {
nullptr,
nullptr,
nullptr,
nullptr };
400 XMLPropertyState* pCharNewBorders[4] = {
nullptr,
nullptr,
nullptr,
nullptr };
402 XMLPropertyState* pCharBorderWidths[4] = {
nullptr,
nullptr,
nullptr,
nullptr };
409 ::std::optional<XMLPropertyState> pNewParaMargins[4];
412 ::std::optional<XMLPropertyState> pNewMargins[4];
416 for(
auto& rProperty : rProperties )
481 bHasAnyMinHeight =
true;
486 bHasAnyHeight =
true;
break;
489 bHasAnyMinWidth =
true;
493 bHasAnyWidth =
true;
break;
526 if( pFontFamilyName || pFontStyleName || pFontFamily ||
527 pFontPitch || pFontCharSet )
528 FontFinished( pFontFamilyName, pFontStyleName, pFontFamily,
529 pFontPitch, pFontCharSet );
530 if( pFontFamilyNameCJK || pFontStyleNameCJK || pFontFamilyCJK ||
531 pFontPitchCJK || pFontCharSetCJK )
532 FontFinished( pFontFamilyNameCJK, pFontStyleNameCJK, pFontFamilyCJK,
533 pFontPitchCJK, pFontCharSetCJK );
534 if( pFontFamilyNameCTL || pFontStyleNameCTL || pFontFamilyCTL ||
535 pFontPitchCTL || pFontCharSetCTL )
536 FontFinished( pFontFamilyNameCTL, pFontStyleNameCTL, pFontFamilyCTL,
537 pFontPitchCTL, pFontCharSetCTL );
539 for (sal_uInt16
i = 0;
i < 4;
i++)
541 if (pAllParaMargin && !pParaMargins[
i]
544#if OSL_DEBUG_LEVEL > 0 && !defined NDEBUG
546 pAllParaMargin->
mnIndex + (2*
i) + 2 );
550 pNewParaMargins[
i].emplace(
553 if (pAllMargin && !pMargins[
i])
555#if OSL_DEBUG_LEVEL > 0 && !defined NDEBUG
560 pNewMargins[
i].emplace(
565 i, pAllBorderDistance, pBorderDistances, pNewBorderDistances,
566 pAllBorder, pBorders, pNewBorders,
567 pAllBorderWidth, pBorderWidths
568#
if OSL_DEBUG_LEVEL > 0 && !defined NDEBUG
574 i, pCharAllBorderDistance, pCharBorderDistances,
575 pCharNewBorderDistances, pCharAllBorder, pCharBorders,
576 pCharNewBorders, pCharAllBorderWidth, pCharBorderWidths
577#
if OSL_DEBUG_LEVEL > 0 && !defined NDEBUG
592 if( pAllBorderDistance )
593 pAllBorderDistance->
mnIndex = -1;
598 if( pAllBorderWidth )
601 if( pCharAllBorderDistance )
602 pCharAllBorderDistance->
mnIndex = -1;
607 if( pCharAllBorderWidth )
608 pCharAllBorderWidth->
mnIndex = -1;
610 if( pVertOrient && pVertOrientRelAsChar )
612 sal_Int16 nVertOrient;
613 pVertOrient->
maValue >>= nVertOrient;
614 sal_Int16 nVertOrientRel = 0;
615 pVertOrientRelAsChar->
maValue >>= nVertOrientRel;
616 switch( nVertOrient )
618 case VertOrientation::TOP:
619 nVertOrient = nVertOrientRel;
621 case VertOrientation::CENTER:
622 switch( nVertOrientRel )
624 case VertOrientation::CHAR_TOP:
625 nVertOrient = VertOrientation::CHAR_CENTER;
627 case VertOrientation::LINE_TOP:
628 nVertOrient = VertOrientation::LINE_CENTER;
632 case VertOrientation::BOTTOM:
633 switch( nVertOrientRel )
635 case VertOrientation::CHAR_TOP:
636 nVertOrient = VertOrientation::CHAR_BOTTOM;
638 case VertOrientation::LINE_TOP:
639 nVertOrient = VertOrientation::LINE_BOTTOM;
644 pVertOrient->
maValue <<= nVertOrient;
645 pVertOrientRelAsChar->
mnIndex = -1;
649 pFontStyleName, pFontFamily, pFontPitch, pFontCharSet,
650 &pNewFontStyleName, &pNewFontFamily, &pNewFontPitch, &pNewFontCharSet );
653 pFontStyleNameCJK, pFontFamilyCJK, pFontPitchCJK, pFontCharSetCJK,
654 &pNewFontStyleNameCJK, &pNewFontFamilyCJK, &pNewFontPitchCJK, &pNewFontCharSetCJK );
657 pFontStyleNameCTL, pFontFamilyCTL, pFontPitchCTL, pFontCharSetCTL,
658 &pNewFontStyleNameCTL, &pNewFontFamilyCTL, &pNewFontPitchCTL, &pNewFontCharSetCTL );
660 if (pFillStyle && !pFillColor && pBackTransparent
662 && pBackTransparent->
maValue.get<
bool>())
670 if( ( pBackTransparency !=
nullptr ) && ( pBackTransparent !=
nullptr ) )
672 if( ! *o3tl::doAccess<bool>(pBackTransparent->
maValue) )
673 pBackTransparent->
mnIndex = -1;
681 if( pNewFontStyleName )
683 rProperties.push_back( *pNewFontStyleName );
684 pNewFontStyleName.reset();
689 rProperties.push_back( *pNewFontFamily );
690 pNewFontFamily.reset();
695 rProperties.push_back( *pNewFontPitch );
696 pNewFontPitch.reset();
699 if( pNewFontCharSet )
701 rProperties.push_back( *pNewFontCharSet );
702 pNewFontCharSet.reset();
705 if( pNewFontStyleNameCJK )
707 rProperties.push_back( *pNewFontStyleNameCJK );
708 pNewFontStyleNameCJK.reset();
711 if( pNewFontFamilyCJK )
713 rProperties.push_back( *pNewFontFamilyCJK );
714 pNewFontFamilyCJK.reset();
717 if( pNewFontPitchCJK )
719 rProperties.push_back( *pNewFontPitchCJK );
720 pNewFontPitchCJK.reset();
723 if( pNewFontCharSetCJK )
725 rProperties.push_back( *pNewFontCharSetCJK );
726 pNewFontCharSetCJK.reset();
729 if( pNewFontStyleNameCTL)
731 rProperties.push_back( *pNewFontStyleNameCTL );
732 pNewFontStyleNameCTL.reset();
735 if( pNewFontFamilyCTL )
737 rProperties.push_back( *pNewFontFamilyCTL );
738 pNewFontFamilyCTL.reset();
741 if( pNewFontPitchCTL )
743 rProperties.push_back( *pNewFontPitchCTL );
744 pNewFontPitchCTL.reset();
747 if( pNewFontCharSetCTL )
749 rProperties.push_back( *pNewFontCharSetCTL );
750 pNewFontCharSetCTL.reset();
753 for (sal_uInt16
i=0;
i<4;
i++)
755 if (pNewParaMargins[
i])
757 rProperties.push_back(*pNewParaMargins[
i]);
761 rProperties.push_back(*pNewMargins[
i]);
763 if( pNewBorderDistances[
i] )
765 rProperties.push_back( *pNewBorderDistances[
i] );
766 delete pNewBorderDistances[
i];
770 rProperties.push_back( *pNewBorders[
i] );
771 delete pNewBorders[
i];
773 if( pCharNewBorderDistances[
i] )
775 rProperties.push_back( *pCharNewBorderDistances[
i] );
776 delete pCharNewBorderDistances[
i];
778 if( pCharNewBorders[
i] )
780 rProperties.push_back( *pCharNewBorders[
i] );
781 delete pCharNewBorders[
i];
792 for( sal_Int32 j=0; j < nPropCount; j++ )
795 ->GetEntryContextId( j ) )
806 aSizeTypeState.
maValue <<=
static_cast<sal_Int16
>( bHasAnyMinHeight
809 rProperties.push_back( aSizeTypeState );
821 for( sal_Int32 j=0; j <
nCount; j++ )
824 ->GetEntryContextId( j ) )
835 aSizeTypeState.
maValue <<=
static_cast<sal_Int16
>( bHasAnyMinWidth
838 rProperties.push_back( aSizeTypeState );
virtual bool handleSpecialItem(XMLPropertyState &rProperty, ::std::vector< XMLPropertyState > &rProperties, const OUString &rValue, const SvXMLUnitConverter &rUnitConverter, const SvXMLNamespaceMap &rNamespaceMap) const
this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_IMPORT flag set
const rtl::Reference< XMLPropertySetMapper > & getPropertySetMapper() const
SvXMLImport & GetImport() const
the SvXMLTypeConverter converts values of various types from their internal representation to the tex...
sal_Int32 m_nSizeTypeIndex
virtual void finished(::std::vector< XMLPropertyState > &rProperties, sal_Int32 nStartIndex, sal_Int32 nEndIndex) const override
This method is called when all attributes have benn processed.
virtual bool handleSpecialItem(XMLPropertyState &rProperty, ::std::vector< XMLPropertyState > &rProperties, const OUString &rValue, const SvXMLUnitConverter &rUnitConverter, const SvXMLNamespaceMap &rNamespaceMap) const override
this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_IMPORT flag set
void FontDefaultsCheck(XMLPropertyState const *pFontFamilyName, XMLPropertyState const *pFontStyleName, XMLPropertyState const *pFontFamily, XMLPropertyState const *pFontPitch, XMLPropertyState const *pFontCharSet, std::optional< XMLPropertyState > *ppNewFontStyleName, std::optional< XMLPropertyState > *ppNewFontFamily, std::optional< XMLPropertyState > *ppNewFontPitch, std::optional< XMLPropertyState > *ppNewFontCharSet) const
since the properties "CharFontFamilyName", "CharFontStyleName", "CharFontFamily", "CharFontPitch" and...
XMLTextImportPropertyMapper(const rtl::Reference< XMLPropertySetMapper > &rMapper, SvXMLImport &rImport)
static void FontFinished(XMLPropertyState *pFontFamilyNameState, XMLPropertyState *pFontStyleNameState, XMLPropertyState *pFontFamilyState, XMLPropertyState *pFontPitchState, XMLPropertyState *pFontCharsetState)
sal_Int32 m_nWidthTypeIndex
virtual ~XMLTextImportPropertyMapper() override
enum SAL_DLLPUBLIC_RTTI FillStyle
Smart struct to transport an Any with an index to the appropriate property-name.
#define CTF_PARAMARGINALL_REL
#define CTF_LEFTBORDERWIDTH
#define CTF_CHARLEFTBORDERWIDTH
#define CTF_VERTICALREL_ASCHAR
#define CTF_PARABOTTOMMARGIN_REL
#define CTF_PARALEFTMARGIN
#define CTF_PARATOPMARGIN_REL
#define CTF_FONTSTYLENAME_CTL
#define CTF_CHARRIGHTBORDERWIDTH
#define CTF_BOTTOMBORDERDISTANCE
#define CTF_CHARTOPBORDERWIDTH
#define CTF_FONTFAMILYNAME
#define CTF_ALLBORDERWIDTH
#define CTF_PARATOPMARGIN
#define CTF_CHARBOTTOMBORDER
#define CTF_CHARALLBORDERDISTANCE
#define CTF_PARARIGHTMARGIN
#define CTF_TOPBORDERDISTANCE
#define CTF_FRAMEHEIGHT_MIN_REL
#define CTF_CHARTOPBORDER
#define CTF_CHARBOTTOMBORDERDISTANCE
#define CTF_FONTFAMILY_CTL
#define CTF_PARAMARGINALL
#define CTF_RIGHTBORDERDISTANCE
#define CTF_CHARALLBORDER
#define CTF_FONTFAMILYNAME_CJK
#define CTF_CHARTOPBORDERDISTANCE
#define CTF_FRAMEWIDTH_MIN_REL
#define CTF_RIGHTBORDERWIDTH
#define CTF_CHARRIGHTBORDER
#define CTF_FONTFAMILYNAME_CTL
#define CTF_FRAMEWIDTH_MIN_ABS
#define CTF_FONTSTYLENAME_CJK
#define CTF_FRAMEWIDTH_ABS
#define CTF_BACKGROUND_TRANSPARENT
#define CTF_PARABOTTOMMARGIN
#define CTF_PARARIGHTMARGIN_REL
#define CTF_CHARLEFTBORDER
#define CTF_FRAMEHEIGHT_MIN_ABS
#define CTF_FRAMEWIDTH_REL
#define CTF_TOPBORDERWIDTH
#define CTF_FONTSTYLENAME
#define CTF_LEFTBORDERDISTANCE
#define CTF_CHARRIGHTBORDERDISTANCE
#define CTF_FONTPITCH_CJK
#define CTF_FONTCHARSET_CJK
#define CTF_FONTCHARSET_CTL
#define CTF_ALLBORDERDISTANCE
#define CTF_FRAMEHEIGHT_ABS
#define CTF_BACKGROUND_TRANSPARENCY
#define CTF_FRAMEHEIGHT_REL
#define CTF_PARALEFTMARGIN_REL
#define CTF_CHARBOTTOMBORDERWIDTH
#define CTF_FONTFAMILY_CJK
#define CTF_FONTPITCH_CTL
#define CTF_CHARALLBORDERWIDTH
#define CTF_CHARLEFTBORDERDISTANCE
#define CTF_BOTTOMBORDERWIDTH
#define CTF_FRAMEWIDTH_TYPE