LCOV - code coverage report
Current view: top level - sw/source/ui/vba - vbaparagraphformat.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 260 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 44 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : #include "vbaparagraphformat.hxx"
      20             : #include <vbahelper/vbahelper.hxx>
      21             : #include <tools/diagnose_ex.h>
      22             : #include "wordvbahelper.hxx"
      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 "vbatabstops.hxx"
      30             : 
      31             : using namespace ::ooo::vba;
      32             : using namespace ::com::sun::star;
      33             : 
      34             : static const sal_Int16 CHARACTER_INDENT_FACTOR = 12;
      35             : static const sal_Int16 PERCENT100 = 100;
      36             : static const sal_Int16 PERCENT150 = 150;
      37             : static const sal_Int16 PERCENT200 = 200;
      38             : 
      39           0 : 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 )
      40             : {
      41           0 : }
      42             : 
      43           0 : SwVbaParagraphFormat::~SwVbaParagraphFormat()
      44             : {
      45           0 : }
      46             : 
      47           0 : sal_Int32 SAL_CALL SwVbaParagraphFormat::getAlignment() throw (uno::RuntimeException, css::script::BasicErrorException, std::exception)
      48             : {
      49           0 :     style::ParagraphAdjust aParaAdjust = style::ParagraphAdjust_LEFT;
      50           0 :     mxParaProps->getPropertyValue("ParaAdjust") >>= aParaAdjust;
      51           0 :     return getMSWordAlignment( aParaAdjust );
      52             : }
      53             : 
      54           0 : void SAL_CALL SwVbaParagraphFormat::setAlignment( sal_Int32 _alignment ) throw (uno::RuntimeException, std::exception)
      55             : {
      56           0 :     style::ParagraphAdjust aParaAdjust = ( style::ParagraphAdjust ) getOOoAlignment( _alignment );
      57           0 :     mxParaProps->setPropertyValue("ParaAdjust", uno::makeAny( aParaAdjust ) );
      58           0 : }
      59             : 
      60           0 : float SAL_CALL SwVbaParagraphFormat::getFirstLineIndent() throw (uno::RuntimeException, std::exception)
      61             : {
      62           0 :     sal_Int32 indent = 0;
      63           0 :     mxParaProps->getPropertyValue("ParaFirstLineIndent") >>= indent;
      64           0 :     return (float)( Millimeter::getInPoints( indent ) );
      65             : }
      66             : 
      67           0 : void SAL_CALL SwVbaParagraphFormat::setFirstLineIndent( float _firstlineindent ) throw (uno::RuntimeException, std::exception)
      68             : {
      69           0 :     sal_Int32 indent = Millimeter::getInHundredthsOfOneMillimeter( _firstlineindent );
      70           0 :     mxParaProps->setPropertyValue("ParaFirstLineIndent", uno::makeAny( indent ) );
      71           0 : }
      72             : 
      73           0 : uno::Any SAL_CALL SwVbaParagraphFormat::getKeepTogether() throw (uno::RuntimeException, std::exception)
      74             : {
      75           0 :     bool bKeep = false;
      76           0 :     mxParaProps->getPropertyValue("ParaKeepTogether") >>= bKeep;
      77           0 :     return uno::makeAny ( bKeep );
      78             : }
      79             : 
      80           0 : void SAL_CALL SwVbaParagraphFormat::setKeepTogether( const uno::Any& _keeptogether ) throw (uno::RuntimeException, std::exception)
      81             : {
      82           0 :     bool bKeep = false;
      83           0 :     if( _keeptogether >>= bKeep )
      84             :     {
      85           0 :         mxParaProps->setPropertyValue("ParaKeepTogether", uno::makeAny( bKeep ) );
      86             :     }
      87             :     else
      88             :     {
      89           0 :         DebugHelper::runtimeexception( SbERR_BAD_PARAMETER, OUString() );
      90             :     }
      91           0 : }
      92             : 
      93           0 : uno::Any SAL_CALL SwVbaParagraphFormat::getKeepWithNext() throw (uno::RuntimeException, std::exception)
      94             : {
      95           0 :     bool bKeep = false;
      96           0 :     mxParaProps->getPropertyValue("ParaSplit") >>= bKeep;
      97           0 :     return uno::makeAny ( bKeep );
      98             : }
      99             : 
     100           0 : void SAL_CALL SwVbaParagraphFormat::setKeepWithNext( const uno::Any& _keepwithnext ) throw (uno::RuntimeException, std::exception)
     101             : {
     102           0 :     bool bKeep = false;
     103           0 :     if( _keepwithnext >>= bKeep )
     104             :     {
     105           0 :         mxParaProps->setPropertyValue("ParaSplit", uno::makeAny( bKeep ) );
     106             :     }
     107             :     else
     108             :     {
     109           0 :         DebugHelper::runtimeexception( SbERR_BAD_PARAMETER, OUString() );
     110             :     }
     111           0 : }
     112             : 
     113           0 : uno::Any SAL_CALL SwVbaParagraphFormat::getHyphenation() throw (uno::RuntimeException, std::exception)
     114             : {
     115           0 :     bool bHypn = false;
     116           0 :     mxParaProps->getPropertyValue("ParaIsHyphenation") >>= bHypn;
     117           0 :     return uno::makeAny ( bHypn );
     118             : }
     119             : 
     120           0 : void SAL_CALL SwVbaParagraphFormat::setHyphenation( const uno::Any& _hyphenation ) throw (uno::RuntimeException, std::exception)
     121             : {
     122           0 :     bool bHypn = false;
     123           0 :     if( _hyphenation >>= bHypn )
     124             :     {
     125           0 :         mxParaProps->setPropertyValue("ParaIsHyphenation", uno::makeAny( bHypn ) );
     126             :     }
     127             :     else
     128             :     {
     129           0 :         DebugHelper::runtimeexception( SbERR_BAD_PARAMETER, OUString() );
     130             :     }
     131           0 : }
     132             : 
     133           0 : float SAL_CALL SwVbaParagraphFormat::getLineSpacing() throw (uno::RuntimeException, std::exception)
     134             : {
     135           0 :     style::LineSpacing aLineSpacing;
     136           0 :     mxParaProps->getPropertyValue("ParaLineSpacing") >>= aLineSpacing;
     137           0 :     return getMSWordLineSpacing( aLineSpacing );
     138             : }
     139             : 
     140           0 : void SAL_CALL SwVbaParagraphFormat::setLineSpacing( float _linespacing ) throw (uno::RuntimeException, std::exception)
     141             : {
     142           0 :     style::LineSpacing aLineSpacing;
     143           0 :     mxParaProps->getPropertyValue("ParaLineSpacing") >>= aLineSpacing;
     144           0 :     aLineSpacing = getOOoLineSpacing( _linespacing, aLineSpacing.Mode );
     145           0 :     mxParaProps->setPropertyValue("ParaLineSpacing", uno::makeAny( aLineSpacing ) );
     146           0 : }
     147             : 
     148           0 : sal_Int32 SAL_CALL SwVbaParagraphFormat::getLineSpacingRule() throw (uno::RuntimeException, std::exception)
     149             : {
     150           0 :     style::LineSpacing aLineSpacing;
     151           0 :     mxParaProps->getPropertyValue("ParaLineSpacing") >>= aLineSpacing;
     152           0 :     return getMSWordLineSpacingRule( aLineSpacing );
     153             : }
     154             : 
     155           0 : void SAL_CALL SwVbaParagraphFormat::setLineSpacingRule( sal_Int32 _linespacingrule ) throw (uno::RuntimeException, std::exception)
     156             : {
     157           0 :     style::LineSpacing aLineSpacing = getOOoLineSpacingFromRule( _linespacingrule );
     158           0 :     mxParaProps->setPropertyValue("ParaLineSpacing", uno::makeAny( aLineSpacing ) );
     159           0 : }
     160             : 
     161           0 : uno::Any SAL_CALL SwVbaParagraphFormat::getNoLineNumber() throw (uno::RuntimeException, std::exception)
     162             : {
     163           0 :     bool noLineNum = false;
     164           0 :     mxParaProps->getPropertyValue("ParaLineNumberCount") >>= noLineNum;
     165           0 :     return uno::makeAny ( noLineNum );
     166             : }
     167             : 
     168           0 : void SAL_CALL SwVbaParagraphFormat::setNoLineNumber( const uno::Any& _nolinenumber ) throw (uno::RuntimeException, std::exception)
     169             : {
     170           0 :     bool noLineNum = false;
     171           0 :     if( _nolinenumber >>= noLineNum )
     172             :     {
     173           0 :         mxParaProps->setPropertyValue("ParaLineNumberCount", uno::makeAny( noLineNum ) );
     174             :     }
     175             :     else
     176             :     {
     177           0 :         DebugHelper::runtimeexception( SbERR_BAD_PARAMETER, OUString() );
     178             :     }
     179           0 : }
     180             : 
     181           0 : sal_Int32 SAL_CALL SwVbaParagraphFormat::getOutlineLevel() throw (uno::RuntimeException, std::exception)
     182             : {
     183           0 :     sal_Int32 nLevel = word::WdOutlineLevel::wdOutlineLevelBodyText;
     184           0 :     OUString aHeading;
     185           0 :     const OUString HEADING = "Heading";
     186           0 :     mxParaProps->getPropertyValue("ParaStyleName") >>= aHeading;
     187           0 :     if( aHeading.startsWith( HEADING ) )
     188             :     {
     189             :         // get the sub string after "Heading"
     190           0 :         nLevel = aHeading.copy( HEADING.getLength() ).toInt32();
     191             :     }
     192           0 :     return nLevel;
     193             : }
     194             : 
     195           0 : void SAL_CALL SwVbaParagraphFormat::setOutlineLevel( sal_Int32 _outlinelevel ) throw (uno::RuntimeException, std::exception)
     196             : {
     197           0 :     if( _outlinelevel != getOutlineLevel() )
     198             :     {
     199             :         // TODO: in my test in msword, there is no effect for this function.
     200             :     }
     201           0 : }
     202             : 
     203           0 : uno::Any SAL_CALL SwVbaParagraphFormat::getPageBreakBefore() throw (uno::RuntimeException, std::exception)
     204             : {
     205             :     style::BreakType aBreakType;
     206           0 :     mxParaProps->getPropertyValue("BreakType") >>= aBreakType;
     207           0 :     bool bBreakBefore = ( aBreakType == style::BreakType_PAGE_BEFORE || aBreakType == style::BreakType_PAGE_BOTH );
     208           0 :     return uno::makeAny( bBreakBefore );
     209             : }
     210             : 
     211           0 : void SAL_CALL SwVbaParagraphFormat::setPageBreakBefore( const uno::Any& _breakbefore ) throw (uno::RuntimeException, std::exception)
     212             : {
     213           0 :     bool bBreakBefore = false;
     214           0 :     if( _breakbefore >>= bBreakBefore )
     215             :     {
     216             :         style::BreakType aBreakType;
     217           0 :         mxParaProps->getPropertyValue("BreakType") >>= aBreakType;
     218           0 :         if( bBreakBefore )
     219             :         {
     220           0 :             if( aBreakType == style::BreakType_NONE )
     221           0 :                 aBreakType = style::BreakType_PAGE_BEFORE;
     222           0 :             else if ( aBreakType == style::BreakType_PAGE_AFTER )
     223           0 :                 aBreakType = style::BreakType_PAGE_BOTH;
     224             :         }
     225             :         else
     226             :         {
     227           0 :             if( aBreakType == style::BreakType_PAGE_BOTH )
     228           0 :                 aBreakType = style::BreakType_PAGE_AFTER;
     229           0 :             else if ( aBreakType == style::BreakType_PAGE_BEFORE )
     230           0 :                 aBreakType = style::BreakType_PAGE_AFTER;
     231             :         }
     232           0 :         mxParaProps->setPropertyValue("BreakType", uno::makeAny( aBreakType ) );
     233             :     }
     234             :     else
     235             :     {
     236           0 :         DebugHelper::runtimeexception( SbERR_BAD_PARAMETER, OUString() );
     237             :     }
     238           0 : }
     239             : 
     240           0 : float SAL_CALL SwVbaParagraphFormat::getSpaceBefore() throw (uno::RuntimeException, std::exception)
     241             : {
     242           0 :     sal_Int32 nSpace = 0;
     243           0 :     mxParaProps->getPropertyValue("ParaTopMargin") >>= nSpace;
     244           0 :     return (float)( Millimeter::getInPoints( nSpace ) );
     245             : }
     246             : 
     247           0 : void SAL_CALL SwVbaParagraphFormat::setSpaceBefore( float _space ) throw (uno::RuntimeException, std::exception)
     248             : {
     249           0 :     sal_Int32 nSpace = Millimeter::getInHundredthsOfOneMillimeter( _space );
     250           0 :     mxParaProps->setPropertyValue("ParaTopMargin", uno::makeAny( nSpace ) );
     251           0 : }
     252             : 
     253           0 : float SAL_CALL SwVbaParagraphFormat::getSpaceAfter() throw (uno::RuntimeException, std::exception)
     254             : {
     255           0 :     sal_Int32 nSpace = 0;
     256           0 :     mxParaProps->getPropertyValue("ParaBottomMargin") >>= nSpace;
     257           0 :     return (float)( Millimeter::getInPoints( nSpace ) );
     258             : }
     259             : 
     260           0 : void SAL_CALL SwVbaParagraphFormat::setSpaceAfter( float _space ) throw (uno::RuntimeException, std::exception)
     261             : {
     262           0 :     sal_Int32 nSpace = Millimeter::getInHundredthsOfOneMillimeter( _space );
     263           0 :     mxParaProps->setPropertyValue("ParaBottomMargin", uno::makeAny( nSpace ) );
     264           0 : }
     265             : 
     266           0 : float SAL_CALL SwVbaParagraphFormat::getLeftIndent() throw (uno::RuntimeException, std::exception)
     267             : {
     268           0 :     sal_Int32 nIndent = 0;
     269           0 :     mxParaProps->getPropertyValue("ParaLeftMargin") >>= nIndent;
     270           0 :     return (float)( Millimeter::getInPoints( nIndent ) );
     271             : }
     272             : 
     273           0 : void SAL_CALL SwVbaParagraphFormat::setLeftIndent( float _leftindent ) throw (uno::RuntimeException, std::exception)
     274             : {
     275           0 :     sal_Int32 nIndent = Millimeter::getInHundredthsOfOneMillimeter( _leftindent );
     276           0 :     mxParaProps->setPropertyValue("ParaLeftMargin", uno::makeAny( nIndent ) );
     277           0 : }
     278             : 
     279           0 : float SAL_CALL SwVbaParagraphFormat::getRightIndent() throw (uno::RuntimeException, std::exception)
     280             : {
     281           0 :     sal_Int32 nIndent = 0;
     282           0 :     mxParaProps->getPropertyValue("ParaRightMargin") >>= nIndent;
     283           0 :     return (float)( Millimeter::getInPoints( nIndent ) );
     284             : }
     285             : 
     286           0 : void SAL_CALL SwVbaParagraphFormat::setRightIndent( float _rightindent ) throw (uno::RuntimeException, std::exception)
     287             : {
     288           0 :     sal_Int32 nIndent = Millimeter::getInHundredthsOfOneMillimeter( _rightindent );
     289           0 :     mxParaProps->setPropertyValue("ParaRightMargin", uno::makeAny( nIndent ) );
     290           0 : }
     291             : 
     292           0 : uno::Any SAL_CALL SwVbaParagraphFormat::getTabStops() throw (uno::RuntimeException, std::exception)
     293             : {
     294           0 :     return uno::makeAny( uno::Reference< word::XTabStops >( new SwVbaTabStops( this, mxContext, mxParaProps ) ) );
     295             : }
     296             : 
     297           0 : void SAL_CALL SwVbaParagraphFormat::setTabStops( const uno::Any& /*_tabstops*/ ) throw (uno::RuntimeException, std::exception)
     298             : {
     299           0 :     throw uno::RuntimeException("Not implemented" );
     300             : }
     301             : 
     302           0 : uno::Any SAL_CALL SwVbaParagraphFormat::getWidowControl() throw (uno::RuntimeException, std::exception)
     303             : {
     304           0 :     sal_Int8 nWidow = 0;
     305           0 :     mxParaProps->getPropertyValue("ParaWidows") >>= nWidow;
     306           0 :     sal_Int8 nOrphan = 0;
     307           0 :     mxParaProps->getPropertyValue("ParaOrphans") >>= nOrphan;
     308             :     // if the amount of single lines on one page > 1 and the same of start and end of the paragraph,
     309             :     // true is retured.
     310           0 :     bool bWidow = ( nWidow > 1 && nOrphan == nWidow );
     311           0 :     return uno::makeAny( bWidow );
     312             : }
     313             : 
     314           0 : void SAL_CALL SwVbaParagraphFormat::setWidowControl( const uno::Any& _widowcontrol ) throw (uno::RuntimeException, std::exception)
     315             : {
     316             :     // if we get true, the part of the paragraph on one page has to be
     317             :     // at least two lines
     318           0 :     bool bWidow = false;
     319           0 :     if( _widowcontrol >>= bWidow )
     320             :     {
     321           0 :         sal_Int8 nControl = bWidow? 2:1;
     322           0 :         mxParaProps->setPropertyValue("ParaWidows", uno::makeAny( nControl ) );
     323           0 :         mxParaProps->setPropertyValue("ParaOrphans", uno::makeAny( nControl ) );
     324             :     }
     325             :     else
     326             :     {
     327           0 :         DebugHelper::runtimeexception( SbERR_BAD_PARAMETER, OUString() );
     328             :     }
     329           0 : }
     330             : 
     331           0 : style::LineSpacing SwVbaParagraphFormat::getOOoLineSpacing( float _lineSpace, sal_Int16 mode )
     332             : {
     333           0 :     style::LineSpacing aLineSpacing;
     334           0 :     if( mode != style::LineSpacingMode::MINIMUM && mode != style::LineSpacingMode::FIX )
     335             :     {
     336             :         // special behaviour of word: if the space is set to these values, the rule and
     337             :         // the height are changed accordingly
     338           0 :         if( _lineSpace == CHARACTER_INDENT_FACTOR )
     339             :         {
     340           0 :             aLineSpacing.Mode = style::LineSpacingMode::PROP;
     341           0 :             aLineSpacing.Height = PERCENT100;
     342             :         }
     343           0 :         else if( _lineSpace == ( sal_Int16 )( CHARACTER_INDENT_FACTOR * 1.5 ) )
     344             :         {
     345           0 :             aLineSpacing.Mode = style::LineSpacingMode::PROP;
     346           0 :             aLineSpacing.Height = PERCENT150;
     347             :         }
     348           0 :         else if( _lineSpace == ( sal_Int16 )( ( CHARACTER_INDENT_FACTOR ) * 2 ) )
     349             :         {
     350           0 :             aLineSpacing.Mode = style::LineSpacingMode::PROP;
     351           0 :             aLineSpacing.Height = PERCENT200;
     352             :         }
     353             :         else
     354             :         {
     355           0 :             aLineSpacing.Mode = style::LineSpacingMode::FIX;
     356           0 :             aLineSpacing.Height = ( sal_Int16 )( Millimeter::getInHundredthsOfOneMillimeter( _lineSpace ) );
     357             :         }
     358             :     }
     359             :     else
     360             :     {
     361           0 :         aLineSpacing.Mode = mode;
     362           0 :         aLineSpacing.Height = ( sal_Int16 )( Millimeter::getInHundredthsOfOneMillimeter( _lineSpace ) );
     363             :     }
     364           0 :     return aLineSpacing;
     365             : }
     366             : 
     367           0 : style::LineSpacing SwVbaParagraphFormat::getOOoLineSpacingFromRule( sal_Int32 _linespacingrule )
     368             : {
     369           0 :     style::LineSpacing aLineSpacing;
     370           0 :     switch( _linespacingrule )
     371             :     {
     372             :         case word::WdLineSpacing::wdLineSpace1pt5:
     373             :         {
     374           0 :             aLineSpacing.Mode = style::LineSpacingMode::PROP;
     375           0 :             aLineSpacing.Height = PERCENT150;
     376           0 :             break;
     377             :         }
     378             :         case word::WdLineSpacing::wdLineSpaceAtLeast:
     379             :         {
     380           0 :             aLineSpacing.Mode = style::LineSpacingMode::MINIMUM;
     381           0 :             aLineSpacing.Height = getCharHeight();
     382           0 :             break;
     383             :         }
     384             :         case word::WdLineSpacing::wdLineSpaceDouble:
     385             :         {
     386           0 :             aLineSpacing.Mode = style::LineSpacingMode::PROP;
     387           0 :             aLineSpacing.Height = getCharHeight();
     388           0 :             break;
     389             :         }
     390             :         case word::WdLineSpacing::wdLineSpaceExactly:
     391             :         case word::WdLineSpacing::wdLineSpaceMultiple:
     392             :         {
     393           0 :             aLineSpacing.Mode = style::LineSpacingMode::FIX;
     394           0 :             aLineSpacing.Height = getCharHeight();
     395           0 :             break;
     396             :         }
     397             :         case word::WdLineSpacing::wdLineSpaceSingle:
     398             :         {
     399           0 :             aLineSpacing.Mode = style::LineSpacingMode::PROP;
     400           0 :             aLineSpacing.Height = PERCENT100;
     401           0 :             break;
     402             :         }
     403             :         default:
     404             :         {
     405           0 :             DebugHelper::runtimeexception( SbERR_BAD_PARAMETER, OUString() );
     406           0 :             break;
     407             :         }
     408             :     }
     409           0 :     return aLineSpacing;
     410             : }
     411             : 
     412           0 : float SwVbaParagraphFormat::getMSWordLineSpacing( style::LineSpacing& rLineSpacing )
     413             : {
     414           0 :     float wdLineSpacing = 0;
     415           0 :     if( rLineSpacing.Mode != style::LineSpacingMode::PROP )
     416             :     {
     417           0 :         wdLineSpacing = (float)( Millimeter::getInPoints( rLineSpacing.Height ) );
     418             :     }
     419             :     else
     420             :     {
     421           0 :         wdLineSpacing = (float)( CHARACTER_INDENT_FACTOR * rLineSpacing.Height ) / PERCENT100;
     422             :     }
     423           0 :     return wdLineSpacing;
     424             : }
     425             : 
     426           0 : sal_Int32 SwVbaParagraphFormat::getMSWordLineSpacingRule( style::LineSpacing& rLineSpacing )
     427             : {
     428           0 :     sal_Int32 wdLineSpacing = word::WdLineSpacing::wdLineSpaceSingle;
     429           0 :     switch( rLineSpacing.Mode )
     430             :     {
     431             :         case style::LineSpacingMode::PROP:
     432             :         {
     433           0 :             switch( rLineSpacing.Height )
     434             :             {
     435             :                 case PERCENT100:
     436             :                 {
     437           0 :                     wdLineSpacing = word::WdLineSpacing::wdLineSpaceSingle;
     438           0 :                     break;
     439             :                 }
     440             :                 case PERCENT150:
     441             :                 {
     442           0 :                     wdLineSpacing = word::WdLineSpacing::wdLineSpace1pt5;
     443           0 :                     break;
     444             :                 }
     445             :                 case PERCENT200:
     446             :                 {
     447           0 :                     wdLineSpacing = word::WdLineSpacing::wdLineSpaceDouble;
     448           0 :                     break;
     449             :                 }
     450             :                 default:
     451             :                 {
     452           0 :                     wdLineSpacing = word::WdLineSpacing::wdLineSpaceMultiple;
     453             :                 }
     454             :             }
     455           0 :             break;
     456             :         }
     457             :         case style::LineSpacingMode::MINIMUM:
     458             :         {
     459           0 :             wdLineSpacing = word::WdLineSpacing::wdLineSpaceAtLeast;
     460           0 :             break;
     461             :         }
     462             :         case style::LineSpacingMode::FIX:
     463             :         case style::LineSpacingMode::LEADING:
     464             :         {
     465           0 :             wdLineSpacing = word::WdLineSpacing::wdLineSpaceExactly;
     466           0 :             break;
     467             :         }
     468             :         default:
     469             :         {
     470           0 :             DebugHelper::runtimeexception( SbERR_BAD_PARAMETER, OUString() );
     471             :         }
     472             :     }
     473           0 :     return wdLineSpacing;
     474             : }
     475             : 
     476           0 : sal_Int16 SwVbaParagraphFormat::getCharHeight() throw (uno::RuntimeException)
     477             : {
     478           0 :     float fCharHeight = 0.0;
     479           0 :     mxParaProps->getPropertyValue("CharHeight") >>= fCharHeight;
     480           0 :     return (sal_Int16)( Millimeter::getInHundredthsOfOneMillimeter( fCharHeight ) );
     481             : }
     482             : 
     483           0 : sal_Int32 SwVbaParagraphFormat::getOOoAlignment( sal_Int32 _alignment )
     484             : {
     485           0 :     sal_Int32 nParaAjust = style::ParagraphAdjust_LEFT;
     486           0 :     switch( _alignment )
     487             :     {
     488             :         case word::WdParagraphAlignment::wdAlignParagraphCenter:
     489             :         {
     490           0 :             nParaAjust = style::ParagraphAdjust_CENTER;
     491           0 :             break;
     492             :         }
     493             :         case word::WdParagraphAlignment::wdAlignParagraphJustify:
     494             :         {
     495           0 :             nParaAjust = style::ParagraphAdjust_BLOCK;
     496           0 :             break;
     497             :         }
     498             :         case word::WdParagraphAlignment::wdAlignParagraphLeft:
     499             :         {
     500           0 :             nParaAjust = style::ParagraphAdjust_LEFT;
     501           0 :             break;
     502             :         }
     503             :         case word::WdParagraphAlignment::wdAlignParagraphRight:
     504             :         {
     505           0 :             nParaAjust = style::ParagraphAdjust_RIGHT;
     506           0 :             break;
     507             :         }
     508             :         default:
     509             :         {
     510           0 :             DebugHelper::runtimeexception( SbERR_BAD_PARAMETER, OUString() );
     511             :         }
     512             :     }
     513           0 :     return nParaAjust;
     514             : }
     515             : 
     516           0 : sal_Int32 SwVbaParagraphFormat::getMSWordAlignment( sal_Int32 _alignment )
     517             : {
     518           0 :     sal_Int32 wdAlignment = word::WdParagraphAlignment::wdAlignParagraphLeft;
     519           0 :     switch( _alignment )
     520             :     {
     521             :         case style::ParagraphAdjust_CENTER:
     522             :         {
     523           0 :             wdAlignment = word::WdParagraphAlignment::wdAlignParagraphCenter;
     524           0 :             break;
     525             :         }
     526             :         case style::ParagraphAdjust_LEFT:
     527             :         {
     528           0 :             wdAlignment = word::WdParagraphAlignment::wdAlignParagraphLeft;
     529           0 :             break;
     530             :         }
     531             :         case style::ParagraphAdjust_BLOCK:
     532             :         {
     533           0 :             wdAlignment = word::WdParagraphAlignment::wdAlignParagraphJustify;
     534           0 :             break;
     535             :         }
     536             :         case style::ParagraphAdjust_RIGHT:
     537             :         {
     538           0 :             wdAlignment = word::WdParagraphAlignment::wdAlignParagraphRight;
     539           0 :             break;
     540             :         }
     541             :         default:
     542             :         {
     543           0 :             DebugHelper::basicexception( SbERR_BAD_PARAMETER, OUString() );
     544             :         }
     545             :     }
     546           0 :     return wdAlignment;
     547             : }
     548             : 
     549             : OUString
     550           0 : SwVbaParagraphFormat::getServiceImplName()
     551             : {
     552           0 :     return OUString("SwVbaParagraphFormat");
     553             : }
     554             : 
     555             : uno::Sequence< OUString >
     556           0 : SwVbaParagraphFormat::getServiceNames()
     557             : {
     558           0 :     static uno::Sequence< OUString > aServiceNames;
     559           0 :     if ( aServiceNames.getLength() == 0 )
     560             :     {
     561           0 :         aServiceNames.realloc( 1 );
     562           0 :         aServiceNames[ 0 ] = "ooo.vba.word.ParagraphFormat";
     563             :     }
     564           0 :     return aServiceNames;
     565             : }
     566             : 
     567             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11