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