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