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