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 <tools/stream.hxx>
30cdf0e10cSrcweir #include <tools/resid.hxx>
31cdf0e10cSrcweir #include <sfx2/app.hxx>
32cdf0e10cSrcweir #include <editeng/paperinf.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 <errhdl.hxx>
38cdf0e10cSrcweir #include <swtypes.hxx>
39cdf0e10cSrcweir #include <envimg.hxx>
40cdf0e10cSrcweir
41cdf0e10cSrcweir #ifndef _CMDID_H
42cdf0e10cSrcweir #include <cmdid.h>
43cdf0e10cSrcweir #endif
44cdf0e10cSrcweir #ifndef _ENVELP_HRC
45cdf0e10cSrcweir #include <envelp.hrc>
46cdf0e10cSrcweir #endif
47cdf0e10cSrcweir
48cdf0e10cSrcweir #include <unomid.h>
49cdf0e10cSrcweir
50cdf0e10cSrcweir #ifdef WNT
51cdf0e10cSrcweir #define NEXTLINE UniString::CreateFromAscii("\r\n")
52cdf0e10cSrcweir #else
53cdf0e10cSrcweir #define NEXTLINE '\n'
54cdf0e10cSrcweir #endif
55cdf0e10cSrcweir
56cdf0e10cSrcweir using namespace utl;
57cdf0e10cSrcweir using namespace rtl;
58cdf0e10cSrcweir using namespace ::com::sun::star::uno;
59cdf0e10cSrcweir
60cdf0e10cSrcweir
61cdf0e10cSrcweir TYPEINIT1_AUTOFACTORY( SwEnvItem, SfxPoolItem );
62cdf0e10cSrcweir
63cdf0e10cSrcweir // --------------------------------------------------------------------------
MakeSender()64cdf0e10cSrcweir SW_DLLPUBLIC String MakeSender()
65cdf0e10cSrcweir {
66cdf0e10cSrcweir SvtUserOptions& rUserOpt = SW_MOD()->GetUserOptions();
67cdf0e10cSrcweir
68cdf0e10cSrcweir String sRet;
69cdf0e10cSrcweir String sSenderToken(SW_RES(STR_SENDER_TOKENS));
70cdf0e10cSrcweir xub_StrLen nSttPos = 0, nTokenCount = sSenderToken.GetTokenCount(';');
71cdf0e10cSrcweir sal_Bool bLastLength = sal_True;
72cdf0e10cSrcweir for( xub_StrLen i = 0; i < nTokenCount; i++ )
73cdf0e10cSrcweir {
74cdf0e10cSrcweir String sToken = sSenderToken.GetToken( 0, ';', nSttPos );
75cdf0e10cSrcweir if(sToken.EqualsAscii("COMPANY"))
76cdf0e10cSrcweir {
77cdf0e10cSrcweir xub_StrLen nOldLen = sRet.Len();
78cdf0e10cSrcweir sRet += (String)rUserOpt.GetCompany();
79cdf0e10cSrcweir bLastLength = sRet.Len() != nOldLen;
80cdf0e10cSrcweir }
81cdf0e10cSrcweir else if(sToken.EqualsAscii("CR"))
82cdf0e10cSrcweir {
83cdf0e10cSrcweir if(bLastLength)
84cdf0e10cSrcweir sRet +=NEXTLINE;
85cdf0e10cSrcweir bLastLength = sal_True;
86cdf0e10cSrcweir }
87cdf0e10cSrcweir else if(sToken.EqualsAscii("FIRSTNAME"))
88cdf0e10cSrcweir sRet += (String)rUserOpt.GetFirstName();
89cdf0e10cSrcweir else if(sToken.EqualsAscii("LASTNAME"))
90cdf0e10cSrcweir sRet += (String)rUserOpt.GetLastName();
91cdf0e10cSrcweir else if(sToken.EqualsAscii("ADDRESS"))
92cdf0e10cSrcweir sRet += (String)rUserOpt.GetStreet();
93cdf0e10cSrcweir else if(sToken.EqualsAscii("COUNTRY"))
94cdf0e10cSrcweir sRet += (String)rUserOpt.GetCountry();
95cdf0e10cSrcweir else if(sToken.EqualsAscii("POSTALCODE"))
96cdf0e10cSrcweir sRet += (String)rUserOpt.GetZip();
97cdf0e10cSrcweir else if(sToken.EqualsAscii("CITY"))
98cdf0e10cSrcweir sRet += (String)rUserOpt.GetCity();
99cdf0e10cSrcweir else if(sToken.EqualsAscii("STATEPROV"))
100cdf0e10cSrcweir sRet += (String)rUserOpt.GetState();
101cdf0e10cSrcweir else if(sToken.Len()) //spaces
102cdf0e10cSrcweir sRet += sToken;
103cdf0e10cSrcweir }
104cdf0e10cSrcweir return sRet;
105cdf0e10cSrcweir }
106cdf0e10cSrcweir // --------------------------------------------------------------------------
SwEnvItem()107cdf0e10cSrcweir SwEnvItem::SwEnvItem() :
108cdf0e10cSrcweir SfxPoolItem(FN_ENVELOP)
109cdf0e10cSrcweir {
110cdf0e10cSrcweir aAddrText = aEmptyStr;
111cdf0e10cSrcweir bSend = sal_True;
112cdf0e10cSrcweir aSendText = MakeSender();
113cdf0e10cSrcweir lSendFromLeft = 566; // 1 cm
114cdf0e10cSrcweir lSendFromTop = 566; // 1 cm
115cdf0e10cSrcweir Size aEnvSz = SvxPaperInfo::GetPaperSize(PAPER_ENV_C65);
116cdf0e10cSrcweir lWidth = aEnvSz.Width();
117cdf0e10cSrcweir lHeight = aEnvSz.Height();
118cdf0e10cSrcweir eAlign = ENV_HOR_LEFT;
119cdf0e10cSrcweir bPrintFromAbove = sal_True;
120cdf0e10cSrcweir lShiftRight = 0;
121cdf0e10cSrcweir lShiftDown = 0;
122cdf0e10cSrcweir
123cdf0e10cSrcweir lAddrFromLeft = Max(lWidth, lHeight) / 2;
124cdf0e10cSrcweir lAddrFromTop = Min(lWidth, lHeight) / 2;
125cdf0e10cSrcweir }
126cdf0e10cSrcweir // --------------------------------------------------------------------------
SwEnvItem(const SwEnvItem & rItem)127cdf0e10cSrcweir SwEnvItem::SwEnvItem(const SwEnvItem& rItem) :
128cdf0e10cSrcweir SfxPoolItem(FN_ENVELOP),
129cdf0e10cSrcweir aAddrText (rItem.aAddrText),
130cdf0e10cSrcweir bSend (rItem.bSend),
131cdf0e10cSrcweir aSendText (rItem.aSendText),
132cdf0e10cSrcweir lAddrFromLeft (rItem.lAddrFromLeft),
133cdf0e10cSrcweir lAddrFromTop (rItem.lAddrFromTop),
134cdf0e10cSrcweir lSendFromLeft (rItem.lSendFromLeft),
135cdf0e10cSrcweir lSendFromTop (rItem.lSendFromTop),
136cdf0e10cSrcweir lWidth (rItem.lWidth),
137cdf0e10cSrcweir lHeight (rItem.lHeight),
138cdf0e10cSrcweir eAlign (rItem.eAlign),
139cdf0e10cSrcweir bPrintFromAbove(rItem.bPrintFromAbove),
140cdf0e10cSrcweir lShiftRight (rItem.lShiftRight),
141cdf0e10cSrcweir lShiftDown (rItem.lShiftDown)
142cdf0e10cSrcweir {
143cdf0e10cSrcweir }
144cdf0e10cSrcweir
145cdf0e10cSrcweir // --------------------------------------------------------------------------
operator =(const SwEnvItem & rItem)146cdf0e10cSrcweir SwEnvItem& SwEnvItem::operator =(const SwEnvItem& rItem)
147cdf0e10cSrcweir {
148cdf0e10cSrcweir aAddrText = rItem.aAddrText;
149cdf0e10cSrcweir bSend = rItem.bSend;
150cdf0e10cSrcweir aSendText = rItem.aSendText;
151cdf0e10cSrcweir lSendFromLeft = rItem.lSendFromLeft;
152cdf0e10cSrcweir lSendFromTop = rItem.lSendFromTop;
153cdf0e10cSrcweir lAddrFromLeft = rItem.lAddrFromLeft;
154cdf0e10cSrcweir lAddrFromTop = rItem.lAddrFromTop;
155cdf0e10cSrcweir lWidth = rItem.lWidth;
156cdf0e10cSrcweir lHeight = rItem.lHeight;
157cdf0e10cSrcweir eAlign = rItem.eAlign;
158cdf0e10cSrcweir bPrintFromAbove = rItem.bPrintFromAbove;
159cdf0e10cSrcweir lShiftRight = rItem.lShiftRight;
160cdf0e10cSrcweir lShiftDown = rItem.lShiftDown;
161cdf0e10cSrcweir return *this;
162cdf0e10cSrcweir }
163cdf0e10cSrcweir // --------------------------------------------------------------------------
operator ==(const SfxPoolItem & rItem) const164cdf0e10cSrcweir int SwEnvItem::operator ==(const SfxPoolItem& rItem) const
165cdf0e10cSrcweir {
166cdf0e10cSrcweir const SwEnvItem& rEnv = (const SwEnvItem&) rItem;
167cdf0e10cSrcweir
168cdf0e10cSrcweir return aAddrText == rEnv.aAddrText &&
169cdf0e10cSrcweir bSend == rEnv.bSend &&
170cdf0e10cSrcweir aSendText == rEnv.aSendText &&
171cdf0e10cSrcweir lSendFromLeft == rEnv.lSendFromLeft &&
172cdf0e10cSrcweir lSendFromTop == rEnv.lSendFromTop &&
173cdf0e10cSrcweir lAddrFromLeft == rEnv.lAddrFromLeft &&
174cdf0e10cSrcweir lAddrFromTop == rEnv.lAddrFromTop &&
175cdf0e10cSrcweir lWidth == rEnv.lWidth &&
176cdf0e10cSrcweir lHeight == rEnv.lHeight &&
177cdf0e10cSrcweir eAlign == rEnv.eAlign &&
178cdf0e10cSrcweir bPrintFromAbove == rEnv.bPrintFromAbove &&
179cdf0e10cSrcweir lShiftRight == rEnv.lShiftRight &&
180cdf0e10cSrcweir lShiftDown == rEnv.lShiftDown;
181cdf0e10cSrcweir }
182cdf0e10cSrcweir
183cdf0e10cSrcweir // --------------------------------------------------------------------------
Clone(SfxItemPool *) const184cdf0e10cSrcweir SfxPoolItem* SwEnvItem::Clone(SfxItemPool*) const
185cdf0e10cSrcweir {
186cdf0e10cSrcweir return new SwEnvItem(*this);
187cdf0e10cSrcweir }
188cdf0e10cSrcweir // --------------------------------------------------------------------------
189cdf0e10cSrcweir // --------------------------------------------------------------------------
SwEnvCfgItem()190cdf0e10cSrcweir SwEnvCfgItem::SwEnvCfgItem() :
191cdf0e10cSrcweir ConfigItem(C2U("Office.Writer/Envelope"))
192cdf0e10cSrcweir {
193cdf0e10cSrcweir Sequence<OUString> aNames = GetPropertyNames();
194cdf0e10cSrcweir Sequence<Any> aValues = GetProperties(aNames);
195cdf0e10cSrcweir EnableNotification(aNames);
196cdf0e10cSrcweir const Any* pValues = aValues.getConstArray();
197cdf0e10cSrcweir DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
198cdf0e10cSrcweir if(aValues.getLength() == aNames.getLength())
199cdf0e10cSrcweir {
200cdf0e10cSrcweir for(int nProp = 0; nProp < aNames.getLength(); nProp++)
201cdf0e10cSrcweir {
202cdf0e10cSrcweir if(pValues[nProp].hasValue())
203cdf0e10cSrcweir {
204cdf0e10cSrcweir switch(nProp)
205cdf0e10cSrcweir {
206cdf0e10cSrcweir case 0: pValues[nProp] >>= aEnvItem.aAddrText; break;// "Inscription/Addressee",
207cdf0e10cSrcweir case 1: pValues[nProp] >>= aEnvItem.aSendText; break;// "Inscription/Sender",
208cdf0e10cSrcweir case 2: aEnvItem.bSend = *(sal_Bool*)pValues[nProp].getValue(); break;// "Inscription/UseSender",
209cdf0e10cSrcweir case 3:
210cdf0e10cSrcweir pValues[nProp] >>= aEnvItem.lAddrFromLeft;// "Format/AddresseeFromLeft",
211cdf0e10cSrcweir aEnvItem.lAddrFromLeft = MM100_TO_TWIP(aEnvItem.lAddrFromLeft);
212cdf0e10cSrcweir break;
213cdf0e10cSrcweir case 4:
214cdf0e10cSrcweir pValues[nProp] >>= aEnvItem.lAddrFromTop; // "Format/AddresseeFromTop",
215cdf0e10cSrcweir aEnvItem.lAddrFromTop = MM100_TO_TWIP(aEnvItem.lAddrFromTop);
216cdf0e10cSrcweir break;
217cdf0e10cSrcweir case 5:
218cdf0e10cSrcweir pValues[nProp] >>= aEnvItem.lSendFromLeft; // "Format/SenderFromLeft",
219cdf0e10cSrcweir aEnvItem.lSendFromLeft = MM100_TO_TWIP(aEnvItem.lSendFromLeft);
220cdf0e10cSrcweir break;
221cdf0e10cSrcweir case 6:
222cdf0e10cSrcweir pValues[nProp] >>= aEnvItem.lSendFromTop;// "Format/SenderFromTop",
223cdf0e10cSrcweir aEnvItem.lSendFromTop = MM100_TO_TWIP(aEnvItem.lSendFromTop);
224cdf0e10cSrcweir break;
225cdf0e10cSrcweir case 7:
226cdf0e10cSrcweir pValues[nProp] >>= aEnvItem.lWidth; // "Format/Width",
227cdf0e10cSrcweir aEnvItem.lWidth = MM100_TO_TWIP(aEnvItem.lWidth);
228cdf0e10cSrcweir break;
229cdf0e10cSrcweir case 8:
230cdf0e10cSrcweir pValues[nProp] >>= aEnvItem.lHeight; // "Format/Height",
231cdf0e10cSrcweir aEnvItem.lHeight = MM100_TO_TWIP(aEnvItem.lHeight);
232cdf0e10cSrcweir break;
233cdf0e10cSrcweir case 9:
234cdf0e10cSrcweir {
235cdf0e10cSrcweir sal_Int32 nTemp = 0;
236cdf0e10cSrcweir pValues[nProp] >>= nTemp; aEnvItem.eAlign = (SwEnvAlign)nTemp; break;// "Print/Alignment",
237cdf0e10cSrcweir }
238cdf0e10cSrcweir case 10: aEnvItem.bPrintFromAbove = *(sal_Bool*)pValues[nProp].getValue(); break;// "Print/FromAbove",
239cdf0e10cSrcweir case 11:
240cdf0e10cSrcweir pValues[nProp] >>= aEnvItem.lShiftRight;
241cdf0e10cSrcweir aEnvItem.lShiftRight = MM100_TO_TWIP(aEnvItem.lShiftRight);// "Print/Right",
242cdf0e10cSrcweir break;
243cdf0e10cSrcweir case 12:
244cdf0e10cSrcweir pValues[nProp] >>= aEnvItem.lShiftDown;
245cdf0e10cSrcweir aEnvItem.lShiftDown = MM100_TO_TWIP(aEnvItem.lShiftDown);
246cdf0e10cSrcweir break;// "Print/Down"
247cdf0e10cSrcweir }
248cdf0e10cSrcweir }
249cdf0e10cSrcweir }
250cdf0e10cSrcweir }
251cdf0e10cSrcweir }
252cdf0e10cSrcweir /* -----------------------------26.09.00 14:04--------------------------------
253cdf0e10cSrcweir
254cdf0e10cSrcweir ---------------------------------------------------------------------------*/
~SwEnvCfgItem()255cdf0e10cSrcweir SwEnvCfgItem::~SwEnvCfgItem()
256cdf0e10cSrcweir {
257cdf0e10cSrcweir }
258cdf0e10cSrcweir /* -----------------------------26.09.00 14:05--------------------------------
259cdf0e10cSrcweir
260cdf0e10cSrcweir ---------------------------------------------------------------------------*/
Commit()261cdf0e10cSrcweir void SwEnvCfgItem::Commit()
262cdf0e10cSrcweir {
263cdf0e10cSrcweir Sequence<OUString> aNames = GetPropertyNames();
264cdf0e10cSrcweir Sequence<Any> aValues(aNames.getLength());
265cdf0e10cSrcweir Any* pValues = aValues.getArray();
266cdf0e10cSrcweir
267cdf0e10cSrcweir const Type& rType = ::getBooleanCppuType();
268cdf0e10cSrcweir for(int nProp = 0; nProp < aNames.getLength(); nProp++)
269cdf0e10cSrcweir {
270cdf0e10cSrcweir switch(nProp)
271cdf0e10cSrcweir {
272cdf0e10cSrcweir case 0: pValues[nProp] <<= aEnvItem.aAddrText; break;// "Inscription/Addressee",
273cdf0e10cSrcweir case 1: pValues[nProp] <<= aEnvItem.aSendText; break;// "Inscription/Sender",
274cdf0e10cSrcweir case 2: pValues[nProp].setValue(&aEnvItem.bSend, rType);break;// "Inscription/UseSender",
275cdf0e10cSrcweir case 3: pValues[nProp] <<= static_cast <sal_Int32>(TWIP_TO_MM100(aEnvItem.lAddrFromLeft)) ; break;// "Format/AddresseeFromLeft",
276cdf0e10cSrcweir case 4: pValues[nProp] <<= static_cast <sal_Int32>(TWIP_TO_MM100(aEnvItem.lAddrFromTop)) ; break;// "Format/AddresseeFromTop",
277cdf0e10cSrcweir case 5: pValues[nProp] <<= static_cast <sal_Int32>(TWIP_TO_MM100(aEnvItem.lSendFromLeft)) ; break;// "Format/SenderFromLeft",
278cdf0e10cSrcweir case 6: pValues[nProp] <<= static_cast <sal_Int32>(TWIP_TO_MM100(aEnvItem.lSendFromTop)) ; break;// "Format/SenderFromTop",
279cdf0e10cSrcweir case 7: pValues[nProp] <<= static_cast <sal_Int32>(TWIP_TO_MM100(aEnvItem.lWidth)) ; break;// "Format/Width",
280cdf0e10cSrcweir case 8: pValues[nProp] <<= static_cast <sal_Int32>(TWIP_TO_MM100(aEnvItem.lHeight)) ; break;// "Format/Height",
281cdf0e10cSrcweir case 9: pValues[nProp] <<= sal_Int32(aEnvItem.eAlign); break;// "Print/Alignment",
282cdf0e10cSrcweir case 10: pValues[nProp].setValue(&aEnvItem.bPrintFromAbove, rType); break;// "Print/FromAbove",
283cdf0e10cSrcweir case 11: pValues[nProp] <<= static_cast <sal_Int32>(TWIP_TO_MM100(aEnvItem.lShiftRight));break; // "Print/Right",
284cdf0e10cSrcweir case 12: pValues[nProp] <<= static_cast <sal_Int32>(TWIP_TO_MM100(aEnvItem.lShiftDown)); break;// "Print/Down"
285cdf0e10cSrcweir }
286cdf0e10cSrcweir }
287cdf0e10cSrcweir PutProperties(aNames, aValues);
288cdf0e10cSrcweir }
289cdf0e10cSrcweir
Notify(const::com::sun::star::uno::Sequence<rtl::OUString> &)290cdf0e10cSrcweir void SwEnvCfgItem::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
291cdf0e10cSrcweir
292cdf0e10cSrcweir /* -----------------------------26.09.00 14:04--------------------------------
293cdf0e10cSrcweir
294cdf0e10cSrcweir ---------------------------------------------------------------------------*/
GetPropertyNames()295cdf0e10cSrcweir Sequence<rtl::OUString> SwEnvCfgItem::GetPropertyNames()
296cdf0e10cSrcweir {
297cdf0e10cSrcweir static const char* aPropNames[] =
298cdf0e10cSrcweir {
299cdf0e10cSrcweir "Inscription/Addressee", // 0
300cdf0e10cSrcweir "Inscription/Sender", // 1
301cdf0e10cSrcweir "Inscription/UseSender", // 2
302cdf0e10cSrcweir "Format/AddresseeFromLeft", // 3
303cdf0e10cSrcweir "Format/AddresseeFromTop", // 4
304cdf0e10cSrcweir "Format/SenderFromLeft", // 5
305cdf0e10cSrcweir "Format/SenderFromTop", // 6
306cdf0e10cSrcweir "Format/Width", // 7
307cdf0e10cSrcweir "Format/Height", // 8
308cdf0e10cSrcweir "Print/Alignment", // 9
309cdf0e10cSrcweir "Print/FromAbove", // 10
310cdf0e10cSrcweir "Print/Right", // 11
311cdf0e10cSrcweir "Print/Down" // 12
312cdf0e10cSrcweir };
313cdf0e10cSrcweir const int nCount = 13;
314cdf0e10cSrcweir Sequence<OUString> aNames(nCount);
315cdf0e10cSrcweir OUString* pNames = aNames.getArray();
316cdf0e10cSrcweir for(int i = 0; i < nCount; i++)
317cdf0e10cSrcweir pNames[i] = OUString::createFromAscii(aPropNames[i]);
318cdf0e10cSrcweir return aNames;
319cdf0e10cSrcweir }
320cdf0e10cSrcweir
QueryValue(Any & rVal,sal_uInt8 nMemberId) const321cdf0e10cSrcweir sal_Bool SwEnvItem::QueryValue( Any& rVal, sal_uInt8 nMemberId ) const
322cdf0e10cSrcweir {
323cdf0e10cSrcweir sal_Bool bRet = sal_True;
324cdf0e10cSrcweir switch(nMemberId & ~CONVERT_TWIPS)
325cdf0e10cSrcweir {
326cdf0e10cSrcweir case MID_ENV_ADDR_TEXT : rVal <<= aAddrText; break;
327cdf0e10cSrcweir case MID_ENV_SEND : rVal <<= bSend; break;
328cdf0e10cSrcweir case MID_SEND_TEXT : rVal <<= aSendText; break;
329cdf0e10cSrcweir case MID_ENV_ADDR_FROM_LEFT : rVal <<= lAddrFromLeft; break;
330cdf0e10cSrcweir case MID_ENV_ADDR_FROM_TOP : rVal <<= lAddrFromTop; break;
331cdf0e10cSrcweir case MID_ENV_SEND_FROM_LEFT : rVal <<= lSendFromLeft; break;
332cdf0e10cSrcweir case MID_ENV_SEND_FROM_TOP : rVal <<= lSendFromTop; break;
333cdf0e10cSrcweir case MID_ENV_WIDTH : rVal <<= lWidth; break;
334cdf0e10cSrcweir case MID_ENV_HEIGHT : rVal <<= lHeight; break;
335cdf0e10cSrcweir case MID_ENV_ALIGN : rVal <<= (sal_Int16) eAlign; break;
336cdf0e10cSrcweir case MID_ENV_PRINT_FROM_ABOVE : rVal <<= bPrintFromAbove; break;
337cdf0e10cSrcweir case MID_ENV_SHIFT_RIGHT : rVal <<= lShiftRight; break;
338cdf0e10cSrcweir case MID_ENV_SHIFT_DOWN : rVal <<= lShiftDown; break;
339cdf0e10cSrcweir default:
340cdf0e10cSrcweir DBG_ERROR("Wrong memberId");
341cdf0e10cSrcweir bRet = sal_False;
342cdf0e10cSrcweir }
343cdf0e10cSrcweir return bRet;
344cdf0e10cSrcweir }
345cdf0e10cSrcweir /* -----------------------------26.04.01 12:26--------------------------------
346cdf0e10cSrcweir
347cdf0e10cSrcweir ---------------------------------------------------------------------------*/
PutValue(const Any & rVal,sal_uInt8 nMemberId)348cdf0e10cSrcweir sal_Bool SwEnvItem::PutValue(const Any& rVal, sal_uInt8 nMemberId)
349cdf0e10cSrcweir {
350cdf0e10cSrcweir sal_Bool bRet = sal_False;
351cdf0e10cSrcweir switch(nMemberId & ~CONVERT_TWIPS)
352cdf0e10cSrcweir {
353cdf0e10cSrcweir case MID_ENV_ADDR_TEXT : bRet = (rVal >>= aAddrText); break;
354cdf0e10cSrcweir case MID_ENV_SEND : bRet = (rVal >>= bSend); break;
355cdf0e10cSrcweir case MID_SEND_TEXT : bRet = (rVal >>= aSendText); break;
356cdf0e10cSrcweir case MID_ENV_ADDR_FROM_LEFT : bRet = (rVal >>= lAddrFromLeft); break;
357cdf0e10cSrcweir case MID_ENV_ADDR_FROM_TOP : bRet = (rVal >>= lAddrFromTop); break;
358cdf0e10cSrcweir case MID_ENV_SEND_FROM_LEFT : bRet = (rVal >>= lSendFromLeft); break;
359cdf0e10cSrcweir case MID_ENV_SEND_FROM_TOP : bRet = (rVal >>= lSendFromTop); break;
360cdf0e10cSrcweir case MID_ENV_WIDTH : bRet = (rVal >>= lWidth); break;
361cdf0e10cSrcweir case MID_ENV_HEIGHT : bRet = (rVal >>= lHeight); break;
362cdf0e10cSrcweir case MID_ENV_ALIGN :
363cdf0e10cSrcweir {
364cdf0e10cSrcweir sal_Int16 nTemp = 0;
365cdf0e10cSrcweir bRet = (rVal >>= nTemp);
366cdf0e10cSrcweir if (bRet)
367cdf0e10cSrcweir eAlign = SwEnvAlign(nTemp);
368cdf0e10cSrcweir break;
369cdf0e10cSrcweir }
370cdf0e10cSrcweir case MID_ENV_PRINT_FROM_ABOVE : bRet = (rVal >>= bPrintFromAbove); break;
371cdf0e10cSrcweir case MID_ENV_SHIFT_RIGHT : bRet = (rVal >>= lShiftRight); break;
372cdf0e10cSrcweir case MID_ENV_SHIFT_DOWN : bRet = (rVal >>= lShiftDown); break;
373cdf0e10cSrcweir default:
374cdf0e10cSrcweir DBG_ERROR("Wrong memberId");
375cdf0e10cSrcweir }
376cdf0e10cSrcweir return bRet;
377cdf0e10cSrcweir }
378