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