25#include <rtl/ustring.hxx>
29#include <com/sun/star/text/XText.hpp>
30#include <com/sun/star/text/XTextCursor.hpp>
31#include <com/sun/star/text/ControlCharacter.hpp>
32#include <oox/token/properties.hxx>
41 : mbHasProperties( false )
58 if (pMasterTextParagraphStyle)
60 aTextCharacterStyle.
assignUsed(rTextStyleProperties);
61 if (pTextParagraphStyle)
64 return aTextCharacterStyle;
72 SAL_INFO(
"oox",
"TextParagraph::getParagraphStyle - level " << nLevel);
75 if (nLevel >=
static_cast< sal_Int16
>(rListStyle.size()))
78 if (!rListStyle.empty())
79 pTextParagraphStyle = &rListStyle[nLevel];
85 const ::oox::core::XmlFilterBase& rFilterBase,
91 float nDefaultCharHeight)
const
94 sal_Int32 nParagraphSize = 0;
100 xText->insertControlCharacter( xAt, ControlCharacter::APPEND_PARAGRAPH,
false );
101 xAt->gotoEnd(
true );
104 sal_Int32 nCharHeight = 0;
105 sal_Int32 nCharHeightFirst = 0;
112 if ( aTextCharacterProps.
moHeight.has_value() )
113 nCharHeight = nCharHeightFirst = aTextCharacterProps.
moHeight.value();
118 for( TextRunVector::const_iterator aIt =
maRuns.begin(), aEnd =
maRuns.end(); aIt != aEnd; ++aIt )
120 sal_Int32 nLen = (*aIt)->getText().getLength();
123 if( !nLen && ( ( aIt + 1 ) == aEnd ) )
125 sal_Int32 nCharHeightCurrent = (*aIt)->insertAt( rFilterBase, xText, xAt, aTextCharacterStyle, nDefaultCharHeight );
127 nCharHeightFirst = nCharHeightCurrent;
128 nCharHeight = std::max< sal_Int32 >( nCharHeight, nCharHeightCurrent);
129 nParagraphSize += nLen;
132 xAt->gotoEnd(
true );
138 aCombinedTextStyle.
apply(rMasterTextListStyle);
139 aCombinedTextStyle.
apply(rTextListStyle);
141 if ( pTextParagraphStyle )
144 aParaProp.
apply( *pTextParagraphStyle );
149 && (*
maRuns.begin())->getTextCharacterProperties().maFillProperties.moFillType.has_value() )
150 aioBulletList.
setProperty( PROP_BulletColor, (*
maRuns.begin())->getTextCharacterProperties().maFillProperties.getBestSolidColor().getColor( rFilterBase.getGraphicHelper() ));
156 tools::Long nFirstCharHeightMm =
TransformMetric(nCharHeightFirst > 0 ? nCharHeightFirst : 1200, FieldUnit::POINT, FieldUnit::MM);
157 float fBulletSizeRel = 1.f;
158 double fBulletAspectRatio = 1.0;
166 css::awt::Size aBulletSize;
167 if( fBulletAspectRatio != 1.0 )
170 aBulletSize.Width = aBulletSize.Height * fBulletAspectRatio;
175 aioBulletList.
setProperty( PROP_GraphicSize, aBulletSize);
179 aParaProp.
pushToPropSet( &rFilterBase, xProps, aioBulletList, &pTextParagraphStyle->
getBulletList(),
true, fCharacterSize,
true );
183 if ( !nParagraphSize )
185 xProps->setPropertyValue(
"NumberingLevel",
Any(
static_cast< sal_Int16
>( -1 ) ) );
195 SAL_INFO(
"oox",
"exception in TextParagraph::insertAt");
210 for (
auto& pTextRun :
getRuns() )
212 if ( pTextRun->hasVisualRunProperties() )
A helper that maps property identifiers to property values.
bool hasProperty(sal_Int32 nPropId) const
Returns true, if the map contains a property with the passed identifier.
bool setProperty(sal_Int32 nPropId, Type &&rValue)
Sets the specified property to the passed value.
A wrapper for a UNO property set.
css::uno::Any mnAspectRatio
::Color getColor(const GraphicHelper &rGraphicHelper, ::Color nPhClr=API_RGB_TRANSPARENT) const
Returns the final RGB color value.
void apply(const TextListStyle &rTextListStyle)
const TextParagraphPropertiesArray & getListStyle() const
float getCharHeightPoints(float fDefault) const
Returns the largest character size of this paragraph.
void apply(const TextParagraphProperties &rSourceProps)
TextCharacterProperties & getTextCharacterProperties()
sal_Int16 getLevel() const
void pushToPropSet(const ::oox::core::XmlFilterBase *pFilterBase, const css::uno::Reference< css::beans::XPropertySet > &xPropSet, PropertyMap &rioBulletList, const BulletList *pMasterBuList, bool bApplyBulletList, float fFontSize, bool bPushDefaultValues=false) const
BulletList & getBulletList()
TextParagraphProperties maProperties
TextCharacterProperties maEndProperties
bool hasVisualRunProperties() const
Returns whether textparagraph had a rPr tag in it that alters it visually.
TextCharacterProperties getCharacterStyle(const TextCharacterProperties &rTextStyleProperties, const TextListStyle &rMasterTextListStyle, const TextListStyle &rTextListStyle) const
std::unique_ptr< formulaimport::XmlStreamBuilder > m_pMathXml
void insertAt(const ::oox::core::XmlFilterBase &rFilterBase, const css::uno::Reference< css::text::XText > &xText, const css::uno::Reference< css::text::XTextCursor > &xAt, const TextCharacterProperties &rTextStyleProperties, const TextListStyle &rMasterTextListStyle, const TextListStyle &rTextListStyle, bool bFirst, float nDefaultCharHeight) const
TextRunVector & getRuns()
TextParagraphProperties * getParagraphStyle(const TextListStyle &rTextListStyle) const
formulaimport::XmlStreamBuilder & GetMathXml()
#define SAL_INFO(area, stream)
float GetFontHeight(sal_Int32 nHeight)
std::array< TextParagraphProperties, NUM_TEXT_LIST_STYLE_ENTRIES > TextParagraphPropertiesArray
Color getBestSolidColor() const
Tries to resolve current settings to a solid color, e.g.
std::optional< sal_Int32 > moFillType
void pushToPropSet(PropertySet &rPropSet, const ::oox::core::XmlFilterBase &rFilter) const
Writes the properties to the passed property set.
void assignUsed(const TextCharacterProperties &rSourceProps)
Overwrites all members that are explicitly set in rSourceProps.
std::optional< sal_Int32 > moHeight
FillProperties maFillProperties
#define OOX_BULLET_LIST_SCALE_FACTOR
SVT_DLLPUBLIC tools::Long TransformMetric(tools::Long nVal, FieldUnit aOld, FieldUnit aNew)