23#include <com/sun/star/style/LineSpacingMode.hpp>
24#include <ooo/vba/word/WdLineSpacing.hpp>
25#include <ooo/vba/word/WdParagraphAlignment.hpp>
26#include <ooo/vba/word/WdOutlineLevel.hpp>
27#include <com/sun/star/style/ParagraphAdjust.hpp>
28#include <com/sun/star/style/BreakType.hpp>
29#include <com/sun/star/beans/XPropertySet.hpp>
51 style::ParagraphAdjust aParaAdjust = style::ParagraphAdjust_LEFT;
52 mxParaProps->getPropertyValue(
"ParaAdjust") >>= aParaAdjust;
65 mxParaProps->getPropertyValue(
"ParaFirstLineIndent") >>= indent;
66 return static_cast<float>( Millimeter::getInPoints( indent ) );
71 sal_Int32 indent = Millimeter::getInHundredthsOfOneMillimeter( _firstlineindent );
78 mxParaProps->getPropertyValue(
"ParaKeepTogether") >>= bKeep;
85 if( _keeptogether >>= bKeep )
98 mxParaProps->getPropertyValue(
"ParaSplit") >>= bKeep;
105 if( _keepwithnext >>= bKeep )
118 mxParaProps->getPropertyValue(
"ParaIsHyphenation") >>= bHypn;
125 if( _hyphenation >>= bHypn )
137 style::LineSpacing aLineSpacing;
138 mxParaProps->getPropertyValue(
"ParaLineSpacing") >>= aLineSpacing;
144 style::LineSpacing aLineSpacing;
145 mxParaProps->getPropertyValue(
"ParaLineSpacing") >>= aLineSpacing;
152 style::LineSpacing aLineSpacing;
153 mxParaProps->getPropertyValue(
"ParaLineSpacing") >>= aLineSpacing;
165 bool noLineNum =
false;
166 mxParaProps->getPropertyValue(
"ParaLineNumberCount") >>= noLineNum;
172 bool noLineNum =
false;
173 if( _nolinenumber >>= noLineNum )
185 sal_Int32 nLevel = word::WdOutlineLevel::wdOutlineLevelBodyText;
187 static constexpr OUStringLiteral HEADING =
u"Heading";
188 mxParaProps->getPropertyValue(
"ParaStyleName") >>= aHeading;
189 if( aHeading.startsWith( HEADING ) )
192 nLevel =
o3tl::toInt32(aHeading.subView( HEADING.getLength() ));
207 style::BreakType aBreakType;
208 mxParaProps->getPropertyValue(
"BreakType") >>= aBreakType;
209 bool bBreakBefore = ( aBreakType == style::BreakType_PAGE_BEFORE || aBreakType == style::BreakType_PAGE_BOTH );
215 bool bBreakBefore =
false;
216 if( _breakbefore >>= bBreakBefore )
218 style::BreakType aBreakType;
219 mxParaProps->getPropertyValue(
"BreakType") >>= aBreakType;
222 if( aBreakType == style::BreakType_NONE )
223 aBreakType = style::BreakType_PAGE_BEFORE;
224 else if ( aBreakType == style::BreakType_PAGE_AFTER )
225 aBreakType = style::BreakType_PAGE_BOTH;
229 if( aBreakType == style::BreakType_PAGE_BOTH )
230 aBreakType = style::BreakType_PAGE_AFTER;
231 else if ( aBreakType == style::BreakType_PAGE_BEFORE )
232 aBreakType = style::BreakType_PAGE_AFTER;
244 sal_Int32 nSpace = 0;
245 mxParaProps->getPropertyValue(
"ParaTopMargin") >>= nSpace;
246 return static_cast<float>( Millimeter::getInPoints( nSpace ) );
251 sal_Int32 nSpace = Millimeter::getInHundredthsOfOneMillimeter( _space );
257 sal_Int32 nSpace = 0;
258 mxParaProps->getPropertyValue(
"ParaBottomMargin") >>= nSpace;
259 return static_cast<float>( Millimeter::getInPoints( nSpace ) );
264 sal_Int32 nSpace = Millimeter::getInHundredthsOfOneMillimeter( _space );
270 sal_Int32 nIndent = 0;
271 mxParaProps->getPropertyValue(
"ParaLeftMargin") >>= nIndent;
272 return static_cast<float>( Millimeter::getInPoints( nIndent ) );
277 sal_Int32 nIndent = Millimeter::getInHundredthsOfOneMillimeter( _leftindent );
283 sal_Int32 nIndent = 0;
284 mxParaProps->getPropertyValue(
"ParaRightMargin") >>= nIndent;
285 return static_cast<float>( Millimeter::getInPoints( nIndent ) );
290 sal_Int32 nIndent = Millimeter::getInHundredthsOfOneMillimeter( _rightindent );
301 throw uno::RuntimeException(
"Not implemented" );
307 mxParaProps->getPropertyValue(
"ParaWidows") >>= nWidow;
309 mxParaProps->getPropertyValue(
"ParaOrphans") >>= nOrphan;
312 bool bWidow = ( nWidow > 1 && nOrphan == nWidow );
321 if( _widowcontrol >>= bWidow )
335 style::LineSpacing aLineSpacing;
336 if(
mode != style::LineSpacingMode::MINIMUM &&
mode != style::LineSpacingMode::FIX )
342 aLineSpacing.Mode = style::LineSpacingMode::PROP;
347 aLineSpacing.Mode = style::LineSpacingMode::PROP;
352 aLineSpacing.Mode = style::LineSpacingMode::PROP;
357 aLineSpacing.Mode = style::LineSpacingMode::FIX;
358 aLineSpacing.Height =
static_cast<sal_Int16
>( Millimeter::getInHundredthsOfOneMillimeter( _lineSpace ) );
363 aLineSpacing.Mode =
mode;
364 aLineSpacing.Height =
static_cast<sal_Int16
>( Millimeter::getInHundredthsOfOneMillimeter( _lineSpace ) );
371 style::LineSpacing aLineSpacing;
372 switch( _linespacingrule )
374 case word::WdLineSpacing::wdLineSpace1pt5:
376 aLineSpacing.Mode = style::LineSpacingMode::PROP;
380 case word::WdLineSpacing::wdLineSpaceAtLeast:
382 aLineSpacing.Mode = style::LineSpacingMode::MINIMUM;
386 case word::WdLineSpacing::wdLineSpaceDouble:
388 aLineSpacing.Mode = style::LineSpacingMode::PROP;
392 case word::WdLineSpacing::wdLineSpaceExactly:
393 case word::WdLineSpacing::wdLineSpaceMultiple:
395 aLineSpacing.Mode = style::LineSpacingMode::FIX;
399 case word::WdLineSpacing::wdLineSpaceSingle:
401 aLineSpacing.Mode = style::LineSpacingMode::PROP;
416 float wdLineSpacing = 0;
417 if( rLineSpacing.Mode != style::LineSpacingMode::PROP )
419 wdLineSpacing =
static_cast<float>( Millimeter::getInPoints( rLineSpacing.Height ) );
425 return wdLineSpacing;
430 sal_Int32 wdLineSpacing = word::WdLineSpacing::wdLineSpaceSingle;
431 switch( rLineSpacing.Mode )
433 case style::LineSpacingMode::PROP:
435 switch( rLineSpacing.Height )
439 wdLineSpacing = word::WdLineSpacing::wdLineSpaceSingle;
444 wdLineSpacing = word::WdLineSpacing::wdLineSpace1pt5;
449 wdLineSpacing = word::WdLineSpacing::wdLineSpaceDouble;
454 wdLineSpacing = word::WdLineSpacing::wdLineSpaceMultiple;
459 case style::LineSpacingMode::MINIMUM:
461 wdLineSpacing = word::WdLineSpacing::wdLineSpaceAtLeast;
464 case style::LineSpacingMode::FIX:
465 case style::LineSpacingMode::LEADING:
467 wdLineSpacing = word::WdLineSpacing::wdLineSpaceExactly;
475 return wdLineSpacing;
480 float fCharHeight = 0.0;
481 mxParaProps->getPropertyValue(
"CharHeight") >>= fCharHeight;
482 return static_cast<sal_Int16
>( Millimeter::getInHundredthsOfOneMillimeter( fCharHeight ) );
487 style::ParagraphAdjust nParaAjust = style::ParagraphAdjust_LEFT;
490 case word::WdParagraphAlignment::wdAlignParagraphCenter:
492 nParaAjust = style::ParagraphAdjust_CENTER;
495 case word::WdParagraphAlignment::wdAlignParagraphJustify:
497 nParaAjust = style::ParagraphAdjust_BLOCK;
500 case word::WdParagraphAlignment::wdAlignParagraphLeft:
502 nParaAjust = style::ParagraphAdjust_LEFT;
505 case word::WdParagraphAlignment::wdAlignParagraphRight:
507 nParaAjust = style::ParagraphAdjust_RIGHT;
520 sal_Int32 wdAlignment = word::WdParagraphAlignment::wdAlignParagraphLeft;
523 case style::ParagraphAdjust_CENTER:
525 wdAlignment = word::WdParagraphAlignment::wdAlignParagraphCenter;
528 case style::ParagraphAdjust_LEFT:
530 wdAlignment = word::WdParagraphAlignment::wdAlignParagraphLeft;
533 case style::ParagraphAdjust_BLOCK:
535 wdAlignment = word::WdParagraphAlignment::wdAlignParagraphJustify;
538 case style::ParagraphAdjust_RIGHT:
540 wdAlignment = word::WdParagraphAlignment::wdAlignParagraphRight;
554 return "SwVbaParagraphFormat";
557uno::Sequence< OUString >
562 "ooo.vba.word.ParagraphFormat"
css::uno::Reference< css::uno::XComponentContext > mxContext
Sequence< OUString > aServiceNames
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
#define ERRCODE_BASIC_BAD_PARAMETER