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 : #include <hintids.hxx>
21 : #include <comphelper/classids.hxx>
22 : #include <tools/stream.hxx>
23 : #include <vcl/svapp.hxx>
24 : #include <svl/mailenum.hxx>
25 : #include <svx/svxids.hrc>
26 : #include <editeng/svxenum.hxx>
27 : #include <osl/diagnose.h>
28 :
29 : #include <tools/globname.hxx>
30 : #include <swtypes.hxx>
31 : #include <itabenum.hxx>
32 : #include <modcfg.hxx>
33 : #include <fldupde.hxx>
34 : #include <unotools/syslocaleoptions.hxx>
35 : #include <caption.hxx>
36 : #include <com/sun/star/uno/Any.hxx>
37 :
38 : #include <unomid.h>
39 :
40 : using namespace utl;
41 : using namespace com::sun::star::uno;
42 :
43 : #define GLOB_NAME_CALC 0
44 : #define GLOB_NAME_IMPRESS 1
45 : #define GLOB_NAME_DRAW 2
46 : #define GLOB_NAME_MATH 3
47 : #define GLOB_NAME_CHART 4
48 :
49 472 : InsCaptionOpt* InsCaptionOptArr::Find(const SwCapObjType eType, const SvGlobalName *pOleId)
50 : {
51 472 : for (InsCapOptArr::iterator aI = m_aInsCapOptArr.begin(); aI != m_aInsCapOptArr.end(); ++aI)
52 : {
53 0 : InsCaptionOpt &rObj = *aI;
54 0 : if (rObj.GetObjType() == eType && (eType != OLE_CAP || (pOleId && rObj.GetOleId() == *pOleId)))
55 0 : return &rObj;
56 : }
57 :
58 472 : return NULL;
59 : }
60 :
61 472 : void InsCaptionOptArr::Insert(InsCaptionOpt* pObj)
62 : {
63 472 : m_aInsCapOptArr.push_back(pObj); //takes ownership
64 472 : }
65 :
66 0 : const InsCaptionOpt* SwModuleOptions::GetCapOption(
67 : bool bHTML, const SwCapObjType eType, const SvGlobalName *pOleId)
68 : {
69 0 : if(bHTML)
70 : {
71 : OSL_FAIL("no caption option in sw/web!");
72 0 : return 0;
73 : }
74 : else
75 : {
76 0 : if(eType == OLE_CAP && pOleId)
77 : {
78 0 : bool bFound = false;
79 0 : for( sal_uInt16 nId = 0; nId <= GLOB_NAME_CHART && !bFound; nId++)
80 0 : bFound = *pOleId == aInsertConfig.aGlobalNames[nId ];
81 0 : if(!bFound)
82 0 : return aInsertConfig.pOLEMiscOpt;
83 : }
84 0 : return aInsertConfig.pCapOptions->Find(eType, pOleId);
85 : }
86 : }
87 :
88 0 : bool SwModuleOptions::SetCapOption(bool bHTML, const InsCaptionOpt* pOpt)
89 : {
90 0 : bool bRet = false;
91 :
92 0 : if(bHTML)
93 : {
94 : OSL_FAIL("no caption option in sw/web!");
95 : }
96 0 : else if (pOpt)
97 : {
98 0 : if(pOpt->GetObjType() == OLE_CAP)
99 : {
100 0 : bool bFound = false;
101 0 : for( sal_uInt16 nId = 0; nId <= GLOB_NAME_CHART; nId++)
102 0 : bFound = pOpt->GetOleId() == aInsertConfig.aGlobalNames[nId ];
103 0 : if(!bFound)
104 : {
105 0 : if(aInsertConfig.pOLEMiscOpt)
106 0 : *aInsertConfig.pOLEMiscOpt = *pOpt;
107 : else
108 0 : aInsertConfig.pOLEMiscOpt = new InsCaptionOpt(*pOpt);
109 : }
110 : }
111 :
112 0 : InsCaptionOptArr& rArr = *aInsertConfig.pCapOptions;
113 0 : InsCaptionOpt *pObj = rArr.Find(pOpt->GetObjType(), &pOpt->GetOleId());
114 :
115 0 : if (pObj)
116 : {
117 0 : *pObj = *pOpt;
118 : }
119 : else
120 0 : rArr.Insert(new InsCaptionOpt(*pOpt));
121 :
122 0 : aInsertConfig.SetModified();
123 0 : bRet = true;
124 : }
125 :
126 0 : return bRet;
127 : }
128 :
129 59 : SwModuleOptions::SwModuleOptions() :
130 : aInsertConfig(false),
131 : aWebInsertConfig(true),
132 : aTableConfig(false),
133 : aWebTableConfig(true),
134 59 : bHideFieldTips(false)
135 : {
136 59 : }
137 :
138 60 : OUString SwModuleOptions::ConvertWordDelimiter(const OUString& rDelim, bool bFromUI)
139 : {
140 60 : OUString sReturn;
141 60 : const sal_Int32 nDelimLen = rDelim.getLength();
142 60 : if(bFromUI)
143 : {
144 472 : for (sal_Int32 i = 0; i < nDelimLen; )
145 : {
146 354 : const sal_Unicode c = rDelim[i++];
147 :
148 354 : if (c == '\\' && i < nDelimLen )
149 : {
150 177 : switch (rDelim[i++])
151 : {
152 59 : case 'n': sReturn += "\n"; break;
153 59 : case 't': sReturn += "\t"; break;
154 0 : case '\\': sReturn += "\\"; break;
155 :
156 : case 'x':
157 : {
158 59 : sal_Unicode nChar = 0;
159 59 : bool bValidData = true;
160 177 : for( sal_Int32 n = 0; n < 2 && i < nDelimLen; ++n, ++i )
161 : {
162 118 : sal_Unicode nVal = rDelim[i];
163 118 : if( (nVal >= '0') && ( nVal <= '9') )
164 0 : nVal -= '0';
165 118 : else if( (nVal >= 'A') && (nVal <= 'F') )
166 0 : nVal -= 'A' - 10;
167 118 : else if( (nVal >= 'a') && (nVal <= 'f') )
168 118 : nVal -= 'a' - 10;
169 : else
170 : {
171 : OSL_FAIL("wrong hex value" );
172 0 : bValidData = false;
173 0 : break;
174 : }
175 :
176 118 : nChar <<= 4;
177 118 : nChar += nVal;
178 : }
179 59 : if( bValidData )
180 59 : sReturn += OUString(nChar);
181 59 : break;
182 : }
183 :
184 : default: // Unknown, so insert backslash
185 0 : sReturn += "\\";
186 0 : i--;
187 0 : break;
188 177 : }
189 : }
190 : else
191 177 : sReturn += OUString(c);
192 : }
193 : }
194 : else
195 : {
196 13 : for (sal_Int32 i = 0; i < nDelimLen; ++i)
197 : {
198 12 : const sal_Unicode c = rDelim[i];
199 :
200 12 : switch (c)
201 : {
202 1 : case '\n': sReturn += "\\n"; break;
203 1 : case '\t': sReturn += "\\t"; break;
204 0 : case '\\': sReturn += "\\\\"; break;
205 :
206 : default:
207 10 : if( c <= 0x1f || c >= 0x7f )
208 : {
209 1 : sReturn += "\\x" + OUString::number( c, 16 );
210 : }
211 : else
212 : {
213 9 : sReturn += OUString(c);
214 : }
215 : }
216 : }
217 : }
218 60 : return sReturn;
219 : }
220 :
221 59 : const Sequence<OUString>& SwRevisionConfig::GetPropertyNames()
222 : {
223 59 : static Sequence<OUString> aNames;
224 59 : if(!aNames.getLength())
225 : {
226 59 : const int nCount = 8;
227 59 : aNames.realloc(nCount);
228 : static const char* aPropNames[] =
229 : {
230 : "TextDisplay/Insert/Attribute", // 0
231 : "TextDisplay/Insert/Color", // 1
232 : "TextDisplay/Delete/Attribute", // 2
233 : "TextDisplay/Delete/Color", // 3
234 : "TextDisplay/ChangedAttribute/Attribute", // 4
235 : "TextDisplay/ChangedAttribute/Color", // 5
236 : "LinesChanged/Mark", // 6
237 : "LinesChanged/Color" // 7
238 : };
239 59 : OUString* pNames = aNames.getArray();
240 531 : for(int i = 0; i < nCount; i++)
241 472 : pNames[i] = OUString::createFromAscii(aPropNames[i]);
242 : }
243 59 : return aNames;
244 : }
245 :
246 59 : SwRevisionConfig::SwRevisionConfig() :
247 : ConfigItem("Office.Writer/Revision",
248 59 : ConfigItemMode::DelayedUpdate|ConfigItemMode::ReleaseTree)
249 : {
250 59 : aInsertAttr.nItemId = SID_ATTR_CHAR_UNDERLINE;
251 59 : aInsertAttr.nAttr = UNDERLINE_SINGLE;
252 59 : aInsertAttr.nColor = COL_TRANSPARENT;
253 59 : aDeletedAttr.nItemId = SID_ATTR_CHAR_STRIKEOUT;
254 59 : aDeletedAttr.nAttr = STRIKEOUT_SINGLE;
255 59 : aDeletedAttr.nColor = COL_TRANSPARENT;
256 59 : aFormatAttr.nItemId = SID_ATTR_CHAR_WEIGHT;
257 59 : aFormatAttr.nAttr = WEIGHT_BOLD;
258 59 : aFormatAttr.nColor = COL_BLACK;
259 :
260 59 : Load();
261 59 : }
262 :
263 26 : SwRevisionConfig::~SwRevisionConfig()
264 : {
265 26 : }
266 :
267 0 : static sal_Int32 lcl_ConvertAttrToCfg(const AuthorCharAttr& rAttr)
268 : {
269 0 : sal_Int32 nRet = 0;
270 0 : switch(rAttr.nItemId)
271 : {
272 0 : case SID_ATTR_CHAR_WEIGHT: nRet = 1; break;
273 0 : case SID_ATTR_CHAR_POSTURE: nRet = 2; break;
274 0 : case SID_ATTR_CHAR_UNDERLINE: nRet = UNDERLINE_SINGLE == rAttr.nAttr ? 3 : 4; break;
275 0 : case SID_ATTR_CHAR_STRIKEOUT: nRet = 3; break;
276 : case SID_ATTR_CHAR_CASEMAP:
277 : {
278 0 : switch(rAttr.nAttr)
279 : {
280 0 : case SVX_CASEMAP_VERSALIEN : nRet = 5;break;
281 0 : case SVX_CASEMAP_GEMEINE : nRet = 6;break;
282 0 : case SVX_CASEMAP_KAPITAELCHEN: nRet = 7;break;
283 0 : case SVX_CASEMAP_TITEL : nRet = 8;break;
284 : }
285 : }
286 0 : break;
287 0 : case SID_ATTR_BRUSH : nRet = 9; break;
288 : }
289 0 : return nRet;
290 : }
291 :
292 0 : void SwRevisionConfig::Notify( const ::com::sun::star::uno::Sequence< OUString >& ) {}
293 :
294 0 : void SwRevisionConfig::ImplCommit()
295 : {
296 0 : const Sequence<OUString>& aNames = GetPropertyNames();
297 0 : Sequence<Any> aValues(aNames.getLength());
298 0 : Any* pValues = aValues.getArray();
299 :
300 0 : for(int nProp = 0; nProp < aNames.getLength(); nProp++)
301 : {
302 0 : sal_Int32 nVal = -1;
303 0 : switch(nProp)
304 : {
305 0 : case 0 : nVal = lcl_ConvertAttrToCfg(aInsertAttr); break;
306 0 : case 1 : nVal = aInsertAttr.nColor ; break;
307 0 : case 2 : nVal = lcl_ConvertAttrToCfg(aDeletedAttr); break;
308 0 : case 3 : nVal = aDeletedAttr.nColor ; break;
309 0 : case 4 : nVal = lcl_ConvertAttrToCfg(aFormatAttr); break;
310 0 : case 5 : nVal = aFormatAttr.nColor ; break;
311 0 : case 6 : nVal = nMarkAlign ; break;
312 0 : case 7 : nVal = aMarkColor.GetColor(); break;
313 : }
314 0 : pValues[nProp] <<= nVal;
315 : }
316 0 : PutProperties(aNames, aValues);
317 0 : }
318 :
319 177 : static void lcl_ConvertCfgToAttr(sal_Int32 nVal, AuthorCharAttr& rAttr, bool bDelete = false)
320 : {
321 177 : rAttr.nItemId = rAttr.nAttr = 0;
322 177 : switch(nVal)
323 : {
324 59 : case 1: rAttr.nItemId = SID_ATTR_CHAR_WEIGHT; rAttr.nAttr = WEIGHT_BOLD ; break;
325 0 : case 2: rAttr.nItemId = SID_ATTR_CHAR_POSTURE; rAttr.nAttr = ITALIC_NORMAL ; break;
326 118 : case 3: if(bDelete)
327 : {
328 59 : rAttr.nItemId = SID_ATTR_CHAR_STRIKEOUT;
329 59 : rAttr.nAttr = STRIKEOUT_SINGLE;
330 : }
331 : else
332 : {
333 59 : rAttr.nItemId = SID_ATTR_CHAR_UNDERLINE;
334 59 : rAttr.nAttr = UNDERLINE_SINGLE;
335 : }
336 118 : break;
337 0 : case 4: rAttr.nItemId = SID_ATTR_CHAR_UNDERLINE;rAttr.nAttr = UNDERLINE_DOUBLE ; break;
338 0 : case 5: rAttr.nItemId = SID_ATTR_CHAR_CASEMAP; rAttr.nAttr = SVX_CASEMAP_VERSALIEN ; break;
339 0 : case 6: rAttr.nItemId = SID_ATTR_CHAR_CASEMAP; rAttr.nAttr = SVX_CASEMAP_GEMEINE ; break;
340 0 : case 7: rAttr.nItemId = SID_ATTR_CHAR_CASEMAP; rAttr.nAttr = SVX_CASEMAP_KAPITAELCHEN ; break;
341 0 : case 8: rAttr.nItemId = SID_ATTR_CHAR_CASEMAP; rAttr.nAttr = SVX_CASEMAP_TITEL ; break;
342 0 : case 9: rAttr.nItemId = SID_ATTR_BRUSH; break;
343 : }
344 177 : }
345 59 : void SwRevisionConfig::Load()
346 : {
347 59 : const Sequence<OUString>& aNames = GetPropertyNames();
348 59 : Sequence<Any> aValues = GetProperties(aNames);
349 59 : const Any* pValues = aValues.getConstArray();
350 : assert(aValues.getLength() == aNames.getLength());
351 531 : for (sal_Int32 nProp = 0; nProp < aNames.getLength(); ++nProp)
352 : {
353 472 : if (pValues[nProp].hasValue())
354 : {
355 472 : sal_Int32 nVal = 0;
356 472 : pValues[nProp] >>= nVal;
357 472 : switch (nProp)
358 : {
359 59 : case 0 : lcl_ConvertCfgToAttr(nVal, aInsertAttr); break;
360 59 : case 1 : aInsertAttr.nColor = nVal; break;
361 59 : case 2 : lcl_ConvertCfgToAttr(nVal, aDeletedAttr, true); break;
362 59 : case 3 : aDeletedAttr.nColor = nVal; break;
363 59 : case 4 : lcl_ConvertCfgToAttr(nVal, aFormatAttr); break;
364 59 : case 5 : aFormatAttr.nColor = nVal; break;
365 59 : case 6 : nMarkAlign = sal::static_int_cast< sal_uInt16, sal_Int32>(nVal); break;
366 59 : case 7 : aMarkColor.SetColor(nVal); break;
367 : }
368 : }
369 59 : }
370 59 : }
371 :
372 : enum InsertConfigProp
373 : {
374 : INS_PROP_TABLE_HEADER = 0,
375 : INS_PROP_TABLE_REPEATHEADER, // 1
376 : INS_PROP_TABLE_BORDER, // 2
377 : INS_PROP_TABLE_SPLIT, // 3 from here not in writer/web
378 : INS_PROP_CAP_AUTOMATIC, // 4
379 : INS_PROP_CAP_CAPTIONORDERNUMBERINGFIRST, // 5
380 : INS_PROP_CAP_OBJECT_TABLE_ENABLE, // 6
381 : INS_PROP_CAP_OBJECT_TABLE_CATEGORY, // 7
382 : INS_PROP_CAP_OBJECT_TABLE_NUMBERING, // 8
383 : INS_PROP_CAP_OBJECT_TABLE_NUMBERINGSEPARATOR, // 9
384 : INS_PROP_CAP_OBJECT_TABLE_CAPTIONTEXT, //10
385 : INS_PROP_CAP_OBJECT_TABLE_DELIMITER, //11
386 : INS_PROP_CAP_OBJECT_TABLE_LEVEL, //12
387 : INS_PROP_CAP_OBJECT_TABLE_POSITION, //13
388 : INS_PROP_CAP_OBJECT_TABLE_CHARACTERSTYLE, //14
389 : INS_PROP_CAP_OBJECT_FRAME_ENABLE, //15
390 : INS_PROP_CAP_OBJECT_FRAME_CATEGORY, //16
391 : INS_PROP_CAP_OBJECT_FRAME_NUMBERING, //17
392 : INS_PROP_CAP_OBJECT_FRAME_NUMBERINGSEPARATOR, //18
393 : INS_PROP_CAP_OBJECT_FRAME_CAPTIONTEXT, //19
394 : INS_PROP_CAP_OBJECT_FRAME_DELIMITER, //20
395 : INS_PROP_CAP_OBJECT_FRAME_LEVEL, //21
396 : INS_PROP_CAP_OBJECT_FRAME_POSITION, //22
397 : INS_PROP_CAP_OBJECT_FRAME_CHARACTERSTYLE, //23
398 : INS_PROP_CAP_OBJECT_GRAPHIC_ENABLE, //24
399 : INS_PROP_CAP_OBJECT_GRAPHIC_CATEGORY, //25
400 : INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERING, //26
401 : INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERINGSEPARATOR, //27
402 : INS_PROP_CAP_OBJECT_GRAPHIC_CAPTIONTEXT, //28
403 : INS_PROP_CAP_OBJECT_GRAPHIC_DELIMITER, //29
404 : INS_PROP_CAP_OBJECT_GRAPHIC_LEVEL, //30
405 : INS_PROP_CAP_OBJECT_GRAPHIC_POSITION, //31
406 : INS_PROP_CAP_OBJECT_GRAPHIC_CHARACTERSTYLE, //32
407 : INS_PROP_CAP_OBJECT_GRAPHIC_APPLYATTRIBUTES, //33
408 : INS_PROP_CAP_OBJECT_CALC_ENABLE, //34
409 : INS_PROP_CAP_OBJECT_CALC_CATEGORY, //35
410 : INS_PROP_CAP_OBJECT_CALC_NUMBERING, //36
411 : INS_PROP_CAP_OBJECT_CALC_NUMBERINGSEPARATOR, //37
412 : INS_PROP_CAP_OBJECT_CALC_CAPTIONTEXT, //38
413 : INS_PROP_CAP_OBJECT_CALC_DELIMITER, //39
414 : INS_PROP_CAP_OBJECT_CALC_LEVEL, //40
415 : INS_PROP_CAP_OBJECT_CALC_POSITION, //41
416 : INS_PROP_CAP_OBJECT_CALC_CHARACTERSTYLE, //42
417 : INS_PROP_CAP_OBJECT_CALC_APPLYATTRIBUTES, //43
418 : INS_PROP_CAP_OBJECT_IMPRESS_ENABLE, //44
419 : INS_PROP_CAP_OBJECT_IMPRESS_CATEGORY, //45
420 : INS_PROP_CAP_OBJECT_IMPRESS_NUMBERING, //46
421 : INS_PROP_CAP_OBJECT_IMPRESS_NUMBERINGSEPARATOR, //47
422 : INS_PROP_CAP_OBJECT_IMPRESS_CAPTIONTEXT, //48
423 : INS_PROP_CAP_OBJECT_IMPRESS_DELIMITER, //49
424 : INS_PROP_CAP_OBJECT_IMPRESS_LEVEL, //50
425 : INS_PROP_CAP_OBJECT_IMPRESS_POSITION, //51
426 : INS_PROP_CAP_OBJECT_IMPRESS_CHARACTERSTYLE, //52
427 : INS_PROP_CAP_OBJECT_IMPRESS_APPLYATTRIBUTES, //53
428 : INS_PROP_CAP_OBJECT_CHART_ENABLE, //54
429 : INS_PROP_CAP_OBJECT_CHART_CATEGORY, //55
430 : INS_PROP_CAP_OBJECT_CHART_NUMBERING, //56
431 : INS_PROP_CAP_OBJECT_CHART_NUMBERINGSEPARATOR, //57
432 : INS_PROP_CAP_OBJECT_CHART_CAPTIONTEXT, //58
433 : INS_PROP_CAP_OBJECT_CHART_DELIMITER, //59
434 : INS_PROP_CAP_OBJECT_CHART_LEVEL, //60
435 : INS_PROP_CAP_OBJECT_CHART_POSITION, //61
436 : INS_PROP_CAP_OBJECT_CHART_CHARACTERSTYLE, //62
437 : INS_PROP_CAP_OBJECT_CHART_APPLYATTRIBUTES, //63
438 : INS_PROP_CAP_OBJECT_FORMULA_ENABLE, //64
439 : INS_PROP_CAP_OBJECT_FORMULA_CATEGORY, //65
440 : INS_PROP_CAP_OBJECT_FORMULA_NUMBERING, //66
441 : INS_PROP_CAP_OBJECT_FORMULA_NUMBERINGSEPARATOR, //67
442 : INS_PROP_CAP_OBJECT_FORMULA_CAPTIONTEXT, //68
443 : INS_PROP_CAP_OBJECT_FORMULA_DELIMITER, //69
444 : INS_PROP_CAP_OBJECT_FORMULA_LEVEL, //70
445 : INS_PROP_CAP_OBJECT_FORMULA_POSITION, //71
446 : INS_PROP_CAP_OBJECT_FORMULA_CHARACTERSTYLE, //72
447 : INS_PROP_CAP_OBJECT_FORMULA_APPLYATTRIBUTES, //73
448 : INS_PROP_CAP_OBJECT_DRAW_ENABLE, //74
449 : INS_PROP_CAP_OBJECT_DRAW_CATEGORY, //75
450 : INS_PROP_CAP_OBJECT_DRAW_NUMBERING, //76
451 : INS_PROP_CAP_OBJECT_DRAW_NUMBERINGSEPARATOR, //77
452 : INS_PROP_CAP_OBJECT_DRAW_CAPTIONTEXT, //78
453 : INS_PROP_CAP_OBJECT_DRAW_DELIMITER, //79
454 : INS_PROP_CAP_OBJECT_DRAW_LEVEL, //80
455 : INS_PROP_CAP_OBJECT_DRAW_POSITION, //81
456 : INS_PROP_CAP_OBJECT_DRAW_CHARACTERSTYLE, //82
457 : INS_PROP_CAP_OBJECT_DRAW_APPLYATTRIBUTES, //83
458 : INS_PROP_CAP_OBJECT_OLEMISC_ENABLE, //84
459 : INS_PROP_CAP_OBJECT_OLEMISC_CATEGORY, //85
460 : INS_PROP_CAP_OBJECT_OLEMISC_NUMBERING, //86
461 : INS_PROP_CAP_OBJECT_OLEMISC_NUMBERINGSEPARATOR, //87
462 : INS_PROP_CAP_OBJECT_OLEMISC_CAPTIONTEXT, //88
463 : INS_PROP_CAP_OBJECT_OLEMISC_DELIMITER, //89
464 : INS_PROP_CAP_OBJECT_OLEMISC_LEVEL, //90
465 : INS_PROP_CAP_OBJECT_OLEMISC_POSITION, //91
466 : INS_PROP_CAP_OBJECT_OLEMISC_CHARACTERSTYLE, //92
467 : INS_PROP_CAP_OBJECT_OLEMISC_APPLYATTRIBUTES //93
468 : };
469 118 : const Sequence<OUString>& SwInsertConfig::GetPropertyNames()
470 : {
471 118 : static Sequence<OUString> aNames;
472 118 : static Sequence<OUString> aWebNames;
473 118 : if(!aNames.getLength())
474 : {
475 : static const char* aPropNames[] =
476 : {
477 : "Table/Header", // 0
478 : "Table/RepeatHeader", // 1
479 : "Table/Border", // 2
480 : "Table/Split", // 3 from here not in writer/web
481 : "Caption/Automatic", // 4
482 : "Caption/CaptionOrderNumberingFirst", // 5
483 : "Caption/WriterObject/Table/Enable", // 6
484 : "Caption/WriterObject/Table/Settings/Category", // 7
485 : "Caption/WriterObject/Table/Settings/Numbering", // 8
486 : "Caption/WriterObject/Table/Settings/NumberingSeparator", // 9
487 : "Caption/WriterObject/Table/Settings/CaptionText", //10
488 : "Caption/WriterObject/Table/Settings/Delimiter", //11
489 : "Caption/WriterObject/Table/Settings/Level", //12
490 : "Caption/WriterObject/Table/Settings/Position", //13
491 : "Caption/WriterObject/Table/Settings/CharacterStyle", //14
492 : "Caption/WriterObject/Frame/Enable", //15
493 : "Caption/WriterObject/Frame/Settings/Category", //16
494 : "Caption/WriterObject/Frame/Settings/Numbering", //17
495 : "Caption/WriterObject/Frame/Settings/NumberingSeparator", //18
496 : "Caption/WriterObject/Frame/Settings/CaptionText", //19
497 : "Caption/WriterObject/Frame/Settings/Delimiter", //20
498 : "Caption/WriterObject/Frame/Settings/Level", //21
499 : "Caption/WriterObject/Frame/Settings/Position", //22
500 : "Caption/WriterObject/Frame/Settings/CharacterStyle", //23
501 : "Caption/WriterObject/Graphic/Enable", //24
502 : "Caption/WriterObject/Graphic/Settings/Category", //25
503 : "Caption/WriterObject/Graphic/Settings/Numbering", //26
504 : "Caption/WriterObject/Graphic/Settings/NumberingSeparator", //27
505 : "Caption/WriterObject/Graphic/Settings/CaptionText", //28
506 : "Caption/WriterObject/Graphic/Settings/Delimiter", //29
507 : "Caption/WriterObject/Graphic/Settings/Level", //30
508 : "Caption/WriterObject/Graphic/Settings/Position", //31
509 : "Caption/WriterObject/Graphic/Settings/CharacterStyle", //32
510 : "Caption/WriterObject/Graphic/Settings/ApplyAttributes", //33
511 : "Caption/OfficeObject/Calc/Enable", //34
512 : "Caption/OfficeObject/Calc/Settings/Category", //35
513 : "Caption/OfficeObject/Calc/Settings/Numbering", //36
514 : "Caption/OfficeObject/Calc/Settings/NumberingSeparator", //37
515 : "Caption/OfficeObject/Calc/Settings/CaptionText", //38
516 : "Caption/OfficeObject/Calc/Settings/Delimiter", //39
517 : "Caption/OfficeObject/Calc/Settings/Level", //40
518 : "Caption/OfficeObject/Calc/Settings/Position", //41
519 : "Caption/OfficeObject/Calc/Settings/CharacterStyle", //42
520 : "Caption/OfficeObject/Calc/Settings/ApplyAttributes", //43
521 : "Caption/OfficeObject/Impress/Enable", //44
522 : "Caption/OfficeObject/Impress/Settings/Category", //45
523 : "Caption/OfficeObject/Impress/Settings/Numbering", //46
524 : "Caption/OfficeObject/Impress/Settings/NumberingSeparator", //47
525 : "Caption/OfficeObject/Impress/Settings/CaptionText", //48
526 : "Caption/OfficeObject/Impress/Settings/Delimiter", //49
527 : "Caption/OfficeObject/Impress/Settings/Level", //50
528 : "Caption/OfficeObject/Impress/Settings/Position", //51
529 : "Caption/OfficeObject/Impress/Settings/CharacterStyle", //52
530 : "Caption/OfficeObject/Impress/Settings/ApplyAttributes", //53
531 : "Caption/OfficeObject/Chart/Enable", //54
532 : "Caption/OfficeObject/Chart/Settings/Category", //55
533 : "Caption/OfficeObject/Chart/Settings/Numbering", //56
534 : "Caption/OfficeObject/Chart/Settings/NumberingSeparator", //57
535 : "Caption/OfficeObject/Chart/Settings/CaptionText", //58
536 : "Caption/OfficeObject/Chart/Settings/Delimiter", //59
537 : "Caption/OfficeObject/Chart/Settings/Level", //60
538 : "Caption/OfficeObject/Chart/Settings/Position", //61
539 : "Caption/OfficeObject/Chart/Settings/CharacterStyle", //62
540 : "Caption/OfficeObject/Chart/Settings/ApplyAttributes", //63
541 : "Caption/OfficeObject/Formula/Enable", //64
542 : "Caption/OfficeObject/Formula/Settings/Category", //65
543 : "Caption/OfficeObject/Formula/Settings/Numbering", //66
544 : "Caption/OfficeObject/Formula/Settings/NumberingSeparator", //67
545 : "Caption/OfficeObject/Formula/Settings/CaptionText", //68
546 : "Caption/OfficeObject/Formula/Settings/Delimiter", //69
547 : "Caption/OfficeObject/Formula/Settings/Level", //70
548 : "Caption/OfficeObject/Formula/Settings/Position", //71
549 : "Caption/OfficeObject/Formula/Settings/CharacterStyle", //72
550 : "Caption/OfficeObject/Formula/Settings/ApplyAttributes", //73
551 : "Caption/OfficeObject/Draw/Enable", //74
552 : "Caption/OfficeObject/Draw/Settings/Category", //75
553 : "Caption/OfficeObject/Draw/Settings/Numbering", //76
554 : "Caption/OfficeObject/Draw/Settings/NumberingSeparator", //77
555 : "Caption/OfficeObject/Draw/Settings/CaptionText", //78
556 : "Caption/OfficeObject/Draw/Settings/Delimiter", //79
557 : "Caption/OfficeObject/Draw/Settings/Level", //80
558 : "Caption/OfficeObject/Draw/Settings/Position", //81
559 : "Caption/OfficeObject/Draw/Settings/CharacterStyle", //82
560 : "Caption/OfficeObject/Draw/Settings/ApplyAttributes", //83
561 : "Caption/OfficeObject/OLEMisc/Enable", //84
562 : "Caption/OfficeObject/OLEMisc/Settings/Category", //85
563 : "Caption/OfficeObject/OLEMisc/Settings/Numbering", //86
564 : "Caption/OfficeObject/OLEMisc/Settings/NumberingSeparator", //87
565 : "Caption/OfficeObject/OLEMisc/Settings/CaptionText", //88
566 : "Caption/OfficeObject/OLEMisc/Settings/Delimiter", //89
567 : "Caption/OfficeObject/OLEMisc/Settings/Level", //90
568 : "Caption/OfficeObject/OLEMisc/Settings/Position", //91
569 : "Caption/OfficeObject/OLEMisc/Settings/CharacterStyle", //92
570 : "Caption/OfficeObject/OLEMisc/Settings/ApplyAttributes" //93
571 : };
572 59 : const int nCount = INS_PROP_CAP_OBJECT_OLEMISC_APPLYATTRIBUTES + 1;
573 59 : const int nWebCount = INS_PROP_TABLE_BORDER + 1;
574 59 : aNames.realloc(nCount);
575 59 : aWebNames.realloc(nWebCount);
576 59 : OUString* pNames = aNames.getArray();
577 59 : OUString* pWebNames = aWebNames.getArray();
578 : int i;
579 5605 : for(i = 0; i < nCount; i++)
580 5546 : pNames[i] = OUString::createFromAscii(aPropNames[i]);
581 236 : for(i = 0; i < nWebCount; i++)
582 177 : pWebNames[i] = OUString::createFromAscii(aPropNames[i]);
583 : }
584 118 : return bIsWeb ? aWebNames : aNames;
585 : }
586 :
587 118 : SwInsertConfig::SwInsertConfig(bool bWeb) :
588 : ConfigItem(bWeb ? OUString("Office.WriterWeb/Insert") : OUString("Office.Writer/Insert"),
589 236 : ConfigItemMode::DelayedUpdate|ConfigItemMode::ReleaseTree),
590 : pCapOptions(0),
591 : pOLEMiscOpt(0),
592 : bInsWithCaption( false ),
593 : bCaptionOrderNumberingFirst( false ),
594 : aInsTableOpts(0,0),
595 236 : bIsWeb(bWeb)
596 : {
597 118 : aGlobalNames[GLOB_NAME_CALC ] = SvGlobalName(SO3_SC_CLASSID);
598 118 : aGlobalNames[GLOB_NAME_IMPRESS] = SvGlobalName(SO3_SIMPRESS_CLASSID);
599 118 : aGlobalNames[GLOB_NAME_DRAW ] = SvGlobalName(SO3_SDRAW_CLASSID);
600 118 : aGlobalNames[GLOB_NAME_MATH ] = SvGlobalName(SO3_SM_CLASSID);
601 118 : aGlobalNames[GLOB_NAME_CHART ] = SvGlobalName(SO3_SCH_CLASSID);
602 118 : if(!bIsWeb)
603 59 : pCapOptions = new InsCaptionOptArr;
604 :
605 118 : Load();
606 118 : }
607 :
608 104 : SwInsertConfig::~SwInsertConfig()
609 : {
610 52 : delete pCapOptions;
611 52 : delete pOLEMiscOpt;
612 52 : }
613 :
614 0 : static void lcl_WriteOpt(const InsCaptionOpt& rOpt, Any* pValues, sal_Int32 nProp, sal_Int32 nOffset)
615 : {
616 0 : switch(nOffset)
617 : {
618 0 : case 0: pValues[nProp] <<= rOpt.UseCaption(); break;//Enable
619 0 : case 1: pValues[nProp] <<= OUString(rOpt.GetCategory()); break;//Category
620 0 : case 2: pValues[nProp] <<= (sal_Int32)rOpt.GetNumType(); break;//Numbering",
621 0 : case 3: pValues[nProp] <<= rOpt.GetNumSeparator(); break;//NumberingSeparator",
622 0 : case 4: pValues[nProp] <<= OUString(rOpt.GetCaption()); break;//CaptionText",
623 0 : case 5: pValues[nProp] <<= OUString(rOpt.GetSeparator());break;//Delimiter",
624 0 : case 6: pValues[nProp] <<= (sal_Int32)rOpt.GetLevel(); break;//Level",
625 0 : case 7: pValues[nProp] <<= (sal_Int32)rOpt.GetPos(); break;//Position",
626 0 : case 8: pValues[nProp] <<= (OUString&)rOpt.GetCharacterStyle(); break; //CharacterStyle
627 0 : case 9: pValues[nProp] <<= rOpt.CopyAttributes(); break; //ApplyAttributes
628 : }
629 0 : }
630 :
631 0 : void SwInsertConfig::Notify( const ::com::sun::star::uno::Sequence< OUString >& ) {}
632 :
633 0 : void SwInsertConfig::ImplCommit()
634 : {
635 0 : const Sequence<OUString>& aNames = GetPropertyNames();
636 0 : Sequence<Any> aValues(aNames.getLength());
637 0 : Any* pValues = aValues.getArray();
638 :
639 0 : for(int nProp = 0; nProp < aNames.getLength(); nProp++)
640 : {
641 0 : const InsCaptionOpt* pWriterTableOpt = 0;
642 0 : const InsCaptionOpt* pWriterFrameOpt = 0;
643 0 : const InsCaptionOpt* pWriterGraphicOpt = 0;
644 0 : const InsCaptionOpt* pOLECalcOpt = 0;
645 0 : const InsCaptionOpt* pOLEImpressOpt = 0;
646 0 : const InsCaptionOpt* pOLEChartOpt = 0;
647 0 : const InsCaptionOpt* pOLEFormulaOpt = 0;
648 0 : const InsCaptionOpt* pOLEDrawOpt = 0;
649 0 : if(pCapOptions)
650 : {
651 0 : pWriterTableOpt = pCapOptions->Find(TABLE_CAP, 0);
652 0 : pWriterFrameOpt = pCapOptions->Find(FRAME_CAP, 0);
653 0 : pWriterGraphicOpt = pCapOptions->Find(GRAPHIC_CAP, 0);
654 0 : pOLECalcOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_CALC]);
655 0 : pOLEImpressOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_IMPRESS]);
656 0 : pOLEDrawOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_DRAW ]);
657 0 : pOLEFormulaOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_MATH ]);
658 0 : pOLEChartOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_CHART ]);
659 : }
660 0 : switch(nProp)
661 : {
662 : case INS_PROP_TABLE_HEADER:
663 0 : pValues[nProp] <<= 0 != (aInsTableOpts.mnInsMode & tabopts::HEADLINE);
664 0 : break;//"Table/Header",
665 : case INS_PROP_TABLE_REPEATHEADER:
666 0 : pValues[nProp] <<= aInsTableOpts.mnRowsToRepeat > 0;
667 0 : break;//"Table/RepeatHeader",
668 : case INS_PROP_TABLE_BORDER:
669 0 : pValues[nProp] <<= 0 != (aInsTableOpts.mnInsMode & tabopts::DEFAULT_BORDER );
670 0 : break;//"Table/Border",
671 : case INS_PROP_TABLE_SPLIT:
672 0 : pValues[nProp] <<= 0 != (aInsTableOpts.mnInsMode & tabopts::SPLIT_LAYOUT);
673 0 : break;//"Table/Split",
674 : case INS_PROP_CAP_AUTOMATIC:
675 0 : pValues[nProp] <<= bInsWithCaption;
676 0 : break;//"Caption/Automatic",
677 : case INS_PROP_CAP_CAPTIONORDERNUMBERINGFIRST:
678 0 : pValues[nProp] <<= bCaptionOrderNumberingFirst;
679 0 : break;//"Caption/CaptionOrderNumberingFirst"
680 :
681 : case INS_PROP_CAP_OBJECT_TABLE_ENABLE:
682 : case INS_PROP_CAP_OBJECT_TABLE_CATEGORY:
683 : case INS_PROP_CAP_OBJECT_TABLE_NUMBERING:
684 : case INS_PROP_CAP_OBJECT_TABLE_NUMBERINGSEPARATOR:
685 : case INS_PROP_CAP_OBJECT_TABLE_CAPTIONTEXT:
686 : case INS_PROP_CAP_OBJECT_TABLE_DELIMITER:
687 : case INS_PROP_CAP_OBJECT_TABLE_LEVEL:
688 : case INS_PROP_CAP_OBJECT_TABLE_POSITION:
689 : case INS_PROP_CAP_OBJECT_TABLE_CHARACTERSTYLE:
690 0 : if(pWriterTableOpt)
691 0 : lcl_WriteOpt(*pWriterTableOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_TABLE_ENABLE);
692 0 : break;
693 : case INS_PROP_CAP_OBJECT_FRAME_ENABLE:
694 : case INS_PROP_CAP_OBJECT_FRAME_CATEGORY:
695 : case INS_PROP_CAP_OBJECT_FRAME_NUMBERING:
696 : case INS_PROP_CAP_OBJECT_FRAME_NUMBERINGSEPARATOR:
697 : case INS_PROP_CAP_OBJECT_FRAME_CAPTIONTEXT:
698 : case INS_PROP_CAP_OBJECT_FRAME_DELIMITER:
699 : case INS_PROP_CAP_OBJECT_FRAME_LEVEL:
700 : case INS_PROP_CAP_OBJECT_FRAME_POSITION:
701 : case INS_PROP_CAP_OBJECT_FRAME_CHARACTERSTYLE:
702 0 : if(pWriterFrameOpt)
703 0 : lcl_WriteOpt(*pWriterFrameOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_FRAME_ENABLE);
704 0 : break;
705 : case INS_PROP_CAP_OBJECT_GRAPHIC_ENABLE:
706 : case INS_PROP_CAP_OBJECT_GRAPHIC_CATEGORY:
707 : case INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERING:
708 : case INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERINGSEPARATOR:
709 : case INS_PROP_CAP_OBJECT_GRAPHIC_CAPTIONTEXT:
710 : case INS_PROP_CAP_OBJECT_GRAPHIC_DELIMITER:
711 : case INS_PROP_CAP_OBJECT_GRAPHIC_LEVEL:
712 : case INS_PROP_CAP_OBJECT_GRAPHIC_POSITION:
713 : case INS_PROP_CAP_OBJECT_GRAPHIC_CHARACTERSTYLE:
714 : case INS_PROP_CAP_OBJECT_GRAPHIC_APPLYATTRIBUTES:
715 0 : if(pWriterGraphicOpt)
716 0 : lcl_WriteOpt(*pWriterGraphicOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_GRAPHIC_ENABLE);
717 0 : break;
718 : case INS_PROP_CAP_OBJECT_CALC_ENABLE:
719 : case INS_PROP_CAP_OBJECT_CALC_CATEGORY:
720 : case INS_PROP_CAP_OBJECT_CALC_NUMBERING:
721 : case INS_PROP_CAP_OBJECT_CALC_NUMBERINGSEPARATOR:
722 : case INS_PROP_CAP_OBJECT_CALC_CAPTIONTEXT:
723 : case INS_PROP_CAP_OBJECT_CALC_DELIMITER:
724 : case INS_PROP_CAP_OBJECT_CALC_LEVEL:
725 : case INS_PROP_CAP_OBJECT_CALC_POSITION:
726 : case INS_PROP_CAP_OBJECT_CALC_CHARACTERSTYLE:
727 : case INS_PROP_CAP_OBJECT_CALC_APPLYATTRIBUTES:
728 0 : if(pOLECalcOpt)
729 0 : lcl_WriteOpt(*pOLECalcOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_CALC_ENABLE);
730 0 : break;
731 : case INS_PROP_CAP_OBJECT_IMPRESS_ENABLE:
732 : case INS_PROP_CAP_OBJECT_IMPRESS_CATEGORY:
733 : case INS_PROP_CAP_OBJECT_IMPRESS_NUMBERING:
734 : case INS_PROP_CAP_OBJECT_IMPRESS_NUMBERINGSEPARATOR:
735 : case INS_PROP_CAP_OBJECT_IMPRESS_CAPTIONTEXT:
736 : case INS_PROP_CAP_OBJECT_IMPRESS_DELIMITER:
737 : case INS_PROP_CAP_OBJECT_IMPRESS_LEVEL:
738 : case INS_PROP_CAP_OBJECT_IMPRESS_POSITION:
739 : case INS_PROP_CAP_OBJECT_IMPRESS_CHARACTERSTYLE:
740 : case INS_PROP_CAP_OBJECT_IMPRESS_APPLYATTRIBUTES:
741 0 : if(pOLEImpressOpt)
742 0 : lcl_WriteOpt(*pOLEImpressOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_IMPRESS_ENABLE);
743 0 : break;
744 : case INS_PROP_CAP_OBJECT_CHART_ENABLE:
745 : case INS_PROP_CAP_OBJECT_CHART_CATEGORY:
746 : case INS_PROP_CAP_OBJECT_CHART_NUMBERING:
747 : case INS_PROP_CAP_OBJECT_CHART_NUMBERINGSEPARATOR:
748 : case INS_PROP_CAP_OBJECT_CHART_CAPTIONTEXT:
749 : case INS_PROP_CAP_OBJECT_CHART_DELIMITER:
750 : case INS_PROP_CAP_OBJECT_CHART_LEVEL:
751 : case INS_PROP_CAP_OBJECT_CHART_POSITION:
752 : case INS_PROP_CAP_OBJECT_CHART_CHARACTERSTYLE:
753 : case INS_PROP_CAP_OBJECT_CHART_APPLYATTRIBUTES:
754 0 : if(pOLEChartOpt)
755 0 : lcl_WriteOpt(*pOLEChartOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_CHART_ENABLE);
756 0 : break;
757 : case INS_PROP_CAP_OBJECT_FORMULA_ENABLE:
758 : case INS_PROP_CAP_OBJECT_FORMULA_CATEGORY:
759 : case INS_PROP_CAP_OBJECT_FORMULA_NUMBERING:
760 : case INS_PROP_CAP_OBJECT_FORMULA_NUMBERINGSEPARATOR:
761 : case INS_PROP_CAP_OBJECT_FORMULA_CAPTIONTEXT:
762 : case INS_PROP_CAP_OBJECT_FORMULA_DELIMITER:
763 : case INS_PROP_CAP_OBJECT_FORMULA_LEVEL:
764 : case INS_PROP_CAP_OBJECT_FORMULA_POSITION:
765 : case INS_PROP_CAP_OBJECT_FORMULA_CHARACTERSTYLE:
766 : case INS_PROP_CAP_OBJECT_FORMULA_APPLYATTRIBUTES:
767 0 : if(pOLEFormulaOpt)
768 0 : lcl_WriteOpt(*pOLEFormulaOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_FORMULA_ENABLE);
769 0 : break;
770 : case INS_PROP_CAP_OBJECT_DRAW_ENABLE:
771 : case INS_PROP_CAP_OBJECT_DRAW_CATEGORY:
772 : case INS_PROP_CAP_OBJECT_DRAW_NUMBERING:
773 : case INS_PROP_CAP_OBJECT_DRAW_NUMBERINGSEPARATOR:
774 : case INS_PROP_CAP_OBJECT_DRAW_CAPTIONTEXT:
775 : case INS_PROP_CAP_OBJECT_DRAW_DELIMITER:
776 : case INS_PROP_CAP_OBJECT_DRAW_LEVEL:
777 : case INS_PROP_CAP_OBJECT_DRAW_POSITION:
778 : case INS_PROP_CAP_OBJECT_DRAW_CHARACTERSTYLE:
779 : case INS_PROP_CAP_OBJECT_DRAW_APPLYATTRIBUTES:
780 0 : if(pOLEDrawOpt)
781 0 : lcl_WriteOpt(*pOLEDrawOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_DRAW_ENABLE);
782 0 : break;
783 : case INS_PROP_CAP_OBJECT_OLEMISC_ENABLE:
784 : case INS_PROP_CAP_OBJECT_OLEMISC_CATEGORY:
785 : case INS_PROP_CAP_OBJECT_OLEMISC_NUMBERING:
786 : case INS_PROP_CAP_OBJECT_OLEMISC_NUMBERINGSEPARATOR:
787 : case INS_PROP_CAP_OBJECT_OLEMISC_CAPTIONTEXT:
788 : case INS_PROP_CAP_OBJECT_OLEMISC_DELIMITER:
789 : case INS_PROP_CAP_OBJECT_OLEMISC_LEVEL:
790 : case INS_PROP_CAP_OBJECT_OLEMISC_POSITION:
791 : case INS_PROP_CAP_OBJECT_OLEMISC_CHARACTERSTYLE:
792 : case INS_PROP_CAP_OBJECT_OLEMISC_APPLYATTRIBUTES:
793 0 : if(pOLEMiscOpt)
794 0 : lcl_WriteOpt(*pOLEMiscOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_OLEMISC_ENABLE);
795 0 : break;
796 :
797 : }
798 : }
799 0 : PutProperties(aNames, aValues);
800 0 : }
801 :
802 4248 : static void lcl_ReadOpt(InsCaptionOpt& rOpt, const Any* pValues, sal_Int32 nProp, sal_Int32 nOffset)
803 : {
804 4248 : switch(nOffset)
805 : {
806 : case 0:
807 531 : rOpt.UseCaption() = *static_cast<sal_Bool const *>(pValues[nProp].getValue());
808 531 : break;//Enable
809 : case 1:
810 : {
811 531 : OUString sTemp; pValues[nProp] >>= sTemp;
812 531 : rOpt.SetCategory(sTemp);
813 : }
814 531 : break;//Category
815 : case 2:
816 : {
817 531 : sal_Int32 nTemp = 0;
818 531 : pValues[nProp] >>= nTemp;
819 531 : rOpt.SetNumType(sal::static_int_cast< sal_uInt16, sal_Int32>(nTemp));
820 : }
821 531 : break;//Numbering",
822 : case 3:
823 : {
824 531 : OUString sTemp; pValues[nProp] >>= sTemp;
825 531 : rOpt.SetNumSeparator(sTemp);
826 : }
827 531 : break;//NumberingSeparator",
828 : case 4:
829 : {
830 531 : OUString sTemp; pValues[nProp] >>= sTemp;
831 531 : rOpt.SetCaption(sTemp);
832 : }
833 531 : break;//CaptionText",
834 : case 5:
835 : {
836 531 : OUString sTemp;
837 531 : if(pValues[nProp] >>= sTemp)
838 531 : rOpt.SetSeparator(sTemp);
839 : }
840 531 : break;//Delimiter",
841 : case 6:
842 : {
843 531 : sal_Int32 nTemp = 0;
844 531 : pValues[nProp] >>= nTemp;
845 531 : rOpt.SetLevel(sal::static_int_cast< sal_uInt16, sal_Int32>(nTemp));
846 : }
847 531 : break;//Level",
848 : case 7:
849 : {
850 531 : sal_Int32 nTemp = 0;
851 531 : pValues[nProp] >>= nTemp;
852 531 : rOpt.SetPos(sal::static_int_cast< sal_uInt16, sal_Int32>(nTemp));
853 : }
854 531 : break;//Position",
855 : case 8 : //CharacterStyle
856 : {
857 0 : OUString sTemp; pValues[nProp] >>= sTemp;
858 0 : rOpt.SetCharacterStyle( sTemp );
859 : }
860 0 : break;
861 : case 9 : //ApplyAttributes
862 : {
863 0 : pValues[nProp] >>= rOpt.CopyAttributes();
864 : }
865 0 : break;
866 : }
867 4248 : }
868 :
869 118 : void SwInsertConfig::Load()
870 : {
871 118 : const Sequence<OUString>& aNames = GetPropertyNames();
872 118 : Sequence<Any> aValues = GetProperties(aNames);
873 118 : const Any* pValues = aValues.getConstArray();
874 : assert(aValues.getLength() == aNames.getLength());
875 118 : InsCaptionOpt* pWriterTableOpt = 0;
876 118 : InsCaptionOpt* pWriterFrameOpt = 0;
877 118 : InsCaptionOpt* pWriterGraphicOpt = 0;
878 118 : InsCaptionOpt* pOLECalcOpt = 0;
879 118 : InsCaptionOpt* pOLEImpressOpt = 0;
880 118 : InsCaptionOpt* pOLEChartOpt = 0;
881 118 : InsCaptionOpt* pOLEFormulaOpt = 0;
882 118 : InsCaptionOpt* pOLEDrawOpt = 0;
883 118 : if (pCapOptions)
884 : {
885 59 : pWriterTableOpt = pCapOptions->Find(TABLE_CAP, 0);
886 59 : pWriterFrameOpt = pCapOptions->Find(FRAME_CAP, 0);
887 59 : pWriterGraphicOpt = pCapOptions->Find(GRAPHIC_CAP, 0);
888 59 : pOLECalcOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_CALC]);
889 59 : pOLEImpressOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_IMPRESS]);
890 59 : pOLEDrawOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_DRAW ]);
891 59 : pOLEFormulaOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_MATH ]);
892 59 : pOLEChartOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_CHART ]);
893 : }
894 59 : else if (!bIsWeb)
895 118 : return;
896 :
897 118 : sal_uInt16 nInsTableFlags = 0;
898 5841 : for (sal_Int32 nProp = 0; nProp < aNames.getLength(); ++nProp)
899 : {
900 5723 : if (pValues[nProp].hasValue())
901 : {
902 4720 : bool bBool = nProp < INS_PROP_CAP_OBJECT_TABLE_ENABLE && *static_cast<sal_Bool const *>(pValues[nProp].getValue());
903 4720 : switch (nProp)
904 : {
905 : case INS_PROP_TABLE_HEADER:
906 : {
907 118 : if(bBool)
908 0 : nInsTableFlags|= tabopts::HEADLINE;
909 : }
910 118 : break;//"Table/Header",
911 : case INS_PROP_TABLE_REPEATHEADER:
912 : {
913 118 : aInsTableOpts.mnRowsToRepeat = bBool? 1 : 0;
914 :
915 : }
916 118 : break;//"Table/RepeatHeader",
917 : case INS_PROP_TABLE_BORDER:
918 : {
919 118 : if(bBool)
920 118 : nInsTableFlags|= tabopts::DEFAULT_BORDER;
921 : }
922 118 : break;//"Table/Border",
923 : case INS_PROP_TABLE_SPLIT:
924 : {
925 59 : if(bBool)
926 59 : nInsTableFlags|= tabopts::SPLIT_LAYOUT;
927 : }
928 59 : break;//"Table/Split",
929 : case INS_PROP_CAP_AUTOMATIC:
930 59 : bInsWithCaption = bBool;
931 59 : break;
932 0 : case INS_PROP_CAP_CAPTIONORDERNUMBERINGFIRST: bCaptionOrderNumberingFirst = bBool; break;
933 : case INS_PROP_CAP_OBJECT_TABLE_ENABLE:
934 : case INS_PROP_CAP_OBJECT_TABLE_CATEGORY:
935 : case INS_PROP_CAP_OBJECT_TABLE_NUMBERING:
936 : case INS_PROP_CAP_OBJECT_TABLE_NUMBERINGSEPARATOR:
937 : case INS_PROP_CAP_OBJECT_TABLE_CAPTIONTEXT:
938 : case INS_PROP_CAP_OBJECT_TABLE_DELIMITER:
939 : case INS_PROP_CAP_OBJECT_TABLE_LEVEL:
940 : case INS_PROP_CAP_OBJECT_TABLE_POSITION:
941 : case INS_PROP_CAP_OBJECT_TABLE_CHARACTERSTYLE:
942 472 : if(!pWriterTableOpt)
943 : {
944 59 : pWriterTableOpt = new InsCaptionOpt(TABLE_CAP);
945 59 : pCapOptions->Insert(pWriterTableOpt);
946 : }
947 472 : lcl_ReadOpt(*pWriterTableOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_TABLE_ENABLE);
948 472 : break;
949 : case INS_PROP_CAP_OBJECT_FRAME_ENABLE:
950 : case INS_PROP_CAP_OBJECT_FRAME_CATEGORY:
951 : case INS_PROP_CAP_OBJECT_FRAME_NUMBERING:
952 : case INS_PROP_CAP_OBJECT_FRAME_NUMBERINGSEPARATOR:
953 : case INS_PROP_CAP_OBJECT_FRAME_CAPTIONTEXT:
954 : case INS_PROP_CAP_OBJECT_FRAME_DELIMITER:
955 : case INS_PROP_CAP_OBJECT_FRAME_LEVEL:
956 : case INS_PROP_CAP_OBJECT_FRAME_POSITION:
957 : case INS_PROP_CAP_OBJECT_FRAME_CHARACTERSTYLE:
958 472 : if(!pWriterFrameOpt)
959 : {
960 59 : pWriterFrameOpt = new InsCaptionOpt(FRAME_CAP);
961 59 : pCapOptions->Insert(pWriterFrameOpt);
962 : }
963 472 : lcl_ReadOpt(*pWriterFrameOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_FRAME_ENABLE);
964 472 : break;
965 : case INS_PROP_CAP_OBJECT_GRAPHIC_ENABLE:
966 : case INS_PROP_CAP_OBJECT_GRAPHIC_CATEGORY:
967 : case INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERING:
968 : case INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERINGSEPARATOR:
969 : case INS_PROP_CAP_OBJECT_GRAPHIC_CAPTIONTEXT:
970 : case INS_PROP_CAP_OBJECT_GRAPHIC_DELIMITER:
971 : case INS_PROP_CAP_OBJECT_GRAPHIC_LEVEL:
972 : case INS_PROP_CAP_OBJECT_GRAPHIC_POSITION:
973 : case INS_PROP_CAP_OBJECT_GRAPHIC_CHARACTERSTYLE:
974 : case INS_PROP_CAP_OBJECT_GRAPHIC_APPLYATTRIBUTES:
975 472 : if(!pWriterGraphicOpt)
976 : {
977 59 : pWriterGraphicOpt = new InsCaptionOpt(GRAPHIC_CAP);
978 59 : pCapOptions->Insert(pWriterGraphicOpt);
979 : }
980 472 : lcl_ReadOpt(*pWriterGraphicOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_GRAPHIC_ENABLE);
981 472 : break;
982 : case INS_PROP_CAP_OBJECT_CALC_ENABLE:
983 : case INS_PROP_CAP_OBJECT_CALC_CATEGORY:
984 : case INS_PROP_CAP_OBJECT_CALC_NUMBERING:
985 : case INS_PROP_CAP_OBJECT_CALC_NUMBERINGSEPARATOR:
986 : case INS_PROP_CAP_OBJECT_CALC_CAPTIONTEXT:
987 : case INS_PROP_CAP_OBJECT_CALC_DELIMITER:
988 : case INS_PROP_CAP_OBJECT_CALC_LEVEL:
989 : case INS_PROP_CAP_OBJECT_CALC_POSITION:
990 : case INS_PROP_CAP_OBJECT_CALC_CHARACTERSTYLE:
991 : case INS_PROP_CAP_OBJECT_CALC_APPLYATTRIBUTES:
992 472 : if(!pOLECalcOpt)
993 : {
994 59 : pOLECalcOpt = new InsCaptionOpt(OLE_CAP, &aGlobalNames[GLOB_NAME_CALC]);
995 59 : pCapOptions->Insert(pOLECalcOpt);
996 : }
997 472 : lcl_ReadOpt(*pOLECalcOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_CALC_ENABLE);
998 472 : break;
999 : case INS_PROP_CAP_OBJECT_IMPRESS_ENABLE:
1000 : case INS_PROP_CAP_OBJECT_IMPRESS_CATEGORY:
1001 : case INS_PROP_CAP_OBJECT_IMPRESS_NUMBERING:
1002 : case INS_PROP_CAP_OBJECT_IMPRESS_NUMBERINGSEPARATOR:
1003 : case INS_PROP_CAP_OBJECT_IMPRESS_CAPTIONTEXT:
1004 : case INS_PROP_CAP_OBJECT_IMPRESS_DELIMITER:
1005 : case INS_PROP_CAP_OBJECT_IMPRESS_LEVEL:
1006 : case INS_PROP_CAP_OBJECT_IMPRESS_POSITION:
1007 : case INS_PROP_CAP_OBJECT_IMPRESS_CHARACTERSTYLE:
1008 : case INS_PROP_CAP_OBJECT_IMPRESS_APPLYATTRIBUTES:
1009 472 : if(!pOLEImpressOpt)
1010 : {
1011 59 : pOLEImpressOpt = new InsCaptionOpt(OLE_CAP, &aGlobalNames[GLOB_NAME_IMPRESS]);
1012 59 : pCapOptions->Insert(pOLEImpressOpt);
1013 : }
1014 472 : lcl_ReadOpt(*pOLEImpressOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_IMPRESS_ENABLE);
1015 472 : break;
1016 : case INS_PROP_CAP_OBJECT_CHART_ENABLE:
1017 : case INS_PROP_CAP_OBJECT_CHART_CATEGORY:
1018 : case INS_PROP_CAP_OBJECT_CHART_NUMBERING:
1019 : case INS_PROP_CAP_OBJECT_CHART_NUMBERINGSEPARATOR:
1020 : case INS_PROP_CAP_OBJECT_CHART_CAPTIONTEXT:
1021 : case INS_PROP_CAP_OBJECT_CHART_DELIMITER:
1022 : case INS_PROP_CAP_OBJECT_CHART_LEVEL:
1023 : case INS_PROP_CAP_OBJECT_CHART_POSITION:
1024 : case INS_PROP_CAP_OBJECT_CHART_CHARACTERSTYLE:
1025 : case INS_PROP_CAP_OBJECT_CHART_APPLYATTRIBUTES:
1026 472 : if(!pOLEChartOpt)
1027 : {
1028 59 : pOLEChartOpt = new InsCaptionOpt(OLE_CAP, &aGlobalNames[GLOB_NAME_CHART]);
1029 59 : pCapOptions->Insert(pOLEChartOpt);
1030 : }
1031 472 : lcl_ReadOpt(*pOLEChartOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_CHART_ENABLE);
1032 472 : break;
1033 : case INS_PROP_CAP_OBJECT_FORMULA_ENABLE:
1034 : case INS_PROP_CAP_OBJECT_FORMULA_CATEGORY:
1035 : case INS_PROP_CAP_OBJECT_FORMULA_NUMBERING:
1036 : case INS_PROP_CAP_OBJECT_FORMULA_NUMBERINGSEPARATOR:
1037 : case INS_PROP_CAP_OBJECT_FORMULA_CAPTIONTEXT:
1038 : case INS_PROP_CAP_OBJECT_FORMULA_DELIMITER:
1039 : case INS_PROP_CAP_OBJECT_FORMULA_LEVEL:
1040 : case INS_PROP_CAP_OBJECT_FORMULA_POSITION:
1041 : case INS_PROP_CAP_OBJECT_FORMULA_CHARACTERSTYLE:
1042 : case INS_PROP_CAP_OBJECT_FORMULA_APPLYATTRIBUTES:
1043 472 : if(!pOLEFormulaOpt)
1044 : {
1045 59 : pOLEFormulaOpt = new InsCaptionOpt(OLE_CAP, &aGlobalNames[GLOB_NAME_MATH]);
1046 59 : pCapOptions->Insert(pOLEFormulaOpt);
1047 : }
1048 472 : lcl_ReadOpt(*pOLEFormulaOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_FORMULA_ENABLE);
1049 472 : break;
1050 : case INS_PROP_CAP_OBJECT_DRAW_ENABLE:
1051 : case INS_PROP_CAP_OBJECT_DRAW_CATEGORY:
1052 : case INS_PROP_CAP_OBJECT_DRAW_NUMBERING:
1053 : case INS_PROP_CAP_OBJECT_DRAW_NUMBERINGSEPARATOR:
1054 : case INS_PROP_CAP_OBJECT_DRAW_CAPTIONTEXT:
1055 : case INS_PROP_CAP_OBJECT_DRAW_DELIMITER:
1056 : case INS_PROP_CAP_OBJECT_DRAW_LEVEL:
1057 : case INS_PROP_CAP_OBJECT_DRAW_POSITION:
1058 : case INS_PROP_CAP_OBJECT_DRAW_CHARACTERSTYLE:
1059 : case INS_PROP_CAP_OBJECT_DRAW_APPLYATTRIBUTES:
1060 472 : if(!pOLEDrawOpt)
1061 : {
1062 59 : pOLEDrawOpt = new InsCaptionOpt(OLE_CAP, &aGlobalNames[GLOB_NAME_DRAW]);
1063 59 : pCapOptions->Insert(pOLEDrawOpt);
1064 : }
1065 472 : lcl_ReadOpt(*pOLEDrawOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_DRAW_ENABLE);
1066 472 : break;
1067 : case INS_PROP_CAP_OBJECT_OLEMISC_ENABLE:
1068 : case INS_PROP_CAP_OBJECT_OLEMISC_CATEGORY:
1069 : case INS_PROP_CAP_OBJECT_OLEMISC_NUMBERING:
1070 : case INS_PROP_CAP_OBJECT_OLEMISC_NUMBERINGSEPARATOR:
1071 : case INS_PROP_CAP_OBJECT_OLEMISC_CAPTIONTEXT:
1072 : case INS_PROP_CAP_OBJECT_OLEMISC_DELIMITER:
1073 : case INS_PROP_CAP_OBJECT_OLEMISC_LEVEL:
1074 : case INS_PROP_CAP_OBJECT_OLEMISC_POSITION:
1075 : case INS_PROP_CAP_OBJECT_OLEMISC_CHARACTERSTYLE:
1076 : case INS_PROP_CAP_OBJECT_OLEMISC_APPLYATTRIBUTES:
1077 472 : if(!pOLEMiscOpt)
1078 : {
1079 59 : pOLEMiscOpt = new InsCaptionOpt(OLE_CAP);
1080 : }
1081 472 : lcl_ReadOpt(*pOLEMiscOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_OLEMISC_ENABLE);
1082 472 : break;
1083 : }
1084 : }
1085 1003 : else if (nProp == INS_PROP_CAP_CAPTIONORDERNUMBERINGFIRST)
1086 : {
1087 : //#i61007# initialize caption order, right now only HUNGARIAN seems to need a different order
1088 59 : SvtSysLocaleOptions aSysLocaleOptions;
1089 118 : OUString sLang = aSysLocaleOptions.GetLocaleConfigString();
1090 118 : bCaptionOrderNumberingFirst = sLang.startsWith( "hu" );
1091 : }
1092 :
1093 : }
1094 118 : aInsTableOpts.mnInsMode = nInsTableFlags;
1095 : }
1096 :
1097 118 : const Sequence<OUString>& SwTableConfig::GetPropertyNames()
1098 : {
1099 118 : const int nCount = 8;
1100 118 : static Sequence<OUString> aNames(nCount);
1101 : static const char* aPropNames[] =
1102 : {
1103 : "Shift/Row", // 0
1104 : "Shift/Column", // 1
1105 : "Insert/Row", // 2
1106 : "Insert/Column", // 3
1107 : "Change/Effect", // 4
1108 : "Input/NumberRecognition", // 5
1109 : "Input/NumberFormatRecognition",// 6
1110 : "Input/Alignment" // 7
1111 : };
1112 118 : OUString* pNames = aNames.getArray();
1113 1062 : for(int i = 0; i < nCount; i++)
1114 944 : pNames[i] = OUString::createFromAscii(aPropNames[i]);
1115 118 : return aNames;
1116 : }
1117 :
1118 118 : SwTableConfig::SwTableConfig(bool bWeb) :
1119 : ConfigItem(bWeb ? OUString("Office.WriterWeb/Table") : OUString("Office.Writer/Table"),
1120 118 : ConfigItemMode::DelayedUpdate|ConfigItemMode::ReleaseTree)
1121 : {
1122 118 : Load();
1123 118 : }
1124 :
1125 52 : SwTableConfig::~SwTableConfig()
1126 : {
1127 52 : }
1128 :
1129 0 : void SwTableConfig::Notify( const ::com::sun::star::uno::Sequence< OUString >& ) {}
1130 :
1131 0 : void SwTableConfig::ImplCommit()
1132 : {
1133 0 : const Sequence<OUString>& aNames = GetPropertyNames();
1134 0 : Sequence<Any> aValues(aNames.getLength());
1135 0 : Any* pValues = aValues.getArray();
1136 :
1137 0 : for(int nProp = 0; nProp < aNames.getLength(); nProp++)
1138 : {
1139 0 : switch(nProp)
1140 : {
1141 0 : case 0 : pValues[nProp] <<= (sal_Int32)convertTwipToMm100(nTableHMove); break; //"Shift/Row",
1142 0 : case 1 : pValues[nProp] <<= (sal_Int32)convertTwipToMm100(nTableVMove); break; //"Shift/Column",
1143 0 : case 2 : pValues[nProp] <<= (sal_Int32)convertTwipToMm100(nTableHInsert); break; //"Insert/Row",
1144 0 : case 3 : pValues[nProp] <<= (sal_Int32)convertTwipToMm100(nTableVInsert); break; //"Insert/Column",
1145 0 : case 4 : pValues[nProp] <<= (sal_Int32)eTableChgMode; break; //"Change/Effect",
1146 0 : case 5 : pValues[nProp] <<= bInsTableFormatNum; break; //"Input/NumberRecognition",
1147 0 : case 6 : pValues[nProp] <<= bInsTableChangeNumFormat; break; //"Input/NumberFormatRecognition",
1148 0 : case 7 : pValues[nProp] <<= bInsTableAlignNum; break; //"Input/Alignment"
1149 : }
1150 : }
1151 0 : PutProperties(aNames, aValues);
1152 0 : }
1153 :
1154 118 : void SwTableConfig::Load()
1155 : {
1156 118 : const Sequence<OUString>& aNames = GetPropertyNames();
1157 118 : Sequence<Any> aValues = GetProperties(aNames);
1158 118 : const Any* pValues = aValues.getConstArray();
1159 : assert(aValues.getLength() == aNames.getLength());
1160 1062 : for (sal_Int32 nProp = 0; nProp < aNames.getLength(); ++nProp)
1161 : {
1162 944 : if (pValues[nProp].hasValue())
1163 : {
1164 944 : sal_Int32 nTemp = 0;
1165 944 : switch (nProp)
1166 : {
1167 118 : case 0 : pValues[nProp] >>= nTemp; nTableHMove = (sal_uInt16)convertMm100ToTwip(nTemp); break; //"Shift/Row",
1168 118 : case 1 : pValues[nProp] >>= nTemp; nTableVMove = (sal_uInt16)convertMm100ToTwip(nTemp); break; //"Shift/Column",
1169 118 : case 2 : pValues[nProp] >>= nTemp; nTableHInsert = (sal_uInt16)convertMm100ToTwip(nTemp); break; //"Insert/Row",
1170 118 : case 3 : pValues[nProp] >>= nTemp; nTableVInsert = (sal_uInt16)convertMm100ToTwip(nTemp); break; //"Insert/Column",
1171 118 : case 4 : pValues[nProp] >>= nTemp; eTableChgMode = (TableChgMode)nTemp; break; //"Change/Effect",
1172 118 : case 5 : bInsTableFormatNum = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break; //"Input/NumberRecognition",
1173 118 : case 6 : bInsTableChangeNumFormat = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break; //"Input/NumberFormatRecognition",
1174 118 : case 7 : bInsTableAlignNum = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break; //"Input/Alignment"
1175 : }
1176 : }
1177 118 : }
1178 118 : }
1179 :
1180 59 : SwMiscConfig::SwMiscConfig() :
1181 : ConfigItem("Office.Writer",
1182 118 : ConfigItemMode::DelayedUpdate|ConfigItemMode::ReleaseTree),
1183 : bDefaultFontsInCurrDocOnly(false),
1184 : bShowIndexPreview(false),
1185 : bGrfToGalleryAsLnk(true),
1186 : bNumAlignSize(true),
1187 : bSinglePrintJob(false),
1188 : bIsNameFromColumn(true),
1189 : bAskForMailMergeInPrint(true),
1190 118 : nMailingFormats(MailTextFormats::NONE)
1191 : {
1192 59 : Load();
1193 59 : }
1194 :
1195 26 : SwMiscConfig::~SwMiscConfig()
1196 : {
1197 26 : }
1198 :
1199 60 : const Sequence<OUString>& SwMiscConfig::GetPropertyNames()
1200 : {
1201 60 : static Sequence<OUString> aNames;
1202 60 : if(!aNames.getLength())
1203 : {
1204 59 : const int nCount = 12;
1205 59 : aNames.realloc(nCount);
1206 : static const char* aPropNames[] =
1207 : {
1208 : "Statistics/WordNumber/Delimiter", // 0
1209 : "DefaultFont/Document", // 1
1210 : "Index/ShowPreview", // 2
1211 : "Misc/GraphicToGalleryAsLink", // 3
1212 : "Numbering/Graphic/KeepRatio", // 4
1213 : "FormLetter/PrintOutput/SinglePrintJobs", // 5
1214 : "FormLetter/MailingOutput/Format", // 6
1215 : "FormLetter/FileOutput/FileName/FromDatabaseField", // 7
1216 : "FormLetter/FileOutput/Path", // 8
1217 : "FormLetter/FileOutput/FileName/FromManualSetting", // 9
1218 : "FormLetter/FileOutput/FileName/Generation",//10
1219 : "FormLetter/PrintOutput/AskForMerge" //11
1220 : };
1221 59 : OUString* pNames = aNames.getArray();
1222 767 : for(int i = 0; i < nCount; i++)
1223 708 : pNames[i] = OUString::createFromAscii(aPropNames[i]);
1224 : }
1225 60 : return aNames;
1226 : }
1227 :
1228 0 : void SwMiscConfig::Notify( const ::com::sun::star::uno::Sequence< OUString >& ) {}
1229 :
1230 1 : void SwMiscConfig::ImplCommit()
1231 : {
1232 1 : const Sequence<OUString>& aNames = GetPropertyNames();
1233 1 : Sequence<Any> aValues(aNames.getLength());
1234 1 : Any* pValues = aValues.getArray();
1235 :
1236 13 : for(int nProp = 0; nProp < aNames.getLength(); nProp++)
1237 : {
1238 12 : switch(nProp)
1239 : {
1240 : case 0 :
1241 2 : pValues[nProp] <<=
1242 1 : SwModuleOptions::ConvertWordDelimiter(sWordDelimiter, false);
1243 1 : break;
1244 1 : case 1 : pValues[nProp] <<= bDefaultFontsInCurrDocOnly; break;
1245 1 : case 2 : pValues[nProp] <<= bShowIndexPreview; break;
1246 1 : case 3 : pValues[nProp] <<= bGrfToGalleryAsLnk; break;
1247 1 : case 4 : pValues[nProp] <<= bNumAlignSize; break;
1248 1 : case 5 : pValues[nProp] <<= bSinglePrintJob; break;
1249 1 : case 6 : pValues[nProp] <<= static_cast<sal_uInt8>(nMailingFormats); break;
1250 1 : case 7 : pValues[nProp] <<= sNameFromColumn; break;
1251 1 : case 8 : pValues[nProp] <<= sMailingPath; break;
1252 1 : case 9 : pValues[nProp] <<= sMailName; break;
1253 1 : case 10: pValues[nProp] <<= bIsNameFromColumn; break;
1254 1 : case 11: pValues[nProp] <<= bAskForMailMergeInPrint; break;
1255 : }
1256 : }
1257 1 : PutProperties(aNames, aValues);
1258 1 : }
1259 :
1260 59 : void SwMiscConfig::Load()
1261 : {
1262 59 : const Sequence<OUString>& aNames = GetPropertyNames();
1263 59 : Sequence<Any> aValues = GetProperties(aNames);
1264 59 : const Any* pValues = aValues.getConstArray();
1265 : assert(aValues.getLength() == aNames.getLength());
1266 118 : OUString sTmp;
1267 767 : for (sal_Int32 nProp = 0; nProp < aNames.getLength(); ++nProp)
1268 : {
1269 708 : if (pValues[nProp].hasValue())
1270 : {
1271 472 : switch (nProp)
1272 : {
1273 59 : case 0 : pValues[nProp] >>= sTmp;
1274 59 : sWordDelimiter = SwModuleOptions::ConvertWordDelimiter(sTmp, true);
1275 59 : break;
1276 59 : case 1 : bDefaultFontsInCurrDocOnly = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
1277 59 : case 2 : bShowIndexPreview = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
1278 59 : case 3 : bGrfToGalleryAsLnk = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
1279 59 : case 4 : bNumAlignSize = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
1280 59 : case 5 : bSinglePrintJob = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
1281 0 : case 6 : nMailingFormats = static_cast<MailTextFormats>(*static_cast<sal_uInt8 const *>(pValues[nProp].getValue())); break;
1282 0 : case 7 : pValues[nProp] >>= sTmp; sNameFromColumn = sTmp; break;
1283 59 : case 8 : pValues[nProp] >>= sTmp; sMailingPath = sTmp; break;
1284 0 : case 9 : pValues[nProp] >>= sTmp; sMailName = sTmp; break;
1285 0 : case 10: bIsNameFromColumn = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
1286 59 : case 11: pValues[nProp] >>= bAskForMailMergeInPrint; break;
1287 : }
1288 : }
1289 59 : }
1290 59 : }
1291 :
1292 60 : const Sequence<OUString>& SwCompareConfig::GetPropertyNames()
1293 : {
1294 60 : static Sequence<OUString> aNames;
1295 60 : if(!aNames.getLength())
1296 : {
1297 59 : const int nCount = 5;
1298 59 : aNames.realloc(nCount);
1299 : static const char* aPropNames[] =
1300 : {
1301 : "Mode", // 0
1302 : "UseRSID", // 1
1303 : "IgnorePieces", // 2
1304 : "IgnoreLength", // 3
1305 : "StoreRSID" // 4
1306 : };
1307 59 : OUString* pNames = aNames.getArray();
1308 354 : for(int i = 0; i < nCount; i++)
1309 295 : pNames[i] = OUString::createFromAscii(aPropNames[i]);
1310 : }
1311 60 : return aNames;
1312 : }
1313 :
1314 59 : SwCompareConfig::SwCompareConfig() :
1315 : ConfigItem("Office.Writer/Comparison",
1316 118 : ConfigItemMode::DelayedUpdate|ConfigItemMode::ReleaseTree)
1317 118 : ,m_bStoreRsid(true)
1318 : {
1319 59 : eCmpMode = SVX_CMP_AUTO;
1320 59 : bUseRsid = false;
1321 59 : bIgnorePieces = false;
1322 59 : nPieceLen = 1;
1323 :
1324 59 : Load();
1325 59 : }
1326 :
1327 26 : SwCompareConfig::~SwCompareConfig()
1328 : {
1329 26 : }
1330 :
1331 1 : void SwCompareConfig::ImplCommit()
1332 : {
1333 1 : const Sequence<OUString>& aNames = GetPropertyNames();
1334 1 : Sequence<Any> aValues(aNames.getLength());
1335 1 : Any* pValues = aValues.getArray();
1336 :
1337 1 : pValues[0] <<= (sal_Int32) eCmpMode;
1338 1 : pValues[1] <<= bUseRsid;
1339 1 : pValues[2] <<= bIgnorePieces;
1340 1 : pValues[3] <<= (sal_Int32) nPieceLen;
1341 1 : pValues[4] <<= m_bStoreRsid;
1342 :
1343 1 : PutProperties(aNames, aValues);
1344 1 : }
1345 :
1346 59 : void SwCompareConfig::Load()
1347 : {
1348 59 : const Sequence<OUString>& aNames = GetPropertyNames();
1349 59 : Sequence<Any> aValues = GetProperties(aNames);
1350 59 : const Any* pValues = aValues.getConstArray();
1351 : assert(aValues.getLength() == aNames.getLength());
1352 354 : for (sal_Int32 nProp = 0; nProp < aNames.getLength(); nProp++)
1353 : {
1354 295 : if (pValues[nProp].hasValue())
1355 : {
1356 0 : sal_Int32 nVal = 0;
1357 0 : pValues[nProp] >>= nVal;
1358 :
1359 0 : switch(nProp)
1360 : {
1361 0 : case 0 : eCmpMode = (SvxCompareMode) nVal; break;;
1362 0 : case 1 : bUseRsid = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
1363 0 : case 2 : bIgnorePieces = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
1364 0 : case 3 : nPieceLen = nVal; break;
1365 0 : case 4 : m_bStoreRsid = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
1366 : }
1367 : }
1368 59 : }
1369 236 : }
1370 :
1371 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|