LCOV - code coverage report
Current view: top level - editeng/source/editeng - eerdll.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 90 94 95.7 %
Date: 2014-11-03 Functions: 11 12 91.7 %
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             : 
      21             : #include <vcl/wrkwin.hxx>
      22             : #include <vcl/dialog.hxx>
      23             : #include <vcl/msgbox.hxx>
      24             : #include <vcl/svapp.hxx>
      25             : #include <vcl/settings.hxx>
      26             : #include <com/sun/star/linguistic2/LanguageGuessing.hpp>
      27             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      28             : #include <comphelper/processfactory.hxx>
      29             : 
      30             : #include <svl/solar.hrc>
      31             : #include <editeng/eerdll.hxx>
      32             : #include <eerdll2.hxx>
      33             : #include <editeng/lspcitem.hxx>
      34             : #include <editeng/adjustitem.hxx>
      35             : #include <editeng/tstpitem.hxx>
      36             : #include <editeng/bulletitem.hxx>
      37             : #include <editeng/flditem.hxx>
      38             : #include <editeng/emphasismarkitem.hxx>
      39             : #include <editeng/scriptspaceitem.hxx>
      40             : #include <editeng/numdef.hxx>
      41             : #include <svl/itempool.hxx>
      42             : #include <svl/grabbagitem.hxx>
      43             : #include <vcl/virdev.hxx>
      44             : 
      45             : #include <editeng/autokernitem.hxx>
      46             : #include <editeng/contouritem.hxx>
      47             : #include <editeng/colritem.hxx>
      48             : #include <editeng/crossedoutitem.hxx>
      49             : #include <editeng/charsetcoloritem.hxx>
      50             : #include <editeng/escapementitem.hxx>
      51             : #include <editeng/fhgtitem.hxx>
      52             : #include <editeng/fontitem.hxx>
      53             : #include <editeng/kernitem.hxx>
      54             : #include <editeng/lrspitem.hxx>
      55             : #include <editeng/postitem.hxx>
      56             : #include <editeng/shdditem.hxx>
      57             : #include <editeng/udlnitem.hxx>
      58             : #include <editeng/ulspitem.hxx>
      59             : #include <editeng/wghtitem.hxx>
      60             : #include <editeng/wrlmitem.hxx>
      61             : #include <editeng/numitem.hxx>
      62             : #include <editeng/langitem.hxx>
      63             : #include <editeng/cmapitem.hxx>
      64             : #include <editeng/charscaleitem.hxx>
      65             : #include <editeng/charreliefitem.hxx>
      66             : #include <editeng/frmdiritem.hxx>
      67             : #include <editeng/xmlcnitm.hxx>
      68             : #include <editeng/forbiddencharacterstable.hxx>
      69             : #include <editeng/justifyitem.hxx>
      70             : #include <rtl/instance.hxx>
      71             : 
      72             : using namespace ::com::sun::star;
      73             : 
      74             : namespace
      75             : {
      76             :     class theEditDLL : public rtl::Static<EditDLL, theEditDLL> {};
      77             : }
      78             : 
      79      264181 : EditDLL& EditDLL::Get()
      80             : {
      81      264181 :     return theEditDLL::get();
      82             : }
      83             : 
      84         172 : GlobalEditData::GlobalEditData()
      85             : {
      86         172 :     ppDefItems = NULL;
      87         172 : }
      88             : 
      89         344 : GlobalEditData::~GlobalEditData()
      90             : {
      91             :     // Destroy DefItems...
      92             :     // Or simply keep them, since at end of excecution?!
      93         172 :     if ( ppDefItems )
      94         172 :         SfxItemPool::ReleaseDefaults( ppDefItems, EDITITEMCOUNT, true );
      95         172 : }
      96             : 
      97       88688 : SfxPoolItem** GlobalEditData::GetDefItems()
      98             : {
      99       88688 :     if ( !ppDefItems )
     100             :     {
     101         172 :         ppDefItems = new SfxPoolItem*[EDITITEMCOUNT];
     102             : 
     103             :         // Paragraph attributes:
     104             :         SvxNumRule aDefaultNumRule( NUM_BULLET_REL_SIZE|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE,
     105         172 :                                     SVX_MAX_NUM, false );
     106             : 
     107         172 :         ppDefItems[0]  = new SvxFrameDirectionItem( FRMDIR_HORI_LEFT_TOP, EE_PARA_WRITINGDIR );
     108         172 :         ppDefItems[1]  = new SvXMLAttrContainerItem( EE_PARA_XMLATTRIBS );
     109         172 :         ppDefItems[2]  = new SfxBoolItem( EE_PARA_HANGINGPUNCTUATION, false );
     110         172 :         ppDefItems[3]  = new SfxBoolItem( EE_PARA_FORBIDDENRULES, true );
     111         172 :         ppDefItems[4]  = new SvxScriptSpaceItem( true, EE_PARA_ASIANCJKSPACING );
     112         172 :         ppDefItems[5]  = new SvxNumBulletItem( aDefaultNumRule, EE_PARA_NUMBULLET );
     113         172 :         ppDefItems[6]  = new SfxBoolItem( EE_PARA_HYPHENATE, false );
     114         172 :         ppDefItems[7]  = new SfxBoolItem( EE_PARA_BULLETSTATE, true );
     115         172 :         ppDefItems[8]  = new SvxLRSpaceItem( EE_PARA_OUTLLRSPACE );
     116         172 :         ppDefItems[9]  = new SfxInt16Item( EE_PARA_OUTLLEVEL, -1 );
     117         172 :         ppDefItems[10] = new SvxBulletItem( EE_PARA_BULLET );
     118         172 :         ppDefItems[11] = new SvxLRSpaceItem( EE_PARA_LRSPACE );
     119         172 :         ppDefItems[12] = new SvxULSpaceItem( EE_PARA_ULSPACE );
     120         172 :         ppDefItems[13] = new SvxLineSpacingItem( 0, EE_PARA_SBL );
     121         172 :         ppDefItems[14] = new SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST );
     122         172 :         ppDefItems[15] = new SvxTabStopItem( 0, 0, SVX_TAB_ADJUST_LEFT, EE_PARA_TABS );
     123         172 :         ppDefItems[16] = new SvxJustifyMethodItem( SVX_JUSTIFY_METHOD_AUTO, EE_PARA_JUST_METHOD );
     124         172 :         ppDefItems[17] = new SvxVerJustifyItem( SVX_VER_JUSTIFY_STANDARD, EE_PARA_VER_JUST );
     125             : 
     126             :         // Character attributes:
     127         172 :         ppDefItems[18] = new SvxColorItem( Color( COL_AUTO ), EE_CHAR_COLOR );
     128         172 :         ppDefItems[19] = new SvxFontItem( EE_CHAR_FONTINFO );
     129         172 :         ppDefItems[20] = new SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT );
     130         172 :         ppDefItems[21] = new SvxCharScaleWidthItem( 100, EE_CHAR_FONTWIDTH );
     131         172 :         ppDefItems[22] = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT );
     132         172 :         ppDefItems[23] = new SvxUnderlineItem( UNDERLINE_NONE, EE_CHAR_UNDERLINE );
     133         172 :         ppDefItems[24] = new SvxCrossedOutItem( STRIKEOUT_NONE, EE_CHAR_STRIKEOUT );
     134         172 :         ppDefItems[25] = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC );
     135         172 :         ppDefItems[26] = new SvxContourItem( false, EE_CHAR_OUTLINE );
     136         172 :         ppDefItems[27] = new SvxShadowedItem( false, EE_CHAR_SHADOW );
     137         172 :         ppDefItems[28] = new SvxEscapementItem( 0, 100, EE_CHAR_ESCAPEMENT );
     138         172 :         ppDefItems[29] = new SvxAutoKernItem( false, EE_CHAR_PAIRKERNING );
     139         172 :         ppDefItems[30] = new SvxKerningItem( 0, EE_CHAR_KERNING );
     140         172 :         ppDefItems[31] = new SvxWordLineModeItem( false, EE_CHAR_WLM );
     141         172 :         ppDefItems[32] = new SvxLanguageItem( LANGUAGE_DONTKNOW, EE_CHAR_LANGUAGE );
     142         172 :         ppDefItems[33] = new SvxLanguageItem( LANGUAGE_DONTKNOW, EE_CHAR_LANGUAGE_CJK );
     143         172 :         ppDefItems[34] = new SvxLanguageItem( LANGUAGE_DONTKNOW, EE_CHAR_LANGUAGE_CTL );
     144         172 :         ppDefItems[35] = new SvxFontItem( EE_CHAR_FONTINFO_CJK );
     145         172 :         ppDefItems[36] = new SvxFontItem( EE_CHAR_FONTINFO_CTL );
     146         172 :         ppDefItems[37] = new SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT_CJK );
     147         172 :         ppDefItems[38] = new SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT_CTL );
     148         172 :         ppDefItems[39] = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK );
     149         172 :         ppDefItems[40] = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL );
     150         172 :         ppDefItems[41] = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK );
     151         172 :         ppDefItems[42] = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL );
     152         172 :         ppDefItems[43] = new SvxEmphasisMarkItem( EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK );
     153         172 :         ppDefItems[44] = new SvxCharReliefItem( RELIEF_NONE, EE_CHAR_RELIEF );
     154         172 :         ppDefItems[45] = new SfxVoidItem( EE_CHAR_RUBI_DUMMY );
     155         172 :         ppDefItems[46] = new SvXMLAttrContainerItem( EE_CHAR_XMLATTRIBS );
     156         172 :         ppDefItems[47] = new SvxOverlineItem( UNDERLINE_NONE, EE_CHAR_OVERLINE );
     157         172 :         ppDefItems[48] = new SvxCaseMapItem( SVX_CASEMAP_NOT_MAPPED, EE_CHAR_CASEMAP );
     158         172 :         ppDefItems[49] = new SfxGrabBagItem( EE_CHAR_GRABBAG );
     159         172 :         ppDefItems[50] = new SvxBackgroundColorItem( Color( COL_AUTO ), EE_CHAR_BKGCOLOR );
     160             :         // Features
     161         172 :         ppDefItems[51] = new SfxVoidItem( EE_FEATURE_TAB );
     162         172 :         ppDefItems[52] = new SfxVoidItem( EE_FEATURE_LINEBR );
     163         172 :         ppDefItems[53] = new SvxCharSetColorItem( Color( COL_RED ), RTL_TEXTENCODING_DONTKNOW, EE_FEATURE_NOTCONV );
     164         172 :         ppDefItems[54] = new SvxFieldItem( SvxFieldData(), EE_FEATURE_FIELD );
     165             : 
     166             :         assert(EDITITEMCOUNT == 55 && "ITEMCOUNT changed, adjust DefItems!");
     167             : 
     168             :         // Init DefFonts:
     169         172 :         GetDefaultFonts( *static_cast<SvxFontItem*>(ppDefItems[EE_CHAR_FONTINFO - EE_ITEMS_START]),
     170         172 :                          *static_cast<SvxFontItem*>(ppDefItems[EE_CHAR_FONTINFO_CJK - EE_ITEMS_START]),
     171         516 :                          *static_cast<SvxFontItem*>(ppDefItems[EE_CHAR_FONTINFO_CTL - EE_ITEMS_START]) );
     172             :     }
     173             : 
     174       88688 :     return ppDefItems;
     175             : }
     176             : 
     177       77347 : rtl::Reference<SvxForbiddenCharactersTable> GlobalEditData::GetForbiddenCharsTable()
     178             : {
     179       77347 :     if ( !xForbiddenCharsTable.is() )
     180             :     {
     181       11387 :         xForbiddenCharsTable = new SvxForbiddenCharactersTable( ::comphelper::getProcessComponentContext() );
     182             :     }
     183       77347 :     return xForbiddenCharsTable;
     184             : }
     185             : 
     186           0 : uno::Reference< linguistic2::XLanguageGuessing > GlobalEditData::GetLanguageGuesser()
     187             : {
     188           0 :     if (!xLanguageGuesser.is())
     189             :     {
     190           0 :         xLanguageGuesser = linguistic2::LanguageGuessing::create( comphelper::getProcessComponentContext() );
     191             :     }
     192           0 :     return xLanguageGuesser;
     193             : }
     194             : 
     195      220934 : EditResId::EditResId(sal_uInt16 nId)
     196      220934 :     : ResId(nId, *EditDLL::GetResMgr())
     197             : {
     198      220934 : }
     199             : 
     200         172 : EditDLL::EditDLL()
     201             : {
     202         172 :     pGlobalData = new GlobalEditData;
     203         172 : }
     204             : 
     205         172 : EditDLL::~EditDLL()
     206             : {
     207         172 :     delete pGlobalData;
     208         172 : }
     209             : 
     210             : static ResMgr* pResMgr=0;
     211             : 
     212      220934 : ResMgr* EditDLL::GetResMgr()
     213             : {
     214      220934 :     if (!pResMgr)
     215         136 :         pResMgr = ResMgr::CreateResMgr("editeng", Application::GetSettings().GetUILanguageTag());
     216      220934 :     return pResMgr;
     217         669 : }
     218             : 
     219             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10