LCOV - code coverage report
Current view: top level - libreoffice/svx/source/items - rotmodit.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 19 54 35.2 %
Date: 2012-12-27 Functions: 10 17 58.8 %
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             : 
      20             : #include <tools/stream.hxx>
      21             : #include <com/sun/star/table/BorderLine.hpp>
      22             : #include <com/sun/star/table/CellVertJustify2.hpp>
      23             : #include <com/sun/star/table/ShadowLocation.hpp>
      24             : #include <com/sun/star/table/TableBorder.hpp>
      25             : #include <com/sun/star/table/ShadowFormat.hpp>
      26             : #include <com/sun/star/table/CellRangeAddress.hpp>
      27             : #include <com/sun/star/table/CellContentType.hpp>
      28             : #include <com/sun/star/table/TableOrientation.hpp>
      29             : #include <com/sun/star/util/SortField.hpp>
      30             : #include <com/sun/star/util/SortFieldType.hpp>
      31             : #include <com/sun/star/table/CellOrientation.hpp>
      32             : #include <com/sun/star/table/CellAddress.hpp>
      33             : 
      34             : #include "svx/rotmodit.hxx"
      35             : 
      36             : using namespace ::rtl;
      37             : using namespace ::com::sun::star;
      38             : 
      39             : // STATIC DATA -----------------------------------------------------------
      40             : 
      41       45078 : TYPEINIT1_FACTORY(SvxRotateModeItem, SfxEnumItem, new SvxRotateModeItem(SVX_ROTATE_MODE_STANDARD, 0));
      42             : 
      43             : 
      44             : //-----------------------------------------------------------------------
      45             : //  SvxRotateModeItem - Ausrichtung bei gedrehtem Text
      46             : //-----------------------------------------------------------------------
      47             : 
      48        1244 : SvxRotateModeItem::SvxRotateModeItem( SvxRotateMode eMode, sal_uInt16 _nWhich )
      49        1244 :     : SfxEnumItem( _nWhich, (sal_uInt16)eMode )
      50             : {
      51        1244 : }
      52             : 
      53          67 : SvxRotateModeItem::SvxRotateModeItem( const SvxRotateModeItem& rItem )
      54          67 :     : SfxEnumItem( rItem )
      55             : {
      56          67 : }
      57             : 
      58        1395 : SvxRotateModeItem::~SvxRotateModeItem()
      59             : {
      60        1395 : }
      61             : 
      62           0 : SfxPoolItem* SvxRotateModeItem::Create( SvStream& rStream, sal_uInt16 ) const
      63             : {
      64             :     sal_uInt16 nVal;
      65           0 :     rStream >> nVal;
      66           0 :     return new SvxRotateModeItem( (SvxRotateMode) nVal,Which() );
      67             : }
      68             : 
      69           0 : SfxItemPresentation SvxRotateModeItem::GetPresentation(
      70             :                                 SfxItemPresentation ePres,
      71             :                                 SfxMapUnit /*eCoreUnit*/, SfxMapUnit /*ePresUnit*/,
      72             :                                 String& rText, const IntlWrapper * )  const
      73             : {
      74           0 :     rText.Erase();
      75             : 
      76           0 :     switch ( ePres )
      77             :     {
      78             :         case SFX_ITEM_PRESENTATION_COMPLETE:
      79           0 :             rText.AppendAscii("...");
      80           0 :             rText.AppendAscii(": ");
      81             : //          break; // DURCHFALLEN!!!
      82             : 
      83             :         case SFX_ITEM_PRESENTATION_NAMELESS:
      84           0 :             rText += UniString::CreateFromInt32( GetValue() );
      85           0 :             break;
      86             :         default: ;//prevent warning
      87             :     }
      88             : 
      89           0 :     return ePres;
      90             : }
      91             : 
      92           0 : String SvxRotateModeItem::GetValueText( sal_uInt16 nVal ) const
      93             : {
      94           0 :     String aText;
      95             : 
      96           0 :     switch ( nVal )
      97             :     {
      98             :         case SVX_ROTATE_MODE_STANDARD:
      99             :         case SVX_ROTATE_MODE_TOP:
     100             :         case SVX_ROTATE_MODE_CENTER:
     101             :         case SVX_ROTATE_MODE_BOTTOM:
     102           0 :             aText.AppendAscii("...");
     103           0 :             break;
     104             :         default:
     105             :             OSL_FAIL("SvxRotateModeItem: falscher enum");
     106           0 :             break;
     107             :     }
     108           0 :     return aText;
     109             : }
     110             : 
     111           0 : sal_uInt16 SvxRotateModeItem::GetValueCount() const
     112             : {
     113           0 :     return 4;       // STANDARD, TOP, CENTER, BOTTOM
     114             : }
     115             : 
     116          67 : SfxPoolItem* SvxRotateModeItem::Clone( SfxItemPool* ) const
     117             : {
     118          67 :     return new SvxRotateModeItem( *this );
     119             : }
     120             : 
     121           0 : sal_uInt16 SvxRotateModeItem::GetVersion( sal_uInt16 /*nFileVersion*/ ) const
     122             : {
     123           0 :     return 0;
     124             : }
     125             : 
     126           0 : bool SvxRotateModeItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
     127             : {
     128           0 :     sal_Int32 nUno = table::CellVertJustify2::STANDARD;
     129           0 :     switch ( (SvxRotateMode)GetValue() )
     130             :     {
     131           0 :         case SVX_ROTATE_MODE_STANDARD: nUno = table::CellVertJustify2::STANDARD; break;
     132           0 :         case SVX_ROTATE_MODE_TOP:      nUno = table::CellVertJustify2::TOP;      break;
     133           0 :         case SVX_ROTATE_MODE_CENTER:   nUno = table::CellVertJustify2::CENTER;   break;
     134           0 :         case SVX_ROTATE_MODE_BOTTOM:   nUno = table::CellVertJustify2::BOTTOM;   break;
     135             :     }
     136           0 :     rVal <<= nUno;
     137           0 :     return true;
     138             : }
     139             : 
     140          40 : bool SvxRotateModeItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
     141             : {
     142          40 :     sal_Int32 nUno(0);
     143          40 :     if(!(rVal >>= nUno))
     144             :     {
     145           0 :         nUno = table::CellVertJustify2::STANDARD;
     146             :     }
     147             : 
     148          40 :     SvxRotateMode eSvx = SVX_ROTATE_MODE_STANDARD;
     149          40 :     switch (nUno)
     150             :     {
     151          40 :         case table::CellVertJustify2::STANDARD: eSvx = SVX_ROTATE_MODE_STANDARD; break;
     152           0 :         case table::CellVertJustify2::TOP:      eSvx = SVX_ROTATE_MODE_TOP;      break;
     153           0 :         case table::CellVertJustify2::CENTER:   eSvx = SVX_ROTATE_MODE_CENTER;   break;
     154           0 :         case table::CellVertJustify2::BOTTOM:   eSvx = SVX_ROTATE_MODE_BOTTOM;   break;
     155             :         default: ;//prevent warning
     156             :     }
     157          40 :     SetValue( (sal_uInt16)eSvx );
     158          40 :     return true;
     159             : }
     160             : 
     161             : 
     162             : 
     163             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10