LCOV - code coverage report
Current view: top level - writerfilter/source/rtftok - rtffly.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 58 0.0 %
Date: 2012-08-25 Functions: 0 10 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 18 0.0 %

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :  * Version: MPL 1.1 / GPLv3+ / LGPLv3+
       3                 :            :  *
       4                 :            :  * The contents of this file are subject to the Mozilla Public License Version
       5                 :            :  * 1.1 (the "License"); you may not use this file except in compliance with
       6                 :            :  * the License. You may obtain a copy of the License at
       7                 :            :  * http://www.mozilla.org/MPL/
       8                 :            :  *
       9                 :            :  * Software distributed under the License is distributed on an "AS IS" basis,
      10                 :            :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      11                 :            :  * for the specific language governing rights and limitations under the
      12                 :            :  * License.
      13                 :            :  *
      14                 :            :  * The Initial Developer of the Original Code is
      15                 :            :  *       Miklos Vajna <vmiklos@frugalware.org>
      16                 :            :  * Portions created by the Initial Developer are Copyright (C) 2011 the
      17                 :            :  * Initial Developer. All Rights Reserved.
      18                 :            :  *
      19                 :            :  * Contributor(s):
      20                 :            :  *
      21                 :            :  * Alternatively, the contents of this file may be used under the terms of
      22                 :            :  * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
      23                 :            :  * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
      24                 :            :  * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
      25                 :            :  * instead of those above.
      26                 :            :  */
      27                 :            : 
      28                 :            : #ifndef _RTFFLY_HXX_
      29                 :            : #define _RTFFLY_HXX_
      30                 :            : 
      31                 :            : namespace writerfilter {
      32                 :            :     namespace rtftok {
      33                 :            :         /// Stores the vertical orientation properties of an RTF fly frame.
      34                 :            :         class RTFVertOrient
      35                 :            :         {
      36                 :            :             public:
      37                 :          0 :                 RTFVertOrient(sal_uInt16 nValue)
      38                 :            :                 {
      39                 :          0 :                     Value.nVal = nValue;
      40                 :          0 :                 }
      41                 :            : 
      42                 :          0 :                 sal_uInt16 GetOrient() const
      43                 :            :                 {
      44                 :          0 :                     return Value.Flags.nOrient;
      45                 :            :                 }
      46                 :            : 
      47                 :          0 :                 sal_uInt16 GetRelation() const
      48                 :            :                 {
      49                 :          0 :                     return Value.Flags.nRelOrient;
      50                 :            :                 }
      51                 :            : 
      52                 :          0 :                 sal_Int32 GetAlign() const
      53                 :            :                 {
      54                 :          0 :                     sal_Int32 nAlign = 0;
      55   [ #  #  #  # ]:          0 :                     switch( GetOrient( ) )
      56                 :            :                     {
      57                 :            :                         case text::VertOrientation::CENTER:
      58                 :          0 :                             nAlign = NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_center;
      59                 :          0 :                             break;
      60                 :            :                         case text::VertOrientation::TOP:
      61                 :          0 :                             nAlign = NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_top;
      62                 :          0 :                             break;
      63                 :            :                         case text::VertOrientation::BOTTOM:
      64                 :          0 :                             nAlign = NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_bottom;
      65                 :          0 :                             break;
      66                 :            :                     }
      67                 :            : 
      68                 :          0 :                     return nAlign;
      69                 :            :                 }
      70                 :            : 
      71                 :          0 :                 sal_Int32 GetAnchor() const
      72                 :            :                 {
      73                 :          0 :                     sal_Int32 nAnchor = 0;
      74   [ #  #  #  # ]:          0 :                     switch( GetRelation( ) )
      75                 :            :                     {
      76                 :            :                         case text::RelOrientation::FRAME:
      77                 :          0 :                             nAnchor = NS_ooxml::LN_Value_wordprocessingml_ST_VAnchor_text;
      78                 :          0 :                             break;
      79                 :            :                         case text::RelOrientation::PAGE_FRAME:
      80                 :          0 :                             nAnchor = NS_ooxml::LN_Value_wordprocessingml_ST_VAnchor_page;
      81                 :          0 :                             break;
      82                 :            :                         case text::RelOrientation::PAGE_PRINT_AREA:
      83                 :          0 :                             nAnchor = NS_ooxml::LN_Value_wordprocessingml_ST_VAnchor_margin;
      84                 :          0 :                             break;
      85                 :            :                     }
      86                 :            : 
      87                 :          0 :                     return nAnchor;
      88                 :            :                 }
      89                 :            : 
      90                 :            :                 sal_uInt16 GetValue() const
      91                 :            :                 {
      92                 :            :                     return Value.nVal;
      93                 :            :                 }
      94                 :            : 
      95                 :            :             private:
      96                 :            :                 union
      97                 :            :                 {
      98                 :            :                     struct
      99                 :            :                     {
     100                 :            :                         sal_uInt16 nOrient : 4;
     101                 :            :                         sal_uInt16 nRelOrient : 1;
     102                 :            :                     } Flags;
     103                 :            :                     sal_uInt16 nVal;
     104                 :            :                 } Value;
     105                 :            :         };
     106                 :            : 
     107                 :            :         /// Stores the horizontal orientation properties of an RTF fly frame.
     108                 :            :         class RTFHoriOrient
     109                 :            :         {
     110                 :            :             public:
     111                 :          0 :                 RTFHoriOrient(sal_uInt16 nValue)
     112                 :            :                 {
     113                 :          0 :                     Value.nVal = nValue;
     114                 :          0 :                 }
     115                 :            : 
     116                 :          0 :                 sal_uInt16 GetOrient() const
     117                 :            :                 {
     118                 :          0 :                     return Value.Flags.nOrient;
     119                 :            :                 }
     120                 :            : 
     121                 :          0 :                 sal_uInt16 GetRelation() const
     122                 :            :                 {
     123                 :          0 :                     return Value.Flags.nRelOrient;
     124                 :            :                 }
     125                 :            : 
     126                 :          0 :                 sal_Int32 GetAlign() const
     127                 :            :                 {
     128                 :          0 :                     sal_Int32 nAlign = 0;
     129   [ #  #  #  #  :          0 :                     switch( GetOrient( ) )
                   #  # ]
     130                 :            :                     {
     131                 :            :                         case text::HoriOrientation::CENTER:
     132                 :          0 :                             nAlign = NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_center;
     133                 :          0 :                             break;
     134                 :            :                         case text::HoriOrientation::RIGHT:
     135                 :          0 :                             nAlign = NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_right;
     136                 :          0 :                             break;
     137                 :            :                         case text::HoriOrientation::LEFT:
     138                 :          0 :                             nAlign = NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_left;
     139                 :          0 :                             break;
     140                 :            :                         case text::HoriOrientation::INSIDE:
     141                 :          0 :                             nAlign = NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_inside;
     142                 :          0 :                             break;
     143                 :            :                         case text::HoriOrientation::OUTSIDE:
     144                 :          0 :                             nAlign = NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_outside;
     145                 :          0 :                             break;
     146                 :            :                     }
     147                 :            : 
     148                 :          0 :                     return nAlign;
     149                 :            :                 }
     150                 :            : 
     151                 :          0 :                 sal_Int32 GetAnchor() const
     152                 :            :                 {
     153                 :          0 :                     sal_Int32 nAnchor = 0;
     154   [ #  #  #  # ]:          0 :                     switch( GetRelation( ) )
     155                 :            :                     {
     156                 :            :                         case text::RelOrientation::FRAME:
     157                 :          0 :                             nAnchor = NS_ooxml::LN_Value_wordprocessingml_ST_HAnchor_text;
     158                 :          0 :                             break;
     159                 :            :                         case text::RelOrientation::PAGE_FRAME:
     160                 :          0 :                             nAnchor = NS_ooxml::LN_Value_wordprocessingml_ST_HAnchor_page;
     161                 :          0 :                             break;
     162                 :            :                         case text::RelOrientation::PAGE_PRINT_AREA:
     163                 :          0 :                             nAnchor = NS_ooxml::LN_Value_wordprocessingml_ST_HAnchor_margin;
     164                 :          0 :                             break;
     165                 :            :                     }
     166                 :            : 
     167                 :          0 :                     return nAnchor;
     168                 :            :                 }
     169                 :            : 
     170                 :            :                 sal_uInt16 GetValue() const
     171                 :            :                 {
     172                 :            :                     return Value.nVal;
     173                 :            :                 }
     174                 :            : 
     175                 :            :             private:
     176                 :            :                 union
     177                 :            :                 {
     178                 :            :                     struct
     179                 :            :                     {
     180                 :            :                         sal_uInt16 nOrient : 4;
     181                 :            :                         sal_uInt16 nRelAnchor : 4;
     182                 :            :                         sal_uInt16 nRelOrient : 1;
     183                 :            :                     } Flags;
     184                 :            :                     sal_uInt16 nVal;
     185                 :            :                 } Value;
     186                 :            :         };
     187                 :            :     } // namespace rtftok
     188                 :            : } // namespace writerfilter
     189                 :            : 
     190                 :            : #endif // _RTFFLY_HXX_
     191                 :            : 
     192                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10