LCOV - code coverage report
Current view: top level - editeng/source/editeng - eerdll.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 90 99 90.9 %
Date: 2012-08-25 Functions: 9 10 90.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 132 272 48.5 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include <vcl/wrkwin.hxx>
      31                 :            : #include <vcl/dialog.hxx>
      32                 :            : #include <vcl/msgbox.hxx>
      33                 :            : #include <vcl/svapp.hxx>
      34                 :            : #include <com/sun/star/linguistic2/XLanguageGuessing.hpp>
      35                 :            : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      36                 :            : #include <comphelper/processfactory.hxx>
      37                 :            : 
      38                 :            : #include <svl/solar.hrc>
      39                 :            : #include <editeng/eerdll.hxx>
      40                 :            : #include <eerdll2.hxx>
      41                 :            : #include <editeng/lspcitem.hxx>
      42                 :            : #include <editeng/adjitem.hxx>
      43                 :            : #include <editeng/tstpitem.hxx>
      44                 :            : #include <editeng/bulitem.hxx>
      45                 :            : #include <editeng/flditem.hxx>
      46                 :            : #include <editeng/emphitem.hxx>
      47                 :            : #include <editeng/scriptspaceitem.hxx>
      48                 :            : #include <svl/itempool.hxx>
      49                 :            : #include <vcl/virdev.hxx>
      50                 :            : 
      51                 :            : #include <editeng/akrnitem.hxx>
      52                 :            : #include <editeng/cntritem.hxx>
      53                 :            : #include <editeng/colritem.hxx>
      54                 :            : #include <editeng/crsditem.hxx>
      55                 :            : #include <editeng/cscoitem.hxx>
      56                 :            : #include <editeng/escpitem.hxx>
      57                 :            : #include <editeng/fhgtitem.hxx>
      58                 :            : #include <editeng/fontitem.hxx>
      59                 :            : #include <editeng/kernitem.hxx>
      60                 :            : #include <editeng/lrspitem.hxx>
      61                 :            : #include <editeng/postitem.hxx>
      62                 :            : #include <editeng/shdditem.hxx>
      63                 :            : #include <editeng/udlnitem.hxx>
      64                 :            : #include <editeng/ulspitem.hxx>
      65                 :            : #include <editeng/wghtitem.hxx>
      66                 :            : #include <editeng/wrlmitem.hxx>
      67                 :            : #include <editeng/numitem.hxx>
      68                 :            : #include <editeng/langitem.hxx>
      69                 :            : #include <editeng/charscaleitem.hxx>
      70                 :            : #include <editeng/charreliefitem.hxx>
      71                 :            : #include <editeng/frmdiritem.hxx>
      72                 :            : #include <editeng/xmlcnitm.hxx>
      73                 :            : #include <editeng/forbiddencharacterstable.hxx>
      74                 :            : #include <editeng/justifyitem.hxx>
      75                 :            : #include <rtl/instance.hxx>
      76                 :            : 
      77                 :            : using namespace ::com::sun::star;
      78                 :            : 
      79                 :            : namespace
      80                 :            : {
      81                 :            :     class theEditDLL : public rtl::Static<EditDLL, theEditDLL> {};
      82                 :            : }
      83                 :            : 
      84                 :     943392 : EditDLL& EditDLL::Get()
      85                 :            : {
      86                 :     943392 :     return theEditDLL::get();
      87                 :            : }
      88                 :            : 
      89                 :        137 : GlobalEditData::GlobalEditData()
      90 [ +  - ][ +  - ]:        137 :     : m_aStdRefDevice(::com::sun::star::uno::Reference<com::sun::star::lang::XComponent>(::comphelper::getProcessComponentContext(), ::com::sun::star::uno::UNO_QUERY_THROW))
                 [ +  - ]
      91                 :            : {
      92                 :        137 :     ppDefItems = NULL;
      93                 :        137 : }
      94                 :            : 
      95 [ +  - ][ +  - ]:        137 : GlobalEditData::~GlobalEditData()
      96                 :            : {
      97                 :            :     // Destroy DefItems...
      98                 :            :     // Or simply keep them, since at end of excecution?!
      99         [ +  - ]:        137 :     if ( ppDefItems )
     100         [ +  - ]:        137 :         SfxItemPool::ReleaseDefaults( ppDefItems, EDITITEMCOUNT, sal_True );
     101                 :        137 : }
     102                 :            : 
     103                 :      31729 : SfxPoolItem** GlobalEditData::GetDefItems()
     104                 :            : {
     105         [ +  + ]:      31729 :     if ( !ppDefItems )
     106                 :            :     {
     107         [ +  - ]:        137 :         ppDefItems = new SfxPoolItem*[EDITITEMCOUNT];
     108                 :            : 
     109                 :            :         // Paragraph attributes:
     110         [ +  - ]:        137 :         SvxNumRule aTmpNumRule( 0, 0, sal_False );
     111                 :            : 
     112 [ +  - ][ +  - ]:        137 :         ppDefItems[0]  = new SvxFrameDirectionItem( FRMDIR_HORI_LEFT_TOP, EE_PARA_WRITINGDIR );
     113 [ +  - ][ +  - ]:        137 :         ppDefItems[1]  = new SvXMLAttrContainerItem( EE_PARA_XMLATTRIBS );
     114 [ +  - ][ +  - ]:        137 :         ppDefItems[2]  = new SfxBoolItem( EE_PARA_HANGINGPUNCTUATION, sal_False );
     115 [ +  - ][ +  - ]:        137 :         ppDefItems[3]  = new SfxBoolItem( EE_PARA_FORBIDDENRULES, sal_True );
     116 [ +  - ][ +  - ]:        137 :         ppDefItems[4]  = new SvxScriptSpaceItem( sal_True, EE_PARA_ASIANCJKSPACING );
     117 [ +  - ][ +  - ]:        137 :         ppDefItems[5]  = new SvxNumBulletItem( aTmpNumRule, EE_PARA_NUMBULLET );
     118 [ +  - ][ +  - ]:        137 :         ppDefItems[6]  = new SfxBoolItem( EE_PARA_HYPHENATE, sal_False );
     119 [ +  - ][ +  - ]:        137 :         ppDefItems[7]  = new SfxBoolItem( EE_PARA_BULLETSTATE, sal_True );
     120 [ +  - ][ +  - ]:        137 :         ppDefItems[8]  = new SvxLRSpaceItem( EE_PARA_OUTLLRSPACE );
     121 [ +  - ][ +  - ]:        137 :         ppDefItems[9]  = new SfxInt16Item( EE_PARA_OUTLLEVEL, -1 );
     122 [ +  - ][ +  - ]:        137 :         ppDefItems[10] = new SvxBulletItem( EE_PARA_BULLET );
     123 [ +  - ][ +  - ]:        137 :         ppDefItems[11] = new SvxLRSpaceItem( EE_PARA_LRSPACE );
     124 [ +  - ][ +  - ]:        137 :         ppDefItems[12] = new SvxULSpaceItem( EE_PARA_ULSPACE );
     125 [ +  - ][ +  - ]:        137 :         ppDefItems[13] = new SvxLineSpacingItem( 0, EE_PARA_SBL );
     126 [ +  - ][ +  - ]:        137 :         ppDefItems[14] = new SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST );
     127 [ +  - ][ +  - ]:        137 :         ppDefItems[15] = new SvxTabStopItem( 0, 0, SVX_TAB_ADJUST_LEFT, EE_PARA_TABS );
     128 [ +  - ][ +  - ]:        137 :         ppDefItems[16] = new SvxJustifyMethodItem( SVX_JUSTIFY_METHOD_AUTO, EE_PARA_JUST_METHOD );
     129 [ +  - ][ +  - ]:        137 :         ppDefItems[17] = new SvxVerJustifyItem( SVX_VER_JUSTIFY_STANDARD, EE_PARA_VER_JUST );
     130                 :            : 
     131                 :            :         // Character attributes:
     132 [ +  - ][ +  - ]:        137 :         ppDefItems[18] = new SvxColorItem( Color( COL_AUTO ), EE_CHAR_COLOR );
     133 [ +  - ][ +  - ]:        137 :         ppDefItems[19] = new SvxFontItem( EE_CHAR_FONTINFO );
     134 [ +  - ][ +  - ]:        137 :         ppDefItems[20] = new SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT );
     135 [ +  - ][ +  - ]:        137 :         ppDefItems[21] = new SvxCharScaleWidthItem( 100, EE_CHAR_FONTWIDTH );
     136 [ +  - ][ +  - ]:        137 :         ppDefItems[22] = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT );
     137 [ +  - ][ +  - ]:        137 :         ppDefItems[23] = new SvxUnderlineItem( UNDERLINE_NONE, EE_CHAR_UNDERLINE );
     138 [ +  - ][ +  - ]:        137 :         ppDefItems[24] = new SvxCrossedOutItem( STRIKEOUT_NONE, EE_CHAR_STRIKEOUT );
     139 [ +  - ][ +  - ]:        137 :         ppDefItems[25] = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC );
     140 [ +  - ][ +  - ]:        137 :         ppDefItems[26] = new SvxContourItem( sal_False, EE_CHAR_OUTLINE );
     141 [ +  - ][ +  - ]:        137 :         ppDefItems[27] = new SvxShadowedItem( sal_False, EE_CHAR_SHADOW );
     142 [ +  - ][ +  - ]:        137 :         ppDefItems[28] = new SvxEscapementItem( 0, 100, EE_CHAR_ESCAPEMENT );
     143 [ +  - ][ +  - ]:        137 :         ppDefItems[29] = new SvxAutoKernItem( sal_False, EE_CHAR_PAIRKERNING );
     144 [ +  - ][ +  - ]:        137 :         ppDefItems[30] = new SvxKerningItem( 0, EE_CHAR_KERNING );
     145 [ +  - ][ +  - ]:        137 :         ppDefItems[31] = new SvxWordLineModeItem( sal_False, EE_CHAR_WLM );
     146 [ +  - ][ +  - ]:        137 :         ppDefItems[32] = new SvxLanguageItem( LANGUAGE_DONTKNOW, EE_CHAR_LANGUAGE );
     147 [ +  - ][ +  - ]:        137 :         ppDefItems[33] = new SvxLanguageItem( LANGUAGE_DONTKNOW, EE_CHAR_LANGUAGE_CJK );
     148 [ +  - ][ +  - ]:        137 :         ppDefItems[34] = new SvxLanguageItem( LANGUAGE_DONTKNOW, EE_CHAR_LANGUAGE_CTL );
     149 [ +  - ][ +  - ]:        137 :         ppDefItems[35] = new SvxFontItem( EE_CHAR_FONTINFO_CJK );
     150 [ +  - ][ +  - ]:        137 :         ppDefItems[36] = new SvxFontItem( EE_CHAR_FONTINFO_CTL );
     151 [ +  - ][ +  - ]:        137 :         ppDefItems[37] = new SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT_CJK );
     152 [ +  - ][ +  - ]:        137 :         ppDefItems[38] = new SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT_CTL );
     153 [ +  - ][ +  - ]:        137 :         ppDefItems[39] = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK );
     154 [ +  - ][ +  - ]:        137 :         ppDefItems[40] = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL );
     155 [ +  - ][ +  - ]:        137 :         ppDefItems[41] = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK );
     156 [ +  - ][ +  - ]:        137 :         ppDefItems[42] = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL );
     157 [ +  - ][ +  - ]:        137 :         ppDefItems[43] = new SvxEmphasisMarkItem( EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK );
     158 [ +  - ][ +  - ]:        137 :         ppDefItems[44] = new SvxCharReliefItem( RELIEF_NONE, EE_CHAR_RELIEF );
     159 [ +  - ][ +  - ]:        137 :         ppDefItems[45] = new SfxVoidItem( EE_CHAR_RUBI_DUMMY );
     160 [ +  - ][ +  - ]:        137 :         ppDefItems[46] = new SvXMLAttrContainerItem( EE_CHAR_XMLATTRIBS );
     161 [ +  - ][ +  - ]:        137 :         ppDefItems[47] = new SvxOverlineItem( UNDERLINE_NONE, EE_CHAR_OVERLINE );
     162                 :            : 
     163                 :            :         // Features
     164 [ +  - ][ +  - ]:        137 :         ppDefItems[48] = new SfxVoidItem( EE_FEATURE_TAB );
     165 [ +  - ][ +  - ]:        137 :         ppDefItems[49] = new SfxVoidItem( EE_FEATURE_LINEBR );
     166 [ +  - ][ +  - ]:        137 :         ppDefItems[50] = new SvxCharSetColorItem( Color( COL_RED ), RTL_TEXTENCODING_DONTKNOW, EE_FEATURE_NOTCONV );
     167 [ +  - ][ +  - ]:        137 :         ppDefItems[51] = new SvxFieldItem( SvxFieldData(), EE_FEATURE_FIELD );
         [ +  - ][ +  - ]
     168                 :            : 
     169                 :            :         DBG_ASSERT( EDITITEMCOUNT == 52, "ITEMCOUNT geaendert, DefItems nicht angepasst!" );
     170                 :            : 
     171                 :            :         // Init DefFonts:
     172                 :        137 :         GetDefaultFonts( *(SvxFontItem*)ppDefItems[EE_CHAR_FONTINFO - EE_ITEMS_START],
     173                 :        137 :                          *(SvxFontItem*)ppDefItems[EE_CHAR_FONTINFO_CJK - EE_ITEMS_START],
     174 [ +  - ][ +  - ]:        137 :                          *(SvxFontItem*)ppDefItems[EE_CHAR_FONTINFO_CTL - EE_ITEMS_START] );
     175                 :            :     }
     176                 :            : 
     177                 :      31729 :     return ppDefItems;
     178                 :            : }
     179                 :            : 
     180                 :     100770 : rtl::Reference<SvxForbiddenCharactersTable> GlobalEditData::GetForbiddenCharsTable()
     181                 :            : {
     182         [ +  + ]:     100770 :     if ( !xForbiddenCharsTable.is() )
     183                 :            :     {
     184         [ +  - ]:      16610 :         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
     185 [ +  - ][ +  - ]:      16610 :         xForbiddenCharsTable = new SvxForbiddenCharactersTable( xMSF );
                 [ +  - ]
     186                 :            :     }
     187                 :     100770 :     return xForbiddenCharsTable;
     188                 :            : }
     189                 :            : 
     190                 :          0 : uno::Reference< linguistic2::XLanguageGuessing > GlobalEditData::GetLanguageGuesser()
     191                 :            : {
     192         [ #  # ]:          0 :     if (!xLanguageGuesser.is())
     193                 :            :     {
     194         [ #  # ]:          0 :         uno::Reference< lang::XMultiServiceFactory > xMgr ( comphelper::getProcessServiceFactory() );
     195         [ #  # ]:          0 :         if (xMgr.is())
     196                 :            :         {
     197                 :            :             xLanguageGuesser = uno::Reference< linguistic2::XLanguageGuessing >(
     198         [ #  # ]:          0 :                     xMgr->createInstance(
     199                 :          0 :                         rtl::OUString( "com.sun.star.linguistic2.LanguageGuessing" ) ),
     200 [ #  # ][ #  # ]:          0 :                         uno::UNO_QUERY );
                 [ #  # ]
     201                 :          0 :         }
     202                 :            :     }
     203                 :          0 :     return xLanguageGuesser;
     204                 :            : }
     205                 :            : 
     206                 :      55423 : OutputDevice* GlobalEditData::GetStdRefDevice()
     207                 :            : {
     208         [ +  + ]:      55423 :     if ( !m_aStdRefDevice )
     209                 :            :     {
     210         [ +  - ]:        137 :         m_aStdRefDevice.reset(new VirtualDevice);
     211         [ +  - ]:        137 :         m_aStdRefDevice->SetMapMode( MAP_TWIP );
     212                 :            :     }
     213                 :      55423 :     return m_aStdRefDevice.get();
     214                 :            : }
     215                 :            : 
     216                 :     710607 : EditResId::EditResId( sal_uInt16 nId ):
     217                 :     710607 :     ResId( nId, *EE_DLL().GetResMgr() )
     218                 :            : {
     219                 :     710607 : }
     220                 :            : 
     221                 :        137 : EditDLL::EditDLL()
     222                 :            : {
     223         [ +  - ]:        137 :     pGlobalData = new GlobalEditData;
     224         [ +  - ]:        137 :     pResMgr = ResMgr::CreateResMgr( "editeng", Application::GetSettings().GetUILocale() );
     225                 :        137 : }
     226                 :            : 
     227                 :        137 : EditDLL::~EditDLL()
     228                 :            : {
     229         [ +  - ]:        137 :     delete pGlobalData;
     230                 :        137 : }
     231                 :            : 
     232                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10