LCOV - code coverage report
Current view: top level - editeng/source/editeng - eerdll.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 89 0.0 %
Date: 2014-04-14 Functions: 0 9 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             : 
      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           0 : EditDLL& EditDLL::Get()
      80             : {
      81           0 :     return theEditDLL::get();
      82             : }
      83             : 
      84           0 : GlobalEditData::GlobalEditData()
      85             : {
      86           0 :     ppDefItems = NULL;
      87           0 : }
      88             : 
      89           0 : GlobalEditData::~GlobalEditData()
      90             : {
      91             :     // Destroy DefItems...
      92             :     // Or simply keep them, since at end of excecution?!
      93           0 :     if ( ppDefItems )
      94           0 :         SfxItemPool::ReleaseDefaults( ppDefItems, EDITITEMCOUNT, true );
      95           0 : }
      96             : 
      97           0 : SfxPoolItem** GlobalEditData::GetDefItems()
      98             : {
      99           0 :     if ( !ppDefItems )
     100             :     {
     101           0 :         ppDefItems = new SfxPoolItem*[EDITITEMCOUNT];
     102             : 
     103             :         // Paragraph attributes:
     104             :         SvxNumRule aDefaultNumRule( NUM_BULLET_REL_SIZE|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE,
     105           0 :                                     SVX_MAX_NUM, false );
     106             : 
     107           0 :         ppDefItems[0]  = new SvxFrameDirectionItem( FRMDIR_HORI_LEFT_TOP, EE_PARA_WRITINGDIR );
     108           0 :         ppDefItems[1]  = new SvXMLAttrContainerItem( EE_PARA_XMLATTRIBS );
     109           0 :         ppDefItems[2]  = new SfxBoolItem( EE_PARA_HANGINGPUNCTUATION, false );
     110           0 :         ppDefItems[3]  = new SfxBoolItem( EE_PARA_FORBIDDENRULES, true );
     111           0 :         ppDefItems[4]  = new SvxScriptSpaceItem( true, EE_PARA_ASIANCJKSPACING );
     112           0 :         ppDefItems[5]  = new SvxNumBulletItem( aDefaultNumRule, EE_PARA_NUMBULLET );
     113           0 :         ppDefItems[6]  = new SfxBoolItem( EE_PARA_HYPHENATE, false );
     114           0 :         ppDefItems[7]  = new SfxBoolItem( EE_PARA_BULLETSTATE, true );
     115           0 :         ppDefItems[8]  = new SvxLRSpaceItem( EE_PARA_OUTLLRSPACE );
     116           0 :         ppDefItems[9]  = new SfxInt16Item( EE_PARA_OUTLLEVEL, -1 );
     117           0 :         ppDefItems[10] = new SvxBulletItem( EE_PARA_BULLET );
     118           0 :         ppDefItems[11] = new SvxLRSpaceItem( EE_PARA_LRSPACE );
     119           0 :         ppDefItems[12] = new SvxULSpaceItem( EE_PARA_ULSPACE );
     120           0 :         ppDefItems[13] = new SvxLineSpacingItem( 0, EE_PARA_SBL );
     121           0 :         ppDefItems[14] = new SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST );
     122           0 :         ppDefItems[15] = new SvxTabStopItem( 0, 0, SVX_TAB_ADJUST_LEFT, EE_PARA_TABS );
     123           0 :         ppDefItems[16] = new SvxJustifyMethodItem( SVX_JUSTIFY_METHOD_AUTO, EE_PARA_JUST_METHOD );
     124           0 :         ppDefItems[17] = new SvxVerJustifyItem( SVX_VER_JUSTIFY_STANDARD, EE_PARA_VER_JUST );
     125             : 
     126             :         // Character attributes:
     127           0 :         ppDefItems[18] = new SvxColorItem( Color( COL_AUTO ), EE_CHAR_COLOR );
     128           0 :         ppDefItems[19] = new SvxFontItem( EE_CHAR_FONTINFO );
     129           0 :         ppDefItems[20] = new SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT );
     130           0 :         ppDefItems[21] = new SvxCharScaleWidthItem( 100, EE_CHAR_FONTWIDTH );
     131           0 :         ppDefItems[22] = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT );
     132           0 :         ppDefItems[23] = new SvxUnderlineItem( UNDERLINE_NONE, EE_CHAR_UNDERLINE );
     133           0 :         ppDefItems[24] = new SvxCrossedOutItem( STRIKEOUT_NONE, EE_CHAR_STRIKEOUT );
     134           0 :         ppDefItems[25] = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC );
     135           0 :         ppDefItems[26] = new SvxContourItem( false, EE_CHAR_OUTLINE );
     136           0 :         ppDefItems[27] = new SvxShadowedItem( false, EE_CHAR_SHADOW );
     137           0 :         ppDefItems[28] = new SvxEscapementItem( 0, 100, EE_CHAR_ESCAPEMENT );
     138           0 :         ppDefItems[29] = new SvxAutoKernItem( false, EE_CHAR_PAIRKERNING );
     139           0 :         ppDefItems[30] = new SvxKerningItem( 0, EE_CHAR_KERNING );
     140           0 :         ppDefItems[31] = new SvxWordLineModeItem( false, EE_CHAR_WLM );
     141           0 :         ppDefItems[32] = new SvxLanguageItem( LANGUAGE_DONTKNOW, EE_CHAR_LANGUAGE );
     142           0 :         ppDefItems[33] = new SvxLanguageItem( LANGUAGE_DONTKNOW, EE_CHAR_LANGUAGE_CJK );
     143           0 :         ppDefItems[34] = new SvxLanguageItem( LANGUAGE_DONTKNOW, EE_CHAR_LANGUAGE_CTL );
     144           0 :         ppDefItems[35] = new SvxFontItem( EE_CHAR_FONTINFO_CJK );
     145           0 :         ppDefItems[36] = new SvxFontItem( EE_CHAR_FONTINFO_CTL );
     146           0 :         ppDefItems[37] = new SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT_CJK );
     147           0 :         ppDefItems[38] = new SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT_CTL );
     148           0 :         ppDefItems[39] = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK );
     149           0 :         ppDefItems[40] = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL );
     150           0 :         ppDefItems[41] = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK );
     151           0 :         ppDefItems[42] = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL );
     152           0 :         ppDefItems[43] = new SvxEmphasisMarkItem( EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK );
     153           0 :         ppDefItems[44] = new SvxCharReliefItem( RELIEF_NONE, EE_CHAR_RELIEF );
     154           0 :         ppDefItems[45] = new SfxVoidItem( EE_CHAR_RUBI_DUMMY );
     155           0 :         ppDefItems[46] = new SvXMLAttrContainerItem( EE_CHAR_XMLATTRIBS );
     156           0 :         ppDefItems[47] = new SvxOverlineItem( UNDERLINE_NONE, EE_CHAR_OVERLINE );
     157           0 :         ppDefItems[48] = new SvxCaseMapItem( SVX_CASEMAP_NOT_MAPPED, EE_CHAR_CASEMAP );
     158           0 :         ppDefItems[49] = new SfxGrabBagItem( EE_CHAR_GRABBAG );
     159             :         // Features
     160           0 :         ppDefItems[50] = new SfxVoidItem( EE_FEATURE_TAB );
     161           0 :         ppDefItems[51] = new SfxVoidItem( EE_FEATURE_LINEBR );
     162           0 :         ppDefItems[52] = new SvxCharSetColorItem( Color( COL_RED ), RTL_TEXTENCODING_DONTKNOW, EE_FEATURE_NOTCONV );
     163           0 :         ppDefItems[53] = new SvxFieldItem( SvxFieldData(), EE_FEATURE_FIELD );
     164             : 
     165             :         DBG_ASSERT( EDITITEMCOUNT == 54, "ITEMCOUNT geaendert, DefItems nicht angepasst!" );
     166             : 
     167             :         // Init DefFonts:
     168           0 :         GetDefaultFonts( *(SvxFontItem*)ppDefItems[EE_CHAR_FONTINFO - EE_ITEMS_START],
     169           0 :                          *(SvxFontItem*)ppDefItems[EE_CHAR_FONTINFO_CJK - EE_ITEMS_START],
     170           0 :                          *(SvxFontItem*)ppDefItems[EE_CHAR_FONTINFO_CTL - EE_ITEMS_START] );
     171             :     }
     172             : 
     173           0 :     return ppDefItems;
     174             : }
     175             : 
     176           0 : rtl::Reference<SvxForbiddenCharactersTable> GlobalEditData::GetForbiddenCharsTable()
     177             : {
     178           0 :     if ( !xForbiddenCharsTable.is() )
     179             :     {
     180           0 :         xForbiddenCharsTable = new SvxForbiddenCharactersTable( ::comphelper::getProcessComponentContext() );
     181             :     }
     182           0 :     return xForbiddenCharsTable;
     183             : }
     184             : 
     185           0 : uno::Reference< linguistic2::XLanguageGuessing > GlobalEditData::GetLanguageGuesser()
     186             : {
     187           0 :     if (!xLanguageGuesser.is())
     188             :     {
     189           0 :         xLanguageGuesser = linguistic2::LanguageGuessing::create( comphelper::getProcessComponentContext() );
     190             :     }
     191           0 :     return xLanguageGuesser;
     192             : }
     193             : 
     194           0 : EditResId::EditResId( sal_uInt16 nId ):
     195           0 :     ResId( nId, *EE_DLL().GetResMgr() )
     196             : {
     197           0 : }
     198             : 
     199           0 : EditDLL::EditDLL()
     200             : {
     201           0 :     pGlobalData = new GlobalEditData;
     202           0 :     pResMgr = ResMgr::CreateResMgr( "editeng", Application::GetSettings().GetUILanguageTag() );
     203           0 : }
     204             : 
     205           0 : EditDLL::~EditDLL()
     206             : {
     207           0 :     delete pGlobalData;
     208           0 : }
     209             : 
     210             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10