22 #include <com/sun/star/text/XNumberingRulesSupplier.hpp>
23 #include <com/sun/star/container/XIndexReplace.hpp>
24 #include <com/sun/star/text/HoriOrientation.hpp>
25 #include <com/sun/star/awt/FontDescriptor.hpp>
26 #include <com/sun/star/awt/FontWeight.hpp>
27 #include <com/sun/star/awt/XBitmap.hpp>
28 #include <com/sun/star/graphic/XGraphic.hpp>
29 #include <com/sun/star/beans/PropertyValue.hpp>
30 #include <com/sun/star/style/NumberingType.hpp>
31 #include <com/sun/star/style/TabStop.hpp>
32 #include <com/sun/star/style/ParagraphAdjust.hpp>
33 #include <com/sun/star/drawing/XDrawPage.hpp>
35 #include <osl/diagnose.h>
39 #include <oox/token/properties.hxx>
40 #include <oox/token/tokens.hxx>
42 #if OSL_DEBUG_LEVEL > 0
43 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
44 #include <com/sun/star/text/XText.hpp>
45 #include <com/sun/star/drawing/XShape.hpp>
56 using ::com::sun::star::awt::FontDescriptor;
62 mbBulletColorFollowText (
false ),
63 mbBulletFontFollowText (
false ),
64 mbBulletSizeFollowText (
false )
122 OSL_ASSERT((nType & sal_Int32(0xFFFF0000))==0);
125 case XML_alphaLcParenBoth:
129 case XML_alphaLcParenR:
133 case XML_alphaLcPeriod:
137 case XML_alphaUcParenBoth:
141 case XML_alphaUcParenR:
145 case XML_alphaUcPeriod:
149 case XML_arabic1Minus:
150 case XML_arabic2Minus:
151 case XML_arabicDbPeriod:
152 case XML_arabicDbPlain:
155 case XML_arabicParenBoth:
159 case XML_arabicParenR:
163 case XML_arabicPeriod:
167 case XML_arabicPlain:
171 case XML_circleNumDbPlain:
172 case XML_circleNumWdBlackPlain:
173 case XML_circleNumWdWhitePlain:
176 case XML_ea1ChsPeriod:
180 case XML_ea1ChsPlain:
184 case XML_ea1ChtPeriod:
188 case XML_ea1ChtPlain:
192 case XML_ea1JpnChsDbPeriod:
193 case XML_ea1JpnKorPeriod:
194 case XML_ea1JpnKorPlain:
196 case XML_hebrew2Minus:
200 case XML_hindiAlpha1Period:
201 case XML_hindiAlphaPeriod:
202 case XML_hindiNumParenR:
203 case XML_hindiNumPeriod:
206 case XML_romanLcParenBoth:
210 case XML_romanLcParenR:
214 case XML_romanLcPeriod:
218 case XML_romanUcParenBoth:
222 case XML_romanUcParenR:
226 case XML_romanUcPeriod:
230 case XML_thaiAlphaParenBoth:
231 case XML_thaiNumParenBoth:
235 case XML_thaiAlphaParenR:
236 case XML_thaiNumParenR:
240 case XML_thaiAlphaPeriod:
241 case XML_thaiNumPeriod:
304 rPropMap.
setProperty( PROP_Adjust, HoriOrientation::LEFT);
309 OUString aBulletFontName;
310 sal_Int16 nBulletFontPitch = 0;
311 sal_Int16 nBulletFontFamily = 0;
312 float nBulletFontWeight = css::awt::FontWeight::NORMAL;
313 bool bSymbolFont =
false;
315 bool bFollowTextFont =
false;
317 if (!bFollowTextFont &&
maBulletFont.
getFontData( aBulletFontName, nBulletFontPitch, nBulletFontFamily, *pFilterBase ) )
319 FontDescriptor aFontDesc;
320 sal_Int16 nFontSize = 0;
322 aFontDesc.Height = nFontSize;
325 aFontDesc.Name = aBulletFontName;
326 aFontDesc.Pitch = nBulletFontPitch;
327 aFontDesc.Family = nBulletFontFamily;
328 aFontDesc.Weight = nBulletFontWeight;
329 if ( aBulletFontName.equalsIgnoreAsciiCase(
"Wingdings") ||
330 aBulletFontName.equalsIgnoreAsciiCase(
"Wingdings 2") ||
331 aBulletFontName.equalsIgnoreAsciiCase(
"Wingdings 3") ||
332 aBulletFontName.equalsIgnoreAsciiCase(
"Monotype Sorts") ||
333 aBulletFontName.equalsIgnoreAsciiCase(
"Monotype Sorts 2") ||
334 aBulletFontName.equalsIgnoreAsciiCase(
"Webdings") ||
335 aBulletFontName.equalsIgnoreAsciiCase(
"StarBats") ||
336 aBulletFontName.equalsIgnoreAsciiCase(
"StarMath") ||
337 aBulletFontName.equalsIgnoreAsciiCase(
"ZapfDingbats") ) {
338 aFontDesc.CharSet = RTL_TEXTENCODING_SYMBOL;
342 rPropMap.
setProperty( PROP_BulletFontName, aBulletFontName);
350 if( pFilterBase && sBuChar.getLength() == 1 &&
maBulletFont.
getFontData( aBulletFontName, nBulletFontPitch, nBulletFontFamily, *pFilterBase ) && bSymbolFont )
355 sBuChar = OUString( &nBuChar, 1 );
366 bool bFollowTextSize =
false;
368 if( !bFollowTextSize &&
mnSize.hasValue() )
373 bool bFollowTextColor =
false;
408 bool bPushDefaultValues )
const
413 sal_Int32 nNumberingType = NumberingType::NUMBER_NONE;
421 if ( nNumberingType == NumberingType::NUMBER_NONE )
422 aPropSet.
setProperty< sal_Int16 >( PROP_NumberingLevel, -1 );
434 if ( nNumberingType != NumberingType::NUMBER_NONE )
436 if ( noParaLeftMargin )
438 aPropSet.
setProperty<sal_Int32>( PROP_ParaLeftMargin, 0);
439 rioBulletMap.
setProperty( PROP_LeftMargin, *noParaLeftMargin);
440 noParaLeftMargin.reset();
442 if ( noFirstLineIndentation )
446 aPropSet.
setProperty<sal_Int32>( PROP_ParaFirstLineIndent, 0);
447 rioBulletMap.
setProperty( PROP_FirstLineOffset, *noFirstLineIndentation);
448 noFirstLineIndentation.reset();
450 if ( nNumberingType != NumberingType::BITMAP && !rioBulletMap.
hasProperty( PROP_BulletColor ) && pFilterBase )
454 if ( bApplyBulletMap )
457 aPropSet.
getProperty( xNumRule, PROP_NumberingRules );
458 OSL_ENSURE( xNumRule.is(),
"can't get Numbering rules");
464 if( !rioBulletMap.
empty() )
467 if( !rioBulletMap.
hasProperty( PROP_BulletRelSize ) )
468 rioBulletMap.
setProperty<sal_Int16>( PROP_BulletRelSize, 100);
470 xNumRule->replaceByIndex(
getLevel(),
Any( aBulletPropSeq ) );
473 aPropSet.
setProperty( PROP_NumberingRules, xNumRule );
481 if ( noParaLeftMargin )
482 aPropSet.
setProperty( PROP_ParaLeftMargin, *noParaLeftMargin);
483 if ( noFirstLineIndentation )
485 aPropSet.
setProperty( PROP_ParaFirstLineIndent, *noFirstLineIndentation );
486 if( bPushDefaultValues )
490 aTabStop.Position = 0;
502 aPropSet.
setProperty( PROP_ParaAdjust, css::style::ParagraphAdjust_LEFT);
511 aPropSet.
setProperty( PROP_ParaLineSpacing, css::style::LineSpacing( css::style::LineSpacingMode::PROP, 100 ));
530 xDebugPage->add( xShape );
534 xText->setString(
"debug" );
536 xStart->gotoEnd(
true );
538 pushToPropSet(
nullptr, xPropSet, emptyMap,
nullptr,
false, 0 );
TextSpacing maLineSpacing
std::optional< css::style::ParagraphAdjust > moParaAdjust
A helper that maps property identifiers to property values.
bool getProperty(Type &orValue, sal_Int32 nPropId) const
Gets the specified property from the property set.
void assignAll(const PropertyMap &rPropMap)
Inserts all properties contained in the passed property map.
std::optional< sal_Int32 > moFirstLineIndentation
TextSpacing maParaTopMargin
css::uno::Any msNumberingPrefix
css::uno::Any maStyleName
bool setProperty(sal_Int32 nPropId, Type &&rValue)
Sets the specified property to the passed value.
css::uno::Any mbBulletColorFollowText
Color getBestSolidColor() const
Tries to resolve current settings to a solid color, e.g.
css::uno::Any msNumberingSuffix
css::style::LineSpacing toLineSpacing() const
css::uno::Any mnAspectRatio
std::shared_ptr< T > make_shared(Args &&...args)
void setBulletSize(sal_Int16 nSize)
float getCharHeightPoints(float fDefault) const
Returns the largest character size of this paragraph.
void setType(sal_Int32 nType)
bool getFontData(OUString &rFontName, sal_Int16 &rnFontPitch, sal_Int16 &rnFontFamily, const ::oox::core::XmlFilterBase &rFilter) const
Returns the font name, pitch, and family; tries to resolve theme placeholder names, e.g.
void setBulletChar(const OUString &sChar)
float getCharHeightPoints(float fDefault) const
Returns the current character size.
void setProperties(const css::uno::Sequence< OUString > &rPropNames, const css::uno::Sequence< css::uno::Any > &rValues)
Puts the passed properties into the property set.
::oox::drawingml::TextFont maBulletFont
void setBulletAspectRatio(double nAspectRatio)
FillProperties maFillProperties
css::uno::Any mbBulletFontFollowText
sal_Int32 toMargin(float fFontSize) const
void setSuffixParenRight()
css::uno::Any mnNumberingType
bool hasProperty(sal_Int32 nPropId) const
Returns true, if the map contains a property with the passed identifier.
static XmlFilterBase * mpDebugFilterBase
sal_Int16 getLevel() const
::Color getColor(const GraphicHelper &rGraphicHelper,::Color nPhClr=API_RGB_TRANSPARENT) const
Returns the final RGB color value.
std::optional< sal_Int32 > moParaLeftMargin
void apply(const TextParagraphProperties &rSourceProps)
bool setAnyProperty(sal_Int32 nPropId, const css::uno::Any &rValue)
Sets the specified property to the passed value.
TextParagraphProperties()
HRESULT createInstance(REFIID iid, Ifc **ppIfc)
void setSuffixMinusRight()
css::uno::Any mbBulletSizeFollowText
css::uno::Sequence< css::beans::PropertyValue > makePropertyValueSequence() const
Returns a sequence of property values, filled with all contained properties.
css::uno::Any msBulletChar
void setSuffixParenBoth()
A wrapper for a UNO property set.
void setGraphic(css::uno::Reference< css::graphic::XGraphic > const &rXGraphic)
TextCharacterProperties maTextCharacterProperties
PropertyMap maTextParagraphPropertyMap
if(aStr!=aBuf) UpdateName_Impl(m_xFollowLb.get()
void apply(const BulletList &)
void setFontSize(sal_Int16 nSize)
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
Sequence< sal_Int8 > aSeq
void assignUsed(const TextCharacterProperties &rSourceProps)
Overwrites all members that are explicitly set in rSourceProps.
static css::uno::WeakReference< css::drawing::XDrawPage > mxDebugPage
std::shared_ptr< ::oox::drawingml::Color > maBulletColorPtr
void pushToPropMap(const ::oox::core::XmlFilterBase *pFilterBase, PropertyMap &xPropMap) const
void assignIfUsed(const TextFont &rTextFont)
Overwrites this text font with the passed text font, if it is used.
bool setProperty(sal_Int32 nPropId, const Type &rValue)
Puts the passed value into the property set.
TextSpacing maParaBottomMargin
bool m_bDetectedRangeSegmentation false