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
10cdf0e10cSrcweir *
11efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
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.
19cdf0e10cSrcweir *
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 <editeng/itemtype.hxx>
29cdf0e10cSrcweir #include <unosett.hxx>
30cdf0e10cSrcweir
31cdf0e10cSrcweir #include "swtypes.hxx"
32cdf0e10cSrcweir #include "cmdid.h"
33cdf0e10cSrcweir #include "uiitems.hxx"
34cdf0e10cSrcweir
35cdf0e10cSrcweir #include "utlui.hrc"
36cdf0e10cSrcweir #include "attrdesc.hrc"
37cdf0e10cSrcweir #ifndef _UNOMID_H
38cdf0e10cSrcweir #include <unomid.h>
39cdf0e10cSrcweir #endif
40cdf0e10cSrcweir #include <numrule.hxx>
41cdf0e10cSrcweir
42cdf0e10cSrcweir using namespace ::com::sun::star;
43cdf0e10cSrcweir using namespace ::com::sun::star::uno;
44cdf0e10cSrcweir
45cdf0e10cSrcweir // Breitenangaben der Fussnotenlinien, mit TabPage abstimmen
46cdf0e10cSrcweir static const sal_uInt16 __FAR_DATA nFtnLines[] = {
47cdf0e10cSrcweir 0,
48cdf0e10cSrcweir 10,
49cdf0e10cSrcweir 50,
50cdf0e10cSrcweir 80,
51cdf0e10cSrcweir 100,
52cdf0e10cSrcweir 150
53cdf0e10cSrcweir };
54cdf0e10cSrcweir
55cdf0e10cSrcweir #define FTN_LINE_STYLE_COUNT 5
56cdf0e10cSrcweir
57cdf0e10cSrcweir
SwPageFtnInfoItem(const sal_uInt16 nId,SwPageFtnInfo & rInfo)58cdf0e10cSrcweir SwPageFtnInfoItem::SwPageFtnInfoItem( const sal_uInt16 nId, SwPageFtnInfo& rInfo) :
59cdf0e10cSrcweir SfxPoolItem( nId ),
60cdf0e10cSrcweir aFtnInfo(rInfo)
61cdf0e10cSrcweir {
62cdf0e10cSrcweir }
63cdf0e10cSrcweir
64cdf0e10cSrcweir
SwPageFtnInfoItem(const SwPageFtnInfoItem & rItem)65cdf0e10cSrcweir SwPageFtnInfoItem::SwPageFtnInfoItem( const SwPageFtnInfoItem& rItem ) :
66cdf0e10cSrcweir SfxPoolItem( rItem ),
67cdf0e10cSrcweir aFtnInfo(rItem.GetPageFtnInfo())
68cdf0e10cSrcweir {
69cdf0e10cSrcweir }
70cdf0e10cSrcweir
71cdf0e10cSrcweir
~SwPageFtnInfoItem()72cdf0e10cSrcweir SwPageFtnInfoItem::~SwPageFtnInfoItem()
73cdf0e10cSrcweir {
74cdf0e10cSrcweir }
75cdf0e10cSrcweir
76cdf0e10cSrcweir
Clone(SfxItemPool *) const77cdf0e10cSrcweir SfxPoolItem* SwPageFtnInfoItem::Clone( SfxItemPool * /*pPool*/ ) const
78cdf0e10cSrcweir {
79cdf0e10cSrcweir return new SwPageFtnInfoItem( *this );
80cdf0e10cSrcweir }
81cdf0e10cSrcweir
82cdf0e10cSrcweir
operator ==(const SfxPoolItem & rAttr) const83cdf0e10cSrcweir int SwPageFtnInfoItem::operator==( const SfxPoolItem& rAttr ) const
84cdf0e10cSrcweir {
85cdf0e10cSrcweir DBG_ASSERT( Which() == rAttr.Which(), "keine gleichen Attribute" );
86cdf0e10cSrcweir return ( aFtnInfo == ((SwPageFtnInfoItem&)rAttr).GetPageFtnInfo());
87cdf0e10cSrcweir }
88cdf0e10cSrcweir
89cdf0e10cSrcweir
GetPresentation(SfxItemPresentation ePres,SfxMapUnit eCoreUnit,SfxMapUnit ePresUnit,String & rText,const IntlWrapper * pIntl) const90cdf0e10cSrcweir SfxItemPresentation SwPageFtnInfoItem::GetPresentation
91cdf0e10cSrcweir (
92cdf0e10cSrcweir SfxItemPresentation ePres,
93cdf0e10cSrcweir SfxMapUnit eCoreUnit,
94cdf0e10cSrcweir SfxMapUnit ePresUnit,
95cdf0e10cSrcweir String& rText,
96cdf0e10cSrcweir const IntlWrapper* pIntl
97cdf0e10cSrcweir ) const
98cdf0e10cSrcweir {
99cdf0e10cSrcweir switch ( ePres )
100cdf0e10cSrcweir {
101cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE:
102cdf0e10cSrcweir rText.Erase();
103cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE;
104cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS:
105cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE:
106cdf0e10cSrcweir {
107cdf0e10cSrcweir sal_uInt16 nHght = (sal_uInt16) GetPageFtnInfo().GetHeight();
108cdf0e10cSrcweir if ( nHght )
109cdf0e10cSrcweir {
110cdf0e10cSrcweir rText = SW_RESSTR( STR_MAX_FTN_HEIGHT );
111cdf0e10cSrcweir rText += ' ';
112cdf0e10cSrcweir rText += ::GetMetricText( nHght, eCoreUnit, ePresUnit, pIntl );
113*ae2dc0faSTsutomu Uchino rText += sal_Unicode(' ');
114cdf0e10cSrcweir rText += ::GetSvxString( ::GetMetricId( ePresUnit ) );
115cdf0e10cSrcweir }
116cdf0e10cSrcweir return ePres;
117cdf0e10cSrcweir }
118cdf0e10cSrcweir default:; //prevent warning
119cdf0e10cSrcweir }
120cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE;
121cdf0e10cSrcweir }
122cdf0e10cSrcweir /* -----------------------------26.04.01 12:25--------------------------------
123cdf0e10cSrcweir
124cdf0e10cSrcweir ---------------------------------------------------------------------------*/
QueryValue(Any & rVal,sal_uInt8 nMemberId) const125cdf0e10cSrcweir sal_Bool SwPageFtnInfoItem::QueryValue( Any& rVal, sal_uInt8 nMemberId ) const
126cdf0e10cSrcweir {
127cdf0e10cSrcweir sal_Bool bRet = sal_True;
128cdf0e10cSrcweir switch(nMemberId & ~CONVERT_TWIPS)
129cdf0e10cSrcweir {
130cdf0e10cSrcweir case MID_FTN_HEIGHT : rVal <<= (sal_Int32)TWIP_TO_MM100(aFtnInfo.GetHeight());break;
131cdf0e10cSrcweir case MID_LINE_WEIGHT : rVal <<= (sal_Int16)TWIP_TO_MM100_UNSIGNED(aFtnInfo.GetLineWidth());break;
132cdf0e10cSrcweir case MID_LINE_COLOR : rVal <<= (sal_Int32)aFtnInfo.GetLineColor().GetColor();break;
133cdf0e10cSrcweir case MID_LINE_RELWIDTH :
134cdf0e10cSrcweir {
135cdf0e10cSrcweir Fraction aTmp( 100, 1 );
136cdf0e10cSrcweir aTmp *= aFtnInfo.GetWidth();
137cdf0e10cSrcweir rVal <<= (sal_Int8)(long)aTmp;
138cdf0e10cSrcweir }
139cdf0e10cSrcweir break;
140cdf0e10cSrcweir case MID_LINE_ADJUST : rVal <<= (sal_Int16)aFtnInfo.GetAdj();break;//text::HorizontalAdjust
141cdf0e10cSrcweir case MID_LINE_TEXT_DIST : rVal <<= (sal_Int32)TWIP_TO_MM100(aFtnInfo.GetTopDist());break;
142cdf0e10cSrcweir case MID_LINE_FOOTNOTE_DIST: rVal <<= (sal_Int32)TWIP_TO_MM100(aFtnInfo.GetBottomDist());break;
143cdf0e10cSrcweir default:
144cdf0e10cSrcweir bRet = sal_False;
145cdf0e10cSrcweir }
146cdf0e10cSrcweir return bRet;
147cdf0e10cSrcweir }
148cdf0e10cSrcweir /* -----------------------------26.04.01 12:26--------------------------------
149cdf0e10cSrcweir
150cdf0e10cSrcweir ---------------------------------------------------------------------------*/
PutValue(const Any & rVal,sal_uInt8 nMemberId)151cdf0e10cSrcweir sal_Bool SwPageFtnInfoItem::PutValue(const Any& rVal, sal_uInt8 nMemberId)
152cdf0e10cSrcweir {
153cdf0e10cSrcweir sal_Int32 nSet32 = 0;
154cdf0e10cSrcweir sal_Bool bRet = sal_True;
155cdf0e10cSrcweir switch(nMemberId & ~CONVERT_TWIPS)
156cdf0e10cSrcweir {
157cdf0e10cSrcweir case MID_LINE_COLOR :
158cdf0e10cSrcweir rVal >>= nSet32;
159cdf0e10cSrcweir aFtnInfo.SetLineColor(nSet32);
160cdf0e10cSrcweir break;
161cdf0e10cSrcweir case MID_FTN_HEIGHT:
162cdf0e10cSrcweir case MID_LINE_TEXT_DIST :
163cdf0e10cSrcweir case MID_LINE_FOOTNOTE_DIST:
164cdf0e10cSrcweir rVal >>= nSet32;
165cdf0e10cSrcweir if(nSet32 < 0)
166cdf0e10cSrcweir bRet = sal_False;
167cdf0e10cSrcweir else
168cdf0e10cSrcweir {
169cdf0e10cSrcweir nSet32 = MM100_TO_TWIP(nSet32);
170cdf0e10cSrcweir switch(nMemberId & ~CONVERT_TWIPS)
171cdf0e10cSrcweir {
172cdf0e10cSrcweir case MID_FTN_HEIGHT: aFtnInfo.SetHeight(nSet32); break;
173cdf0e10cSrcweir case MID_LINE_TEXT_DIST: aFtnInfo.SetTopDist(nSet32);break;
174cdf0e10cSrcweir case MID_LINE_FOOTNOTE_DIST: aFtnInfo.SetBottomDist(nSet32);break;
175cdf0e10cSrcweir }
176cdf0e10cSrcweir }
177cdf0e10cSrcweir break;
178cdf0e10cSrcweir case MID_LINE_WEIGHT :
179cdf0e10cSrcweir {
180cdf0e10cSrcweir sal_Int16 nSet = 0;
181cdf0e10cSrcweir rVal >>= nSet;
182cdf0e10cSrcweir if(nSet >= 0)
183cdf0e10cSrcweir aFtnInfo.SetLineWidth(MM100_TO_TWIP(nSet));
184cdf0e10cSrcweir else
185cdf0e10cSrcweir bRet = sal_False;
186cdf0e10cSrcweir }
187cdf0e10cSrcweir break;
188cdf0e10cSrcweir case MID_LINE_RELWIDTH :
189cdf0e10cSrcweir {
190cdf0e10cSrcweir sal_Int8 nSet = 0;
191cdf0e10cSrcweir rVal >>= nSet;
192cdf0e10cSrcweir if(nSet < 0)
193cdf0e10cSrcweir bRet = sal_False;
194cdf0e10cSrcweir else
195cdf0e10cSrcweir aFtnInfo.SetWidth(Fraction(nSet, 100));
196cdf0e10cSrcweir }
197cdf0e10cSrcweir break;
198cdf0e10cSrcweir case MID_LINE_ADJUST :
199cdf0e10cSrcweir {
200cdf0e10cSrcweir sal_Int16 nSet = 0;
201cdf0e10cSrcweir rVal >>= nSet;
202cdf0e10cSrcweir if(nSet >= 0 && nSet < 3) //text::HorizontalAdjust
203cdf0e10cSrcweir aFtnInfo.SetAdj((SwFtnAdj)nSet);
204cdf0e10cSrcweir else
205cdf0e10cSrcweir bRet = sal_False;
206cdf0e10cSrcweir }
207cdf0e10cSrcweir break;
208cdf0e10cSrcweir default:
209cdf0e10cSrcweir bRet = sal_False;
210cdf0e10cSrcweir }
211cdf0e10cSrcweir return bRet;
212cdf0e10cSrcweir }
213cdf0e10cSrcweir
SwPtrItem(const sal_uInt16 nId,void * pPtr)214cdf0e10cSrcweir SwPtrItem::SwPtrItem( const sal_uInt16 nId, void* pPtr ) :
215cdf0e10cSrcweir SfxPoolItem( nId ),
216cdf0e10cSrcweir pMisc(pPtr)
217cdf0e10cSrcweir {
218cdf0e10cSrcweir }
219cdf0e10cSrcweir
220cdf0e10cSrcweir /*--------------------------------------------------------------------
221cdf0e10cSrcweir Beschreibung: Copy-Konstruktor
222cdf0e10cSrcweir --------------------------------------------------------------------*/
223cdf0e10cSrcweir
224cdf0e10cSrcweir
SwPtrItem(const SwPtrItem & rItem)225cdf0e10cSrcweir SwPtrItem::SwPtrItem( const SwPtrItem& rItem ) : SfxPoolItem( rItem )
226cdf0e10cSrcweir {
227cdf0e10cSrcweir pMisc = rItem.pMisc;
228cdf0e10cSrcweir }
229cdf0e10cSrcweir
230cdf0e10cSrcweir /*--------------------------------------------------------------------
231cdf0e10cSrcweir Beschreibung: Clonen
232cdf0e10cSrcweir --------------------------------------------------------------------*/
233cdf0e10cSrcweir
234cdf0e10cSrcweir
Clone(SfxItemPool *) const235cdf0e10cSrcweir SfxPoolItem* SwPtrItem::Clone( SfxItemPool * /*pPool*/ ) const
236cdf0e10cSrcweir {
237cdf0e10cSrcweir return new SwPtrItem( *this );
238cdf0e10cSrcweir }
239cdf0e10cSrcweir
240cdf0e10cSrcweir /*--------------------------------------------------------------------
241cdf0e10cSrcweir Beschreibung:
242cdf0e10cSrcweir --------------------------------------------------------------------*/
243cdf0e10cSrcweir
244cdf0e10cSrcweir
operator ==(const SfxPoolItem & rAttr) const245cdf0e10cSrcweir int SwPtrItem::operator==( const SfxPoolItem& rAttr ) const
246cdf0e10cSrcweir {
247cdf0e10cSrcweir DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
248cdf0e10cSrcweir const SwPtrItem& rItem = (SwPtrItem&)rAttr;
249cdf0e10cSrcweir return ( pMisc == rItem.pMisc );
250cdf0e10cSrcweir }
251cdf0e10cSrcweir
252cdf0e10cSrcweir
253cdf0e10cSrcweir /*-----------------12.11.97 12:55-------------------------------
254cdf0e10cSrcweir SwUINumRuleItem fuer die NumTabPages der FormatNumRule/Stylisten
255cdf0e10cSrcweir ---------------------------------------------------------------*/
SwUINumRuleItem(const SwNumRule & rRul,const sal_uInt16 nId)256cdf0e10cSrcweir SwUINumRuleItem::SwUINumRuleItem( const SwNumRule& rRul, const sal_uInt16 nId )
257cdf0e10cSrcweir : SfxPoolItem( nId ), pRule( new SwNumRule( rRul ) )
258cdf0e10cSrcweir {
259cdf0e10cSrcweir }
260cdf0e10cSrcweir
SwUINumRuleItem(const SwUINumRuleItem & rItem)261cdf0e10cSrcweir SwUINumRuleItem::SwUINumRuleItem( const SwUINumRuleItem& rItem )
262cdf0e10cSrcweir : SfxPoolItem( rItem ),
263cdf0e10cSrcweir pRule( new SwNumRule( *rItem.pRule ))
264cdf0e10cSrcweir {
265cdf0e10cSrcweir }
266cdf0e10cSrcweir
~SwUINumRuleItem()267cdf0e10cSrcweir SwUINumRuleItem::~SwUINumRuleItem()
268cdf0e10cSrcweir {
269cdf0e10cSrcweir delete pRule;
270cdf0e10cSrcweir }
271cdf0e10cSrcweir
272cdf0e10cSrcweir
Clone(SfxItemPool *) const273cdf0e10cSrcweir SfxPoolItem* SwUINumRuleItem::Clone( SfxItemPool * /*pPool*/ ) const
274cdf0e10cSrcweir {
275cdf0e10cSrcweir return new SwUINumRuleItem( *this );
276cdf0e10cSrcweir }
277cdf0e10cSrcweir
operator ==(const SfxPoolItem & rAttr) const278cdf0e10cSrcweir int SwUINumRuleItem::operator==( const SfxPoolItem& rAttr ) const
279cdf0e10cSrcweir {
280cdf0e10cSrcweir DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
281cdf0e10cSrcweir return *pRule == *((SwUINumRuleItem&)rAttr).pRule;
282cdf0e10cSrcweir }
283cdf0e10cSrcweir
QueryValue(uno::Any & rVal,sal_uInt8) const284cdf0e10cSrcweir sal_Bool SwUINumRuleItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
285cdf0e10cSrcweir {
286cdf0e10cSrcweir uno::Reference< container::XIndexReplace >xRules = new SwXNumberingRules(*pRule);
287cdf0e10cSrcweir rVal.setValue(&xRules, ::getCppuType((uno::Reference< container::XIndexReplace>*)0));
288cdf0e10cSrcweir return sal_True;
289cdf0e10cSrcweir }
PutValue(const uno::Any & rVal,sal_uInt8)290cdf0e10cSrcweir sal_Bool SwUINumRuleItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
291cdf0e10cSrcweir {
292cdf0e10cSrcweir uno::Reference< container::XIndexReplace> xRulesRef;
293cdf0e10cSrcweir if(rVal >>= xRulesRef)
294cdf0e10cSrcweir {
295cdf0e10cSrcweir uno::Reference< lang::XUnoTunnel > xTunnel(xRulesRef, uno::UNO_QUERY);
296cdf0e10cSrcweir SwXNumberingRules* pSwXRules = xTunnel.is() ? reinterpret_cast<SwXNumberingRules*>(
297cdf0e10cSrcweir xTunnel->getSomething(SwXNumberingRules::getUnoTunnelId())) : 0;
298cdf0e10cSrcweir if(pSwXRules)
299cdf0e10cSrcweir {
300cdf0e10cSrcweir *pRule = *pSwXRules->GetNumRule();
301cdf0e10cSrcweir }
302cdf0e10cSrcweir }
303cdf0e10cSrcweir return sal_True;
304cdf0e10cSrcweir }
305cdf0e10cSrcweir /* -----------------17.06.98 17:43-------------------
306cdf0e10cSrcweir *
307cdf0e10cSrcweir * --------------------------------------------------*/
SwBackgroundDestinationItem(sal_uInt16 _nWhich,sal_uInt16 nValue)308cdf0e10cSrcweir SwBackgroundDestinationItem::SwBackgroundDestinationItem(sal_uInt16 _nWhich, sal_uInt16 nValue) :
309cdf0e10cSrcweir SfxUInt16Item(_nWhich, nValue)
310cdf0e10cSrcweir {
311cdf0e10cSrcweir }
312cdf0e10cSrcweir /* -----------------17.06.98 17:44-------------------
313cdf0e10cSrcweir *
314cdf0e10cSrcweir * --------------------------------------------------*/
Clone(SfxItemPool *) const315cdf0e10cSrcweir SfxPoolItem* SwBackgroundDestinationItem::Clone( SfxItemPool * /*pPool*/ ) const
316cdf0e10cSrcweir {
317cdf0e10cSrcweir return new SwBackgroundDestinationItem(Which(), GetValue());
318cdf0e10cSrcweir }
319cdf0e10cSrcweir
320cdf0e10cSrcweir
321cdf0e10cSrcweir
322