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