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 0 : InsCaptionOpt* InsCaptionOptArr::Find(const SwCapObjType eType, const SvGlobalName *pOleId)
50 : {
51 0 : 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 0 : return NULL;
59 : }
60 :
61 0 : void InsCaptionOptArr::Insert(InsCaptionOpt* pObj)
62 : {
63 0 : m_aInsCapOptArr.push_back(pObj); //takes ownership
64 0 : }
65 :
66 0 : const InsCaptionOpt* SwModuleOptions::GetCapOption(
67 : sal_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 : sal_Bool SwModuleOptions::SetCapOption(sal_Bool bHTML, const InsCaptionOpt* pOpt)
89 : {
90 0 : sal_Bool bRet = sal_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 && &pOpt->GetOleId())
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 = sal_True;
124 : }
125 :
126 0 : return bRet;
127 : }
128 :
129 0 : SwModuleOptions::SwModuleOptions() :
130 : aInsertConfig(sal_False),
131 : aWebInsertConfig(sal_True),
132 : aTableConfig(sal_False),
133 : aWebTableConfig(sal_True),
134 0 : bHideFieldTips(sal_False)
135 : {
136 0 : }
137 :
138 0 : OUString SwModuleOptions::ConvertWordDelimiter(const OUString& rDelim, sal_Bool bFromUI)
139 : {
140 0 : OUString sReturn;
141 0 : const sal_Int32 nDelimLen = rDelim.getLength();
142 0 : if(bFromUI)
143 : {
144 0 : for (sal_Int32 i = 0; i < nDelimLen; )
145 : {
146 0 : const sal_Unicode c = rDelim[i++];
147 :
148 0 : if (c == '\\' && i < nDelimLen )
149 : {
150 0 : switch (rDelim[i++])
151 : {
152 0 : case 'n': sReturn += "\n"; break;
153 0 : case 't': sReturn += "\t"; break;
154 0 : case '\\': sReturn += "\\"; break;
155 :
156 : case 'x':
157 : {
158 0 : sal_Unicode nChar = 0;
159 0 : bool bValidData = true;
160 0 : for( sal_Int32 n = 0; n < 2 && i < nDelimLen; ++n, ++i )
161 : {
162 0 : sal_Unicode nVal = rDelim[i];
163 0 : if( (nVal >= '0') && ( nVal <= '9') )
164 0 : nVal -= '0';
165 0 : else if( (nVal >= 'A') && (nVal <= 'F') )
166 0 : nVal -= 'A' - 10;
167 0 : else if( (nVal >= 'a') && (nVal <= 'f') )
168 0 : nVal -= 'a' - 10;
169 : else
170 : {
171 : OSL_FAIL("wrong hex value" );
172 0 : bValidData = false;
173 0 : break;
174 : }
175 :
176 0 : nChar <<= 4;
177 0 : nChar += nVal;
178 : }
179 0 : if( bValidData )
180 0 : sReturn += OUString(nChar);
181 0 : break;
182 : }
183 :
184 : default: // Unknown, so insert backslash
185 0 : sReturn += "\\";
186 0 : i--;
187 0 : break;
188 0 : }
189 : }
190 : else
191 0 : sReturn += OUString(c);
192 : }
193 : }
194 : else
195 : {
196 0 : for (sal_Int32 i = 0; i < nDelimLen; ++i)
197 : {
198 0 : const sal_Unicode c = rDelim[i];
199 :
200 0 : switch (c)
201 : {
202 0 : case '\n': sReturn += "\\n"; break;
203 0 : case '\t': sReturn += "\\t"; break;
204 0 : case '\\': sReturn += "\\\\"; break;
205 :
206 : default:
207 0 : if( c <= 0x1f || c >= 0x7f )
208 : {
209 0 : sReturn += "\\x" + OUString::number( c, 16 );
210 : }
211 : else
212 : {
213 0 : sReturn += OUString(c);
214 : }
215 : }
216 : }
217 : }
218 0 : return sReturn;
219 : }
220 :
221 0 : const Sequence<OUString>& SwRevisionConfig::GetPropertyNames()
222 : {
223 0 : static Sequence<OUString> aNames;
224 0 : if(!aNames.getLength())
225 : {
226 0 : const int nCount = 8;
227 0 : 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 0 : OUString* pNames = aNames.getArray();
240 0 : for(int i = 0; i < nCount; i++)
241 0 : pNames[i] = OUString::createFromAscii(aPropNames[i]);
242 : }
243 0 : return aNames;
244 : }
245 :
246 0 : SwRevisionConfig::SwRevisionConfig() :
247 : ConfigItem("Office.Writer/Revision",
248 0 : CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE)
249 : {
250 0 : aInsertAttr.nItemId = SID_ATTR_CHAR_UNDERLINE;
251 0 : aInsertAttr.nAttr = UNDERLINE_SINGLE;
252 0 : aInsertAttr.nColor = COL_TRANSPARENT;
253 0 : aDeletedAttr.nItemId = SID_ATTR_CHAR_STRIKEOUT;
254 0 : aDeletedAttr.nAttr = STRIKEOUT_SINGLE;
255 0 : aDeletedAttr.nColor = COL_TRANSPARENT;
256 0 : aFormatAttr.nItemId = SID_ATTR_CHAR_WEIGHT;
257 0 : aFormatAttr.nAttr = WEIGHT_BOLD;
258 0 : aFormatAttr.nColor = COL_BLACK;
259 :
260 0 : Load();
261 0 : }
262 :
263 0 : SwRevisionConfig::~SwRevisionConfig()
264 : {
265 0 : }
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 0 : static void lcl_ConvertCfgToAttr(sal_Int32 nVal, AuthorCharAttr& rAttr, bool bDelete = false)
320 : {
321 0 : rAttr.nItemId = rAttr.nAttr = 0;
322 0 : switch(nVal)
323 : {
324 0 : 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 0 : case 3: if(bDelete)
327 : {
328 0 : rAttr.nItemId = SID_ATTR_CHAR_STRIKEOUT;
329 0 : rAttr.nAttr = STRIKEOUT_SINGLE;
330 : }
331 : else
332 : {
333 0 : rAttr.nItemId = SID_ATTR_CHAR_UNDERLINE;
334 0 : rAttr.nAttr = UNDERLINE_SINGLE;
335 : }
336 0 : 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 0 : }
345 0 : void SwRevisionConfig::Load()
346 : {
347 0 : const Sequence<OUString>& aNames = GetPropertyNames();
348 0 : Sequence<Any> aValues = GetProperties(aNames);
349 0 : const Any* pValues = aValues.getConstArray();
350 : OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
351 0 : if(aValues.getLength() == aNames.getLength())
352 : {
353 0 : for(int nProp = 0; nProp < aNames.getLength(); nProp++)
354 : {
355 0 : if(pValues[nProp].hasValue())
356 : {
357 0 : sal_Int32 nVal = 0;
358 0 : pValues[nProp] >>= nVal;
359 0 : switch(nProp)
360 : {
361 0 : case 0 : lcl_ConvertCfgToAttr(nVal, aInsertAttr); break;
362 0 : case 1 : aInsertAttr.nColor = nVal; break;
363 0 : case 2 : lcl_ConvertCfgToAttr(nVal, aDeletedAttr, true); break;
364 0 : case 3 : aDeletedAttr.nColor = nVal; break;
365 0 : case 4 : lcl_ConvertCfgToAttr(nVal, aFormatAttr); break;
366 0 : case 5 : aFormatAttr.nColor = nVal; break;
367 0 : case 6 : nMarkAlign = sal::static_int_cast< sal_uInt16, sal_Int32>(nVal); break;
368 0 : case 7 : aMarkColor.SetColor(nVal); break;
369 : }
370 : }
371 : }
372 0 : }
373 0 : }
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 0 : const Sequence<OUString>& SwInsertConfig::GetPropertyNames()
473 : {
474 0 : static Sequence<OUString> aNames;
475 0 : static Sequence<OUString> aWebNames;
476 0 : 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 0 : const int nCount = INS_PROP_CAP_OBJECT_OLEMISC_APPLYATTRIBUTES + 1;
576 0 : const int nWebCount = INS_PROP_TABLE_BORDER + 1;
577 0 : aNames.realloc(nCount);
578 0 : aWebNames.realloc(nWebCount);
579 0 : OUString* pNames = aNames.getArray();
580 0 : OUString* pWebNames = aWebNames.getArray();
581 : int i;
582 0 : for(i = 0; i < nCount; i++)
583 0 : pNames[i] = OUString::createFromAscii(aPropNames[i]);
584 0 : for(i = 0; i < nWebCount; i++)
585 0 : pWebNames[i] = OUString::createFromAscii(aPropNames[i]);
586 : }
587 0 : return bIsWeb ? aWebNames : aNames;
588 : }
589 :
590 0 : SwInsertConfig::SwInsertConfig(sal_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( sal_False ),
596 : bCaptionOrderNumberingFirst( sal_False ),
597 : aInsTblOpts(0,0),
598 0 : bIsWeb(bWeb)
599 : {
600 0 : aGlobalNames[GLOB_NAME_CALC ] = SvGlobalName(SO3_SC_CLASSID);
601 0 : aGlobalNames[GLOB_NAME_IMPRESS] = SvGlobalName(SO3_SIMPRESS_CLASSID);
602 0 : aGlobalNames[GLOB_NAME_DRAW ] = SvGlobalName(SO3_SDRAW_CLASSID);
603 0 : aGlobalNames[GLOB_NAME_MATH ] = SvGlobalName(SO3_SM_CLASSID);
604 0 : aGlobalNames[GLOB_NAME_CHART ] = SvGlobalName(SO3_SCH_CLASSID);
605 0 : if(!bIsWeb)
606 0 : pCapOptions = new InsCaptionOptArr;
607 :
608 0 : Load();
609 0 : }
610 :
611 0 : SwInsertConfig::~SwInsertConfig()
612 : {
613 0 : delete pCapOptions;
614 0 : delete pOLEMiscOpt;
615 0 : }
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 0 : static void lcl_ReadOpt(InsCaptionOpt& rOpt, const Any* pValues, sal_Int32 nProp, sal_Int32 nOffset)
818 : {
819 0 : switch(nOffset)
820 : {
821 : case 0:
822 0 : rOpt.UseCaption() = *(sal_Bool*)pValues[nProp].getValue();
823 0 : break;//Enable
824 : case 1:
825 : {
826 0 : OUString sTemp; pValues[nProp] >>= sTemp;
827 0 : rOpt.SetCategory(sTemp);
828 : }
829 0 : break;//Category
830 : case 2:
831 : {
832 0 : sal_Int32 nTemp = 0;
833 0 : pValues[nProp] >>= nTemp;
834 0 : rOpt.SetNumType(sal::static_int_cast< sal_uInt16, sal_Int32>(nTemp));
835 : }
836 0 : break;//Numbering",
837 : case 3:
838 : {
839 0 : OUString sTemp; pValues[nProp] >>= sTemp;
840 0 : rOpt.SetNumSeparator(sTemp);
841 : }
842 0 : break;//NumberingSeparator",
843 : case 4:
844 : {
845 0 : OUString sTemp; pValues[nProp] >>= sTemp;
846 0 : rOpt.SetCaption(sTemp);
847 : }
848 0 : break;//CaptionText",
849 : case 5:
850 : {
851 0 : OUString sTemp;
852 0 : if(pValues[nProp] >>= sTemp)
853 0 : rOpt.SetSeparator(sTemp);
854 : }
855 0 : break;//Delimiter",
856 : case 6:
857 : {
858 0 : sal_Int32 nTemp = 0;
859 0 : pValues[nProp] >>= nTemp;
860 0 : rOpt.SetLevel(sal::static_int_cast< sal_uInt16, sal_Int32>(nTemp));
861 : }
862 0 : break;//Level",
863 : case 7:
864 : {
865 0 : sal_Int32 nTemp = 0;
866 0 : pValues[nProp] >>= nTemp;
867 0 : rOpt.SetPos(sal::static_int_cast< sal_uInt16, sal_Int32>(nTemp));
868 : }
869 0 : 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 0 : }
883 :
884 0 : void SwInsertConfig::Load()
885 : {
886 0 : const Sequence<OUString>& aNames = GetPropertyNames();
887 0 : Sequence<Any> aValues = GetProperties(aNames);
888 0 : const Any* pValues = aValues.getConstArray();
889 : OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
890 0 : if(aValues.getLength() == aNames.getLength())
891 : {
892 0 : InsCaptionOpt* pWriterTableOpt = 0;
893 0 : InsCaptionOpt* pWriterFrameOpt = 0;
894 0 : InsCaptionOpt* pWriterGraphicOpt = 0;
895 0 : InsCaptionOpt* pOLECalcOpt = 0;
896 0 : InsCaptionOpt* pOLEImpressOpt = 0;
897 0 : InsCaptionOpt* pOLEChartOpt = 0;
898 0 : InsCaptionOpt* pOLEFormulaOpt = 0;
899 0 : InsCaptionOpt* pOLEDrawOpt = 0;
900 0 : if(pCapOptions)
901 : {
902 0 : pWriterTableOpt = pCapOptions->Find(TABLE_CAP, 0);
903 0 : pWriterFrameOpt = pCapOptions->Find(FRAME_CAP, 0);
904 0 : pWriterGraphicOpt = pCapOptions->Find(GRAPHIC_CAP, 0);
905 0 : pOLECalcOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_CALC]);
906 0 : pOLEImpressOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_IMPRESS]);
907 0 : pOLEDrawOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_DRAW ]);
908 0 : pOLEFormulaOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_MATH ]);
909 0 : pOLEChartOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_CHART ]);
910 : }
911 0 : else if(!bIsWeb)
912 0 : return;
913 :
914 0 : sal_uInt16 nInsTblFlags = 0;
915 0 : for(int nProp = 0; nProp < aNames.getLength(); nProp++)
916 : {
917 0 : if(pValues[nProp].hasValue())
918 : {
919 0 : sal_Bool bBool = nProp < INS_PROP_CAP_OBJECT_TABLE_ENABLE ? *(sal_Bool*)pValues[nProp].getValue() : sal_False;
920 0 : switch(nProp)
921 : {
922 : case INS_PROP_TABLE_HEADER:
923 : {
924 0 : if(bBool)
925 0 : nInsTblFlags|= tabopts::HEADLINE;
926 : }
927 0 : break;//"Table/Header",
928 : case INS_PROP_TABLE_REPEATHEADER:
929 : {
930 0 : aInsTblOpts.mnRowsToRepeat = bBool? 1 : 0;
931 :
932 : }
933 0 : break;//"Table/RepeatHeader",
934 : case INS_PROP_TABLE_BORDER:
935 : {
936 0 : if(bBool)
937 0 : nInsTblFlags|= tabopts::DEFAULT_BORDER;
938 : }
939 0 : break;//"Table/Border",
940 : case INS_PROP_TABLE_SPLIT:
941 : {
942 0 : if(bBool)
943 0 : nInsTblFlags|= tabopts::SPLIT_LAYOUT;
944 : }
945 0 : break;//"Table/Split",
946 : case INS_PROP_CAP_AUTOMATIC:
947 0 : bInsWithCaption = bBool;
948 0 : 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 0 : if(!pWriterTableOpt)
960 : {
961 0 : pWriterTableOpt = new InsCaptionOpt(TABLE_CAP);
962 0 : pCapOptions->Insert(pWriterTableOpt);
963 : }
964 0 : lcl_ReadOpt(*pWriterTableOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_TABLE_ENABLE);
965 0 : 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 0 : if(!pWriterFrameOpt)
976 : {
977 0 : pWriterFrameOpt = new InsCaptionOpt(FRAME_CAP);
978 0 : pCapOptions->Insert(pWriterFrameOpt);
979 : }
980 0 : lcl_ReadOpt(*pWriterFrameOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_FRAME_ENABLE);
981 0 : 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 0 : if(!pWriterGraphicOpt)
993 : {
994 0 : pWriterGraphicOpt = new InsCaptionOpt(GRAPHIC_CAP);
995 0 : pCapOptions->Insert(pWriterGraphicOpt);
996 : }
997 0 : lcl_ReadOpt(*pWriterGraphicOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_GRAPHIC_ENABLE);
998 0 : 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 0 : if(!pOLECalcOpt)
1010 : {
1011 0 : pOLECalcOpt = new InsCaptionOpt(OLE_CAP, &aGlobalNames[GLOB_NAME_CALC]);
1012 0 : pCapOptions->Insert(pOLECalcOpt);
1013 : }
1014 0 : lcl_ReadOpt(*pOLECalcOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_CALC_ENABLE);
1015 0 : 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 0 : if(!pOLEImpressOpt)
1027 : {
1028 0 : pOLEImpressOpt = new InsCaptionOpt(OLE_CAP, &aGlobalNames[GLOB_NAME_IMPRESS]);
1029 0 : pCapOptions->Insert(pOLEImpressOpt);
1030 : }
1031 0 : lcl_ReadOpt(*pOLEImpressOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_IMPRESS_ENABLE);
1032 0 : 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 0 : if(!pOLEChartOpt)
1044 : {
1045 0 : pOLEChartOpt = new InsCaptionOpt(OLE_CAP, &aGlobalNames[GLOB_NAME_CHART]);
1046 0 : pCapOptions->Insert(pOLEChartOpt);
1047 : }
1048 0 : lcl_ReadOpt(*pOLEChartOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_CHART_ENABLE);
1049 0 : 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 0 : if(!pOLEFormulaOpt)
1061 : {
1062 0 : pOLEFormulaOpt = new InsCaptionOpt(OLE_CAP, &aGlobalNames[GLOB_NAME_MATH]);
1063 0 : pCapOptions->Insert(pOLEFormulaOpt);
1064 : }
1065 0 : lcl_ReadOpt(*pOLEFormulaOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_FORMULA_ENABLE);
1066 0 : 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 0 : if(!pOLEDrawOpt)
1078 : {
1079 0 : pOLEDrawOpt = new InsCaptionOpt(OLE_CAP, &aGlobalNames[GLOB_NAME_DRAW]);
1080 0 : pCapOptions->Insert(pOLEDrawOpt);
1081 : }
1082 0 : lcl_ReadOpt(*pOLEDrawOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_DRAW_ENABLE);
1083 0 : 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 0 : if(!pOLEMiscOpt)
1095 : {
1096 0 : pOLEMiscOpt = new InsCaptionOpt(OLE_CAP);
1097 : }
1098 0 : lcl_ReadOpt(*pOLEMiscOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_OLEMISC_ENABLE);
1099 0 : break;
1100 : }
1101 : }
1102 0 : else if(nProp == INS_PROP_CAP_CAPTIONORDERNUMBERINGFIRST)
1103 : {
1104 : //#i61007# initialize caption order, right now only HUNGARIAN seems to need a different order
1105 0 : SvtSysLocaleOptions aSysLocaleOptions;
1106 0 : OUString sLang = aSysLocaleOptions.GetLocaleConfigString();
1107 0 : bCaptionOrderNumberingFirst = ( !sLang.isEmpty() && sLang.matchAsciiL( "hu", 2 )) ? sal_True : sal_False;
1108 : }
1109 :
1110 : }
1111 0 : aInsTblOpts.mnInsMode = nInsTblFlags;
1112 0 : }
1113 : }
1114 :
1115 0 : const Sequence<OUString>& SwTableConfig::GetPropertyNames()
1116 : {
1117 0 : const int nCount = 8;
1118 0 : 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 0 : OUString* pNames = aNames.getArray();
1131 0 : for(int i = 0; i < nCount; i++)
1132 0 : pNames[i] = OUString::createFromAscii(aPropNames[i]);
1133 0 : return aNames;
1134 : }
1135 :
1136 0 : SwTableConfig::SwTableConfig(sal_Bool bWeb) :
1137 : ConfigItem(bWeb ? OUString("Office.WriterWeb/Table") : OUString("Office.Writer/Table"),
1138 0 : CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE)
1139 : {
1140 0 : Load();
1141 0 : }
1142 :
1143 0 : SwTableConfig::~SwTableConfig()
1144 : {
1145 0 : }
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 0 : void SwTableConfig::Load()
1174 : {
1175 0 : const Sequence<OUString>& aNames = GetPropertyNames();
1176 0 : Sequence<Any> aValues = GetProperties(aNames);
1177 0 : const Any* pValues = aValues.getConstArray();
1178 : OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
1179 0 : if(aValues.getLength() == aNames.getLength())
1180 : {
1181 0 : for(int nProp = 0; nProp < aNames.getLength(); nProp++)
1182 : {
1183 0 : if(pValues[nProp].hasValue())
1184 : {
1185 0 : sal_Int32 nTemp = 0;
1186 0 : switch(nProp)
1187 : {
1188 0 : case 0 : pValues[nProp] >>= nTemp; nTblHMove = (sal_uInt16)convertMm100ToTwip(nTemp); break; //"Shift/Row",
1189 0 : case 1 : pValues[nProp] >>= nTemp; nTblVMove = (sal_uInt16)convertMm100ToTwip(nTemp); break; //"Shift/Column",
1190 0 : case 2 : pValues[nProp] >>= nTemp; nTblHInsert = (sal_uInt16)convertMm100ToTwip(nTemp); break; //"Insert/Row",
1191 0 : case 3 : pValues[nProp] >>= nTemp; nTblVInsert = (sal_uInt16)convertMm100ToTwip(nTemp); break; //"Insert/Column",
1192 0 : case 4 : pValues[nProp] >>= nTemp; eTblChgMode = (TblChgMode)nTemp; break; //"Change/Effect",
1193 0 : case 5 : bInsTblFormatNum = *(sal_Bool*)pValues[nProp].getValue(); break; //"Input/NumberRecognition",
1194 0 : case 6 : bInsTblChangeNumFormat = *(sal_Bool*)pValues[nProp].getValue(); break; //"Input/NumberFormatRecognition",
1195 0 : case 7 : bInsTblAlignNum = *(sal_Bool*)pValues[nProp].getValue(); break; //"Input/Alignment"
1196 : }
1197 : }
1198 : }
1199 0 : }
1200 0 : }
1201 :
1202 0 : SwMiscConfig::SwMiscConfig() :
1203 : ConfigItem("Office.Writer",
1204 : CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE),
1205 : bDefaultFontsInCurrDocOnly(sal_False),
1206 : bShowIndexPreview(sal_False),
1207 : bGrfToGalleryAsLnk(sal_True),
1208 : bNumAlignSize(sal_True),
1209 : bSinglePrintJob(sal_False),
1210 : bIsNameFromColumn(sal_True),
1211 : bAskForMailMergeInPrint(sal_True),
1212 0 : nMailingFormats(0)
1213 : {
1214 0 : Load();
1215 0 : }
1216 :
1217 0 : SwMiscConfig::~SwMiscConfig()
1218 : {
1219 0 : }
1220 :
1221 0 : const Sequence<OUString>& SwMiscConfig::GetPropertyNames()
1222 : {
1223 0 : static Sequence<OUString> aNames;
1224 0 : if(!aNames.getLength())
1225 : {
1226 0 : const int nCount = 12;
1227 0 : 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 0 : OUString* pNames = aNames.getArray();
1244 0 : for(int i = 0; i < nCount; i++)
1245 0 : pNames[i] = OUString::createFromAscii(aPropNames[i]);
1246 : }
1247 0 : return aNames;
1248 : }
1249 :
1250 0 : void SwMiscConfig::Notify( const ::com::sun::star::uno::Sequence< OUString >& ) {}
1251 :
1252 0 : void SwMiscConfig::Commit()
1253 : {
1254 0 : const Sequence<OUString>& aNames = GetPropertyNames();
1255 0 : Sequence<Any> aValues(aNames.getLength());
1256 0 : Any* pValues = aValues.getArray();
1257 :
1258 0 : const Type& rType = ::getBooleanCppuType();
1259 0 : for(int nProp = 0; nProp < aNames.getLength(); nProp++)
1260 : {
1261 0 : switch(nProp)
1262 : {
1263 : case 0 :
1264 0 : pValues[nProp] <<=
1265 0 : SwModuleOptions::ConvertWordDelimiter(sWordDelimiter, sal_False);
1266 0 : break;
1267 0 : case 1 : pValues[nProp].setValue(&bDefaultFontsInCurrDocOnly, rType); break;
1268 0 : case 2 : pValues[nProp].setValue(&bShowIndexPreview, rType) ; break;
1269 0 : case 3 : pValues[nProp].setValue(&bGrfToGalleryAsLnk, rType); break;
1270 0 : case 4 : pValues[nProp].setValue(&bNumAlignSize, rType); break;
1271 0 : case 5 : pValues[nProp].setValue(&bSinglePrintJob, rType); break;
1272 0 : case 6 : pValues[nProp] <<= nMailingFormats; break;
1273 0 : case 7 : pValues[nProp] <<= sNameFromColumn; break;
1274 0 : case 8 : pValues[nProp] <<= sMailingPath; break;
1275 0 : case 9 : pValues[nProp] <<= sMailName; break;
1276 0 : case 10: pValues[nProp].setValue(&bIsNameFromColumn, rType);break;
1277 0 : case 11: pValues[nProp] <<= bAskForMailMergeInPrint; break;
1278 : }
1279 : }
1280 0 : PutProperties(aNames, aValues);
1281 0 : }
1282 :
1283 0 : void SwMiscConfig::Load()
1284 : {
1285 0 : const Sequence<OUString>& aNames = GetPropertyNames();
1286 0 : Sequence<Any> aValues = GetProperties(aNames);
1287 0 : const Any* pValues = aValues.getConstArray();
1288 : OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
1289 0 : if(aValues.getLength() == aNames.getLength())
1290 : {
1291 0 : OUString sTmp;
1292 0 : for(int nProp = 0; nProp < aNames.getLength(); nProp++)
1293 : {
1294 0 : if(pValues[nProp].hasValue())
1295 : {
1296 0 : switch(nProp)
1297 : {
1298 0 : case 0 : pValues[nProp] >>= sTmp;
1299 0 : sWordDelimiter = SwModuleOptions::ConvertWordDelimiter(sTmp, sal_True);
1300 0 : break;
1301 0 : case 1 : bDefaultFontsInCurrDocOnly = *(sal_Bool*)pValues[nProp].getValue(); break;
1302 0 : case 2 : bShowIndexPreview = *(sal_Bool*)pValues[nProp].getValue(); break;
1303 0 : case 3 : bGrfToGalleryAsLnk = *(sal_Bool*)pValues[nProp].getValue(); break;
1304 0 : case 4 : bNumAlignSize = *(sal_Bool*)pValues[nProp].getValue(); break;
1305 0 : 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 0 : 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 0 : case 11: pValues[nProp] >>= bAskForMailMergeInPrint; break;
1312 : }
1313 : }
1314 0 : }
1315 0 : }
1316 0 : }
1317 :
1318 0 : const Sequence<OUString>& SwCompareConfig::GetPropertyNames()
1319 : {
1320 0 : static Sequence<OUString> aNames;
1321 0 : if(!aNames.getLength())
1322 : {
1323 0 : const int nCount = 4;
1324 0 : aNames.realloc(nCount);
1325 : static const char* aPropNames[] =
1326 : {
1327 : "Mode", // 0
1328 : "UseRSID", // 1
1329 : "IgnorePieces", // 2
1330 : "IgnoreLength" // 3
1331 : };
1332 0 : OUString* pNames = aNames.getArray();
1333 0 : for(int i = 0; i < nCount; i++)
1334 0 : pNames[i] = OUString::createFromAscii(aPropNames[i]);
1335 : }
1336 0 : return aNames;
1337 : }
1338 :
1339 0 : SwCompareConfig::SwCompareConfig() :
1340 : ConfigItem("Office.Writer/Comparison",
1341 0 : CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE)
1342 : {
1343 0 : eCmpMode = SVX_CMP_AUTO;
1344 0 : bUseRsid = 0;
1345 0 : bIgnorePieces = 0;
1346 0 : nPieceLen = 1;
1347 :
1348 0 : Load();
1349 0 : }
1350 :
1351 0 : SwCompareConfig::~SwCompareConfig()
1352 : {
1353 0 : }
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 0 : void SwCompareConfig::Load()
1372 : {
1373 0 : const Sequence<OUString>& aNames = GetPropertyNames();
1374 0 : Sequence<Any> aValues = GetProperties(aNames);
1375 0 : const Any* pValues = aValues.getConstArray();
1376 : DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
1377 0 : if(aValues.getLength() == aNames.getLength())
1378 : {
1379 0 : for(int nProp = 0; nProp < aNames.getLength(); nProp++)
1380 : {
1381 0 : 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 0 : }
1396 0 : }
1397 :
1398 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|