LCOV - code coverage report
Current view: top level - writerfilter/source/rtftok - rtffly.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 34 58 58.6 %
Date: 2014-11-03 Functions: 10 10 100.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             : 
      10             : #ifndef INCLUDED_WRITERFILTER_SOURCE_RTFTOK_RTFFLY_HXX
      11             : #define INCLUDED_WRITERFILTER_SOURCE_RTFTOK_RTFFLY_HXX
      12             : 
      13             : namespace writerfilter
      14             : {
      15             : namespace rtftok
      16             : {
      17             : /// Stores the vertical orientation properties of an RTF fly frame.
      18             : class RTFVertOrient
      19             : {
      20             : public:
      21           4 :     RTFVertOrient(sal_uInt16 nValue)
      22           4 :         : nVal(nValue)
      23             :     {
      24           4 :     }
      25             : 
      26           4 :     sal_uInt16 GetOrient() const
      27             :     {
      28           4 :         return OSL_LONIBBLE(OSL_LOBYTE(nVal));
      29             :     }
      30             : 
      31           4 :     sal_uInt16 GetRelation() const
      32             :     {
      33           4 :         return OSL_HINIBBLE(OSL_LOBYTE(nVal));
      34             :     }
      35             : 
      36           4 :     sal_Int32 GetAlign() const
      37             :     {
      38           4 :         sal_Int32 nAlign = 0;
      39           4 :         switch (GetOrient())
      40             :         {
      41             :         case css::text::VertOrientation::CENTER:
      42           0 :             nAlign = NS_ooxml::LN_Value_doc_ST_YAlign_center;
      43           0 :             break;
      44             :         case css::text::VertOrientation::TOP:
      45           0 :             nAlign = NS_ooxml::LN_Value_doc_ST_YAlign_top;
      46           0 :             break;
      47             :         case css::text::VertOrientation::BOTTOM:
      48           0 :             nAlign = NS_ooxml::LN_Value_doc_ST_YAlign_bottom;
      49           0 :             break;
      50             :         }
      51             : 
      52           4 :         return nAlign;
      53             :     }
      54             : 
      55           4 :     sal_Int32 GetAnchor() const
      56             :     {
      57           4 :         sal_Int32 nAnchor = 0;
      58           4 :         switch (GetRelation())
      59             :         {
      60             :         case css::text::RelOrientation::FRAME:
      61           0 :             nAnchor = NS_ooxml::LN_Value_doc_ST_VAnchor_text;
      62           0 :             break;
      63             :         case css::text::RelOrientation::PAGE_FRAME:
      64           4 :             nAnchor = NS_ooxml::LN_Value_doc_ST_VAnchor_page;
      65           4 :             break;
      66             :         case css::text::RelOrientation::PAGE_PRINT_AREA:
      67           0 :             nAnchor = NS_ooxml::LN_Value_doc_ST_VAnchor_margin;
      68           0 :             break;
      69             :         }
      70             : 
      71           4 :         return nAnchor;
      72             :     }
      73             : 
      74             :     sal_uInt16 GetValue() const
      75             :     {
      76             :         return nVal;
      77             :     }
      78             : 
      79             : private:
      80             :     sal_uInt16 nVal;
      81             : };
      82             : 
      83             : /// Stores the horizontal orientation properties of an RTF fly frame.
      84             : class RTFHoriOrient
      85             : {
      86             : public:
      87           4 :     RTFHoriOrient(sal_uInt16 nValue)
      88           4 :         : nVal(nValue)
      89             :     {
      90           4 :     }
      91             : 
      92           4 :     sal_uInt16 GetOrient() const
      93             :     {
      94           4 :         return OSL_LONIBBLE(OSL_LOBYTE(nVal));
      95             :     }
      96             : 
      97           4 :     sal_uInt16 GetRelation() const
      98             :     {
      99           4 :         return OSL_LONIBBLE(OSL_HIBYTE(nVal));
     100             :     }
     101             : 
     102             :     sal_uInt16 GetRelAnchor() const
     103             :     {
     104             :         return OSL_HINIBBLE(OSL_LOBYTE(nVal));
     105             :     }
     106             : 
     107           4 :     sal_Int32 GetAlign() const
     108             :     {
     109           4 :         sal_Int32 nAlign = 0;
     110           4 :         switch (GetOrient())
     111             :         {
     112             :         case css::text::HoriOrientation::CENTER:
     113           0 :             nAlign = NS_ooxml::LN_Value_doc_ST_XAlign_center;
     114           0 :             break;
     115             :         case css::text::HoriOrientation::RIGHT:
     116           0 :             nAlign = NS_ooxml::LN_Value_doc_ST_XAlign_right;
     117           0 :             break;
     118             :         case css::text::HoriOrientation::LEFT:
     119           0 :             nAlign = NS_ooxml::LN_Value_doc_ST_XAlign_left;
     120           0 :             break;
     121             :         case css::text::HoriOrientation::INSIDE:
     122           0 :             nAlign = NS_ooxml::LN_Value_doc_ST_XAlign_inside;
     123           0 :             break;
     124             :         case css::text::HoriOrientation::OUTSIDE:
     125           0 :             nAlign = NS_ooxml::LN_Value_doc_ST_XAlign_outside;
     126           0 :             break;
     127             :         }
     128             : 
     129           4 :         return nAlign;
     130             :     }
     131             : 
     132           4 :     sal_Int32 GetAnchor() const
     133             :     {
     134           4 :         sal_Int32 nAnchor = 0;
     135           4 :         switch (GetRelation())
     136             :         {
     137             :         case css::text::RelOrientation::FRAME:
     138           0 :             nAnchor = NS_ooxml::LN_Value_doc_ST_HAnchor_text;
     139           0 :             break;
     140             :         case css::text::RelOrientation::PAGE_FRAME:
     141           4 :             nAnchor = NS_ooxml::LN_Value_doc_ST_HAnchor_page;
     142           4 :             break;
     143             :         case css::text::RelOrientation::PAGE_PRINT_AREA:
     144           0 :             nAnchor = NS_ooxml::LN_Value_doc_ST_HAnchor_margin;
     145           0 :             break;
     146             :         }
     147             : 
     148           4 :         return nAnchor;
     149             :     }
     150             : 
     151             :     sal_uInt16 GetValue() const
     152             :     {
     153             :         return nVal;
     154             :     }
     155             : 
     156             : private:
     157             :     sal_uInt16 nVal;
     158             : };
     159             : } // namespace rtftok
     160             : } // namespace writerfilter
     161             : 
     162             : #endif // INCLUDED_WRITERFILTER_SOURCE_RTFTOK_RTFFLY_HXX
     163             : 
     164             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10