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
39 #define XML_LINE_TOP 2
40 #define XML_LINE_BOTTOM 3
50 ::std::vector< XMLPropertyState >& rProperties,
62 if(
GetImport().GetFontDecls() !=
nullptr )
95 ) &&
"illegal property map" );
123 bool bHidden =
false;
131 rProperties, rValue, rUnitConverter, rNamespaceMap );
142 nSizeTypeIndex( -2 ),
143 nWidthTypeIndex( -2 )
158 if( pFontFamilyNameState && pFontFamilyNameState->
mnIndex != -1 )
161 pFontFamilyNameState->
maValue >>= sName;
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::unique_ptr<XMLPropertyState>* ppNewFontStyleName,
191 std::unique_ptr<XMLPropertyState>* ppNewFontFamily,
192 std::unique_ptr<XMLPropertyState>* ppNewFontPitch,
193 std::unique_ptr<XMLPropertyState>* ppNewFontCharSet )
const
195 if( pFontFamilyName )
199 if( !pFontStyleName )
202 #if OSL_DEBUG_LEVEL > 0 && !defined NDEBUG
204 pFontFamilyName->
mnIndex + 1 );
213 aAny <<= sal_Int16(css::awt::FontFamily::DONTKNOW);
215 #if OSL_DEBUG_LEVEL > 0 && !defined NDEBUG
217 pFontFamilyName->
mnIndex + 2 );
226 aAny <<= sal_Int16(css::awt::FontPitch::DONTKNOW);
227 #if OSL_DEBUG_LEVEL > 0 && !defined NDEBUG
229 pFontFamilyName->
mnIndex + 3 );
238 aAny <<= static_cast<sal_Int16>(osl_getThreadTextEncoding());
239 #if OSL_DEBUG_LEVEL > 0 && !defined NDEBUG
241 pFontFamilyName->
mnIndex + 4 );
279 void lcl_SeparateBorder(
285 #
if OSL_DEBUG_LEVEL > 0 && !defined NDEBUG
290 if( pAllBorderDistance && !pBorderDistances[nIndex] )
292 #if OSL_DEBUG_LEVEL > 0 && !defined NDEBUG
293 sal_Int16 nTmp = rMapper->GetEntryContextId(
294 pAllBorderDistance->
mnIndex + nIndex + 1 );
296 rMapper->GetEntryContextId(pAllBorderDistance->
mnIndex))
307 pNewBorderDistances[nIndex] =
310 pBorderDistances[nIndex] = pNewBorderDistances[nIndex];
312 if( pAllBorder && !pBorders[nIndex] )
314 #if OSL_DEBUG_LEVEL > 0 && !defined NDEBUG
315 sal_Int16 nTmp = rMapper->GetEntryContextId(
316 pAllBorder->
mnIndex + nIndex + 1 );
318 rMapper->GetEntryContextId(pAllBorder->
mnIndex))
329 pBorders[nIndex] = pNewBorders[nIndex];
331 if( !pBorderWidths[nIndex] )
332 pBorderWidths[nIndex] = pAllBorderWidth;
334 pBorderWidths[nIndex]->
mnIndex = -1;
336 if( !(pBorders[nIndex] && pBorderWidths[nIndex]) )
339 table::BorderLine2 aBorderLine;
340 pBorders[nIndex]->
maValue >>= aBorderLine;
342 table::BorderLine2 aBorderLineWidth;
343 pBorderWidths[nIndex]->maValue >>= aBorderLineWidth;
345 aBorderLine.OuterLineWidth = aBorderLineWidth.OuterLineWidth;
346 aBorderLine.InnerLineWidth = aBorderLineWidth.InnerLineWidth;
347 aBorderLine.LineDistance = aBorderLineWidth.LineDistance;
348 aBorderLine.LineWidth = aBorderLineWidth.LineWidth;
350 pBorders[nIndex]->
maValue <<= aBorderLine;
356 ::std::vector< XMLPropertyState >& rProperties,
357 sal_Int32 , sal_Int32 )
const
359 bool bHasAnyHeight =
false;
360 bool bHasAnyMinHeight =
false;
361 bool bHasAnyWidth =
false;
362 bool bHasAnyMinWidth =
false;
369 std::unique_ptr<XMLPropertyState> pNewFontStyleName;
370 std::unique_ptr<XMLPropertyState> pNewFontFamily;
371 std::unique_ptr<XMLPropertyState> pNewFontPitch;
372 std::unique_ptr<XMLPropertyState> pNewFontCharSet;
378 std::unique_ptr<XMLPropertyState> pNewFontStyleNameCJK;
379 std::unique_ptr<XMLPropertyState> pNewFontFamilyCJK;
380 std::unique_ptr<XMLPropertyState> pNewFontPitchCJK;
381 std::unique_ptr<XMLPropertyState> pNewFontCharSetCJK;
387 std::unique_ptr<XMLPropertyState> pNewFontStyleNameCTL;
388 std::unique_ptr<XMLPropertyState> pNewFontFamilyCTL;
389 std::unique_ptr<XMLPropertyState> pNewFontPitchCTL;
390 std::unique_ptr<XMLPropertyState> pNewFontCharSetCTL;
392 XMLPropertyState* pBorderDistances[4] = {
nullptr,
nullptr,
nullptr,
nullptr };
393 XMLPropertyState* pNewBorderDistances[4] = {
nullptr,
nullptr,
nullptr,
nullptr };
398 XMLPropertyState* pBorderWidths[4] = {
nullptr,
nullptr,
nullptr,
nullptr };
400 XMLPropertyState* pCharBorderDistances[4] = {
nullptr,
nullptr,
nullptr,
nullptr };
401 XMLPropertyState* pCharNewBorderDistances[4] = {
nullptr,
nullptr,
nullptr,
nullptr };
404 XMLPropertyState* pCharNewBorders[4] = {
nullptr,
nullptr,
nullptr,
nullptr };
406 XMLPropertyState* pCharBorderWidths[4] = {
nullptr,
nullptr,
nullptr,
nullptr };
413 ::std::unique_ptr<XMLPropertyState> pNewParaMargins[4];
416 ::std::unique_ptr<XMLPropertyState> pNewMargins[4];
420 for(
auto& rProperty : rProperties )
485 bHasAnyMinHeight =
true;
490 bHasAnyHeight =
true;
break;
493 bHasAnyMinWidth =
true;
497 bHasAnyWidth =
true;
break;
530 if( pFontFamilyName || pFontStyleName || pFontFamily ||
531 pFontPitch || pFontCharSet )
532 FontFinished( pFontFamilyName, pFontStyleName, pFontFamily,
533 pFontPitch, pFontCharSet );
534 if( pFontFamilyNameCJK || pFontStyleNameCJK || pFontFamilyCJK ||
535 pFontPitchCJK || pFontCharSetCJK )
536 FontFinished( pFontFamilyNameCJK, pFontStyleNameCJK, pFontFamilyCJK,
537 pFontPitchCJK, pFontCharSetCJK );
538 if( pFontFamilyNameCTL || pFontStyleNameCTL || pFontFamilyCTL ||
539 pFontPitchCTL || pFontCharSetCTL )
540 FontFinished( pFontFamilyNameCTL, pFontStyleNameCTL, pFontFamilyCTL,
541 pFontPitchCTL, pFontCharSetCTL );
543 for (sal_uInt16
i = 0;
i < 4;
i++)
545 if (pAllParaMargin && !pParaMargins[
i]
548 #if OSL_DEBUG_LEVEL > 0 && !defined NDEBUG
550 pAllParaMargin->
mnIndex + (2*
i) + 2 );
557 if (pAllMargin && !pMargins[
i])
559 #if OSL_DEBUG_LEVEL > 0 && !defined NDEBUG
569 i, pAllBorderDistance, pBorderDistances, pNewBorderDistances,
570 pAllBorder, pBorders, pNewBorders,
571 pAllBorderWidth, pBorderWidths
572 #
if OSL_DEBUG_LEVEL > 0 && !defined NDEBUG
578 i, pCharAllBorderDistance, pCharBorderDistances,
579 pCharNewBorderDistances, pCharAllBorder, pCharBorders,
580 pCharNewBorders, pCharAllBorderWidth, pCharBorderWidths
581 #
if OSL_DEBUG_LEVEL > 0 && !defined NDEBUG
596 if( pAllBorderDistance )
597 pAllBorderDistance->
mnIndex = -1;
602 if( pAllBorderWidth )
605 if( pCharAllBorderDistance )
606 pCharAllBorderDistance->
mnIndex = -1;
611 if( pCharAllBorderWidth )
612 pCharAllBorderWidth->
mnIndex = -1;
614 if( pVertOrient && pVertOrientRelAsChar )
616 sal_Int16 nVertOrient;
617 pVertOrient->
maValue >>= nVertOrient;
618 sal_Int16 nVertOrientRel = 0;
619 pVertOrientRelAsChar->
maValue >>= nVertOrientRel;
620 switch( nVertOrient )
622 case VertOrientation::TOP:
623 nVertOrient = nVertOrientRel;
625 case VertOrientation::CENTER:
626 switch( nVertOrientRel )
628 case VertOrientation::CHAR_TOP:
629 nVertOrient = VertOrientation::CHAR_CENTER;
631 case VertOrientation::LINE_TOP:
632 nVertOrient = VertOrientation::LINE_CENTER;
636 case VertOrientation::BOTTOM:
637 switch( nVertOrientRel )
639 case VertOrientation::CHAR_TOP:
640 nVertOrient = VertOrientation::CHAR_BOTTOM;
642 case VertOrientation::LINE_TOP:
643 nVertOrient = VertOrientation::LINE_BOTTOM;
648 pVertOrient->
maValue <<= nVertOrient;
649 pVertOrientRelAsChar->
mnIndex = -1;
653 pFontStyleName, pFontFamily, pFontPitch, pFontCharSet,
654 &pNewFontStyleName, &pNewFontFamily, &pNewFontPitch, &pNewFontCharSet );
657 pFontStyleNameCJK, pFontFamilyCJK, pFontPitchCJK, pFontCharSetCJK,
658 &pNewFontStyleNameCJK, &pNewFontFamilyCJK, &pNewFontPitchCJK, &pNewFontCharSetCJK );
661 pFontStyleNameCTL, pFontFamilyCTL, pFontPitchCTL, pFontCharSetCTL,
662 &pNewFontStyleNameCTL, &pNewFontFamilyCTL, &pNewFontPitchCTL, &pNewFontCharSetCTL );
664 if (pFillStyle && !pFillColor && pBackTransparent
665 && drawing::FillStyle_SOLID == pFillStyle->
maValue.get<drawing::FillStyle>()
666 && pBackTransparent->
maValue.get<
bool>())
674 if( ( pBackTransparency !=
nullptr ) && ( pBackTransparent !=
nullptr ) )
676 if( ! *o3tl::doAccess<bool>(pBackTransparent->
maValue) )
677 pBackTransparent->
mnIndex = -1;
685 if( pNewFontStyleName )
687 rProperties.push_back( *pNewFontStyleName );
688 pNewFontStyleName.reset();
693 rProperties.push_back( *pNewFontFamily );
694 pNewFontFamily.reset();
699 rProperties.push_back( *pNewFontPitch );
700 pNewFontPitch.reset();
703 if( pNewFontCharSet )
705 rProperties.push_back( *pNewFontCharSet );
706 pNewFontCharSet.reset();
709 if( pNewFontStyleNameCJK )
711 rProperties.push_back( *pNewFontStyleNameCJK );
712 pNewFontStyleNameCJK.reset();
715 if( pNewFontFamilyCJK )
717 rProperties.push_back( *pNewFontFamilyCJK );
718 pNewFontFamilyCJK.reset();
721 if( pNewFontPitchCJK )
723 rProperties.push_back( *pNewFontPitchCJK );
724 pNewFontPitchCJK.reset();
727 if( pNewFontCharSetCJK )
729 rProperties.push_back( *pNewFontCharSetCJK );
730 pNewFontCharSetCJK.reset();
733 if( pNewFontStyleNameCTL)
735 rProperties.push_back( *pNewFontStyleNameCTL );
736 pNewFontStyleNameCTL.reset();
739 if( pNewFontFamilyCTL )
741 rProperties.push_back( *pNewFontFamilyCTL );
742 pNewFontFamilyCTL.reset();
745 if( pNewFontPitchCTL )
747 rProperties.push_back( *pNewFontPitchCTL );
748 pNewFontPitchCTL.reset();
751 if( pNewFontCharSetCTL )
753 rProperties.push_back( *pNewFontCharSetCTL );
754 pNewFontCharSetCTL.reset();
757 for (sal_uInt16
i=0;
i<4;
i++)
759 if (pNewParaMargins[
i])
761 rProperties.push_back(*pNewParaMargins[i]);
765 rProperties.push_back(*pNewMargins[i]);
767 if( pNewBorderDistances[i] )
769 rProperties.push_back( *pNewBorderDistances[i] );
770 delete pNewBorderDistances[i];
774 rProperties.push_back( *pNewBorders[i] );
775 delete pNewBorders[i];
777 if( pCharNewBorderDistances[i] )
779 rProperties.push_back( *pCharNewBorderDistances[i] );
780 delete pCharNewBorderDistances[i];
782 if( pCharNewBorders[i] )
784 rProperties.push_back( *pCharNewBorders[i] );
785 delete pCharNewBorders[i];
796 for( sal_Int32 j=0; j < nPropCount; j++ )
799 ->GetEntryContextId( j ) )
810 aSizeTypeState.
maValue <<=
static_cast<sal_Int16
>( bHasAnyMinHeight
813 rProperties.push_back( aSizeTypeState );
825 for( sal_Int32 j=0; j < nCount; j++ )
828 ->GetEntryContextId( j ) )
839 aSizeTypeState.
maValue <<=
static_cast<sal_Int16
>( bHasAnyMinWidth
842 rProperties.push_back( aSizeTypeState );
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.
#define CTF_FONTPITCH_CJK
#define CTF_FONTFAMILY_CTL
bool FillProperties(const OUString &rName,::std::vector< XMLPropertyState > &rProps, sal_Int32 nFamilyNameIdx, sal_Int32 nStyleNameIdx, sal_Int32 nFamilyIdx, sal_Int32 nPitchIdx, sal_Int32 nCharsetIdx) const
#define CTF_FRAMEWIDTH_MIN_REL
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 ...
#define CTF_PARALEFTMARGIN_REL
#define CTF_CHARTOPBORDERDISTANCE
the SvXMLTypeConverter converts values of various types from their internal representation to the tex...
#define CTF_CHARRIGHTBORDERDISTANCE
#define CTF_FRAMEHEIGHT_ABS
#define CTF_FRAMEHEIGHT_MIN_REL
#define CTF_PARAMARGINALL
#define CTF_FONTSTYLENAME_CJK
#define CTF_FRAMEWIDTH_ABS
#define CTF_FONTFAMILYNAME_CJK
#define CTF_FONTPITCH_CTL
static void FontFinished(XMLPropertyState *pFontFamilyNameState, XMLPropertyState *pFontStyleNameState, XMLPropertyState *pFontFamilyState, XMLPropertyState *pFontPitchState, XMLPropertyState *pFontCharsetState)
#define CTF_PARABOTTOMMARGIN_REL
#define CTF_FONTFAMILYNAME
const rtl::Reference< XMLPropertySetMapper > & getPropertySetMapper() const
#define CTF_RIGHTBORDERDISTANCE
XMLTextImportPropertyMapper(const rtl::Reference< XMLPropertySetMapper > &rMapper, SvXMLImport &rImport)
virtual ~XMLTextImportPropertyMapper() override
#define CTF_TOPBORDERWIDTH
#define CTF_FONTCHARSET_CJK
css::uno::Any const & rValue
static const sal_uInt16 OOo_2x
#define CTF_BACKGROUND_TRANSPARENCY
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
#define CTF_CHARLEFTBORDER
#define CTF_PARATOPMARGIN
#define CTF_VERTICALREL_ASCHAR
SvXMLImport & GetImport() const
#define CTF_FRAMEWIDTH_MIN_ABS
#define CTF_CHARLEFTBORDERDISTANCE
#define CTF_LEFTBORDERDISTANCE
#define CTF_FONTCHARSET_CTL
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 ...
#define CTF_LEFTBORDERWIDTH
#define CTF_CHARALLBORDERWIDTH
#define CTF_PARATOPMARGIN_REL
#define CTF_CHARRIGHTBORDERWIDTH
sal_Int32 nWidthTypeIndex
#define CTF_BACKGROUND_TRANSPARENT
#define CTF_FONTSTYLENAME_CTL
#define CTF_TOPBORDERDISTANCE
#define CTF_CHARTOPBORDERWIDTH
#define CTF_BOTTOMBORDERDISTANCE
#define CTF_FRAMEWIDTH_REL
#define CTF_FRAMEHEIGHT_MIN_ABS
#define CTF_CHARALLBORDERDISTANCE
#define CTF_PARALEFTMARGIN
#define CTF_CHARTOPBORDER
#define CTF_CHARALLBORDER
#define CTF_CHARBOTTOMBORDER
#define CTF_FONTSTYLENAME
#define CTF_PARARIGHTMARGIN_REL
#define CTF_FRAMEWIDTH_TYPE
#define CTF_FONTFAMILYNAME_CTL
Smart struct to transport an Any with an index to the appropriate property-name.
#define CTF_CHARBOTTOMBORDERWIDTH
#define CTF_ALLBORDERDISTANCE
#define CTF_FRAMEHEIGHT_REL
#define CTF_PARARIGHTMARGIN
#define CTF_CHARLEFTBORDERWIDTH
#define CTF_CHARRIGHTBORDER
#define CTF_ALLBORDERWIDTH
#define CTF_BOTTOMBORDERWIDTH
#define CTF_CHARBOTTOMBORDERDISTANCE
XMLFontStylesContext * GetFontDecls()
#define CTF_PARABOTTOMMARGIN
#define CTF_RIGHTBORDERWIDTH
#define CTF_FONTFAMILY_CJK
#define CTF_PARAMARGINALL_REL
void FontDefaultsCheck(XMLPropertyState const *pFontFamilyName, XMLPropertyState const *pFontStyleName, XMLPropertyState const *pFontFamily, XMLPropertyState const *pFontPitch, XMLPropertyState const *pFontCharSet, std::unique_ptr< XMLPropertyState > *ppNewFontStyleName, std::unique_ptr< XMLPropertyState > *ppNewFontFamily, std::unique_ptr< XMLPropertyState > *ppNewFontPitch, std::unique_ptr< XMLPropertyState > *ppNewFontCharSet) const
since the properties "CharFontFamilyName", "CharFontStyleName", "CharFontFamily", "CharFontPitch" and...