LCOV - code coverage report
Current view: top level - xmloff/source/style - prhdlfac.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 203 0.0 %
Date: 2014-04-14 Functions: 0 7 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             : 
      20             : #include <com/sun/star/drawing/ColorMode.hpp>
      21             : #include <com/sun/star/text/HorizontalAdjust.hpp>
      22             : #include <com/sun/star/text/WritingMode2.hpp>
      23             : 
      24             : #include <tools/debug.hxx>
      25             : 
      26             : #include <xmloff/prhdlfac.hxx>
      27             : #include <xmloff/xmltypes.hxx>
      28             : #include <xmloff/xmltoken.hxx>
      29             : #include "xmlbahdl.hxx"
      30             : #include <xmloff/NamedBoolPropertyHdl.hxx>
      31             : #include <xmloff/XMLConstantsPropertyHandler.hxx>
      32             : #include "cdouthdl.hxx"
      33             : #include "csmaphdl.hxx"
      34             : #include "fonthdl.hxx"
      35             : #include "kernihdl.hxx"
      36             : #include <postuhdl.hxx>
      37             : #include "shadwhdl.hxx"
      38             : #include "shdwdhdl.hxx"
      39             : #include "undlihdl.hxx"
      40             : #include "weighhdl.hxx"
      41             : #include "breakhdl.hxx"
      42             : #include <adjushdl.hxx>
      43             : #include <escphdl.hxx>
      44             : #include <chrhghdl.hxx>
      45             : #include <chrlohdl.hxx>
      46             : #include <lspachdl.hxx>
      47             : #include <bordrhdl.hxx>
      48             : #include <tabsthdl.hxx>
      49             : #include <xmloff/EnumPropertyHdl.hxx>
      50             : #include "AttributeContainerHandler.hxx"
      51             : #include "durationhdl.hxx"
      52             : #include "XMLRectangleMembersHandler.hxx"
      53             : #include "DrawAspectHdl.hxx"
      54             : 
      55             : using namespace ::com::sun::star;
      56             : using namespace ::xmloff::token;
      57             : 
      58             : static SvXMLEnumMapEntry const aXML_ColorMode_EnumMap[] =
      59             : {
      60             :     { XML_GREYSCALE,    drawing::ColorMode_GREYS },
      61             :     { XML_MONO,         drawing::ColorMode_MONO },
      62             :     { XML_WATERMARK,    drawing::ColorMode_WATERMARK },
      63             :     { XML_STANDARD,     drawing::ColorMode_STANDARD },
      64             :     { XML_TOKEN_INVALID, 0 }
      65             : };
      66             : 
      67             : static SvXMLEnumMapEntry const aXML_HorizontalAdjust_Enum[] =
      68             : {
      69             :     { XML_LEFT,     text::HorizontalAdjust_LEFT },
      70             :     { XML_CENTER,   text::HorizontalAdjust_CENTER },
      71             :     { XML_RIGHT,    text::HorizontalAdjust_RIGHT },
      72             :     { XML_TOKEN_INVALID, 0 }
      73             : };
      74             : 
      75             : // aXML_WritingDirection_Enum is used with and without 'page'
      76             : // attribute, so you'll find uses of aXML_WritingDirection_Enum
      77             : // directly, as well as &(aXML_WritingDirection_Enum[1])
      78             : static SvXMLEnumMapEntry const aXML_WritingDirection_Enum[] =
      79             : {
      80             :     // aXML_WritingDirection_Enum
      81             :     { XML_PAGE,     text::WritingMode2::PAGE },
      82             : 
      83             :     // &(aXML_WritingDirection_Enum[1])
      84             :     { XML_LR_TB,    text::WritingMode2::LR_TB },
      85             :     { XML_RL_TB,    text::WritingMode2::RL_TB },
      86             :     { XML_TB_RL,    text::WritingMode2::TB_RL },
      87             :     { XML_TB_LR,    text::WritingMode2::TB_LR },
      88             : 
      89             :     // alternative names of the above, as accepted by XSL
      90             :     { XML_LR,       text::WritingMode2::LR_TB },
      91             :     { XML_RL,       text::WritingMode2::RL_TB },
      92             :     { XML_TB,       text::WritingMode2::TB_RL },
      93             : 
      94             :     { XML_TOKEN_INVALID, 0 }
      95             : };
      96             : 
      97             : // Dtor
      98           0 : XMLPropertyHandlerFactory::~XMLPropertyHandlerFactory()
      99             : {
     100           0 :     for( CacheMap::iterator pPos = maHandlerCache.begin(); pPos != maHandlerCache.end(); ++pPos )
     101           0 :         delete pPos->second;
     102           0 : }
     103             : 
     104             : // Interface
     105           0 : const XMLPropertyHandler* XMLPropertyHandlerFactory::GetPropertyHandler( sal_Int32 nType ) const
     106             : {
     107             :     DBG_ASSERT( (nType & ~((sal_uInt32)MID_FLAG_MASK)) == 0,
     108             :                 "GetPropertyHandler called with flags in type" );
     109           0 :     return GetBasicHandler( nType );
     110             : }
     111             : 
     112             : // Helper-methods to create and cache PropertyHandler
     113           0 : XMLPropertyHandler* XMLPropertyHandlerFactory::GetHdlCache( sal_Int32 nType ) const
     114             : {
     115           0 :     XMLPropertyHandler* pRet = NULL;
     116             : 
     117           0 :     if( maHandlerCache.find( nType ) != maHandlerCache.end() )
     118           0 :         pRet = maHandlerCache.find( nType )->second;
     119             : 
     120           0 :     return pRet;
     121             : }
     122             : 
     123           0 : void XMLPropertyHandlerFactory::PutHdlCache( sal_Int32 nType, const XMLPropertyHandler* pHdl ) const
     124             : {
     125             :     // Don't be wondered about the following construct. The  sense is to be able to provide a const-
     126             :     // method as class-interface.
     127           0 :     ((XMLPropertyHandlerFactory*)this)->maHandlerCache[ nType ] = (XMLPropertyHandler*)pHdl;
     128           0 : }
     129             : 
     130           0 : const XMLPropertyHandler* XMLPropertyHandlerFactory::GetBasicHandler( sal_Int32 nType ) const
     131             : {
     132           0 :     const XMLPropertyHandler* pPropHdl = GetHdlCache( nType );
     133             : 
     134           0 :     if( !pPropHdl )
     135             :     {
     136           0 :         pPropHdl = CreatePropertyHandler( nType );
     137             : 
     138           0 :         if( pPropHdl )
     139           0 :             PutHdlCache( nType, pPropHdl );
     140             :     }
     141             : 
     142           0 :     return pPropHdl;
     143             : }
     144             : 
     145           0 : const XMLPropertyHandler* XMLPropertyHandlerFactory::CreatePropertyHandler( sal_Int32 nType )
     146             : {
     147           0 :     XMLPropertyHandler* pPropHdl = NULL;
     148             : 
     149           0 :     switch( nType )
     150             :     {
     151             :         case XML_TYPE_BOOL :
     152           0 :             pPropHdl = new XMLBoolPropHdl;
     153           0 :             break;
     154             :         case XML_TYPE_BOOL_FALSE :
     155           0 :             pPropHdl = new XMLBoolFalsePropHdl;
     156           0 :             break;
     157             :         case XML_TYPE_MEASURE :
     158           0 :             pPropHdl = new XMLMeasurePropHdl( 4 );
     159           0 :             break;
     160             :         case XML_TYPE_MEASURE8 :
     161           0 :             pPropHdl = new XMLMeasurePropHdl( 1 );
     162           0 :             break;
     163             :         case XML_TYPE_MEASURE16:
     164           0 :             pPropHdl = new XMLMeasurePropHdl( 2 );
     165           0 :             break;
     166             :         case XML_TYPE_PERCENT :
     167           0 :             pPropHdl = new XMLPercentPropHdl( 4 );
     168           0 :             break;
     169             :         case XML_TYPE_PERCENT8 :
     170           0 :             pPropHdl = new XMLPercentPropHdl( 1 );
     171           0 :             break;
     172             :         case XML_TYPE_PERCENT16 :
     173           0 :             pPropHdl = new XMLPercentPropHdl( 2 );
     174           0 :             break;
     175             :         case XML_TYPE_DOUBLE_PERCENT :
     176           0 :             pPropHdl = new XMLDoublePercentPropHdl();
     177           0 :             break;
     178             :         case XML_TYPE_NEG_PERCENT :
     179           0 :             pPropHdl = new XMLNegPercentPropHdl( 4 );
     180           0 :             break;
     181             :         case XML_TYPE_NEG_PERCENT8 :
     182           0 :             pPropHdl = new XMLNegPercentPropHdl( 1 );
     183           0 :             break;
     184             :         case XML_TYPE_NEG_PERCENT16 :
     185           0 :             pPropHdl = new XMLNegPercentPropHdl( 2 );
     186           0 :             break;
     187             :         case XML_TYPE_MEASURE_PX :
     188           0 :             pPropHdl = new XMLMeasurePxPropHdl( 4 );
     189           0 :             break;
     190             :         case XML_TYPE_STRING :
     191           0 :             pPropHdl = new XMLStringPropHdl;
     192           0 :             break;
     193             :         case XML_TYPE_COLOR :
     194           0 :             pPropHdl = new XMLColorPropHdl;
     195           0 :             break;
     196             :         case XML_TYPE_HEX :
     197           0 :             pPropHdl = new XMLHexPropHdl;
     198           0 :             break;
     199             :         case XML_TYPE_NUMBER :
     200           0 :             pPropHdl = new XMLNumberPropHdl( 4 );
     201           0 :             break;
     202             :         case XML_TYPE_NUMBER8 :
     203           0 :             pPropHdl = new XMLNumberPropHdl( 1 );
     204           0 :             break;
     205             :         case XML_TYPE_NUMBER16:
     206           0 :             pPropHdl = new XMLNumberPropHdl( 2 );
     207           0 :             break;
     208             :         case XML_TYPE_NUMBER_NONE :
     209           0 :             pPropHdl = new XMLNumberNonePropHdl;
     210           0 :             break;
     211             :         case XML_TYPE_NUMBER8_NONE :
     212           0 :             pPropHdl = new XMLNumberNonePropHdl( 1 );
     213           0 :             break;
     214             :         case XML_TYPE_NUMBER16_NONE :
     215           0 :             pPropHdl = new XMLNumberNonePropHdl( 2 );
     216           0 :             break;
     217             :         case XML_TYPE_DOUBLE :
     218           0 :             pPropHdl = new XMLDoublePropHdl;
     219           0 :             break;
     220             :         case XML_TYPE_NBOOL :
     221           0 :             pPropHdl = new XMLNBoolPropHdl;
     222           0 :             break;
     223             :         case XML_TYPE_COLORTRANSPARENT :
     224           0 :             pPropHdl = new XMLColorTransparentPropHdl;
     225           0 :             break;
     226             :         case XML_TYPE_ISTRANSPARENT :
     227           0 :             pPropHdl = new XMLIsTransparentPropHdl;
     228           0 :             break;
     229             :         case XML_TYPE_COLORAUTO :
     230           0 :             pPropHdl = new XMLColorAutoPropHdl;
     231           0 :             break;
     232             :         case XML_TYPE_ISAUTOCOLOR :
     233           0 :             pPropHdl = new XMLIsAutoColorPropHdl;
     234           0 :             break;
     235             :         case XML_TYPE_BUILDIN_CMP_ONLY :
     236           0 :             pPropHdl = new XMLCompareOnlyPropHdl;
     237           0 :             break;
     238             : 
     239             :         case XML_TYPE_RECTANGLE_LEFT :
     240             :         case XML_TYPE_RECTANGLE_TOP :
     241             :         case XML_TYPE_RECTANGLE_WIDTH :
     242             :         case XML_TYPE_RECTANGLE_HEIGHT :
     243           0 :             pPropHdl = new XMLRectangleMembersHdl( nType );
     244           0 :             break;
     245             : 
     246             :         case XML_TYPE_TEXT_CROSSEDOUT_TYPE:
     247           0 :             pPropHdl = new XMLCrossedOutTypePropHdl ;
     248           0 :             break;
     249             :         case XML_TYPE_TEXT_CROSSEDOUT_STYLE:
     250           0 :             pPropHdl = new XMLCrossedOutStylePropHdl ;
     251           0 :             break;
     252             :         case XML_TYPE_TEXT_CROSSEDOUT_WIDTH:
     253           0 :             pPropHdl = new XMLCrossedOutWidthPropHdl ;
     254           0 :             break;
     255             :         case XML_TYPE_TEXT_CROSSEDOUT_TEXT:
     256           0 :             pPropHdl = new XMLCrossedOutTextPropHdl ;
     257           0 :             break;
     258             :         case XML_TYPE_TEXT_BOOLCROSSEDOUT:
     259             :             pPropHdl = new XMLNamedBoolPropertyHdl(
     260             :                 GetXMLToken(XML_SOLID),
     261           0 :                 GetXMLToken(XML_NONE) );
     262           0 :             break;
     263             :         case XML_TYPE_TEXT_ESCAPEMENT:
     264           0 :             pPropHdl = new XMLEscapementPropHdl;
     265           0 :             break;
     266             :         case XML_TYPE_TEXT_ESCAPEMENT_HEIGHT:
     267           0 :             pPropHdl = new XMLEscapementHeightPropHdl;
     268           0 :             break;
     269             :         case XML_TYPE_TEXT_CASEMAP:
     270           0 :             pPropHdl = new XMLCaseMapPropHdl;
     271           0 :             break;
     272             :         case XML_TYPE_TEXT_CASEMAP_VAR:
     273           0 :             pPropHdl = new XMLCaseMapVariantHdl;
     274           0 :             break;
     275             :         case XML_TYPE_TEXT_FONTFAMILYNAME:
     276           0 :             pPropHdl = new XMLFontFamilyNamePropHdl;
     277           0 :             break;
     278             :         case XML_TYPE_TEXT_FONTFAMILY:
     279           0 :             pPropHdl = new XMLFontFamilyPropHdl;
     280           0 :             break;
     281             :         case XML_TYPE_TEXT_FONTENCODING:
     282           0 :             pPropHdl = new XMLFontEncodingPropHdl;
     283           0 :             break;
     284             :         case XML_TYPE_TEXT_FONTPITCH:
     285           0 :             pPropHdl = new XMLFontPitchPropHdl;
     286           0 :             break;
     287             :         case XML_TYPE_TEXT_KERNING:
     288           0 :             pPropHdl = new XMLKerningPropHdl;
     289           0 :             break;
     290             :         case XML_TYPE_TEXT_POSTURE:
     291           0 :             pPropHdl = new XMLPosturePropHdl;
     292           0 :             break;
     293             :         case XML_TYPE_TEXT_SHADOWED:
     294           0 :             pPropHdl = new XMLShadowedPropHdl;
     295           0 :             break;
     296             :         case XML_TYPE_TEXT_UNDERLINE_TYPE:
     297           0 :             pPropHdl = new XMLUnderlineTypePropHdl;
     298           0 :             break;
     299             :         case XML_TYPE_TEXT_UNDERLINE_STYLE:
     300           0 :             pPropHdl = new XMLUnderlineStylePropHdl;
     301           0 :             break;
     302             :         case XML_TYPE_TEXT_UNDERLINE_WIDTH:
     303           0 :             pPropHdl = new XMLUnderlineWidthPropHdl;
     304           0 :             break;
     305             :         case XML_TYPE_TEXT_UNDERLINE_COLOR:
     306           0 :             pPropHdl = new XMLColorTransparentPropHdl( XML_FONT_COLOR );
     307           0 :             break;
     308             :         case XML_TYPE_TEXT_UNDERLINE_HASCOLOR:
     309             :             pPropHdl = new XMLIsTransparentPropHdl( XML_FONT_COLOR,
     310           0 :                                                      false );
     311           0 :             break;
     312             :         case XML_TYPE_TEXT_OVERLINE_TYPE:
     313           0 :             pPropHdl = new XMLUnderlineTypePropHdl;
     314           0 :             break;
     315             :         case XML_TYPE_TEXT_OVERLINE_STYLE:
     316           0 :             pPropHdl = new XMLUnderlineStylePropHdl;
     317           0 :             break;
     318             :         case XML_TYPE_TEXT_OVERLINE_WIDTH:
     319           0 :             pPropHdl = new XMLUnderlineWidthPropHdl;
     320           0 :             break;
     321             :         case XML_TYPE_TEXT_OVERLINE_COLOR:
     322           0 :             pPropHdl = new XMLColorTransparentPropHdl( XML_FONT_COLOR );
     323           0 :             break;
     324             :         case XML_TYPE_TEXT_OVERLINE_HASCOLOR:
     325             :             pPropHdl = new XMLIsTransparentPropHdl( XML_FONT_COLOR,
     326           0 :                                                      false );
     327           0 :             break;
     328             :         case XML_TYPE_TEXT_WEIGHT:
     329           0 :             pPropHdl = new XMLFontWeightPropHdl;
     330           0 :             break;
     331             :         case XML_TYPE_TEXT_SPLIT:
     332             :             pPropHdl = new XMLNamedBoolPropertyHdl(
     333             :                 GetXMLToken(XML_AUTO),
     334           0 :                 GetXMLToken(XML_ALWAYS) );
     335           0 :             break;
     336             :         case XML_TYPE_TEXT_BREAKBEFORE:
     337           0 :             pPropHdl = new XMLFmtBreakBeforePropHdl;
     338           0 :             break;
     339             :         case XML_TYPE_TEXT_BREAKAFTER:
     340           0 :             pPropHdl = new XMLFmtBreakAfterPropHdl;
     341           0 :             break;
     342             :         case XML_TYPE_TEXT_SHADOW:
     343           0 :             pPropHdl = new XMLShadowPropHdl;
     344           0 :             break;
     345             :         case XML_TYPE_TEXT_ADJUST:
     346           0 :             pPropHdl = new XMLParaAdjustPropHdl;
     347           0 :             break;
     348             :         case XML_TYPE_TEXT_ADJUSTLAST:
     349           0 :             pPropHdl = new XMLLastLineAdjustPropHdl;
     350           0 :             break;
     351             :         case XML_TYPE_CHAR_HEIGHT:
     352           0 :             pPropHdl = new XMLCharHeightHdl;
     353           0 :             break;
     354             :         case XML_TYPE_CHAR_HEIGHT_PROP:
     355           0 :             pPropHdl = new XMLCharHeightPropHdl;
     356           0 :             break;
     357             :         case XML_TYPE_CHAR_HEIGHT_DIFF:
     358           0 :             pPropHdl = new XMLCharHeightDiffHdl;
     359           0 :             break;
     360             :         case XML_TYPE_CHAR_RFC_LANGUAGE_TAG:
     361           0 :             pPropHdl = new XMLCharRfcLanguageTagHdl;
     362           0 :             break;
     363             :         case XML_TYPE_CHAR_LANGUAGE:
     364           0 :             pPropHdl = new XMLCharLanguageHdl;
     365           0 :             break;
     366             :         case XML_TYPE_CHAR_SCRIPT:
     367           0 :             pPropHdl = new XMLCharScriptHdl;
     368           0 :             break;
     369             :         case XML_TYPE_CHAR_COUNTRY:
     370           0 :             pPropHdl = new XMLCharCountryHdl;
     371           0 :             break;
     372             :         case XML_TYPE_LINE_SPACE_FIXED:
     373           0 :             pPropHdl = new XMLLineHeightHdl;
     374           0 :             break;
     375             :         case XML_TYPE_LINE_SPACE_MINIMUM:
     376           0 :             pPropHdl = new XMLLineHeightAtLeastHdl;
     377           0 :             break;
     378             :         case XML_TYPE_LINE_SPACE_DISTANCE:
     379           0 :             pPropHdl = new XMLLineSpacingHdl;
     380           0 :             break;
     381             :         case XML_TYPE_BORDER_WIDTH:
     382           0 :             pPropHdl = new XMLBorderWidthHdl;
     383           0 :             break;
     384             :         case XML_TYPE_BORDER:
     385           0 :             pPropHdl = new XMLBorderHdl;
     386           0 :             break;
     387             :         case XML_TYPE_TEXT_TABSTOP:
     388           0 :             pPropHdl = new XMLTabStopPropHdl;
     389           0 :             break;
     390             :         case XML_TYPE_ATTRIBUTE_CONTAINER:
     391           0 :             pPropHdl = new XMLAttributeContainerHandler;
     392           0 :             break;
     393             :         case XML_TYPE_COLOR_MODE:
     394             :             pPropHdl = new XMLEnumPropertyHdl( aXML_ColorMode_EnumMap,
     395           0 :                             ::getCppuType((const drawing::ColorMode*)0) );
     396           0 :             break;
     397             :         case XML_TYPE_DURATION16_MS:
     398           0 :             pPropHdl = new XMLDurationMS16PropHdl_Impl;
     399           0 :             break;
     400             :         case XML_TYPE_TEXT_HORIZONTAL_ADJUST:
     401             :             pPropHdl = new XMLEnumPropertyHdl(
     402             :                 aXML_HorizontalAdjust_Enum,
     403           0 :                 ::getCppuType((const text::HorizontalAdjust*)0) );
     404           0 :             break;
     405             :         case XML_TYPE_TEXT_DRAW_ASPECT:
     406           0 :             pPropHdl = new DrawAspectHdl;
     407           0 :             break;
     408             :         case XML_TYPE_TEXT_WRITING_MODE:
     409             :             pPropHdl = new XMLConstantsPropertyHandler(
     410             :                 &(aXML_WritingDirection_Enum[1]),
     411           0 :                 XML_LR_TB);
     412           0 :             break;
     413             :         case XML_TYPE_TEXT_WRITING_MODE_WITH_DEFAULT:
     414             :             pPropHdl = new XMLConstantsPropertyHandler(
     415             :                 aXML_WritingDirection_Enum,
     416           0 :                 XML_PAGE);
     417           0 :             break;
     418             :         case XML_TYPE_TEXT_HIDDEN_AS_DISPLAY:
     419             :             pPropHdl = new XMLNamedBoolPropertyHdl(
     420             :                 GetXMLToken(XML_NONE),
     421           0 :                 GetXMLToken(XML_TRUE) );
     422           0 :             break;
     423             :         case XML_TYPE_STYLENAME :
     424           0 :             pPropHdl = new XMLStyleNamePropHdl;
     425           0 :             break;
     426             :         case XML_TYPE_NUMBER_NO_ZERO:
     427           0 :             pPropHdl = new XMLNumberWithoutZeroPropHdl( 4 );
     428           0 :             break;
     429             :         case XML_TYPE_NUMBER8_NO_ZERO:
     430           0 :             pPropHdl = new XMLNumberWithoutZeroPropHdl( 1 );
     431           0 :             break;
     432             :         case XML_TYPE_NUMBER16_NO_ZERO:
     433           0 :             pPropHdl = new XMLNumberWithoutZeroPropHdl( 2 );
     434           0 :             break;
     435             :         case XML_TYPE_NUMBER16_AUTO:
     436           0 :             pPropHdl = new XMLNumberWithAutoInsteadZeroPropHdl();
     437           0 :             break;
     438             :     }
     439             : 
     440           0 :     return pPropHdl;
     441             : }
     442             : 
     443             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10