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
10*efeef26fSAndrew Rist *
11*efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*efeef26fSAndrew Rist *
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.
19*efeef26fSAndrew Rist *
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 <tools/stream.hxx>
29cdf0e10cSrcweir #ifndef _RESID_HXX //autogen
30cdf0e10cSrcweir #include <tools/resid.hxx>
31cdf0e10cSrcweir #endif
32cdf0e10cSrcweir #include <com/sun/star/uno/Any.hxx>
33cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx>
34cdf0e10cSrcweir #include <unotools/useroptions.hxx>
35cdf0e10cSrcweir #include <tools/shl.hxx>
36cdf0e10cSrcweir #include <swmodule.hxx>
37cdf0e10cSrcweir #include "labimg.hxx"
38cdf0e10cSrcweir #include "cmdid.h"
39cdf0e10cSrcweir #include "swtypes.hxx"
40cdf0e10cSrcweir #include <unomid.h>
41cdf0e10cSrcweir
42cdf0e10cSrcweir using namespace utl;
43cdf0e10cSrcweir using namespace rtl;
44cdf0e10cSrcweir using namespace ::com::sun::star::uno;
45cdf0e10cSrcweir
46cdf0e10cSrcweir
47cdf0e10cSrcweir // ----------------------------------------------------------------------------
SwLabItem()48cdf0e10cSrcweir SwLabItem::SwLabItem() :
49cdf0e10cSrcweir
50cdf0e10cSrcweir SfxPoolItem(FN_LABEL),
51cdf0e10cSrcweir lLeft (0),
52cdf0e10cSrcweir lUpper(0),
53cdf0e10cSrcweir nCols (1),
54cdf0e10cSrcweir nRows (1),
55cdf0e10cSrcweir nCol (1),
56cdf0e10cSrcweir nRow (1)
57cdf0e10cSrcweir {
58cdf0e10cSrcweir bAddr = bCont = bSynchron = sal_False;
59cdf0e10cSrcweir bPage = sal_True;
60cdf0e10cSrcweir lHDist =
61cdf0e10cSrcweir lVDist =
62cdf0e10cSrcweir lWidth =
63cdf0e10cSrcweir lHeight = 5669; // 10 cm
64cdf0e10cSrcweir }
65cdf0e10cSrcweir
66cdf0e10cSrcweir // ----------------------------------------------------------------------------
SwLabItem(const SwLabItem & rItem)67cdf0e10cSrcweir SwLabItem::SwLabItem(const SwLabItem& rItem) :
68cdf0e10cSrcweir SfxPoolItem(FN_LABEL)
69cdf0e10cSrcweir {
70cdf0e10cSrcweir *this = rItem;
71cdf0e10cSrcweir }
72cdf0e10cSrcweir // ----------------------------------------------------------------------------
operator =(const SwLabItem & rItem)73cdf0e10cSrcweir SwLabItem& SwLabItem::operator =(const SwLabItem& rItem)
74cdf0e10cSrcweir {
75cdf0e10cSrcweir bAddr = rItem.bAddr;
76cdf0e10cSrcweir aWriting = rItem.aWriting;
77cdf0e10cSrcweir bCont = rItem.bCont;
78cdf0e10cSrcweir sDBName = rItem.sDBName;
79cdf0e10cSrcweir aLstMake = rItem.aLstMake;
80cdf0e10cSrcweir aLstType = rItem.aLstType;
81cdf0e10cSrcweir aMake = rItem.aMake;
82cdf0e10cSrcweir aType = rItem.aType;
83cdf0e10cSrcweir bPage = rItem.bPage;
84cdf0e10cSrcweir bSynchron = rItem.bSynchron;
85cdf0e10cSrcweir aBin = rItem.aBin;
86cdf0e10cSrcweir nCol = rItem.nCol;
87cdf0e10cSrcweir nRow = rItem.nRow;
88cdf0e10cSrcweir lHDist = rItem.lHDist;
89cdf0e10cSrcweir lVDist = rItem.lVDist;
90cdf0e10cSrcweir lWidth = rItem.lWidth;
91cdf0e10cSrcweir lHeight = rItem.lHeight;
92cdf0e10cSrcweir lLeft = rItem.lLeft;
93cdf0e10cSrcweir lUpper = rItem.lUpper;
94cdf0e10cSrcweir nCols = rItem.nCols;
95cdf0e10cSrcweir nRows = rItem.nRows;
96cdf0e10cSrcweir aPrivFirstName = rItem.aPrivFirstName;
97cdf0e10cSrcweir aPrivName = rItem.aPrivName;
98cdf0e10cSrcweir aPrivShortCut = rItem.aPrivShortCut;
99cdf0e10cSrcweir aPrivFirstName2 = rItem.aPrivFirstName2;
100cdf0e10cSrcweir aPrivName2 = rItem.aPrivName2;
101cdf0e10cSrcweir aPrivShortCut2 = rItem.aPrivShortCut2;
102cdf0e10cSrcweir aPrivStreet = rItem.aPrivStreet;
103cdf0e10cSrcweir aPrivZip = rItem.aPrivZip;
104cdf0e10cSrcweir aPrivCity = rItem.aPrivCity;
105cdf0e10cSrcweir aPrivCountry = rItem.aPrivCountry;
106cdf0e10cSrcweir aPrivState = rItem.aPrivState;
107cdf0e10cSrcweir aPrivTitle = rItem.aPrivTitle;
108cdf0e10cSrcweir aPrivProfession = rItem.aPrivProfession;
109cdf0e10cSrcweir aPrivPhone = rItem.aPrivPhone;
110cdf0e10cSrcweir aPrivMobile = rItem.aPrivMobile;
111cdf0e10cSrcweir aPrivFax = rItem.aPrivFax;
112cdf0e10cSrcweir aPrivWWW = rItem.aPrivWWW;
113cdf0e10cSrcweir aPrivMail = rItem.aPrivMail;
114cdf0e10cSrcweir aCompCompany = rItem.aCompCompany;
115cdf0e10cSrcweir aCompCompanyExt = rItem.aCompCompanyExt;
116cdf0e10cSrcweir aCompSlogan = rItem.aCompSlogan;
117cdf0e10cSrcweir aCompStreet = rItem.aCompStreet;
118cdf0e10cSrcweir aCompZip = rItem.aCompZip;
119cdf0e10cSrcweir aCompCity = rItem.aCompCity;
120cdf0e10cSrcweir aCompCountry = rItem.aCompCountry;
121cdf0e10cSrcweir aCompState = rItem.aCompState;
122cdf0e10cSrcweir aCompPosition = rItem.aCompPosition;
123cdf0e10cSrcweir aCompPhone = rItem.aCompPhone;
124cdf0e10cSrcweir aCompMobile = rItem.aCompMobile;
125cdf0e10cSrcweir aCompFax = rItem.aCompFax;
126cdf0e10cSrcweir aCompWWW = rItem.aCompWWW;
127cdf0e10cSrcweir aCompMail = rItem.aCompMail;
128cdf0e10cSrcweir sGlossaryGroup = rItem.sGlossaryGroup;
129cdf0e10cSrcweir sGlossaryBlockName = rItem.sGlossaryBlockName;
130cdf0e10cSrcweir return *this;
131cdf0e10cSrcweir }
132cdf0e10cSrcweir
133cdf0e10cSrcweir // --------------------------------------------------------------------------
134cdf0e10cSrcweir
135cdf0e10cSrcweir
136cdf0e10cSrcweir
operator ==(const SfxPoolItem & rItem) const137cdf0e10cSrcweir int SwLabItem::operator ==(const SfxPoolItem& rItem) const
138cdf0e10cSrcweir {
139cdf0e10cSrcweir const SwLabItem& rLab = (const SwLabItem&) rItem;
140cdf0e10cSrcweir
141cdf0e10cSrcweir return bAddr == rLab.bAddr &&
142cdf0e10cSrcweir bCont == rLab.bCont &&
143cdf0e10cSrcweir bPage == rLab.bPage &&
144cdf0e10cSrcweir bSynchron == rLab.bSynchron &&
145cdf0e10cSrcweir aBin == rLab.aBin &&
146cdf0e10cSrcweir nCol == rLab.nCol &&
147cdf0e10cSrcweir nRow == rLab.nRow &&
148cdf0e10cSrcweir lHDist == rLab.lHDist &&
149cdf0e10cSrcweir lVDist == rLab.lVDist &&
150cdf0e10cSrcweir lWidth == rLab.lWidth &&
151cdf0e10cSrcweir lHeight == rLab.lHeight &&
152cdf0e10cSrcweir lLeft == rLab.lLeft &&
153cdf0e10cSrcweir lUpper == rLab.lUpper &&
154cdf0e10cSrcweir nCols == rLab.nCols &&
155cdf0e10cSrcweir nRows == rLab.nRows &&
156cdf0e10cSrcweir aWriting == rLab.aWriting&&
157cdf0e10cSrcweir aMake == rLab.aMake &&
158cdf0e10cSrcweir aType == rLab.aType &&
159cdf0e10cSrcweir aLstMake == rLab.aLstMake&&
160cdf0e10cSrcweir aLstType == rLab.aLstType&&
161cdf0e10cSrcweir sDBName == rLab.sDBName &&
162cdf0e10cSrcweir aPrivFirstName == rLab.aPrivFirstName&&
163cdf0e10cSrcweir aPrivName == rLab.aPrivName&&
164cdf0e10cSrcweir aPrivShortCut == rLab.aPrivShortCut&&
165cdf0e10cSrcweir aPrivFirstName2 == rLab.aPrivFirstName2&&
166cdf0e10cSrcweir aPrivName2 == rLab.aPrivName2&&
167cdf0e10cSrcweir aPrivShortCut2 == rLab.aPrivShortCut2&&
168cdf0e10cSrcweir aPrivStreet == rLab.aPrivStreet&&
169cdf0e10cSrcweir aPrivZip == rLab.aPrivZip&&
170cdf0e10cSrcweir aPrivCity == rLab.aPrivCity&&
171cdf0e10cSrcweir aPrivCountry == rLab.aPrivCountry&&
172cdf0e10cSrcweir aPrivState == rLab.aPrivState&&
173cdf0e10cSrcweir aPrivTitle == rLab.aPrivTitle&&
174cdf0e10cSrcweir aPrivProfession == rLab.aPrivProfession&&
175cdf0e10cSrcweir aPrivPhone == rLab.aPrivPhone&&
176cdf0e10cSrcweir aPrivMobile == rLab.aPrivMobile&&
177cdf0e10cSrcweir aPrivFax == rLab.aPrivFax&&
178cdf0e10cSrcweir aPrivWWW == rLab.aPrivWWW&&
179cdf0e10cSrcweir aPrivMail == rLab.aPrivMail&&
180cdf0e10cSrcweir aCompCompany == rLab.aCompCompany&&
181cdf0e10cSrcweir aCompCompanyExt == rLab.aCompCompanyExt&&
182cdf0e10cSrcweir aCompSlogan == rLab.aCompSlogan&&
183cdf0e10cSrcweir aCompStreet == rLab.aCompStreet&&
184cdf0e10cSrcweir aCompZip == rLab.aCompZip&&
185cdf0e10cSrcweir aCompCity == rLab.aCompCity&&
186cdf0e10cSrcweir aCompCountry == rLab.aCompCountry&&
187cdf0e10cSrcweir aCompState == rLab.aCompState&&
188cdf0e10cSrcweir aCompPosition == rLab.aCompPosition&&
189cdf0e10cSrcweir aCompPhone == rLab.aCompPhone&&
190cdf0e10cSrcweir aCompMobile == rLab.aCompMobile&&
191cdf0e10cSrcweir aCompFax == rLab.aCompFax&&
192cdf0e10cSrcweir aCompWWW == rLab.aCompWWW&&
193cdf0e10cSrcweir aCompMail == rLab.aCompMail &&
194cdf0e10cSrcweir sGlossaryGroup == rLab.sGlossaryGroup &&
195cdf0e10cSrcweir sGlossaryBlockName == rLab.sGlossaryBlockName;
196cdf0e10cSrcweir }
197cdf0e10cSrcweir
198cdf0e10cSrcweir // --------------------------------------------------------------------------
Clone(SfxItemPool *) const199cdf0e10cSrcweir SfxPoolItem* SwLabItem::Clone(SfxItemPool*) const
200cdf0e10cSrcweir {
201cdf0e10cSrcweir return new SwLabItem(*this);
202cdf0e10cSrcweir }
203cdf0e10cSrcweir
204cdf0e10cSrcweir /* -----------------------------25.09.00 16:25--------------------------------
205cdf0e10cSrcweir
206cdf0e10cSrcweir ---------------------------------------------------------------------------*/
GetPropertyNames()207cdf0e10cSrcweir Sequence<rtl::OUString> SwLabCfgItem::GetPropertyNames()
208cdf0e10cSrcweir {
209cdf0e10cSrcweir static const char* aLabelPropNames[] =
210cdf0e10cSrcweir {
211cdf0e10cSrcweir "Medium/Continous", // 0
212cdf0e10cSrcweir "Medium/Brand", // 1
213cdf0e10cSrcweir "Medium/Type", // 2
214cdf0e10cSrcweir "Format/Column", // 3
215cdf0e10cSrcweir "Format/Row", // 4
216cdf0e10cSrcweir "Format/HorizontalDistance",// 5
217cdf0e10cSrcweir "Format/VerticalDistance", // 6
218cdf0e10cSrcweir "Format/Width", // 7
219cdf0e10cSrcweir "Format/Height", // 8
220cdf0e10cSrcweir "Format/LeftMargin", // 9
221cdf0e10cSrcweir "Format/TopMargin", //10
222cdf0e10cSrcweir "Option/Synchronize", //11
223cdf0e10cSrcweir "Option/Page", //12
224cdf0e10cSrcweir "Option/Column", //13
225cdf0e10cSrcweir "Option/Row", //14
226cdf0e10cSrcweir "Inscription/UseAddress", //15
227cdf0e10cSrcweir "Inscription/Address", //16
228cdf0e10cSrcweir "Inscription/Database" //17
229cdf0e10cSrcweir };
230cdf0e10cSrcweir static const char* aBusinessPropNames[] =
231cdf0e10cSrcweir {
232cdf0e10cSrcweir "PrivateAddress/FirstName", // 0
233cdf0e10cSrcweir "PrivateAddress/Name", // 1
234cdf0e10cSrcweir "PrivateAddress/ShortCut", // 2
235cdf0e10cSrcweir "PrivateAddress/SecondFirstName", // 3
236cdf0e10cSrcweir "PrivateAddress/SecondName", // 4
237cdf0e10cSrcweir "PrivateAddress/SecondShortCut", // 5
238cdf0e10cSrcweir "PrivateAddress/Street", // 6
239cdf0e10cSrcweir "PrivateAddress/Zip", // 7
240cdf0e10cSrcweir "PrivateAddress/City", // 8
241cdf0e10cSrcweir "PrivateAddress/Country", // 9
242cdf0e10cSrcweir "PrivateAddress/State", // 10
243cdf0e10cSrcweir "PrivateAddress/Title", // 11
244cdf0e10cSrcweir "PrivateAddress/Profession", // 12
245cdf0e10cSrcweir "PrivateAddress/Phone", // 13
246cdf0e10cSrcweir "PrivateAddress/Mobile", // 14
247cdf0e10cSrcweir "PrivateAddress/Fax", // 15
248cdf0e10cSrcweir "PrivateAddress/WebAddress", // 16
249cdf0e10cSrcweir "PrivateAddress/Email", // 17
250cdf0e10cSrcweir "BusinessAddress/Company", // 18
251cdf0e10cSrcweir "BusinessAddress/CompanyExt", // 19
252cdf0e10cSrcweir "BusinessAddress/Slogan", // 20
253cdf0e10cSrcweir "BusinessAddress/Street", // 21
254cdf0e10cSrcweir "BusinessAddress/Zip", // 22
255cdf0e10cSrcweir "BusinessAddress/City", // 23
256cdf0e10cSrcweir "BusinessAddress/Country", // 24
257cdf0e10cSrcweir "BusinessAddress/State", // 25
258cdf0e10cSrcweir "BusinessAddress/Position", // 26
259cdf0e10cSrcweir "BusinessAddress/Phone", // 27
260cdf0e10cSrcweir "BusinessAddress/Mobile", // 28
261cdf0e10cSrcweir "BusinessAddress/Fax", // 29
262cdf0e10cSrcweir "BusinessAddress/WebAddress", // 30
263cdf0e10cSrcweir "BusinessAddress/Email", // 31
264cdf0e10cSrcweir "AutoText/Group", // 32
265cdf0e10cSrcweir "AutoText/Block" // 33
266cdf0e10cSrcweir };
267cdf0e10cSrcweir const int nBusinessCount = bIsLabel ? 0 : 34;
268cdf0e10cSrcweir const int nLabelCount = bIsLabel ? 18 : 15;
269cdf0e10cSrcweir Sequence<OUString> aNames(nBusinessCount + nLabelCount);
270cdf0e10cSrcweir OUString* pNames = aNames.getArray();
271cdf0e10cSrcweir int nIndex = 0;
272cdf0e10cSrcweir for(int nLabel = 0; nLabel < nLabelCount; nLabel++)
273cdf0e10cSrcweir pNames[nIndex++] = OUString::createFromAscii(aLabelPropNames[nLabel]);
274cdf0e10cSrcweir for(int nBusiness = 0; nBusiness < nBusinessCount; nBusiness++)
275cdf0e10cSrcweir pNames[nIndex++] = OUString::createFromAscii(aBusinessPropNames[nBusiness]);
276cdf0e10cSrcweir return aNames;
277cdf0e10cSrcweir }
278cdf0e10cSrcweir /* ----------------------------------------------------------------------------
279cdf0e10cSrcweir
280cdf0e10cSrcweir ---------------------------------------------------------------------------*/
SwLabCfgItem(sal_Bool bLabel)281cdf0e10cSrcweir SwLabCfgItem::SwLabCfgItem(sal_Bool bLabel) :
282cdf0e10cSrcweir ConfigItem(bLabel ? C2U("Office.Writer/Label") : C2U("Office.Writer/BusinessCard")),
283cdf0e10cSrcweir bIsLabel(bLabel)
284cdf0e10cSrcweir {
285cdf0e10cSrcweir Sequence<OUString> aNames = GetPropertyNames();
286cdf0e10cSrcweir Sequence<Any> aValues = GetProperties(aNames);
287cdf0e10cSrcweir EnableNotification(aNames);
288cdf0e10cSrcweir const Any* pValues = aValues.getConstArray();
289cdf0e10cSrcweir DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
290cdf0e10cSrcweir sal_Bool bNoConfigValues = sal_True;
291cdf0e10cSrcweir if(aValues.getLength() == aNames.getLength())
292cdf0e10cSrcweir {
293cdf0e10cSrcweir for(int nProp = 0, nProperty = 0; nProp < aNames.getLength(); nProp++, nProperty++)
294cdf0e10cSrcweir {
295cdf0e10cSrcweir
296cdf0e10cSrcweir if(pValues[nProp].hasValue())
297cdf0e10cSrcweir {
298cdf0e10cSrcweir //to have a contiuous switch an offset is added
299cdf0e10cSrcweir if(nProp == 15 && !bIsLabel)
300cdf0e10cSrcweir nProperty += 3;
301cdf0e10cSrcweir if(nProperty >= 18)
302cdf0e10cSrcweir bNoConfigValues = sal_False;
303cdf0e10cSrcweir switch(nProperty)
304cdf0e10cSrcweir {
305cdf0e10cSrcweir case 0: aItem.bCont = *(sal_Bool*)pValues[nProp].getValue(); break;// "Medium/Continous",
306cdf0e10cSrcweir case 1: pValues[nProp] >>= aItem.aMake; break;// "Medium/Brand",
307cdf0e10cSrcweir case 2: pValues[nProp] >>= aItem.aType; break;// "Medium/Type",
308cdf0e10cSrcweir case 3: pValues[nProp] >>= aItem.nCols; break;// "Format/Column",
309cdf0e10cSrcweir case 4: pValues[nProp] >>= aItem.nRows; break;// "Format/Row",
310cdf0e10cSrcweir case 5:
311cdf0e10cSrcweir pValues[nProp] >>= aItem.lHDist;
312cdf0e10cSrcweir aItem.lHDist = MM100_TO_TWIP(aItem.lHDist);
313cdf0e10cSrcweir break;// "Format/HorizontalDistance",
314cdf0e10cSrcweir case 6:
315cdf0e10cSrcweir pValues[nProp] >>= aItem.lVDist;
316cdf0e10cSrcweir aItem.lVDist = MM100_TO_TWIP(aItem.lVDist);
317cdf0e10cSrcweir break;// "Format/VerticalDistance",
318cdf0e10cSrcweir case 7:
319cdf0e10cSrcweir pValues[nProp] >>= aItem.lWidth;
320cdf0e10cSrcweir aItem.lWidth = MM100_TO_TWIP(aItem.lWidth);
321cdf0e10cSrcweir break;// "Format/Width",
322cdf0e10cSrcweir case 8:
323cdf0e10cSrcweir pValues[nProp] >>= aItem.lHeight;
324cdf0e10cSrcweir aItem.lHeight = MM100_TO_TWIP(aItem.lHeight);
325cdf0e10cSrcweir break;// "Format/Height",
326cdf0e10cSrcweir case 9:
327cdf0e10cSrcweir pValues[nProp] >>= aItem.lLeft;
328cdf0e10cSrcweir aItem.lLeft = MM100_TO_TWIP(aItem.lLeft);
329cdf0e10cSrcweir break;// "Format/LeftMargin",
330cdf0e10cSrcweir case 10:
331cdf0e10cSrcweir pValues[nProp] >>= aItem.lUpper;
332cdf0e10cSrcweir aItem.lUpper = MM100_TO_TWIP(aItem.lUpper);
333cdf0e10cSrcweir break;// "Format/TopMargin",
334cdf0e10cSrcweir case 11: aItem.bSynchron = *(sal_Bool*)pValues[nProp].getValue(); break;// "Option/Synchronize",
335cdf0e10cSrcweir case 12: aItem.bPage = *(sal_Bool*)pValues[nProp].getValue(); break;// "Option/Page",
336cdf0e10cSrcweir case 13: pValues[nProp] >>= aItem.nCol; break;// "Option/Column",
337cdf0e10cSrcweir case 14: pValues[nProp] >>= aItem.nRow; break;// "Option/Row"
338cdf0e10cSrcweir case 15: aItem.bAddr = *(sal_Bool*)pValues[nProp].getValue(); break;// "Inscription/UseAddress",
339cdf0e10cSrcweir case 16: pValues[nProp] >>= aItem.aWriting; break;// "Inscription/Address",
340cdf0e10cSrcweir case 17: pValues[nProp] >>= aItem.sDBName; break;// "Inscription/Database"
341cdf0e10cSrcweir case 18: pValues[nProp] >>= aItem.aPrivFirstName; break;// "PrivateAddress/FirstName",
342cdf0e10cSrcweir case 19: pValues[nProp] >>= aItem.aPrivName; break;// "PrivateAddress/Name",
343cdf0e10cSrcweir case 20: pValues[nProp] >>= aItem.aPrivShortCut; break;// "PrivateAddress/ShortCut",
344cdf0e10cSrcweir case 21: pValues[nProp] >>= aItem.aPrivFirstName2; break;// "PrivateAddress/SecondFirstName",
345cdf0e10cSrcweir case 22: pValues[nProp] >>= aItem.aPrivName2; break;// "PrivateAddress/SecondName",
346cdf0e10cSrcweir case 23: pValues[nProp] >>= aItem.aPrivShortCut2; break;// "PrivateAddress/SecondShortCut",
347cdf0e10cSrcweir case 24: pValues[nProp] >>= aItem.aPrivStreet; break;// "PrivateAddress/Street",
348cdf0e10cSrcweir case 25: pValues[nProp] >>= aItem.aPrivZip; break;// "PrivateAddress/Zip",
349cdf0e10cSrcweir case 26: pValues[nProp] >>= aItem.aPrivCity; break;// "PrivateAddress/City",
350cdf0e10cSrcweir case 27: pValues[nProp] >>= aItem.aPrivCountry; break;// "PrivateAddress/Country",
351cdf0e10cSrcweir case 28: pValues[nProp] >>= aItem.aPrivState; break;// "PrivateAddress/State",
352cdf0e10cSrcweir case 29: pValues[nProp] >>= aItem.aPrivTitle; break;// "PrivateAddress/Title",
353cdf0e10cSrcweir case 30: pValues[nProp] >>= aItem.aPrivProfession; break;// "PrivateAddress/Profession",
354cdf0e10cSrcweir case 31: pValues[nProp] >>= aItem.aPrivPhone; break;// "PrivateAddress/Phone",
355cdf0e10cSrcweir case 32: pValues[nProp] >>= aItem.aPrivMobile; break;// "PrivateAddress/Mobile",
356cdf0e10cSrcweir case 33: pValues[nProp] >>= aItem.aPrivFax; break;// "PrivateAddress/Fax",
357cdf0e10cSrcweir case 34: pValues[nProp] >>= aItem.aPrivWWW; break;// "PrivateAddress/WebAddress",
358cdf0e10cSrcweir case 35: pValues[nProp] >>= aItem.aPrivMail; break;// "PrivateAddress/Email",
359cdf0e10cSrcweir case 36: pValues[nProp] >>= aItem.aCompCompany; break;// "BusinessAddress/Company",
360cdf0e10cSrcweir case 37: pValues[nProp] >>= aItem.aCompCompanyExt; break;// "BusinessAddress/CompanyExt",
361cdf0e10cSrcweir case 38: pValues[nProp] >>= aItem.aCompSlogan; break;// "BusinessAddress/Slogan",
362cdf0e10cSrcweir case 39: pValues[nProp] >>= aItem.aCompStreet; break;// "BusinessAddress/Street",
363cdf0e10cSrcweir case 40: pValues[nProp] >>= aItem.aCompZip; break;// "BusinessAddress/Zip",
364cdf0e10cSrcweir case 41: pValues[nProp] >>= aItem.aCompCity; break;// "BusinessAddress/City",
365cdf0e10cSrcweir case 42: pValues[nProp] >>= aItem.aCompCountry; break;// "BusinessAddress/Country",
366cdf0e10cSrcweir case 43: pValues[nProp] >>= aItem.aCompState; break;// "BusinessAddress/State",
367cdf0e10cSrcweir case 44: pValues[nProp] >>= aItem.aCompPosition; break;// "BusinessAddress/Position",
368cdf0e10cSrcweir case 45: pValues[nProp] >>= aItem.aCompPhone; break;// "BusinessAddress/Phone",
369cdf0e10cSrcweir case 46: pValues[nProp] >>= aItem.aCompMobile; break;// "BusinessAddress/Mobile",
370cdf0e10cSrcweir case 47: pValues[nProp] >>= aItem.aCompFax; break;// "BusinessAddress/Fax",
371cdf0e10cSrcweir case 48: pValues[nProp] >>= aItem.aCompWWW; break;// "BusinessAddress/WebAddress",
372cdf0e10cSrcweir case 49: pValues[nProp] >>= aItem.aCompMail; break;// "BusinessAddress/Email",
373cdf0e10cSrcweir case 50: pValues[nProp] >>= aItem.sGlossaryGroup; break;// "AutoText/Group"
374cdf0e10cSrcweir case 51: pValues[nProp] >>= aItem.sGlossaryBlockName; break;// "AutoText/Block"
375cdf0e10cSrcweir }
376cdf0e10cSrcweir }
377cdf0e10cSrcweir }
378cdf0e10cSrcweir }
379cdf0e10cSrcweir if(!bIsLabel && bNoConfigValues)
380cdf0e10cSrcweir {
381cdf0e10cSrcweir
382cdf0e10cSrcweir SvtUserOptions& rUserOpt = SW_MOD()->GetUserOptions();
383cdf0e10cSrcweir aItem.aPrivFirstName = rUserOpt.GetFirstName();
384cdf0e10cSrcweir aItem.aPrivName = rUserOpt.GetLastName();
385cdf0e10cSrcweir aItem.aPrivShortCut = rUserOpt.GetID();
386cdf0e10cSrcweir aItem.aCompCompany = rUserOpt.GetCompany();
387cdf0e10cSrcweir aItem.aCompStreet = aItem.aPrivStreet = rUserOpt.GetStreet();
388cdf0e10cSrcweir
389cdf0e10cSrcweir aItem.aCompCountry = aItem.aPrivCountry = rUserOpt.GetCountry();
390cdf0e10cSrcweir aItem.aCompZip = aItem.aPrivZip= rUserOpt.GetZip();
391cdf0e10cSrcweir aItem.aCompCity = aItem.aPrivCity = rUserOpt.GetCity();
392cdf0e10cSrcweir aItem.aPrivTitle = rUserOpt.GetTitle();
393cdf0e10cSrcweir aItem.aCompPosition = rUserOpt.GetPosition();
394cdf0e10cSrcweir aItem.aPrivPhone = rUserOpt.GetTelephoneHome();
395cdf0e10cSrcweir aItem.aCompPhone = rUserOpt.GetTelephoneWork();
396cdf0e10cSrcweir aItem.aCompFax = aItem.aPrivFax = rUserOpt.GetFax();
397cdf0e10cSrcweir aItem.aCompMail = aItem.aPrivMail = rUserOpt.GetEmail();
398cdf0e10cSrcweir aItem.aCompState = aItem.aPrivState = rUserOpt.GetState();
399cdf0e10cSrcweir aItem.bSynchron = sal_True;
400cdf0e10cSrcweir SetModified();
401cdf0e10cSrcweir }
402cdf0e10cSrcweir }
403cdf0e10cSrcweir /* -----------------------------25.09.00 16:26--------------------------------
404cdf0e10cSrcweir
405cdf0e10cSrcweir ---------------------------------------------------------------------------*/
Notify(const::com::sun::star::uno::Sequence<rtl::OUString> &)406cdf0e10cSrcweir void SwLabCfgItem::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
407cdf0e10cSrcweir
Commit()408cdf0e10cSrcweir void SwLabCfgItem::Commit()
409cdf0e10cSrcweir {
410cdf0e10cSrcweir Sequence<OUString> aNames = GetPropertyNames();
411cdf0e10cSrcweir Sequence<Any> aValues(aNames.getLength());
412cdf0e10cSrcweir Any* pValues = aValues.getArray();
413cdf0e10cSrcweir
414cdf0e10cSrcweir const Type& rType = ::getBooleanCppuType();
415cdf0e10cSrcweir for(int nProp = 0, nProperty = 0; nProp < aNames.getLength(); nProp++, nProperty++)
416cdf0e10cSrcweir {
417cdf0e10cSrcweir //to have a contiuous switch an offset is added
418cdf0e10cSrcweir if(nProp == 15 && !bIsLabel)
419cdf0e10cSrcweir nProperty += 3;
420cdf0e10cSrcweir switch(nProperty)
421cdf0e10cSrcweir {
422cdf0e10cSrcweir case 0: pValues[nProp].setValue(&aItem.bCont, rType); break;// "Medium/Continous",
423cdf0e10cSrcweir case 1: pValues[nProp] <<= aItem.aMake; break;// "Medium/Brand",
424cdf0e10cSrcweir case 2: pValues[nProp] <<= aItem.aType; break;// "Medium/Type",
425cdf0e10cSrcweir case 3: pValues[nProp] <<= aItem.nCols; break;// "Format/Column",
426cdf0e10cSrcweir case 4: pValues[nProp] <<= aItem.nRows; break;// "Format/Row",
427cdf0e10cSrcweir case 5: pValues[nProp] <<= static_cast<sal_Int32>(TWIP_TO_MM100(aItem.lHDist));break;// "Format/HorizontalDistance",
428cdf0e10cSrcweir case 6: pValues[nProp] <<= static_cast<sal_Int32>(TWIP_TO_MM100(aItem.lVDist));break;// "Format/VerticalDistance",
429cdf0e10cSrcweir case 7: pValues[nProp] <<= static_cast<sal_Int32>(TWIP_TO_MM100(aItem.lWidth)); break;// "Format/Width",
430cdf0e10cSrcweir case 8: pValues[nProp] <<= static_cast<sal_Int32>(TWIP_TO_MM100(aItem.lHeight)); break;// "Format/Height",
431cdf0e10cSrcweir case 9: pValues[nProp] <<= static_cast<sal_Int32>(TWIP_TO_MM100(aItem.lLeft)); break;// "Format/LeftMargin",
432cdf0e10cSrcweir case 10: pValues[nProp] <<= static_cast<sal_Int32>(TWIP_TO_MM100(aItem.lUpper)); break;// "Format/TopMargin",
433cdf0e10cSrcweir case 11: pValues[nProp].setValue(&aItem.bSynchron, rType); break;// "Option/Synchronize",
434cdf0e10cSrcweir case 12: pValues[nProp].setValue(&aItem.bPage, rType); break;// "Option/Page",
435cdf0e10cSrcweir case 13: pValues[nProp] <<= aItem.nCol; break;// "Option/Column",
436cdf0e10cSrcweir case 14: pValues[nProp] <<= aItem.nRow; break;// "Option/Row"
437cdf0e10cSrcweir case 15: pValues[nProp].setValue(&aItem.bAddr, rType); break;// "Inscription/UseAddress",
438cdf0e10cSrcweir case 16: pValues[nProp] <<= aItem.aWriting; break;// "Inscription/Address",
439cdf0e10cSrcweir case 17: pValues[nProp] <<= aItem.sDBName; break;// "Inscription/Database"
440cdf0e10cSrcweir case 18: pValues[nProp] <<= aItem.aPrivFirstName; break;// "PrivateAddress/FirstName",
441cdf0e10cSrcweir case 19: pValues[nProp] <<= aItem.aPrivName; break;// "PrivateAddress/Name",
442cdf0e10cSrcweir case 20: pValues[nProp] <<= aItem.aPrivShortCut; break;// "PrivateAddress/ShortCut",
443cdf0e10cSrcweir case 21: pValues[nProp] <<= aItem.aPrivFirstName2; break;// "PrivateAddress/SecondFirstName",
444cdf0e10cSrcweir case 22: pValues[nProp] <<= aItem.aPrivName2; break;// "PrivateAddress/SecondName",
445cdf0e10cSrcweir case 23: pValues[nProp] <<= aItem.aPrivShortCut2; break;// "PrivateAddress/SecondShortCut",
446cdf0e10cSrcweir case 24: pValues[nProp] <<= aItem.aPrivStreet; break;// "PrivateAddress/Street",
447cdf0e10cSrcweir case 25: pValues[nProp] <<= aItem.aPrivZip; break;// "PrivateAddress/Zip",
448cdf0e10cSrcweir case 26: pValues[nProp] <<= aItem.aPrivCity; break;// "PrivateAddress/City",
449cdf0e10cSrcweir case 27: pValues[nProp] <<= aItem.aPrivCountry; break;// "PrivateAddress/Country",
450cdf0e10cSrcweir case 28: pValues[nProp] <<= aItem.aPrivState; break;// "PrivateAddress/State",
451cdf0e10cSrcweir case 29: pValues[nProp] <<= aItem.aPrivTitle; break;// "PrivateAddress/Title",
452cdf0e10cSrcweir case 30: pValues[nProp] <<= aItem.aPrivProfession; break;// "PrivateAddress/Profession",
453cdf0e10cSrcweir case 31: pValues[nProp] <<= aItem.aPrivPhone; break;// "PrivateAddress/Phone",
454cdf0e10cSrcweir case 32: pValues[nProp] <<= aItem.aPrivMobile; break;// "PrivateAddress/Mobile",
455cdf0e10cSrcweir case 33: pValues[nProp] <<= aItem.aPrivFax; break;// "PrivateAddress/Fax",
456cdf0e10cSrcweir case 34: pValues[nProp] <<= aItem.aPrivWWW; break;// "PrivateAddress/WebAddress",
457cdf0e10cSrcweir case 35: pValues[nProp] <<= aItem.aPrivMail; break;// "PrivateAddress/Email",
458cdf0e10cSrcweir case 36: pValues[nProp] <<= aItem.aCompCompany; break;// "BusinessAddress/Company",
459cdf0e10cSrcweir case 37: pValues[nProp] <<= aItem.aCompCompanyExt; break;// "BusinessAddress/CompanyExt",
460cdf0e10cSrcweir case 38: pValues[nProp] <<= aItem.aCompSlogan; break;// "BusinessAddress/Slogan",
461cdf0e10cSrcweir case 39: pValues[nProp] <<= aItem.aCompStreet; break;// "BusinessAddress/Street",
462cdf0e10cSrcweir case 40: pValues[nProp] <<= aItem.aCompZip; break;// "BusinessAddress/Zip",
463cdf0e10cSrcweir case 41: pValues[nProp] <<= aItem.aCompCity; break;// "BusinessAddress/City",
464cdf0e10cSrcweir case 42: pValues[nProp] <<= aItem.aCompCountry; break;// "BusinessAddress/Country",
465cdf0e10cSrcweir case 43: pValues[nProp] <<= aItem.aCompState; break;// "BusinessAddress/State",
466cdf0e10cSrcweir case 44: pValues[nProp] <<= aItem.aCompPosition; break;// "BusinessAddress/Position",
467cdf0e10cSrcweir case 45: pValues[nProp] <<= aItem.aCompPhone; break;// "BusinessAddress/Phone",
468cdf0e10cSrcweir case 46: pValues[nProp] <<= aItem.aCompMobile; break;// "BusinessAddress/Mobile",
469cdf0e10cSrcweir case 47: pValues[nProp] <<= aItem.aCompFax; break;// "BusinessAddress/Fax",
470cdf0e10cSrcweir case 48: pValues[nProp] <<= aItem.aCompWWW; break;// "BusinessAddress/WebAddress",
471cdf0e10cSrcweir case 49: pValues[nProp] <<= aItem.aCompMail; break;// "BusinessAddress/Email",
472cdf0e10cSrcweir case 50: pValues[nProp] <<= aItem.sGlossaryGroup; break;// "AutoText/Group"
473cdf0e10cSrcweir case 51: pValues[nProp] <<= aItem.sGlossaryBlockName; break;// "AutoText/Block"
474cdf0e10cSrcweir }
475cdf0e10cSrcweir }
476cdf0e10cSrcweir PutProperties(aNames, aValues);
477cdf0e10cSrcweir }
478cdf0e10cSrcweir
479