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