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