merge the formfield patch from ooo-build
[ooovba.git] / sw / source / ui / vba / vbaparagraphformat.cxx
blob2959a239ad65e5f6aba444c7d25c418e9db3e7f8
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile:
10 * $Revision:
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #include "vbaparagraphformat.hxx"
31 #include <vbahelper/vbahelper.hxx>
32 #include <tools/diagnose_ex.h>
33 #include "wordvbahelper.hxx"
34 #include <com/sun/star/style/LineSpacingMode.hpp>
35 #include <ooo/vba/word/WdLineSpacing.hpp>
36 #include <ooo/vba/word/WdParagraphAlignment.hpp>
37 #include <ooo/vba/word/WdOutlineLevel.hpp>
38 #include <com/sun/star/style/ParagraphAdjust.hpp>
39 #include <com/sun/star/style/BreakType.hpp>
42 using namespace ::ooo::vba;
43 using namespace ::com::sun::star;
45 static const sal_Int16 CHARACTER_INDENT_FACTOR = 12;
46 static const sal_Int16 PERCENT100 = 100;
47 static const sal_Int16 PERCENT150 = 150;
48 static const sal_Int16 PERCENT200 = 200;
50 SwVbaParagraphFormat::SwVbaParagraphFormat( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& rTextDocument, const uno::Reference< beans::XPropertySet >& rParaProps ) : SwVbaParagraphFormat_BASE( rParent, rContext ), mxTextDocument( rTextDocument ), mxParaProps( rParaProps )
54 SwVbaParagraphFormat::~SwVbaParagraphFormat()
58 sal_Int32 SAL_CALL SwVbaParagraphFormat::getAlignment() throw (uno::RuntimeException)
60 style::ParagraphAdjust aParaAdjust = style::ParagraphAdjust_LEFT;
61 mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaAdjust") ) ) >>= aParaAdjust;
62 return getMSWordAlignment( aParaAdjust );
65 void SAL_CALL SwVbaParagraphFormat::setAlignment( sal_Int32 _alignment ) throw (uno::RuntimeException)
67 style::ParagraphAdjust aParaAdjust = ( style::ParagraphAdjust ) getOOoAlignment( _alignment );
68 mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaAdjust") ), uno::makeAny( aParaAdjust ) );
71 float SAL_CALL SwVbaParagraphFormat::getFirstLineIndent() throw (uno::RuntimeException)
73 sal_Int32 indent = 0;
74 mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaFirstLineIndent") ) ) >>= indent;
75 return (float)( Millimeter::getInPoints( indent ) );
78 void SAL_CALL SwVbaParagraphFormat::setFirstLineIndent( float _firstlineindent ) throw (uno::RuntimeException)
80 sal_Int32 indent = Millimeter::getInHundredthsOfOneMillimeter( _firstlineindent );
81 mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaFirstLineIndent") ), uno::makeAny( indent ) );
84 uno::Any SAL_CALL SwVbaParagraphFormat::getKeepTogether() throw (uno::RuntimeException)
86 sal_Bool bKeep = sal_False;
87 mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaKeepTogether") ) ) >>= bKeep;
88 return uno::makeAny ( bKeep );
91 void SAL_CALL SwVbaParagraphFormat::setKeepTogether( const uno::Any& _keeptogether ) throw (uno::RuntimeException)
93 sal_Bool bKeep = sal_False;
94 if( _keeptogether >>= bKeep )
96 mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaKeepTogether") ), uno::makeAny( bKeep ) );
98 else
100 DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() );
104 uno::Any SAL_CALL SwVbaParagraphFormat::getKeepWithNext() throw (uno::RuntimeException)
106 sal_Bool bKeep = sal_False;
107 mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaSplit") ) ) >>= bKeep;
108 return uno::makeAny ( bKeep );
111 void SAL_CALL SwVbaParagraphFormat::setKeepWithNext( const uno::Any& _keepwithnext ) throw (uno::RuntimeException)
113 sal_Bool bKeep = sal_False;
114 if( _keepwithnext >>= bKeep )
116 mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaSplit") ), uno::makeAny( bKeep ) );
118 else
120 DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() );
124 uno::Any SAL_CALL SwVbaParagraphFormat::getHyphenation() throw (uno::RuntimeException)
126 sal_Bool bHypn = sal_False;
127 mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaIsHyphenation") ) ) >>= bHypn;
128 return uno::makeAny ( bHypn );
131 void SAL_CALL SwVbaParagraphFormat::setHyphenation( const uno::Any& _hyphenation ) throw (uno::RuntimeException)
133 sal_Bool bHypn = sal_False;
134 if( _hyphenation >>= bHypn )
136 mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaIsHyphenation") ), uno::makeAny( bHypn ) );
138 else
140 DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() );
144 float SAL_CALL SwVbaParagraphFormat::getLineSpacing() throw (uno::RuntimeException)
146 style::LineSpacing aLineSpacing;
147 mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLineSpacing") ) ) >>= aLineSpacing;
148 return getMSWordLineSpacing( aLineSpacing );
151 void SAL_CALL SwVbaParagraphFormat::setLineSpacing( float _linespacing ) throw (uno::RuntimeException)
153 style::LineSpacing aLineSpacing;
154 mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLineSpacing") ) ) >>= aLineSpacing;
155 aLineSpacing = getOOoLineSpacing( _linespacing, aLineSpacing.Mode );
156 mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLineSpacing") ), uno::makeAny( aLineSpacing ) );
159 sal_Int32 SAL_CALL SwVbaParagraphFormat::getLineSpacingRule() throw (uno::RuntimeException)
161 style::LineSpacing aLineSpacing;
162 mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLineSpacing") ) ) >>= aLineSpacing;
163 return getMSWordLineSpacingRule( aLineSpacing );
166 void SAL_CALL SwVbaParagraphFormat::setLineSpacingRule( sal_Int32 _linespacingrule ) throw (uno::RuntimeException)
168 style::LineSpacing aLineSpacing = getOOoLineSpacingFromRule( _linespacingrule );
169 mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLineSpacing") ), uno::makeAny( aLineSpacing ) );
172 uno::Any SAL_CALL SwVbaParagraphFormat::getNoLineNumber() throw (uno::RuntimeException)
174 sal_Bool noLineNum = sal_False;
175 mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLineNumberCount") ) ) >>= noLineNum;
176 return uno::makeAny ( noLineNum );
179 void SAL_CALL SwVbaParagraphFormat::setNoLineNumber( const uno::Any& _nolinenumber ) throw (uno::RuntimeException)
181 sal_Bool noLineNum = sal_False;
182 if( _nolinenumber >>= noLineNum )
184 mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLineNumberCount") ), uno::makeAny( noLineNum ) );
186 else
188 DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() );
192 sal_Int32 SAL_CALL SwVbaParagraphFormat::getOutlineLevel() throw (uno::RuntimeException)
194 sal_Int32 nLevel = word::WdOutlineLevel::wdOutlineLevelBodyText;
195 rtl::OUString aHeading;
196 const rtl::OUString HEADING = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Heading") );
197 mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaStyleName") ) ) >>= aHeading;
198 if( aHeading.indexOf( HEADING ) == 0 )
200 // get the sub string after "Heading"
201 nLevel = aHeading.copy( HEADING.getLength() ).toInt32();
203 return nLevel;
206 void SAL_CALL SwVbaParagraphFormat::setOutlineLevel( sal_Int32 /*_outlinelevel*/ ) throw (uno::RuntimeException)
208 throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
211 uno::Any SAL_CALL SwVbaParagraphFormat::getPageBreakBefore() throw (uno::RuntimeException)
213 style::BreakType aBreakType;
214 mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BreakType") ) ) >>= aBreakType;
215 sal_Bool bBreakBefore = ( aBreakType == style::BreakType_PAGE_BEFORE || aBreakType == style::BreakType_PAGE_BOTH );
216 return uno::makeAny( bBreakBefore );
219 void SAL_CALL SwVbaParagraphFormat::setPageBreakBefore( const uno::Any& _breakbefore ) throw (uno::RuntimeException)
221 sal_Bool bBreakBefore = sal_False;
222 if( _breakbefore >>= bBreakBefore )
224 style::BreakType aBreakType;
225 mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BreakType") ) ) >>= aBreakType;
226 if( bBreakBefore )
228 if( aBreakType == style::BreakType_NONE )
229 aBreakType = style::BreakType_PAGE_BEFORE;
230 else if ( aBreakType == style::BreakType_PAGE_AFTER )
231 aBreakType = style::BreakType_PAGE_BOTH;
233 else
235 if( aBreakType == style::BreakType_PAGE_BOTH )
236 aBreakType = style::BreakType_PAGE_AFTER;
237 else if ( aBreakType == style::BreakType_PAGE_BEFORE )
238 aBreakType = style::BreakType_PAGE_AFTER;
240 mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BreakType") ), uno::makeAny( aBreakType ) );
242 else
244 DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() );
248 float SAL_CALL SwVbaParagraphFormat::getSpaceBefore() throw (uno::RuntimeException)
250 sal_Int32 nSpace = 0;
251 mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaTopMargin") ) ) >>= nSpace;
252 return (float)( Millimeter::getInPoints( nSpace ) );
255 void SAL_CALL SwVbaParagraphFormat::setSpaceBefore( float _space ) throw (uno::RuntimeException)
257 sal_Int32 nSpace = Millimeter::getInHundredthsOfOneMillimeter( _space );
258 mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaTopMargin") ), uno::makeAny( nSpace ) );
261 float SAL_CALL SwVbaParagraphFormat::getSpaceAfter() throw (uno::RuntimeException)
263 sal_Int32 nSpace = 0;
264 mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaBottomMargin") ) ) >>= nSpace;
265 return (float)( Millimeter::getInPoints( nSpace ) );
268 void SAL_CALL SwVbaParagraphFormat::setSpaceAfter( float _space ) throw (uno::RuntimeException)
270 sal_Int32 nSpace = Millimeter::getInHundredthsOfOneMillimeter( _space );
271 mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaBottomMargin") ), uno::makeAny( nSpace ) );
274 float SAL_CALL SwVbaParagraphFormat::getLeftIndent() throw (uno::RuntimeException)
276 sal_Int32 nIndent = 0;
277 mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLeftMargin") ) ) >>= nIndent;
278 return (float)( Millimeter::getInPoints( nIndent ) );
281 void SAL_CALL SwVbaParagraphFormat::setLeftIndent( float _leftindent ) throw (uno::RuntimeException)
283 sal_Int32 nIndent = Millimeter::getInHundredthsOfOneMillimeter( _leftindent );
284 mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLeftMargin") ), uno::makeAny( nIndent ) );
287 float SAL_CALL SwVbaParagraphFormat::getRightIndent() throw (uno::RuntimeException)
289 sal_Int32 nIndent = 0;
290 mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaRightMargin") ) ) >>= nIndent;
291 return (float)( Millimeter::getInPoints( nIndent ) );
294 void SAL_CALL SwVbaParagraphFormat::setRightIndent( float _rightindent ) throw (uno::RuntimeException)
296 sal_Int32 nIndent = Millimeter::getInHundredthsOfOneMillimeter( _rightindent );
297 mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaRightMargin") ), uno::makeAny( nIndent ) );
300 uno::Any SAL_CALL SwVbaParagraphFormat::getTabStops() throw (uno::RuntimeException)
302 throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
305 void SAL_CALL SwVbaParagraphFormat::setTabStops( const uno::Any& /*_tabstops*/ ) throw (uno::RuntimeException)
307 throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
310 uno::Any SAL_CALL SwVbaParagraphFormat::getWidowControl() throw (uno::RuntimeException)
312 sal_Bool bWidow = sal_False;
313 sal_Int8 nWidow = 0;
314 mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaWidows") ) ) >>= nWidow;
315 sal_Int8 nOrphan = 0;
316 mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaOrphans") ) ) >>= nOrphan;
317 // if the amount of single lines on one page > 1 and the same of start and end of the paragraph,
318 // true is retured.
319 bWidow = ( nWidow > 1 && nOrphan == nWidow );
320 return uno::makeAny( bWidow );
323 void SAL_CALL SwVbaParagraphFormat::setWidowControl( const uno::Any& _widowcontrol ) throw (uno::RuntimeException)
325 // if we get true, the part of the paragraph on one page has to be
326 // at least two lines
327 sal_Bool bWidow = sal_False;
328 if( _widowcontrol >>= bWidow )
330 sal_Int8 nControl = bWidow? 2:1;
331 mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaWidows") ), uno::makeAny( nControl ) );
332 mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaOrphans") ), uno::makeAny( nControl ) );
334 else
336 DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() );
340 style::LineSpacing SwVbaParagraphFormat::getOOoLineSpacing( float _lineSpace, sal_Int16 mode )
342 style::LineSpacing aLineSpacing;
343 if( mode != style::LineSpacingMode::MINIMUM && mode != style::LineSpacingMode::FIX )
345 // special behaviour of word: if the space is set to these values, the rule and
346 // the height are changed accordingly
347 if( _lineSpace == CHARACTER_INDENT_FACTOR )
349 aLineSpacing.Mode = style::LineSpacingMode::PROP;
350 aLineSpacing.Height = PERCENT100;
352 else if( _lineSpace == ( sal_Int16 )( CHARACTER_INDENT_FACTOR * 1.5 ) )
354 aLineSpacing.Mode = style::LineSpacingMode::PROP;
355 aLineSpacing.Height = PERCENT150;
357 else if( _lineSpace == ( sal_Int16 )( ( CHARACTER_INDENT_FACTOR ) * 2 ) )
359 aLineSpacing.Mode = style::LineSpacingMode::PROP;
360 aLineSpacing.Height = PERCENT200;
362 else
364 aLineSpacing.Mode = style::LineSpacingMode::FIX;
365 aLineSpacing.Height = ( sal_Int16 )( Millimeter::getInHundredthsOfOneMillimeter( _lineSpace ) );
368 else
370 aLineSpacing.Mode = mode;
371 aLineSpacing.Height = ( sal_Int16 )( Millimeter::getInHundredthsOfOneMillimeter( _lineSpace ) );
373 return aLineSpacing;
376 style::LineSpacing SwVbaParagraphFormat::getOOoLineSpacingFromRule( sal_Int32 _linespacingrule )
378 style::LineSpacing aLineSpacing;
379 switch( _linespacingrule )
381 case word::WdLineSpacing::wdLineSpace1pt5:
383 aLineSpacing.Mode = style::LineSpacingMode::PROP;
384 aLineSpacing.Height = PERCENT150;
385 break;
387 case word::WdLineSpacing::wdLineSpaceAtLeast:
389 aLineSpacing.Mode = style::LineSpacingMode::MINIMUM;
390 aLineSpacing.Height = getCharHeight();
391 break;
393 case word::WdLineSpacing::wdLineSpaceDouble:
395 aLineSpacing.Mode = style::LineSpacingMode::PROP;
396 aLineSpacing.Height = getCharHeight();
397 break;
399 case word::WdLineSpacing::wdLineSpaceExactly:
400 case word::WdLineSpacing::wdLineSpaceMultiple:
402 aLineSpacing.Mode = style::LineSpacingMode::FIX;
403 aLineSpacing.Height = getCharHeight();
404 break;
406 case word::WdLineSpacing::wdLineSpaceSingle:
408 aLineSpacing.Mode = style::LineSpacingMode::PROP;
409 aLineSpacing.Height = PERCENT100;
410 break;
412 default:
414 DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() );
415 break;
418 return aLineSpacing;
421 float SwVbaParagraphFormat::getMSWordLineSpacing( style::LineSpacing& rLineSpacing )
423 float wdLineSpacing = 0;
424 if( rLineSpacing.Mode != style::LineSpacingMode::PROP )
426 wdLineSpacing = (float)( Millimeter::getInPoints( rLineSpacing.Height ) );
428 else
430 wdLineSpacing = (float)( CHARACTER_INDENT_FACTOR * rLineSpacing.Height ) / PERCENT100;
432 return wdLineSpacing;
435 sal_Int32 SwVbaParagraphFormat::getMSWordLineSpacingRule( style::LineSpacing& rLineSpacing )
437 sal_Int32 wdLineSpacing = word::WdLineSpacing::wdLineSpaceSingle;
438 switch( rLineSpacing.Mode )
440 case style::LineSpacingMode::PROP:
442 switch( rLineSpacing.Height )
444 case PERCENT100:
446 wdLineSpacing = word::WdLineSpacing::wdLineSpaceSingle;
447 break;
449 case PERCENT150:
451 wdLineSpacing = word::WdLineSpacing::wdLineSpace1pt5;
452 break;
454 case PERCENT200:
456 wdLineSpacing = word::WdLineSpacing::wdLineSpaceDouble;
457 break;
459 default:
461 wdLineSpacing = word::WdLineSpacing::wdLineSpaceMultiple;
464 break;
466 case style::LineSpacingMode::MINIMUM:
468 wdLineSpacing = word::WdLineSpacing::wdLineSpaceAtLeast;
469 break;
471 case style::LineSpacingMode::FIX:
472 case style::LineSpacingMode::LEADING:
474 wdLineSpacing = word::WdLineSpacing::wdLineSpaceExactly;
475 break;
477 default:
479 DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() );
482 return wdLineSpacing;
485 sal_Int16 SwVbaParagraphFormat::getCharHeight() throw (uno::RuntimeException)
487 float fCharHeight = 0.0;
488 mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharHeight") ) ) >>= fCharHeight;
489 return (sal_Int16)( Millimeter::getInHundredthsOfOneMillimeter( fCharHeight ) );
492 sal_Int32 SwVbaParagraphFormat::getOOoAlignment( sal_Int32 _alignment )
494 sal_Int32 nParaAjust = style::ParagraphAdjust_LEFT;
495 switch( _alignment )
497 case word::WdParagraphAlignment::wdAlignParagraphCenter:
499 nParaAjust = style::ParagraphAdjust_CENTER;
500 break;
502 case word::WdParagraphAlignment::wdAlignParagraphJustify:
504 nParaAjust = style::ParagraphAdjust_BLOCK;
505 break;
507 case word::WdParagraphAlignment::wdAlignParagraphLeft:
509 nParaAjust = style::ParagraphAdjust_LEFT;
510 break;
512 case word::WdParagraphAlignment::wdAlignParagraphRight:
514 nParaAjust = style::ParagraphAdjust_RIGHT;
515 break;
517 default:
519 DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() );
522 return nParaAjust;
525 sal_Int32 SwVbaParagraphFormat::getMSWordAlignment( sal_Int32 _alignment )
527 sal_Int32 wdAlignment = word::WdParagraphAlignment::wdAlignParagraphLeft;
528 switch( _alignment )
530 case style::ParagraphAdjust_CENTER:
532 wdAlignment = word::WdParagraphAlignment::wdAlignParagraphCenter;
533 break;
535 case style::ParagraphAdjust_LEFT:
537 wdAlignment = word::WdParagraphAlignment::wdAlignParagraphLeft;
538 break;
540 case style::ParagraphAdjust_BLOCK:
542 wdAlignment = word::WdParagraphAlignment::wdAlignParagraphJustify;
543 break;
545 case style::ParagraphAdjust_RIGHT:
547 wdAlignment = word::WdParagraphAlignment::wdAlignParagraphRight;
548 break;
550 default:
552 DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() );
555 return wdAlignment;
558 rtl::OUString&
559 SwVbaParagraphFormat::getServiceImplName()
561 static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaParagraphFormat") );
562 return sImplName;
565 uno::Sequence< rtl::OUString >
566 SwVbaParagraphFormat::getServiceNames()
568 static uno::Sequence< rtl::OUString > aServiceNames;
569 if ( aServiceNames.getLength() == 0 )
571 aServiceNames.realloc( 1 );
572 aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ParagraphFormat" ) );
574 return aServiceNames;