xref: /aoo42x/main/sw/source/core/layout/atrfrm.cxx (revision 64b14621)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sw.hxx"
26 
27 
28 #include <hintids.hxx>
29 #include <com/sun/star/text/RelOrientation.hpp>
30 #include <com/sun/star/text/VertOrientation.hpp>
31 #include <com/sun/star/text/HorizontalAdjust.hpp>
32 #include <com/sun/star/text/DocumentStatistic.hpp>
33 #include <com/sun/star/text/HoriOrientation.hpp>
34 #include <com/sun/star/text/HoriOrientationFormat.hpp>
35 #include <com/sun/star/text/NotePrintMode.hpp>
36 #include <com/sun/star/text/SizeType.hpp>
37 #include <com/sun/star/text/VertOrientationFormat.hpp>
38 #include <com/sun/star/text/WrapTextMode.hpp>
39 #include <com/sun/star/text/XTextFrame.hpp>
40 #include <com/sun/star/text/TextContentAnchorType.hpp>
41 #include <com/sun/star/text/InvalidTextContentException.hpp>
42 #include <com/sun/star/container/XIndexContainer.hpp>
43 #include <com/sun/star/text/TextGridMode.hpp>
44 #include <com/sun/star/awt/Size.hpp>
45 #include <svtools/unoimap.hxx>
46 #include <svtools/unoevent.hxx>
47 #include <basic/sbxvar.hxx>
48 #include <svtools/imap.hxx>
49 #include <svtools/imapobj.hxx>
50 #include <editeng/ulspitem.hxx>
51 #include <editeng/lrspitem.hxx>
52 #include <svx/svdmodel.hxx>
53 #include <svx/svdpage.hxx>
54 #include <unosett.hxx>
55 #include <unostyle.hxx>
56 #include <fmtclds.hxx>
57 #include <fmtornt.hxx>
58 #include <fmthdft.hxx>
59 #include <fmtpdsc.hxx>
60 #include <fmtcntnt.hxx>
61 #include <fmtfsize.hxx>
62 #include <fmtfordr.hxx>
63 #include <fmtsrnd.hxx>
64 #include <fmtanchr.hxx>
65 #include <fmtlsplt.hxx>
66 #include <fmtrowsplt.hxx>
67 #include <fmtftntx.hxx>
68 #include <fmteiro.hxx>
69 #include <fmturl.hxx>
70 #include <fmtcnct.hxx>
71 #include <node.hxx>
72 #include <section.hxx>
73 #include <fmtline.hxx>
74 #include <tgrditem.hxx>
75 #include <hfspacingitem.hxx>
76 #include <doc.hxx>
77 #include <IDocumentUndoRedo.hxx>
78 #include <pagefrm.hxx>
79 #include <rootfrm.hxx>
80 #include <cntfrm.hxx>
81 #include <crsrsh.hxx>
82 #include <pam.hxx>
83 #include <dflyobj.hxx>
84 #include <dcontact.hxx>
85 #include <flyfrm.hxx>
86 #include <frmtool.hxx>
87 #include <flyfrms.hxx>
88 #include <pagedesc.hxx>
89 #include <grfatr.hxx>
90 #include <ndnotxt.hxx>
91 #include <docary.hxx>
92 #include <node2lay.hxx>
93 #include <fmtclbl.hxx>
94 #include <swunohelper.hxx>
95 #include <unoframe.hxx>
96 #include <unotextbodyhf.hxx>
97 #include <SwStyleNameMapper.hxx>
98 #include <editeng/brshitem.hxx>
99 #include <svtools/grfmgr.hxx>
100 #include <cmdid.h>
101 #include <unomid.h>
102 #include <comcore.hrc>
103 #include <svx/svdundo.hxx> // #111827#
104 #include <sortedobjs.hxx>
105 #include <HandleAnchorNodeChg.hxx>
106 #include <svl/cjkoptions.hxx>
107 #include <switerator.hxx>
108 #include <pagedeschint.hxx>
109 #include <svx/sdr/primitive2d/sdrattributecreator.hxx>
110 
111 //UUUU
112 #include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
113 #include <basegfx/polygon/b2dpolygontools.hxx>
114 #include <basegfx/matrix/b2dhommatrix.hxx>
115 #include <basegfx/polygon/b2dpolygon.hxx>
116 #include <drawinglayer/attribute/fillhatchattribute.hxx>
117 #include <drawinglayer/attribute/sdrfillgraphicattribute.hxx>
118 #include <svx/xfillit0.hxx>
119 
120 using namespace ::com::sun::star;
121 using ::rtl::OUString;
122 
123 SV_IMPL_PTRARR(SwColumns,SwColumn*)
124 
125 TYPEINIT1(SwFmtVertOrient, SfxPoolItem);
126 TYPEINIT1(SwFmtHoriOrient, SfxPoolItem);
127 TYPEINIT2(SwFmtHeader,  SfxPoolItem, SwClient );
128 TYPEINIT2(SwFmtFooter,  SfxPoolItem, SwClient );
129 TYPEINIT2(SwFmtPageDesc,  SfxPoolItem, SwClient );
130 TYPEINIT1_AUTOFACTORY(SwFmtLineNumber, SfxPoolItem);
131 
132 /* -----------------19.05.98 09:26-------------------
133  * 	Umwandlung fuer QueryValue
134  * --------------------------------------------------*/
135 sal_Int16 lcl_RelToINT(sal_Int16 eRelation)
136 {
137     sal_Int16 nRet = text::RelOrientation::FRAME;
138 	switch(eRelation)
139 	{
140     case  text::RelOrientation::PRINT_AREA:           nRet = text::RelOrientation::PRINT_AREA; break;
141     case  text::RelOrientation::CHAR:         nRet = text::RelOrientation::CHAR; break;
142     case  text::RelOrientation::PAGE_LEFT:        nRet = text::RelOrientation::PAGE_LEFT; break;
143     case  text::RelOrientation::PAGE_RIGHT:       nRet = text::RelOrientation::PAGE_RIGHT; break;
144     case  text::RelOrientation::FRAME_LEFT:       nRet = text::RelOrientation::FRAME_LEFT; break;
145     case  text::RelOrientation::FRAME_RIGHT:  nRet = text::RelOrientation::FRAME_RIGHT; break;
146     case  text::RelOrientation::PAGE_FRAME:       nRet = text::RelOrientation::PAGE_FRAME; break;
147     case  text::RelOrientation::PAGE_PRINT_AREA:  nRet = text::RelOrientation::PAGE_PRINT_AREA; break;
148     // OD 13.11.2003 #i22341#
149     case  text::RelOrientation::TEXT_LINE:    nRet = text::RelOrientation::TEXT_LINE; break;
150     default: break;
151 	}
152 	return nRet;
153 }
154 
155 sal_Int16 lcl_IntToRelation(const uno::Any& rVal)
156 {
157     sal_Int16 eRet = text::RelOrientation::FRAME;
158     sal_Int16 nVal = 0;
159     rVal >>= nVal;
160     switch(nVal)
161 	{
162         case  text::RelOrientation::PRINT_AREA:         eRet =   text::RelOrientation::PRINT_AREA           ; break;
163         case  text::RelOrientation::CHAR:               eRet =   text::RelOrientation::CHAR          ; break;
164         case  text::RelOrientation::PAGE_LEFT:          eRet =   text::RelOrientation::PAGE_LEFT       ; break;
165         case  text::RelOrientation::PAGE_RIGHT:         eRet =   text::RelOrientation::PAGE_RIGHT      ; break;
166         case  text::RelOrientation::FRAME_LEFT:         eRet =   text::RelOrientation::FRAME_LEFT      ; break;
167         case  text::RelOrientation::FRAME_RIGHT:        eRet =   text::RelOrientation::FRAME_RIGHT     ; break;
168         case  text::RelOrientation::PAGE_FRAME:         eRet =   text::RelOrientation::PAGE_FRAME      ; break;
169         case  text::RelOrientation::PAGE_PRINT_AREA:    eRet =   text::RelOrientation::PAGE_PRINT_AREA    ; break;
170         // OD 13.11.2003 #i22341#
171         case  text::RelOrientation::TEXT_LINE: eRet = text::RelOrientation::TEXT_LINE; break;
172     }
173 	return eRet;
174 }
175 
176 void DelHFFormat( SwClient *pToRemove, SwFrmFmt *pFmt )
177 {
178 	//Wenn der Client der letzte ist der das Format benutzt, so muss dieses
179 	//vernichtet werden. Zuvor muss jedoch ggf. die Inhaltssection vernichtet
180 	//werden.
181 	SwDoc* pDoc = pFmt->GetDoc();
182 	pFmt->Remove( pToRemove );
183 	if( pDoc->IsInDtor() )
184 	{
185 		delete pFmt;
186 		return;
187 	}
188 
189 	//Nur noch Frms angemeldet?
190 	sal_Bool bDel = sal_True;
191 	{
192 		// Klammer, weil im DTOR SwClientIter das Flag bTreeChg zurueck
193 		// gesetzt wird. Unguenstig, wenn das Format vorher zerstoert wird.
194 		SwClientIter aIter( *pFmt );        // TODO
195 		SwClient *pLast = aIter.GoStart();
196 		if( pLast )
197 			do {
198                 bDel = pLast->IsA( TYPE(SwFrm) )
199                     || SwXHeadFootText::IsXHeadFootText(pLast);
200 			} while( bDel && 0 != ( pLast = ++aIter ));
201 	}
202 
203 	if ( bDel )
204 	{
205 		//Wenn in einem der Nodes noch ein Crsr angemeldet ist, muss das
206 		//ParkCrsr einer (beliebigen) Shell gerufen werden.
207 		SwFmtCntnt& rCnt = (SwFmtCntnt&)pFmt->GetCntnt();
208 		if ( rCnt.GetCntntIdx() )
209 		{
210 			SwNode *pNode = 0;
211 			{
212                 // --> OD 2008-10-07 #i92993#
213                 // Begin with start node of page header/footer to assure that
214                 // complete content is checked for cursors and the complete content
215                 // is deleted on below made method call <pDoc->DeleteSection(pNode)>
216 //                SwNodeIndex aIdx( *rCnt.GetCntntIdx(), 1 );
217                 SwNodeIndex aIdx( *rCnt.GetCntntIdx(), 0 );
218                 // <--
219 				//Wenn in einem der Nodes noch ein Crsr angemeldet ist, muss das
220 				//ParkCrsr einer (beliebigen) Shell gerufen werden.
221                 pNode = & aIdx.GetNode();
222 				sal_uInt32 nEnd = pNode->EndOfSectionIndex();
223 				while ( aIdx < nEnd )
224 				{
225 					if ( pNode->IsCntntNode() &&
226 						 ((SwCntntNode*)pNode)->GetDepends() )
227 					{
228 						SwCrsrShell *pShell = SwIterator<SwCrsrShell,SwCntntNode>::FirstElement( *(SwCntntNode*)pNode );
229 						if( pShell )
230 						{
231 							pShell->ParkCrsr( aIdx );
232 								aIdx = nEnd-1;
233 						}
234 					}
235 					aIdx++;
236                     pNode = & aIdx.GetNode();
237                 }
238             }
239             rCnt.SetNewCntntIdx( (const SwNodeIndex*)0 );
240 
241 			// beim Loeschen von Header/Footer-Formaten IMMER das Undo
242 			// abschalten! (Bug 31069)
243             ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
244 
245 			ASSERT( pNode, "Ein grosses Problem." );
246 			pDoc->DeleteSection( pNode );
247 		}
248 		delete pFmt;
249 	}
250 }
251 
252 //	class SwFmtFrmSize
253 //	Implementierung teilweise inline im hxx
254 
255 SwFmtFrmSize::SwFmtFrmSize( SwFrmSize eSize, SwTwips nWidth, SwTwips nHeight )
256 	: SfxPoolItem( RES_FRM_SIZE ),
257 	aSize( nWidth, nHeight ),
258     eFrmHeightType( eSize ),
259     eFrmWidthType( ATT_FIX_SIZE )
260 {
261 	nWidthPercent = nHeightPercent = 0;
262 }
263 
264 SwFmtFrmSize& SwFmtFrmSize::operator=( const SwFmtFrmSize& rCpy )
265 {
266 	aSize = rCpy.GetSize();
267     eFrmHeightType = rCpy.GetHeightSizeType();
268     eFrmWidthType = rCpy.GetWidthSizeType();
269 	nHeightPercent = rCpy.GetHeightPercent();
270 	nWidthPercent  = rCpy.GetWidthPercent();
271 	return *this;
272 }
273 
274 int  SwFmtFrmSize::operator==( const SfxPoolItem& rAttr ) const
275 {
276 	ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
277     return( eFrmHeightType  == ((SwFmtFrmSize&)rAttr).eFrmHeightType &&
278             eFrmWidthType  == ((SwFmtFrmSize&)rAttr).eFrmWidthType &&
279 			aSize    		== ((SwFmtFrmSize&)rAttr).GetSize()&&
280 			nWidthPercent	== ((SwFmtFrmSize&)rAttr).GetWidthPercent() &&
281 			nHeightPercent	== ((SwFmtFrmSize&)rAttr).GetHeightPercent() );
282 }
283 
284 SfxPoolItem*  SwFmtFrmSize::Clone( SfxItemPool* ) const
285 {
286 	return new SwFmtFrmSize( *this );
287 }
288 
289 
290 /* -----------------24.04.98 11:36-------------------
291  *
292  * --------------------------------------------------*/
293 sal_Bool SwFmtFrmSize::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
294 {
295 	// hier wird immer konvertiert!
296 	nMemberId &= ~CONVERT_TWIPS;
297 	switch ( nMemberId )
298 	{
299 		case MID_FRMSIZE_SIZE:
300 		{
301 			awt::Size aTmp;
302 			aTmp.Height = TWIP_TO_MM100(aSize.Height());
303 			aTmp.Width = TWIP_TO_MM100(aSize.Width());
304 			rVal.setValue(&aTmp, ::getCppuType((const awt::Size*)0));
305 		}
306 		break;
307 		case MID_FRMSIZE_REL_HEIGHT:
308 			rVal <<= (sal_Int16)(GetHeightPercent() != 0xFF ? GetHeightPercent() : 0);
309 		break;
310 		case MID_FRMSIZE_REL_WIDTH:
311 			rVal <<= (sal_Int16)(GetWidthPercent() != 0xFF ? GetWidthPercent() : 0);
312 		break;
313         case MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH:
314 		{
315 			sal_Bool bTmp = 0xFF == GetHeightPercent();
316 			rVal.setValue(&bTmp, ::getBooleanCppuType());
317 		}
318 		break;
319 		case MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT:
320 		{
321 			sal_Bool bTmp = 0xFF == GetWidthPercent();
322 			rVal.setValue(&bTmp, ::getBooleanCppuType());
323 		}
324 		break;
325 		case MID_FRMSIZE_WIDTH :
326 			rVal <<= (sal_Int32)TWIP_TO_MM100(aSize.Width());
327 		break;
328         case MID_FRMSIZE_HEIGHT:
329             // #95848# returned size should never be zero.
330             // (there was a bug that allowed for setting height to 0.
331             // Thus there some documents existing with that not allowed
332             // attribut value which may cause problems on import.)
333             rVal <<= (sal_Int32)TWIP_TO_MM100(aSize.Height() < MINLAY ? MINLAY : aSize.Height() );
334         break;
335         case MID_FRMSIZE_SIZE_TYPE:
336             rVal <<= (sal_Int16)GetHeightSizeType();
337 		break;
338 		case MID_FRMSIZE_IS_AUTO_HEIGHT:
339 		{
340             sal_Bool bTmp = ATT_FIX_SIZE != GetHeightSizeType();
341 			rVal.setValue(&bTmp, ::getBooleanCppuType());
342 		}
343 		break;
344         case MID_FRMSIZE_WIDTH_TYPE:
345             rVal <<= (sal_Int16)GetWidthSizeType();
346         break;
347 	}
348 	return sal_True;
349 }
350 
351 /* -----------------24.04.98 11:36-------------------
352  *
353  * --------------------------------------------------*/
354 sal_Bool SwFmtFrmSize::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
355 {
356 	sal_Bool bConvert = 0 != (nMemberId&CONVERT_TWIPS);
357 	nMemberId &= ~CONVERT_TWIPS;
358 	sal_Bool bRet = sal_True;
359 	switch ( nMemberId )
360 	{
361 		case MID_FRMSIZE_SIZE:
362 		{
363             awt::Size aVal;
364             if(!(rVal >>= aVal))
365                 bRet = sal_False;
366             else
367             {
368                 Size aTmp(aVal.Width, aVal.Height);
369                 if(bConvert)
370                 {
371                     aTmp.Height() = MM100_TO_TWIP(aTmp.Height());
372                     aTmp.Width() = MM100_TO_TWIP(aTmp.Width());
373                 }
374                 if(aTmp.Height() && aTmp.Width())
375                     aSize = aTmp;
376                 else
377                     bRet = sal_False;
378             }
379 		}
380 		break;
381 		case MID_FRMSIZE_REL_HEIGHT:
382 		{
383 			sal_Int16 nSet = 0;
384 			rVal >>= nSet;
385             if(nSet >= 0 && nSet <= 0xfe)
386 				SetHeightPercent((sal_uInt8)nSet);
387 			else
388 				bRet = sal_False;
389 		}
390 		break;
391 		case MID_FRMSIZE_REL_WIDTH:
392 		{
393 			sal_Int16 nSet = 0;
394 			rVal >>= nSet;
395             if(nSet >= 0 && nSet <= 0xfe)
396 				SetWidthPercent((sal_uInt8)nSet);
397 			else
398 				bRet = sal_False;
399 		}
400 		break;
401 		case MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH:
402 		{
403 			sal_Bool bSet = *(sal_Bool*)rVal.getValue();
404 			if(bSet)
405 				SetHeightPercent(0xff);
406 			else if( 0xff == GetHeightPercent() )
407 				SetHeightPercent( 0 );
408 		}
409 		break;
410 		case MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT:
411 		{
412 			sal_Bool bSet = *(sal_Bool*)rVal.getValue();
413 			if(bSet)
414 				SetWidthPercent(0xff);
415 			else if( 0xff == GetWidthPercent() )
416 				SetWidthPercent(0);
417 		}
418 		break;
419 		case MID_FRMSIZE_WIDTH :
420 		{
421             sal_Int32 nWd = 0;
422             if(rVal >>= nWd)
423             {
424                 if(bConvert)
425                     nWd = MM100_TO_TWIP(nWd);
426                 if(nWd < MINLAY)
427                    nWd = MINLAY;
428                 aSize.Width() = nWd;
429             }
430             else
431                 bRet = sal_False;
432         }
433 		break;
434 		case MID_FRMSIZE_HEIGHT:
435 		{
436             sal_Int32 nHg = 0;
437             if(rVal >>= nHg)
438             {
439                 if(bConvert)
440                     nHg = MM100_TO_TWIP(nHg);
441                 if(nHg < MINLAY)
442                     nHg = MINLAY;
443                 aSize.Height() = nHg;
444             }
445             else
446                 bRet = sal_False;
447         }
448 		break;
449 		case MID_FRMSIZE_SIZE_TYPE:
450 		{
451             sal_Int16 nType = 0;
452             if((rVal >>= nType) && nType >= 0 && nType <= ATT_MIN_SIZE )
453 			{
454                 SetHeightSizeType((SwFrmSize)nType);
455 			}
456             else
457                 bRet = sal_False;
458         }
459 		break;
460 		case MID_FRMSIZE_IS_AUTO_HEIGHT:
461 		{
462 			sal_Bool bSet = *(sal_Bool*)rVal.getValue();
463             SetHeightSizeType(bSet ? ATT_VAR_SIZE : ATT_FIX_SIZE);
464 		}
465 		break;
466         case MID_FRMSIZE_WIDTH_TYPE:
467         {
468             sal_Int16 nType = 0;
469             if((rVal >>= nType) && nType >= 0 && nType <= ATT_MIN_SIZE )
470 			{
471                 SetWidthSizeType((SwFrmSize)nType);
472 			}
473             else
474                 bRet = sal_False;
475         }
476         break;
477 		default:
478 			bRet = sal_False;
479 	}
480 	return bRet;
481 }
482 
483 //	class SwFmtFillOrder
484 //	Implementierung teilweise inline im hxx
485 
486 SwFmtFillOrder::SwFmtFillOrder( SwFillOrder nFO )
487 	: SfxEnumItem( RES_FILL_ORDER, sal_uInt16(nFO) )
488 {}
489 
490 SfxPoolItem*  SwFmtFillOrder::Clone( SfxItemPool* ) const
491 {
492 	return new SwFmtFillOrder( GetFillOrder() );
493 }
494 
495 sal_uInt16  SwFmtFillOrder::GetValueCount() const
496 {
497 	return SW_FILL_ORDER_END - SW_FILL_ORDER_BEGIN;
498 }
499 
500 //	class SwFmtHeader
501 //	Implementierung teilweise inline im hxx
502 
503 SwFmtHeader::SwFmtHeader( SwFrmFmt *pHeaderFmt )
504 	: SfxPoolItem( RES_HEADER ),
505 	SwClient( pHeaderFmt ),
506 	bActive( pHeaderFmt ? sal_True : sal_False )
507 {
508 }
509 
510 SwFmtHeader::SwFmtHeader( const SwFmtHeader &rCpy )
511 	: SfxPoolItem( RES_HEADER ),
512 	SwClient( (SwModify*)rCpy.GetRegisteredIn() ),
513 	bActive( rCpy.IsActive() )
514 {
515 }
516 
517 SwFmtHeader::SwFmtHeader( sal_Bool bOn )
518 	: SfxPoolItem( RES_HEADER ),
519 	SwClient( 0 ),
520 	bActive( bOn )
521 {
522 }
523 
524  SwFmtHeader::~SwFmtHeader()
525 {
526 	if ( GetHeaderFmt() )
527 		DelHFFormat( this, GetHeaderFmt() );
528 }
529 
530 int  SwFmtHeader::operator==( const SfxPoolItem& rAttr ) const
531 {
532 	ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
533 	return ( GetRegisteredIn() == ((SwFmtHeader&)rAttr).GetRegisteredIn() &&
534 			 bActive == ((SwFmtHeader&)rAttr).IsActive() );
535 }
536 
537 SfxPoolItem*  SwFmtHeader::Clone( SfxItemPool* ) const
538 {
539 	return new SwFmtHeader( *this );
540 }
541 
542 void SwFmtHeader::RegisterToFormat( SwFmt& rFmt )
543 {
544     rFmt.Add(this);
545 }
546 
547 //	class SwFmtFooter
548 //	Implementierung teilweise inline im hxx
549 
550 SwFmtFooter::SwFmtFooter( SwFrmFmt *pFooterFmt )
551 	: SfxPoolItem( RES_FOOTER ),
552 	SwClient( pFooterFmt ),
553 	bActive( pFooterFmt ? sal_True : sal_False )
554 {
555 }
556 
557 SwFmtFooter::SwFmtFooter( const SwFmtFooter &rCpy )
558 	: SfxPoolItem( RES_FOOTER ),
559 	SwClient( (SwModify*)rCpy.GetRegisteredIn() ),
560 	bActive( rCpy.IsActive() )
561 {
562 }
563 
564 SwFmtFooter::SwFmtFooter( sal_Bool bOn )
565 	: SfxPoolItem( RES_FOOTER ),
566 	SwClient( 0 ),
567 	bActive( bOn )
568 {
569 }
570 
571  SwFmtFooter::~SwFmtFooter()
572 {
573 	if ( GetFooterFmt() )
574 		DelHFFormat( this, GetFooterFmt() );
575 }
576 
577 void SwFmtFooter::RegisterToFormat( SwFmt& rFmt )
578 {
579     rFmt.Add(this);
580 }
581 
582 int  SwFmtFooter::operator==( const SfxPoolItem& rAttr ) const
583 {
584 	ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
585 	return ( GetRegisteredIn() == ((SwFmtFooter&)rAttr).GetRegisteredIn() &&
586 			 bActive == ((SwFmtFooter&)rAttr).IsActive() );
587 }
588 
589 SfxPoolItem*  SwFmtFooter::Clone( SfxItemPool* ) const
590 {
591 	return new SwFmtFooter( *this );
592 }
593 
594 //	class SwFmtCntnt
595 //	Implementierung teilweise inline im hxx
596 
597 SwFmtCntnt::SwFmtCntnt( const SwFmtCntnt &rCpy )
598 	: SfxPoolItem( RES_CNTNT )
599 {
600 	pStartNode = rCpy.GetCntntIdx() ?
601 					new SwNodeIndex( *rCpy.GetCntntIdx() ) : 0;
602 }
603 
604 SwFmtCntnt::SwFmtCntnt( const SwStartNode *pStartNd )
605 	: SfxPoolItem( RES_CNTNT )
606 {
607 	pStartNode = pStartNd ? new SwNodeIndex( *pStartNd ) : 0;
608 }
609 
610  SwFmtCntnt::~SwFmtCntnt()
611 {
612 	delete pStartNode;
613 }
614 
615 void SwFmtCntnt::SetNewCntntIdx( const SwNodeIndex *pIdx )
616 {
617 	delete pStartNode;
618 	pStartNode = pIdx ? new SwNodeIndex( *pIdx ) : 0;
619 }
620 
621 int  SwFmtCntnt::operator==( const SfxPoolItem& rAttr ) const
622 {
623 	ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
624 	if( (long)pStartNode ^ (long)((SwFmtCntnt&)rAttr).pStartNode )
625 		return 0;
626 	if( pStartNode )
627 		return ( *pStartNode == *((SwFmtCntnt&)rAttr).GetCntntIdx() );
628 	return 1;
629 }
630 
631 SfxPoolItem*  SwFmtCntnt::Clone( SfxItemPool* ) const
632 {
633 	return new SwFmtCntnt( *this );
634 }
635 
636 //	class SwFmtPageDesc
637 //	Implementierung teilweise inline im hxx
638 
639 SwFmtPageDesc::SwFmtPageDesc( const SwFmtPageDesc &rCpy )
640 	: SfxPoolItem( RES_PAGEDESC ),
641 	SwClient( (SwPageDesc*)rCpy.GetPageDesc() ),
642     nNumOffset( rCpy.nNumOffset ),
643     nDescNameIdx( rCpy.nDescNameIdx ),
644     pDefinedIn( 0 )
645 {
646 }
647 
648 SwFmtPageDesc::SwFmtPageDesc( const SwPageDesc *pDesc )
649 	: SfxPoolItem( RES_PAGEDESC ),
650 	SwClient( (SwPageDesc*)pDesc ),
651     nNumOffset( 0 ),
652     nDescNameIdx( 0xFFFF ), // IDX_NO_VALUE
653     pDefinedIn( 0 )
654 {
655 }
656 
657  SwFmtPageDesc::~SwFmtPageDesc() {}
658 
659 bool SwFmtPageDesc::KnowsPageDesc() const
660 {
661     return (GetRegisteredIn() != 0);
662 }
663 
664 int  SwFmtPageDesc::operator==( const SfxPoolItem& rAttr ) const
665 {
666 	ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
667 	return	( pDefinedIn == ((SwFmtPageDesc&)rAttr).pDefinedIn ) &&
668 			( nNumOffset == ((SwFmtPageDesc&)rAttr).nNumOffset ) &&
669 			( GetPageDesc() == ((SwFmtPageDesc&)rAttr).GetPageDesc() );
670 }
671 
672 SfxPoolItem*  SwFmtPageDesc::Clone( SfxItemPool* ) const
673 {
674 	return new SwFmtPageDesc( *this );
675 }
676 
677 void SwFmtPageDesc::SwClientNotify( const SwModify&, const SfxHint& rHint )
678 {
679     const SwPageDescHint* pHint = dynamic_cast<const SwPageDescHint*>(&rHint);
680     if ( pHint )
681     {
682         // mba: shouldn't that be broadcasted also?
683         SwFmtPageDesc aDfltDesc( pHint->GetPageDesc() );
684         SwPageDesc* pDesc = pHint->GetPageDesc();
685         const SwModify* pMod = GetDefinedIn();
686         if ( pMod )
687         {
688             if( pMod->ISA( SwCntntNode ) )
689                 ((SwCntntNode*)pMod)->SetAttr( aDfltDesc );
690             else if( pMod->ISA( SwFmt ))
691                 ((SwFmt*)pMod)->SetFmtAttr( aDfltDesc );
692             else
693             {
694                 DBG_ERROR( "What kind of SwModify is this?" );
695                 RegisterToPageDesc( *pDesc );
696             }
697         }
698         else
699             // there could be an Undo-copy
700             RegisterToPageDesc( *pDesc );
701     }
702 }
703 
704 void SwFmtPageDesc::RegisterToPageDesc( SwPageDesc& rDesc )
705 {
706     rDesc.Add( this );
707 }
708 
709 void SwFmtPageDesc::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
710 {
711 	if( !pDefinedIn )
712 		return;
713 
714     const sal_uInt16 nWhichId = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
715     switch( nWhichId )
716 	{
717 		case RES_OBJECTDYING:
718 				//Der Pagedesc, bei dem ich angemeldet bin stirbt, ich trage
719 				//mich also bei meinem Format aus.
720 				//Dabei werden ich Deletet!!!
721 			if( IS_TYPE( SwFmt, pDefinedIn ))
722 #ifdef DBG_UTIL
723 			{
724                 sal_Bool bDel = ((SwFmt*)pDefinedIn)->ResetFmtAttr( RES_PAGEDESC );
725 				ASSERT( bDel, ";-) FmtPageDesc nicht zerstoert." );
726 			}
727 #else
728                 ((SwFmt*)pDefinedIn)->ResetFmtAttr( RES_PAGEDESC );
729 #endif
730 			else if( IS_TYPE( SwCntntNode, pDefinedIn ))
731 #ifdef DBG_UTIL
732 			{
733 				sal_Bool bDel = ((SwCntntNode*)pDefinedIn)->ResetAttr( RES_PAGEDESC );
734 				ASSERT( bDel, ";-) FmtPageDesc nicht zerstoert." );
735 			}
736 #else
737 				((SwCntntNode*)pDefinedIn)->ResetAttr( RES_PAGEDESC );
738 #endif
739 			break;
740 
741 		default:
742 			/* do nothing */;
743 	}
744 }
745 
746 sal_Bool SwFmtPageDesc::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
747 {
748 	// hier wird immer konvertiert!
749 	nMemberId &= ~CONVERT_TWIPS;
750 	sal_Bool	bRet = sal_True;
751 	switch ( nMemberId )
752 	{
753 		case MID_PAGEDESC_PAGENUMOFFSET:
754 			rVal <<= (sal_Int16)GetNumOffset();
755 			break;
756 
757 		case MID_PAGEDESC_PAGEDESCNAME:
758 			{
759 				const SwPageDesc* pDesc = GetPageDesc();
760 				if( pDesc )
761 				{
762 					String aString;
763 					SwStyleNameMapper::FillProgName(pDesc->GetName(), aString, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC, sal_True );
764 					rVal <<= OUString( aString );
765 				}
766 				else
767 					rVal.clear();
768 			}
769 			break;
770 		default:
771 			ASSERT( !this, "unknown MemberId" );
772 			bRet = sal_False;
773 	}
774 	return bRet;
775 }
776 
777 sal_Bool SwFmtPageDesc::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
778 {
779 	// hier wird immer konvertiert!
780 	nMemberId &= ~CONVERT_TWIPS;
781 	sal_Bool bRet = sal_True;
782 	switch ( nMemberId )
783 	{
784 		case MID_PAGEDESC_PAGENUMOFFSET:
785         {
786             sal_Int16 nOffset = 0;
787             if(rVal >>= nOffset)
788                 SetNumOffset( nOffset );
789             else
790                 bRet = sal_False;
791         }
792         break;
793 
794 		case MID_PAGEDESC_PAGEDESCNAME:
795 			/* geht nicht, weil das Attribut eigentlich nicht den Namen
796 			 * sondern einen Pointer auf den PageDesc braucht (ist Client davon).
797 			 * Der Pointer waere aber ueber den Namen nur vom Dokument zu erfragen.
798 			 */
799 		default:
800 			ASSERT( !this, "unknown MemberId" );
801 			bRet = sal_False;
802 	}
803 	return bRet;
804 }
805 
806 
807 //	class SwFmtCol
808 //	Implementierung teilweise inline im hxx
809 
810 SwColumn::SwColumn() :
811     nWish ( 0 ),
812     nUpper( 0 ),
813 	nLower( 0 ),
814 	nLeft ( 0 ),
815     nRight( 0 )
816 {
817 }
818 
819 sal_Bool SwColumn::operator==( const SwColumn &rCmp )
820 {
821 	return (nWish    == rCmp.GetWishWidth() &&
822 			GetLeft()  == rCmp.GetLeft() &&
823 			GetRight() == rCmp.GetRight() &&
824 			GetUpper() == rCmp.GetUpper() &&
825 			GetLower() == rCmp.GetLower()) ? sal_True : sal_False;
826 }
827 
828 SwFmtCol::SwFmtCol( const SwFmtCol& rCpy )
829 	: SfxPoolItem( RES_COL ),
830 	nLineWidth( rCpy.nLineWidth),
831 	aLineColor( rCpy.aLineColor),
832 	nLineHeight( rCpy.GetLineHeight() ),
833 	eAdj( rCpy.GetLineAdj() ),
834     aColumns( (sal_Int8)rCpy.GetNumCols(), 1 ),
835     nWidth( rCpy.GetWishWidth() ),
836     aWidthAdjustValue( rCpy.aWidthAdjustValue ),
837     bOrtho( rCpy.IsOrtho() )
838 {
839 	for ( sal_uInt16 i = 0; i < rCpy.GetNumCols(); ++i )
840 	{
841 		SwColumn *pCol = new SwColumn( *rCpy.GetColumns()[i] );
842 		aColumns.Insert( pCol, aColumns.Count() );
843 	}
844 }
845 
846 SwFmtCol::~SwFmtCol() {}
847 
848 SwFmtCol& SwFmtCol::operator=( const SwFmtCol& rCpy )
849 {
850 	nLineWidth  = rCpy.nLineWidth;
851 	aLineColor  = rCpy.aLineColor;
852 	nLineHeight	= rCpy.GetLineHeight();
853 	eAdj		= rCpy.GetLineAdj();
854 	nWidth		= rCpy.GetWishWidth();
855 	bOrtho		= rCpy.IsOrtho();
856 	aWidthAdjustValue = rCpy.aWidthAdjustValue;
857 
858 	if ( aColumns.Count() )
859 		aColumns.DeleteAndDestroy( 0, aColumns.Count() );
860 	for ( sal_uInt16 i = 0; i < rCpy.GetNumCols(); ++i )
861 	{
862 		SwColumn *pCol = new SwColumn( *rCpy.GetColumns()[i] );
863 		aColumns.Insert( pCol, aColumns.Count() );
864 	}
865 	return *this;
866 }
867 
868 SwFmtCol::SwFmtCol()
869 	: SfxPoolItem( RES_COL ),
870     nLineWidth(0),
871     nLineHeight( 100 ),
872 	eAdj( COLADJ_NONE ),
873 	nWidth( USHRT_MAX ),
874 	aWidthAdjustValue( 0 ),
875 	bOrtho( sal_True )
876 {
877 }
878 
879 int SwFmtCol::operator==( const SfxPoolItem& rAttr ) const
880 {
881 	ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
882 	const SwFmtCol &rCmp = (const SwFmtCol&)rAttr;
883 	if( !(nLineWidth		== rCmp.nLineWidth  &&
884 		  aLineColor        == rCmp.aLineColor	&&
885 		  nLineHeight  		 == rCmp.GetLineHeight() &&
886 		  eAdj		 		 == rCmp.GetLineAdj() &&
887 		  nWidth  	 		 == rCmp.GetWishWidth() &&
888 		  bOrtho  			 == rCmp.IsOrtho() &&
889 		  aColumns.Count() == rCmp.GetNumCols() &&
890 		  aWidthAdjustValue == rCmp.GetAdjustValue()
891          ) )
892 		return 0;
893 
894 	for ( sal_uInt16 i = 0; i < aColumns.Count(); ++i )
895 		if ( !(*aColumns[i] == *rCmp.GetColumns()[i]) )
896 			return 0;
897 
898 	return 1;
899 }
900 
901 SfxPoolItem*  SwFmtCol::Clone( SfxItemPool* ) const
902 {
903 	return new SwFmtCol( *this );
904 }
905 
906 sal_uInt16 SwFmtCol::GetGutterWidth( sal_Bool bMin ) const
907 {
908 	sal_uInt16 nRet = 0;
909 	if ( aColumns.Count() == 2 )
910 		nRet = aColumns[0]->GetRight() + aColumns[1]->GetLeft();
911 	else if ( aColumns.Count() > 2 )
912 	{
913 		sal_Bool bSet = sal_False;
914 		for ( sal_uInt16 i = 1; i < aColumns.Count()-1; ++i )
915 		{
916 			const sal_uInt16 nTmp = aColumns[i]->GetRight() + aColumns[i+1]->GetLeft();
917 			if ( bSet )
918 			{
919 				if ( nTmp != nRet )
920 				{
921 					if ( !bMin )
922 						return USHRT_MAX;
923 					if ( nRet > nTmp )
924 						nRet = nTmp;
925 				}
926 			}
927 			else
928 			{	bSet = sal_True;
929 				nRet = nTmp;
930 			}
931 		}
932 	}
933 	return nRet;
934 }
935 
936 void SwFmtCol::SetGutterWidth( sal_uInt16 nNew, sal_uInt16 nAct )
937 {
938 	if ( bOrtho )
939 		Calc( nNew, nAct );
940 	else
941 	{
942 		sal_uInt16 nHalf = nNew / 2;
943 		for ( sal_uInt16 i = 0; i < aColumns.Count(); ++i )
944 		{	SwColumn *pCol = aColumns[i];
945 			pCol->SetLeft ( nHalf );
946 			pCol->SetRight( nHalf );
947 			if ( i == 0 )
948 				pCol->SetLeft( 0 );
949 			else if ( i == (aColumns.Count() - 1) )
950 				pCol->SetRight( 0 );
951 		}
952 	}
953 }
954 
955 void SwFmtCol::Init( sal_uInt16 nNumCols, sal_uInt16 nGutterWidth, sal_uInt16 nAct )
956 {
957 	//Loeschen scheint hier auf den erste Blick vielleicht etwas zu heftig;
958 	//anderfalls muessten allerdings alle Werte der verbleibenden SwColumn's
959 	//initialisiert werden.
960 	if ( aColumns.Count() )
961 		aColumns.DeleteAndDestroy( 0, aColumns.Count() );
962 	for ( sal_uInt16 i = 0; i < nNumCols; ++i )
963 	{	SwColumn *pCol = new SwColumn;
964 		aColumns.Insert( pCol, i );
965 	}
966 	bOrtho = sal_True;
967 	nWidth = USHRT_MAX;
968 	if( nNumCols )
969 		Calc( nGutterWidth, nAct );
970 }
971 
972 void SwFmtCol::SetOrtho( sal_Bool bNew, sal_uInt16 nGutterWidth, sal_uInt16 nAct )
973 {
974 	bOrtho = bNew;
975 	if ( bNew && aColumns.Count() )
976 		Calc( nGutterWidth, nAct );
977 }
978 
979 sal_uInt16 SwFmtCol::CalcColWidth( sal_uInt16 nCol, sal_uInt16 nAct ) const
980 {
981 	ASSERT( nCol < aColumns.Count(), ":-( ColumnsArr ueberindiziert." );
982 	if ( nWidth != nAct )
983 	{
984 		long nW = aColumns[nCol]->GetWishWidth();
985 		nW *= nAct;
986 		nW /= nWidth;
987 		return sal_uInt16(nW);
988 	}
989 	else
990 		return aColumns[nCol]->GetWishWidth();
991 }
992 
993 sal_uInt16 SwFmtCol::CalcPrtColWidth( sal_uInt16 nCol, sal_uInt16 nAct ) const
994 {
995 	ASSERT( nCol < aColumns.Count(), ":-( ColumnsArr ueberindiziert." );
996 	sal_uInt16 nRet = CalcColWidth( nCol, nAct );
997 	SwColumn *pCol = aColumns[nCol];
998 	nRet = nRet - pCol->GetLeft();
999 	nRet = nRet - pCol->GetRight();
1000 	return nRet;
1001 }
1002 
1003 void SwFmtCol::Calc( sal_uInt16 nGutterWidth, sal_uInt16 nAct )
1004 {
1005 	if(!GetNumCols())
1006         return;
1007     //Erstmal die Spalten mit der Aktuellen Breite einstellen, dann die
1008 	//Wunschbreite der Spalten anhand der Gesamtwunschbreite hochrechnen.
1009 
1010 	const sal_uInt16 nGutterHalf = nGutterWidth ? nGutterWidth / 2 : 0;
1011 
1012 	//Breite der PrtAreas ist Gesamtbreite - Zwischenraeume / Anzahl
1013 	const sal_uInt16 nPrtWidth =
1014 				(nAct - ((GetNumCols()-1) * nGutterWidth)) / GetNumCols();
1015 	sal_uInt16 nAvail = nAct;
1016 
1017 	//Die erste Spalte ist PrtBreite + (Zwischenraumbreite/2)
1018 	const sal_uInt16 nLeftWidth = nPrtWidth + nGutterHalf;
1019 	SwColumn *pCol = aColumns[0];
1020 	pCol->SetWishWidth( nLeftWidth );
1021 	pCol->SetRight( nGutterHalf );
1022 	pCol->SetLeft ( 0 );
1023 	nAvail = nAvail - nLeftWidth;
1024 
1025 	//Spalte 2 bis n-1 ist PrtBreite + Zwischenraumbreite
1026 	const sal_uInt16 nMidWidth = nPrtWidth + nGutterWidth;
1027 	sal_uInt16 i;
1028 
1029 	for ( i = 1; i < GetNumCols()-1; ++i )
1030 	{
1031 		pCol = aColumns[i];
1032 		pCol->SetWishWidth( nMidWidth );
1033 		pCol->SetLeft ( nGutterHalf );
1034 		pCol->SetRight( nGutterHalf );
1035 		nAvail = nAvail - nMidWidth;
1036 	}
1037 
1038 	//Die Letzte Spalte entspricht wieder der ersten, um Rundungsfehler
1039 	//auszugleichen wird der letzten Spalte alles zugeschlagen was die
1040 	//anderen nicht verbraucht haben.
1041 	pCol = aColumns[aColumns.Count()-1];
1042 	pCol->SetWishWidth( nAvail );
1043 	pCol->SetLeft ( nGutterHalf );
1044 	pCol->SetRight( 0 );
1045 
1046 	//Umrechnen der aktuellen Breiten in Wunschbreiten.
1047 	for ( i = 0; i < aColumns.Count(); ++i )
1048 	{
1049 		pCol = aColumns[i];
1050 		long nTmp = pCol->GetWishWidth();
1051 		nTmp *= GetWishWidth();
1052 		nTmp /= nAct;
1053 		pCol->SetWishWidth( sal_uInt16(nTmp) );
1054 	}
1055 }
1056 
1057 sal_Bool SwFmtCol::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
1058 {
1059 	// hier wird immer konvertiert!
1060 	nMemberId &= ~CONVERT_TWIPS;
1061 	if(MID_COLUMN_SEPARATOR_LINE == nMemberId)
1062 	{
1063 		DBG_ERROR("not implemented");
1064 	}
1065 	else
1066 	{
1067 		uno::Reference< text::XTextColumns >  xCols = new SwXTextColumns(*this);
1068 		rVal.setValue(&xCols, ::getCppuType((uno::Reference< text::XTextColumns>*)0));
1069 	}
1070 	return sal_True;
1071 }
1072 
1073 sal_Bool SwFmtCol::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
1074 {
1075 	// hier wird immer konvertiert!
1076 	nMemberId &= ~CONVERT_TWIPS;
1077 	sal_Bool bRet = sal_False;
1078 	if(MID_COLUMN_SEPARATOR_LINE == nMemberId)
1079 	{
1080 		DBG_ERROR("not implemented");
1081 	}
1082 	else
1083 	{
1084         uno::Reference< text::XTextColumns > xCols;
1085         rVal >>= xCols;
1086         if(xCols.is())
1087 		{
1088             uno::Sequence<text::TextColumn> aSetColumns = xCols->getColumns();
1089 			const text::TextColumn* pArray = aSetColumns.getConstArray();
1090 			aColumns.DeleteAndDestroy(0, aColumns.Count());
1091 			//max. Count ist hier 64K - das kann das Array aber nicht
1092 			sal_uInt16 nCount = Min( (sal_uInt16)aSetColumns.getLength(),
1093 									 (sal_uInt16) 0x3fff );
1094 			sal_uInt16 nWidthSum = 0;
1095             // #101224# one column is no column
1096             //
1097             if(nCount > 1)
1098                 for(sal_uInt16 i = 0; i < nCount; i++)
1099                 {
1100                     SwColumn* pCol = new SwColumn;
1101                     pCol->SetWishWidth( static_cast<sal_uInt16>(pArray[i].Width) );
1102                     nWidthSum = static_cast<sal_uInt16>(nWidthSum + pArray[i].Width);
1103                     pCol->SetLeft ( static_cast<sal_uInt16>(MM100_TO_TWIP(pArray[i].LeftMargin)) );
1104                     pCol->SetRight( static_cast<sal_uInt16>(MM100_TO_TWIP(pArray[i].RightMargin)) );
1105                     aColumns.Insert(pCol, i);
1106                 }
1107 			bRet = sal_True;
1108 			nWidth = nWidthSum;
1109             bOrtho = sal_False;
1110 
1111             uno::Reference<lang::XUnoTunnel> xNumTunnel(xCols, uno::UNO_QUERY);
1112 			SwXTextColumns* pSwColums = 0;
1113 			if(xNumTunnel.is())
1114 			{
1115                 pSwColums = reinterpret_cast< SwXTextColumns * >(
1116                     sal::static_int_cast< sal_IntPtr >(
1117                     xNumTunnel->getSomething( SwXTextColumns::getUnoTunnelId() )));
1118 			}
1119 			if(pSwColums)
1120 			{
1121                 bOrtho = pSwColums->IsAutomaticWidth();
1122                 nLineWidth = pSwColums->GetSepLineWidth();
1123 				aLineColor.SetColor(pSwColums->GetSepLineColor());
1124 				nLineHeight = pSwColums->GetSepLineHeightRelative();
1125 				if(!pSwColums->GetSepLineIsOn())
1126 					eAdj = COLADJ_NONE;
1127 				else switch(pSwColums->GetSepLineVertAlign())
1128 				{
1129 					case 0: eAdj = COLADJ_TOP;	break;	//VerticalAlignment_TOP
1130 					case 1: eAdj = COLADJ_CENTER;break; //VerticalAlignment_MIDDLE
1131 					case 2: eAdj = COLADJ_BOTTOM;break;	//VerticalAlignment_BOTTOM
1132                     default: ASSERT( !this, "unknown alignment" ); break;
1133 				}
1134 			}
1135 		}
1136 	}
1137 	return bRet;
1138 }
1139 
1140 
1141 //	class SwFmtSurround
1142 //	Implementierung teilweise inline im hxx
1143 
1144 SwFmtSurround::SwFmtSurround( SwSurround eFly ) :
1145 	SfxEnumItem( RES_SURROUND, sal_uInt16( eFly ) )
1146 {
1147 	bAnchorOnly = bContour = bOutside = sal_False;
1148 }
1149 
1150 SwFmtSurround::SwFmtSurround( const SwFmtSurround &rCpy ) :
1151 	SfxEnumItem( RES_SURROUND, rCpy.GetValue() )
1152 {
1153 	bAnchorOnly = rCpy.bAnchorOnly;
1154 	bContour = rCpy.bContour;
1155 	bOutside = rCpy.bOutside;
1156 }
1157 
1158 int  SwFmtSurround::operator==( const SfxPoolItem& rAttr ) const
1159 {
1160 	ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
1161 	return ( GetValue() == ((SwFmtSurround&)rAttr).GetValue() &&
1162 			 bAnchorOnly== ((SwFmtSurround&)rAttr).bAnchorOnly &&
1163 			 bContour== ((SwFmtSurround&)rAttr).bContour &&
1164 			 bOutside== ((SwFmtSurround&)rAttr).bOutside );
1165 }
1166 
1167 SfxPoolItem*  SwFmtSurround::Clone( SfxItemPool* ) const
1168 {
1169 	return new SwFmtSurround( *this );
1170 }
1171 
1172 sal_uInt16  SwFmtSurround::GetValueCount() const
1173 {
1174 	return SURROUND_END - SURROUND_BEGIN;
1175 }
1176 
1177 
1178 sal_Bool SwFmtSurround::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
1179 {
1180 	// hier wird immer konvertiert!
1181 	nMemberId &= ~CONVERT_TWIPS;
1182 	sal_Bool bRet = sal_True;
1183 	switch ( nMemberId )
1184 	{
1185 		case MID_SURROUND_SURROUNDTYPE:
1186 				rVal <<= (text::WrapTextMode)GetSurround();
1187 		break;
1188 		case MID_SURROUND_ANCHORONLY:
1189 		{
1190 			sal_Bool bTmp = IsAnchorOnly();
1191 			rVal.setValue(&bTmp, ::getBooleanCppuType());
1192 		}
1193 				break;
1194 		case MID_SURROUND_CONTOUR:
1195 		{
1196 			sal_Bool bTmp = IsContour();
1197 			rVal.setValue(&bTmp, ::getBooleanCppuType());
1198 		}
1199 				break;
1200 		case MID_SURROUND_CONTOUROUTSIDE:
1201 		{
1202 			sal_Bool bTmp = IsOutside();
1203 			rVal.setValue(&bTmp, ::getBooleanCppuType());
1204 		}
1205 				break;
1206 		default:
1207 			ASSERT( !this, "unknown MemberId" );
1208 			bRet = sal_False;
1209 	}
1210 	return bRet;
1211 }
1212 
1213 sal_Bool SwFmtSurround::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
1214 {
1215 	// hier wird immer konvertiert!
1216 	nMemberId &= ~CONVERT_TWIPS;
1217 	sal_Bool bRet = sal_True;
1218 	switch ( nMemberId )
1219 	{
1220 		case MID_SURROUND_SURROUNDTYPE:
1221 		{
1222 			sal_Int32 eVal = SWUnoHelper::GetEnumAsInt32( rVal );
1223 			if( eVal >= 0 && eVal < (sal_Int16)SURROUND_END )
1224 				SetValue( static_cast<sal_uInt16>(eVal) );
1225 			else {
1226 				//exception
1227 				;
1228             }
1229 		}
1230 		break;
1231 
1232 		case MID_SURROUND_ANCHORONLY:
1233 			SetAnchorOnly( *(sal_Bool*)rVal.getValue() );
1234 			break;
1235 		case MID_SURROUND_CONTOUR:
1236 			SetContour( *(sal_Bool*)rVal.getValue() );
1237 			break;
1238 		case MID_SURROUND_CONTOUROUTSIDE:
1239 			SetOutside( *(sal_Bool*)rVal.getValue() );
1240 			break;
1241 		default:
1242 			ASSERT( !this, "unknown MemberId" );
1243 			bRet = sal_False;
1244 	}
1245 	return bRet;
1246 }
1247 
1248 //	class SwFmtVertOrient
1249 //	Implementierung teilweise inline im hxx
1250 
1251 SwFmtVertOrient::SwFmtVertOrient( SwTwips nY, sal_Int16 eVert,
1252                                   sal_Int16 eRel )
1253 	: SfxPoolItem( RES_VERT_ORIENT ),
1254 	nYPos( nY ),
1255 	eOrient( eVert ),
1256 	eRelation( eRel )
1257 {}
1258 
1259 int  SwFmtVertOrient::operator==( const SfxPoolItem& rAttr ) const
1260 {
1261 	ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
1262 	return ( nYPos     == ((SwFmtVertOrient&)rAttr).nYPos &&
1263 			 eOrient   == ((SwFmtVertOrient&)rAttr).eOrient &&
1264 			 eRelation == ((SwFmtVertOrient&)rAttr).eRelation );
1265 }
1266 
1267 SfxPoolItem*  SwFmtVertOrient::Clone( SfxItemPool* ) const
1268 {
1269 	return new SwFmtVertOrient( nYPos, eOrient, eRelation );
1270 }
1271 
1272 sal_Bool SwFmtVertOrient::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
1273 {
1274 	// hier wird immer konvertiert!
1275 	nMemberId &= ~CONVERT_TWIPS;
1276 	sal_Bool bRet = sal_True;
1277 	switch ( nMemberId )
1278 	{
1279 		case MID_VERTORIENT_ORIENT:
1280 		{
1281             sal_Int16 nRet = text::VertOrientation::NONE;
1282 			switch( eOrient )
1283 			{
1284                 case text::VertOrientation::TOP        :  nRet = text::VertOrientation::TOP        ;break;
1285                 case text::VertOrientation::CENTER     :  nRet = text::VertOrientation::CENTER     ;break;
1286                 case text::VertOrientation::BOTTOM     :  nRet = text::VertOrientation::BOTTOM     ;break;
1287                 case text::VertOrientation::CHAR_TOP   :  nRet = text::VertOrientation::CHAR_TOP   ;break;
1288                 case text::VertOrientation::CHAR_CENTER:  nRet = text::VertOrientation::CHAR_CENTER;break;
1289                 case text::VertOrientation::CHAR_BOTTOM:  nRet = text::VertOrientation::CHAR_BOTTOM;break;
1290                 case text::VertOrientation::LINE_TOP   :  nRet = text::VertOrientation::LINE_TOP   ;break;
1291                 case text::VertOrientation::LINE_CENTER:  nRet = text::VertOrientation::LINE_CENTER;break;
1292                 case text::VertOrientation::LINE_BOTTOM:  nRet = text::VertOrientation::LINE_BOTTOM;break;
1293                 default: break;
1294 			}
1295 			rVal <<= nRet;
1296 		}
1297 		break;
1298 		case MID_VERTORIENT_RELATION:
1299 				rVal <<= lcl_RelToINT(eRelation);
1300 		break;
1301 		case MID_VERTORIENT_POSITION:
1302 				rVal <<= (sal_Int32)TWIP_TO_MM100(GetPos());
1303 				break;
1304 		default:
1305 			ASSERT( !this, "unknown MemberId" );
1306 			bRet = sal_False;
1307 	}
1308 	return bRet;
1309 }
1310 
1311 sal_Bool SwFmtVertOrient::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
1312 {
1313 	sal_Bool bConvert = 0 != (nMemberId&CONVERT_TWIPS);
1314 	nMemberId &= ~CONVERT_TWIPS;
1315 	sal_Bool bRet = sal_True;
1316 	switch ( nMemberId )
1317 	{
1318 		case MID_VERTORIENT_ORIENT:
1319 		{
1320 			sal_uInt16 nVal = 0;
1321 			rVal >>= nVal;
1322 			switch( nVal )
1323 			{
1324                 case text::VertOrientation::NONE:           eOrient = text::VertOrientation::NONE;    break;
1325                 case text::VertOrientation::TOP        :    eOrient = text::VertOrientation::TOP;     break;
1326                 case text::VertOrientation::CENTER     :    eOrient = text::VertOrientation::CENTER;     break;
1327                 case text::VertOrientation::BOTTOM     :    eOrient = text::VertOrientation::BOTTOM;     break;
1328                 case text::VertOrientation::CHAR_TOP   :    eOrient = text::VertOrientation::CHAR_TOP;   break;
1329                 case text::VertOrientation::CHAR_CENTER:    eOrient = text::VertOrientation::CHAR_CENTER;break;
1330                 case text::VertOrientation::CHAR_BOTTOM:    eOrient = text::VertOrientation::CHAR_BOTTOM;break;
1331                 case text::VertOrientation::LINE_TOP   :    eOrient = text::VertOrientation::LINE_TOP;    break;
1332                 case text::VertOrientation::LINE_CENTER:    eOrient = text::VertOrientation::LINE_CENTER;break;
1333                 case text::VertOrientation::LINE_BOTTOM:    eOrient = text::VertOrientation::LINE_BOTTOM;break;
1334 			}
1335 		}
1336 		break;
1337 		case MID_VERTORIENT_RELATION:
1338 		{
1339 			eRelation = lcl_IntToRelation(rVal);
1340 		}
1341 		break;
1342 		case MID_VERTORIENT_POSITION:
1343 		{
1344 			sal_Int32 nVal = 0;
1345 			rVal >>= nVal;
1346 			if(bConvert)
1347 				nVal = MM100_TO_TWIP(nVal);
1348 			SetPos( nVal );
1349 		}
1350 		break;
1351 		default:
1352 			ASSERT( !this, "unknown MemberId" );
1353 			bRet = sal_False;
1354 	}
1355 	return bRet;
1356 }
1357 
1358 
1359 
1360 //	class SwFmtHoriOrient
1361 //	Implementierung teilweise inline im hxx
1362 
1363 SwFmtHoriOrient::SwFmtHoriOrient( SwTwips nX, sal_Int16 eHori,
1364                               sal_Int16 eRel, sal_Bool bPos )
1365 	: SfxPoolItem( RES_HORI_ORIENT ),
1366 	nXPos( nX ),
1367 	eOrient( eHori ),
1368 	eRelation( eRel ),
1369 	bPosToggle( bPos )
1370 {}
1371 
1372 int  SwFmtHoriOrient::operator==( const SfxPoolItem& rAttr ) const
1373 {
1374 	ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
1375 	return ( nXPos == ((SwFmtHoriOrient&)rAttr).nXPos &&
1376 			 eOrient == ((SwFmtHoriOrient&)rAttr).eOrient &&
1377 			 eRelation == ((SwFmtHoriOrient&)rAttr).eRelation &&
1378 			 bPosToggle == ((SwFmtHoriOrient&)rAttr).bPosToggle );
1379 }
1380 
1381 SfxPoolItem*  SwFmtHoriOrient::Clone( SfxItemPool* ) const
1382 {
1383 	return new SwFmtHoriOrient( nXPos, eOrient, eRelation, bPosToggle );
1384 }
1385 
1386 sal_Bool SwFmtHoriOrient::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
1387 {
1388 	// hier wird immer konvertiert!
1389 	nMemberId &= ~CONVERT_TWIPS;
1390 	sal_Bool bRet = sal_True;
1391 	switch ( nMemberId )
1392 	{
1393 		case MID_HORIORIENT_ORIENT:
1394 		{
1395             sal_Int16 nRet = text::HoriOrientation::NONE;
1396 			switch( eOrient )
1397 			{
1398                 case text::HoriOrientation::RIGHT:    nRet = text::HoriOrientation::RIGHT; break;
1399                 case text::HoriOrientation::CENTER :  nRet = text::HoriOrientation::CENTER; break;
1400                 case text::HoriOrientation::LEFT   :  nRet = text::HoriOrientation::LEFT; break;
1401                 case text::HoriOrientation::INSIDE :  nRet = text::HoriOrientation::INSIDE; break;
1402                 case text::HoriOrientation::OUTSIDE:  nRet = text::HoriOrientation::OUTSIDE; break;
1403                 case text::HoriOrientation::FULL:     nRet = text::HoriOrientation::FULL; break;
1404                 case text::HoriOrientation::LEFT_AND_WIDTH :
1405                     nRet = text::HoriOrientation::LEFT_AND_WIDTH;
1406                     break;
1407                 default:
1408                     break;
1409 
1410 			}
1411 			rVal <<= nRet;
1412 		}
1413 		break;
1414 		case MID_HORIORIENT_RELATION:
1415 			rVal <<= lcl_RelToINT(eRelation);
1416 		break;
1417 		case MID_HORIORIENT_POSITION:
1418 				rVal <<= (sal_Int32)TWIP_TO_MM100(GetPos());
1419 				break;
1420 		case MID_HORIORIENT_PAGETOGGLE:
1421 		{
1422 			sal_Bool bTmp = IsPosToggle();
1423 			rVal.setValue(&bTmp, ::getBooleanCppuType());
1424 		}
1425 				break;
1426 		default:
1427 			ASSERT( !this, "unknown MemberId" );
1428 			bRet = sal_False;
1429 	}
1430 	return bRet;
1431 }
1432 
1433 sal_Bool SwFmtHoriOrient::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
1434 {
1435 	sal_Bool bConvert = 0 != (nMemberId&CONVERT_TWIPS);
1436 	nMemberId &= ~CONVERT_TWIPS;
1437 	sal_Bool bRet = sal_True;
1438 	switch ( nMemberId )
1439 	{
1440 		case MID_HORIORIENT_ORIENT:
1441 		{
1442             sal_Int16 nVal = 0;
1443             rVal >>= nVal;
1444             switch( nVal )
1445 			{
1446                 case text::HoriOrientation::NONE:       eOrient = text::HoriOrientation::NONE ;   break;
1447                 case text::HoriOrientation::RIGHT:  eOrient = text::HoriOrientation::RIGHT;   break;
1448                 case text::HoriOrientation::CENTER :    eOrient = text::HoriOrientation::CENTER;  break;
1449                 case text::HoriOrientation::LEFT   :    eOrient = text::HoriOrientation::LEFT;    break;
1450                 case text::HoriOrientation::INSIDE :    eOrient = text::HoriOrientation::INSIDE;  break;
1451                 case text::HoriOrientation::OUTSIDE:    eOrient = text::HoriOrientation::OUTSIDE; break;
1452                 case text::HoriOrientation::FULL:      eOrient = text::HoriOrientation::FULL;     break;
1453                 case text::HoriOrientation::LEFT_AND_WIDTH:
1454                     eOrient = text::HoriOrientation::LEFT_AND_WIDTH;
1455 				break;
1456 			}
1457 		}
1458 		break;
1459 		case MID_HORIORIENT_RELATION:
1460 		{
1461 			eRelation = lcl_IntToRelation(rVal);
1462 		}
1463 		break;
1464 		case MID_HORIORIENT_POSITION:
1465 		{
1466             sal_Int32 nVal = 0;
1467             if(!(rVal >>= nVal))
1468                 bRet = sal_False;
1469 			if(bConvert)
1470 				nVal = MM100_TO_TWIP(nVal);
1471 			SetPos( nVal );
1472 		}
1473 		break;
1474 		case MID_HORIORIENT_PAGETOGGLE:
1475 				SetPosToggle( *(sal_Bool*)rVal.getValue());
1476 			break;
1477 		default:
1478 			ASSERT( !this, "unknown MemberId" );
1479 			bRet = sal_False;
1480 	}
1481 	return bRet;
1482 }
1483 
1484 
1485 
1486 //	class SwFmtAnchor
1487 //	Implementierung teilweise inline im hxx
1488 
1489 SwFmtAnchor::SwFmtAnchor( RndStdIds nRnd, sal_uInt16 nPage )
1490 	: SfxPoolItem( RES_ANCHOR ),
1491 	pCntntAnchor( 0 ),
1492 	nAnchorId( nRnd ),
1493     nPageNum( nPage ),
1494     // OD 2004-05-05 #i28701# - get always new increased order number
1495     mnOrder( ++mnOrderCounter )
1496 {}
1497 
1498 SwFmtAnchor::SwFmtAnchor( const SwFmtAnchor &rCpy )
1499 	: SfxPoolItem( RES_ANCHOR ),
1500 	nAnchorId( rCpy.GetAnchorId() ),
1501     nPageNum( rCpy.GetPageNum() ),
1502     // OD 2004-05-05 #i28701# - get always new increased order number
1503     mnOrder( ++mnOrderCounter )
1504 {
1505 	pCntntAnchor = rCpy.GetCntntAnchor() ?
1506 						new SwPosition( *rCpy.GetCntntAnchor() ) : 0;
1507 }
1508 
1509  SwFmtAnchor::~SwFmtAnchor()
1510 {
1511 	delete pCntntAnchor;
1512 }
1513 
1514 void SwFmtAnchor::SetAnchor( const SwPosition *pPos )
1515 {
1516 	if ( pCntntAnchor )
1517 		delete pCntntAnchor;
1518 	pCntntAnchor = pPos ? new SwPosition( *pPos ) : 0;
1519 		//AM Absatz gebundene Flys sollten nie in den Absatz hineinzeigen.
1520     if (pCntntAnchor &&
1521         ((FLY_AT_PARA == nAnchorId) || (FLY_AT_FLY == nAnchorId)))
1522     {
1523 		pCntntAnchor->nContent.Assign( 0, 0 );
1524     }
1525 }
1526 
1527 SwFmtAnchor& SwFmtAnchor::operator=(const SwFmtAnchor& rAnchor)
1528 {
1529 	nAnchorId  = rAnchor.GetAnchorId();
1530 	nPageNum   = rAnchor.GetPageNum();
1531     // OD 2004-05-05 #i28701# - get always new increased order number
1532     mnOrder = ++mnOrderCounter;
1533 
1534 	delete pCntntAnchor;
1535 	pCntntAnchor = rAnchor.pCntntAnchor ?
1536 									new SwPosition(*(rAnchor.pCntntAnchor)) : 0;
1537 	return *this;
1538 }
1539 
1540 int  SwFmtAnchor::operator==( const SfxPoolItem& rAttr ) const
1541 {
1542 	ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
1543     // OD 2004-05-05 #i28701# - Note: <mnOrder> hasn't to be considered.
1544 	return ( nAnchorId == ((SwFmtAnchor&)rAttr).GetAnchorId() &&
1545 			 nPageNum == ((SwFmtAnchor&)rAttr).GetPageNum()   &&
1546 					//Anker vergleichen. Entweder zeigen beide auf das gleiche
1547 					//Attribut bzw. sind 0 oder die SwPosition* sind beide
1548 					//gueltig und die SwPositions sind gleich.
1549 			 (pCntntAnchor == ((SwFmtAnchor&)rAttr).GetCntntAnchor() ||
1550 			  (pCntntAnchor && ((SwFmtAnchor&)rAttr).GetCntntAnchor() &&
1551 			   *pCntntAnchor == *((SwFmtAnchor&)rAttr).GetCntntAnchor())));
1552 }
1553 
1554 SfxPoolItem*  SwFmtAnchor::Clone( SfxItemPool* ) const
1555 {
1556 	return new SwFmtAnchor( *this );
1557 }
1558 
1559 // OD 2004-05-05 #i28701#
1560 sal_uInt32 SwFmtAnchor::mnOrderCounter = 0;
1561 
1562 // OD 2004-05-05 #i28701#
1563 sal_uInt32 SwFmtAnchor::GetOrder() const
1564 {
1565     return mnOrder;
1566 }
1567 
1568 /*-----------------16.02.98 15:21-------------------
1569 
1570 --------------------------------------------------*/
1571 sal_Bool SwFmtAnchor::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
1572 {
1573 	// hier wird immer konvertiert!
1574 	nMemberId &= ~CONVERT_TWIPS;
1575 	sal_Bool bRet = sal_True;
1576 	switch ( nMemberId )
1577 	{
1578 		case MID_ANCHOR_ANCHORTYPE:
1579 
1580 			text::TextContentAnchorType eRet;
1581             switch (GetAnchorId())
1582             {
1583                 case  FLY_AT_CHAR:
1584                     eRet = text::TextContentAnchorType_AT_CHARACTER;
1585                     break;
1586                 case  FLY_AT_PAGE:
1587                     eRet = text::TextContentAnchorType_AT_PAGE;
1588                     break;
1589                 case  FLY_AT_FLY:
1590                     eRet = text::TextContentAnchorType_AT_FRAME;
1591                     break;
1592                 case  FLY_AS_CHAR:
1593                     eRet = text::TextContentAnchorType_AS_CHARACTER;
1594                     break;
1595                 //case  FLY_AT_PARA:
1596                 default:
1597                     eRet = text::TextContentAnchorType_AT_PARAGRAPH;
1598             }
1599 			rVal <<= eRet;
1600 		break;
1601 		case MID_ANCHOR_PAGENUM:
1602 			rVal <<= (sal_Int16)GetPageNum();
1603         break;
1604         case MID_ANCHOR_ANCHORFRAME:
1605         {
1606             if(pCntntAnchor && FLY_AT_FLY == nAnchorId)
1607             {
1608                 SwFrmFmt* pFmt = pCntntAnchor->nNode.GetNode().GetFlyFmt();
1609                 if(pFmt)
1610                 {
1611                     uno::Reference<container::XNamed> xNamed = SwXFrames::GetObject( *pFmt, FLYCNTTYPE_FRM );
1612                     uno::Reference<text::XTextFrame> xRet(xNamed, uno::UNO_QUERY);
1613                     rVal <<= xRet;
1614                 }
1615             }
1616         }
1617         break;
1618         default:
1619 			ASSERT( !this, "unknown MemberId" );
1620 			bRet = sal_False;
1621 	}
1622 	return bRet;
1623 }
1624 
1625 sal_Bool SwFmtAnchor::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
1626 {
1627 	// hier wird immer konvertiert!
1628 	nMemberId &= ~CONVERT_TWIPS;
1629 	sal_Bool bRet = sal_True;
1630 	switch ( nMemberId )
1631 	{
1632 		case MID_ANCHOR_ANCHORTYPE:
1633 		{
1634 			RndStdIds	eAnchor;
1635 			switch( SWUnoHelper::GetEnumAsInt32( rVal ) )
1636 			{
1637 				case  text::TextContentAnchorType_AS_CHARACTER:
1638                     eAnchor = FLY_AS_CHAR;
1639 					break;
1640 				case  text::TextContentAnchorType_AT_PAGE:
1641                     eAnchor = FLY_AT_PAGE;
1642 					if( GetPageNum() > 0 && pCntntAnchor )
1643 					{
1644 						// If the anchor type is page and a valid page number
1645 						// has been set, the content position isn't required
1646 						// any longer.
1647 						delete pCntntAnchor;
1648 						pCntntAnchor = 0;
1649 					}
1650 					break;
1651 				case  text::TextContentAnchorType_AT_FRAME:
1652 					eAnchor = FLY_AT_FLY;
1653 					break;
1654 				case  text::TextContentAnchorType_AT_CHARACTER:
1655                     eAnchor = FLY_AT_CHAR;
1656 					break;
1657 				//case  text::TextContentAnchorType_AT_PARAGRAPH:
1658 				default:
1659                     eAnchor = FLY_AT_PARA;
1660 					break;
1661 			}
1662 			SetType( eAnchor );
1663 		}
1664 		break;
1665 		case MID_ANCHOR_PAGENUM:
1666 		{
1667             sal_Int16 nVal = 0;
1668             if((rVal >>= nVal) && nVal > 0)
1669 			{
1670 				SetPageNum( nVal );
1671                 if ((FLY_AT_PAGE == GetAnchorId()) && pCntntAnchor)
1672                 {
1673 					// If the anchor type is page and a valid page number
1674 					// is set, the content paoition has to be deleted to not
1675 					// confuse the layout (frmtool.cxx). However, if the
1676 					// anchor type is not page, any content position will
1677 					// be kept.
1678 					delete pCntntAnchor;
1679 					pCntntAnchor = 0;
1680 				}
1681 			}
1682 			else
1683 				bRet = sal_False;
1684 		}
1685 		break;
1686         case MID_ANCHOR_ANCHORFRAME:
1687         //no break here!;
1688 		default:
1689 			ASSERT( !this, "unknown MemberId" );
1690 			bRet = sal_False;
1691 	}
1692 	return bRet;
1693 }
1694 
1695 //	class SwFmtURL
1696 //	Implementierung teilweise inline im hxx
1697 
1698 SwFmtURL::SwFmtURL() :
1699 	SfxPoolItem( RES_URL ),
1700 	pMap( 0 ),
1701 	bIsServerMap( sal_False )
1702 {
1703 }
1704 
1705 SwFmtURL::SwFmtURL( const SwFmtURL &rURL) :
1706 	SfxPoolItem( RES_URL ),
1707     sTargetFrameName( rURL.GetTargetFrameName() ),
1708     sURL( rURL.GetURL() ),
1709     sName( rURL.GetName() ),
1710 	bIsServerMap( rURL.IsServerMap() )
1711 {
1712 	pMap = rURL.GetMap() ? new ImageMap( *rURL.GetMap() ) : 0;
1713 }
1714 
1715 SwFmtURL::~SwFmtURL()
1716 {
1717 	if ( pMap )
1718 		delete pMap;
1719 }
1720 
1721 int SwFmtURL::operator==( const SfxPoolItem &rAttr ) const
1722 {
1723 	ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
1724 	const SwFmtURL &rCmp = (SwFmtURL&)rAttr;
1725 	sal_Bool bRet = bIsServerMap  	 == rCmp.IsServerMap() &&
1726 				sURL			 == rCmp.GetURL() &&
1727 				sTargetFrameName == rCmp.GetTargetFrameName() &&
1728 				sName 			 == rCmp.GetName();
1729 	if ( bRet )
1730 	{
1731 		if ( pMap && rCmp.GetMap() )
1732 			bRet = *pMap == *rCmp.GetMap();
1733 		else
1734 			bRet = pMap == rCmp.GetMap();
1735 	}
1736 	return bRet;
1737 }
1738 
1739 SfxPoolItem* SwFmtURL::Clone( SfxItemPool* ) const
1740 {
1741 	return new SwFmtURL( *this );
1742 }
1743 
1744 void SwFmtURL::SetURL( const XubString &rURL, sal_Bool bServerMap )
1745 {
1746 	sURL = rURL;
1747 	bIsServerMap = bServerMap;
1748 }
1749 
1750 void SwFmtURL::SetMap( const ImageMap *pM )
1751 {
1752 	if ( pMap )
1753 		delete pMap;
1754 	pMap = pM ? new ImageMap( *pM ) : 0;
1755 }
1756 extern const SvEventDescription* lcl_GetSupportedMacroItems();
1757 
1758 sal_Bool SwFmtURL::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
1759 {
1760 	// hier wird immer konvertiert!
1761 	nMemberId &= ~CONVERT_TWIPS;
1762 	sal_Bool bRet = sal_True;
1763 	switch ( nMemberId )
1764 	{
1765 		case MID_URL_URL:
1766 		{
1767 			OUString sRet = GetURL();
1768 			rVal <<= sRet;
1769 		}
1770 		break;
1771 		case MID_URL_TARGET:
1772 		{
1773 			OUString sRet = GetTargetFrameName();
1774 			rVal <<= sRet;
1775 		}
1776 		break;
1777 		case MID_URL_HYPERLINKNAME:
1778 			rVal <<= OUString( GetName() );
1779 			break;
1780 		case MID_URL_CLIENTMAP:
1781         {
1782             uno::Reference< uno::XInterface > xInt;
1783             if(pMap)
1784             {
1785                 xInt = SvUnoImageMap_createInstance( *pMap, lcl_GetSupportedMacroItems() );
1786             }
1787             else
1788             {
1789                 ImageMap aEmptyMap;
1790                 xInt = SvUnoImageMap_createInstance( aEmptyMap, lcl_GetSupportedMacroItems() );
1791             }
1792             uno::Reference< container::XIndexContainer > xCont(xInt, uno::UNO_QUERY);
1793             rVal <<= xCont;
1794         }
1795         break;
1796 		case MID_URL_SERVERMAP:
1797 		{
1798 			sal_Bool bTmp = IsServerMap();
1799 			rVal.setValue(&bTmp, ::getBooleanCppuType());
1800 		}
1801 			break;
1802 		default:
1803 			ASSERT( !this, "unknown MemberId" );
1804 			bRet = sal_False;
1805 	}
1806 	return bRet;
1807 }
1808 
1809 sal_Bool SwFmtURL::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
1810 {
1811 	// hier wird immer konvertiert!
1812 	nMemberId &= ~CONVERT_TWIPS;
1813 	sal_Bool bRet = sal_True;
1814 	switch ( nMemberId )
1815 	{
1816 		case MID_URL_URL:
1817         {
1818             OUString sTmp;
1819             rVal >>= sTmp;
1820             SetURL( sTmp, bIsServerMap );
1821         }
1822 		break;
1823 		case MID_URL_TARGET:
1824         {
1825             OUString sTmp;
1826             rVal >>= sTmp;
1827             SetTargetFrameName( sTmp );
1828         }
1829 		break;
1830 		case MID_URL_HYPERLINKNAME:
1831         {
1832             OUString sTmp;
1833             rVal >>= sTmp;
1834             SetName( sTmp );
1835         }
1836 		break;
1837 		case MID_URL_CLIENTMAP:
1838         {
1839             uno::Reference<container::XIndexContainer> xCont;
1840             if(!rVal.hasValue())
1841                 DELETEZ(pMap);
1842             else if(rVal >>= xCont)
1843             {
1844                 if(!pMap)
1845                     pMap = new ImageMap;
1846                 bRet = SvUnoImageMap_fillImageMap( xCont, *pMap );
1847             }
1848             else
1849                 bRet = sal_False;
1850         }
1851         break;
1852 		case MID_URL_SERVERMAP:
1853 			bIsServerMap = *(sal_Bool*)rVal.getValue();
1854 			break;
1855 		default:
1856 			ASSERT( !this, "unknown MemberId" );
1857 			bRet = sal_False;
1858 	}
1859 	return bRet;
1860 }
1861 
1862 
1863 // class SwNoReadOnly
1864 
1865 SfxPoolItem* SwFmtEditInReadonly::Clone( SfxItemPool* ) const
1866 {
1867 	return new SwFmtEditInReadonly( Which(), GetValue() );
1868 }
1869 
1870 // class SwFmtLayoutSplit
1871 
1872 SfxPoolItem* SwFmtLayoutSplit::Clone( SfxItemPool* ) const
1873 {
1874 	return new SwFmtLayoutSplit( GetValue() );
1875 }
1876 
1877 // class SwFmtRowSplit
1878 
1879 SfxPoolItem* SwFmtRowSplit::Clone( SfxItemPool* ) const
1880 {
1881     return new SwFmtRowSplit( GetValue() );
1882 }
1883 
1884 
1885 // class SwFmtNoBalancedColumns
1886 
1887 SfxPoolItem* SwFmtNoBalancedColumns::Clone( SfxItemPool* ) const
1888 {
1889 	return new SwFmtNoBalancedColumns( GetValue() );
1890 }
1891 
1892 // class SwFmtFtnEndAtTxtEnd
1893 
1894 sal_uInt16 SwFmtFtnEndAtTxtEnd::GetValueCount() const
1895 {
1896 	return sal_uInt16( FTNEND_ATTXTEND_END );
1897 }
1898 
1899 SwFmtFtnEndAtTxtEnd& SwFmtFtnEndAtTxtEnd::operator=(
1900 						const SwFmtFtnEndAtTxtEnd& rAttr )
1901 {
1902 	SfxEnumItem::SetValue( rAttr.GetValue() );
1903 	aFmt = rAttr.aFmt;
1904 	nOffset = rAttr.nOffset;
1905 	sPrefix = rAttr.sPrefix;
1906 	sSuffix = rAttr.sSuffix;
1907 	return *this;
1908 }
1909 
1910 int SwFmtFtnEndAtTxtEnd::operator==( const SfxPoolItem& rItem ) const
1911 {
1912 	const SwFmtFtnEndAtTxtEnd& rAttr = (SwFmtFtnEndAtTxtEnd&)rItem;
1913 	return SfxEnumItem::operator==( rAttr ) &&
1914 			aFmt.GetNumberingType() == rAttr.aFmt.GetNumberingType() &&
1915 			nOffset == rAttr.nOffset &&
1916 			sPrefix == rAttr.sPrefix &&
1917 			sSuffix == rAttr.sSuffix;
1918 }
1919 
1920 sal_Bool SwFmtFtnEndAtTxtEnd::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
1921 {
1922 	nMemberId &= ~CONVERT_TWIPS;
1923 	switch(nMemberId)
1924 	{
1925 		case MID_COLLECT	 :
1926 		{
1927 			sal_Bool bVal = GetValue() >= FTNEND_ATTXTEND;
1928 			rVal.setValue(&bVal, ::getBooleanCppuType());
1929 		}
1930 		break;
1931 		case MID_RESTART_NUM :
1932 		{
1933 			sal_Bool bVal = GetValue() >= FTNEND_ATTXTEND_OWNNUMSEQ;
1934 			rVal.setValue(&bVal, ::getBooleanCppuType());
1935 		}
1936 		break;
1937 		case MID_NUM_START_AT: rVal <<= (sal_Int16) nOffset; break;
1938 		case MID_OWN_NUM     :
1939 		{
1940 			sal_Bool bVal = GetValue() >= FTNEND_ATTXTEND_OWNNUMANDFMT;
1941 			rVal.setValue(&bVal, ::getBooleanCppuType());
1942 		}
1943 		break;
1944 		case MID_NUM_TYPE    : rVal <<= aFmt.GetNumberingType(); break;
1945 		case MID_PREFIX      : rVal <<= OUString(sPrefix); break;
1946 		case MID_SUFFIX      : rVal <<= OUString(sSuffix); break;
1947 		default: return sal_False;
1948 	}
1949 	return sal_True;
1950 }
1951 
1952 sal_Bool SwFmtFtnEndAtTxtEnd::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
1953 {
1954 	sal_Bool bRet = sal_True;
1955 	nMemberId &= ~CONVERT_TWIPS;
1956 	switch(nMemberId)
1957 	{
1958 		case MID_COLLECT	 :
1959 		{
1960 			sal_Bool bVal = *(sal_Bool*)rVal.getValue();
1961 			if(!bVal && GetValue() >= FTNEND_ATTXTEND)
1962 				SetValue(FTNEND_ATPGORDOCEND);
1963 			else if(bVal && GetValue() < FTNEND_ATTXTEND)
1964 				SetValue(FTNEND_ATTXTEND);
1965 		}
1966 		break;
1967 		case MID_RESTART_NUM :
1968 		{
1969 			sal_Bool bVal = *(sal_Bool*)rVal.getValue();
1970 			if(!bVal && GetValue() >= FTNEND_ATTXTEND_OWNNUMSEQ)
1971 				SetValue(FTNEND_ATTXTEND);
1972 			else if(bVal && GetValue() < FTNEND_ATTXTEND_OWNNUMSEQ)
1973 				SetValue(FTNEND_ATTXTEND_OWNNUMSEQ);
1974 		}
1975 		break;
1976 		case MID_NUM_START_AT:
1977 		{
1978 			sal_Int16 nVal = 0;
1979 			rVal >>= nVal;
1980 			if(nVal >= 0)
1981 				nOffset = nVal;
1982 			else
1983 				bRet = sal_False;
1984 		}
1985 		break;
1986 		case MID_OWN_NUM     :
1987 		{
1988 			sal_Bool bVal = *(sal_Bool*)rVal.getValue();
1989 			if(!bVal && GetValue() >= FTNEND_ATTXTEND_OWNNUMANDFMT)
1990 				SetValue(FTNEND_ATTXTEND_OWNNUMSEQ);
1991 			else if(bVal && GetValue() < FTNEND_ATTXTEND_OWNNUMANDFMT)
1992 				SetValue(FTNEND_ATTXTEND_OWNNUMANDFMT);
1993 		}
1994 		break;
1995 		case MID_NUM_TYPE    :
1996 		{
1997 			sal_Int16 nVal = 0;
1998 			rVal >>= nVal;
1999 			if(nVal >= 0 &&
2000 				(nVal <= SVX_NUM_ARABIC ||
2001 					SVX_NUM_CHARS_UPPER_LETTER_N == nVal ||
2002 						SVX_NUM_CHARS_LOWER_LETTER_N == nVal ))
2003 				aFmt.SetNumberingType(nVal);
2004 			else
2005 				bRet = sal_False;
2006 		}
2007 		break;
2008 		case MID_PREFIX      :
2009 		{
2010 			OUString sVal; rVal >>= sVal;
2011 			sPrefix = sVal;
2012 		}
2013 		break;
2014 		case MID_SUFFIX      :
2015 		{
2016 			OUString sVal; rVal >>= sVal;
2017 			sSuffix = sVal;
2018 		}
2019 		break;
2020 		default: bRet = sal_False;
2021 	}
2022 	return bRet;
2023 }
2024 
2025 
2026 // class SwFmtFtnAtTxtEnd
2027 
2028 SfxPoolItem* SwFmtFtnAtTxtEnd::Clone( SfxItemPool* ) const
2029 {
2030 	SwFmtFtnAtTxtEnd* pNew = new SwFmtFtnAtTxtEnd;
2031 	*pNew = *this;
2032 	return pNew;
2033 }
2034 
2035 // class SwFmtEndAtTxtEnd
2036 
2037 SfxPoolItem* SwFmtEndAtTxtEnd::Clone( SfxItemPool* ) const
2038 {
2039 	SwFmtEndAtTxtEnd* pNew = new SwFmtEndAtTxtEnd;
2040 	*pNew = *this;
2041 	return pNew;
2042 }
2043 
2044 //class SwFmtChain
2045 
2046 
2047 int SwFmtChain::operator==( const SfxPoolItem &rAttr ) const
2048 {
2049 	ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
2050 
2051 	return GetPrev() == ((SwFmtChain&)rAttr).GetPrev() &&
2052 		   GetNext() == ((SwFmtChain&)rAttr).GetNext();
2053 }
2054 
2055 SwFmtChain::SwFmtChain( const SwFmtChain &rCpy ) :
2056 	SfxPoolItem( RES_CHAIN )
2057 {
2058 	SetPrev( rCpy.GetPrev() );
2059 	SetNext( rCpy.GetNext() );
2060 }
2061 
2062 SfxPoolItem* SwFmtChain::Clone( SfxItemPool* ) const
2063 {
2064 	SwFmtChain *pRet = new SwFmtChain;
2065 	pRet->SetPrev( GetPrev() );
2066 	pRet->SetNext( GetNext() );
2067 	return pRet;
2068 }
2069 
2070 void SwFmtChain::SetPrev( SwFlyFrmFmt *pFmt )
2071 {
2072 	if ( pFmt )
2073 		pFmt->Add( &aPrev );
2074 	else if ( aPrev.GetRegisteredIn() )
2075 		((SwModify*)aPrev.GetRegisteredIn())->Remove( &aPrev );
2076 }
2077 
2078 void SwFmtChain::SetNext( SwFlyFrmFmt *pFmt )
2079 {
2080 	if ( pFmt )
2081 		pFmt->Add( &aNext );
2082 	else if ( aNext.GetRegisteredIn() )
2083 		((SwModify*)aNext.GetRegisteredIn())->Remove( &aNext );
2084 }
2085 
2086 sal_Bool SwFmtChain::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
2087 {
2088 	// hier wird immer konvertiert!
2089 	nMemberId &= ~CONVERT_TWIPS;
2090 	sal_Bool   bRet = sal_True;
2091 	XubString aRet;
2092 	switch ( nMemberId )
2093 	{
2094 		case MID_CHAIN_PREVNAME:
2095 			if ( GetPrev() )
2096 				aRet = GetPrev()->GetName();
2097 			break;
2098 		case MID_CHAIN_NEXTNAME:
2099 			if ( GetNext() )
2100 				aRet = GetNext()->GetName();
2101 			break;
2102 		default:
2103 			ASSERT( !this, "unknown MemberId" );
2104 			bRet = sal_False;
2105 	}
2106 	rVal <<= OUString(aRet);
2107 	return bRet;
2108 }
2109 
2110 
2111 
2112 
2113 //class SwFmtLineNumber
2114 
2115 SwFmtLineNumber::SwFmtLineNumber() :
2116 	SfxPoolItem( RES_LINENUMBER )
2117 {
2118 	nStartValue = 0;
2119 	bCountLines = sal_True;
2120 }
2121 
2122 SwFmtLineNumber::~SwFmtLineNumber()
2123 {
2124 }
2125 
2126 int SwFmtLineNumber::operator==( const SfxPoolItem &rAttr ) const
2127 {
2128 	ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
2129 
2130 	return nStartValue	== ((SwFmtLineNumber&)rAttr).GetStartValue() &&
2131 		   bCountLines	== ((SwFmtLineNumber&)rAttr).IsCount();
2132 }
2133 
2134 SfxPoolItem* SwFmtLineNumber::Clone( SfxItemPool* ) const
2135 {
2136 	return new SwFmtLineNumber( *this );
2137 }
2138 
2139 sal_Bool SwFmtLineNumber::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
2140 {
2141 	// hier wird immer konvertiert!
2142 	nMemberId &= ~CONVERT_TWIPS;
2143 	sal_Bool bRet = sal_True;
2144 	switch ( nMemberId )
2145 	{
2146 		case MID_LINENUMBER_COUNT:
2147 		{
2148 			sal_Bool bTmp = IsCount();
2149 			rVal.setValue(&bTmp, ::getBooleanCppuType());
2150 		}
2151 		break;
2152 		case MID_LINENUMBER_STARTVALUE:
2153 			rVal <<= (sal_Int32)GetStartValue();
2154 			break;
2155 		default:
2156 			ASSERT( !this, "unknown MemberId" );
2157 			bRet = sal_False;
2158 	}
2159 	return bRet;
2160 }
2161 
2162 sal_Bool SwFmtLineNumber::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
2163 {
2164 	// hier wird immer konvertiert!
2165 	nMemberId &= ~CONVERT_TWIPS;
2166 	sal_Bool bRet = sal_True;
2167 	switch ( nMemberId )
2168 	{
2169 		case MID_LINENUMBER_COUNT:
2170 			SetCountLines( *(sal_Bool*)rVal.getValue() );
2171 			break;
2172 		case MID_LINENUMBER_STARTVALUE:
2173         {
2174             sal_Int32 nVal = 0;
2175             if(rVal >>= nVal)
2176                 SetStartValue( nVal );
2177             else
2178                 bRet = sal_False;
2179         }
2180         break;
2181 		default:
2182 			ASSERT( !this, "unknown MemberId" );
2183 			bRet = sal_False;
2184 	}
2185 	return bRet;
2186 }
2187 
2188 /*************************************************************************
2189  *    class SwTextGridItem
2190  *************************************************************************/
2191 
2192 SwTextGridItem::SwTextGridItem()
2193     : SfxPoolItem( RES_TEXTGRID ), aColor( COL_LIGHTGRAY ), nLines( 20 ),
2194       nBaseHeight( 400 ), nRubyHeight( 200 ), eGridType( GRID_NONE ),
2195       bRubyTextBelow( 0 ), bPrintGrid( 1 ), bDisplayGrid( 1 ),
2196       nBaseWidth(400), bSnapToChars( 1 ), bSquaredMode(1)
2197 {
2198 }
2199 
2200 SwTextGridItem::~SwTextGridItem()
2201 {
2202 }
2203 
2204 int SwTextGridItem::operator==( const SfxPoolItem& rAttr ) const
2205 {
2206 	ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
2207     return eGridType == ((SwTextGridItem&)rAttr).GetGridType() &&
2208            nLines == ((SwTextGridItem&)rAttr).GetLines() &&
2209            nBaseHeight == ((SwTextGridItem&)rAttr).GetBaseHeight() &&
2210            nRubyHeight == ((SwTextGridItem&)rAttr).GetRubyHeight() &&
2211            bRubyTextBelow == ((SwTextGridItem&)rAttr).GetRubyTextBelow() &&
2212            bDisplayGrid == ((SwTextGridItem&)rAttr).GetDisplayGrid() &&
2213            bPrintGrid == ((SwTextGridItem&)rAttr).GetPrintGrid() &&
2214            aColor == ((SwTextGridItem&)rAttr).GetColor() &&
2215            nBaseWidth == ((SwTextGridItem&)rAttr).GetBaseWidth() &&
2216            bSnapToChars == ((SwTextGridItem&)rAttr).GetSnapToChars() &&
2217            bSquaredMode == ((SwTextGridItem&)rAttr).GetSquaredMode();
2218 }
2219 
2220 SfxPoolItem* SwTextGridItem::Clone( SfxItemPool* ) const
2221 {
2222     return new SwTextGridItem( *this );
2223 }
2224 
2225 SwTextGridItem& SwTextGridItem::operator=( const SwTextGridItem& rCpy )
2226 {
2227     aColor = rCpy.GetColor();
2228     nLines = rCpy.GetLines();
2229     nBaseHeight = rCpy.GetBaseHeight();
2230     nRubyHeight = rCpy.GetRubyHeight();
2231     eGridType = rCpy.GetGridType();
2232     bRubyTextBelow = rCpy.GetRubyTextBelow();
2233     bPrintGrid = rCpy.GetPrintGrid();
2234     bDisplayGrid = rCpy.GetDisplayGrid();
2235     nBaseWidth = rCpy.GetBaseWidth();
2236     bSnapToChars = rCpy.GetSnapToChars();
2237     bSquaredMode = rCpy.GetSquaredMode();
2238 
2239 	return *this;
2240 }
2241 
2242 sal_Bool SwTextGridItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
2243 {
2244     sal_Bool bRet = sal_True;
2245 
2246     switch( nMemberId & ~CONVERT_TWIPS )
2247     {
2248         case MID_GRID_COLOR:
2249             rVal <<= GetColor().GetColor();
2250             break;
2251         case MID_GRID_LINES:
2252             rVal <<= GetLines();
2253             break;
2254         case MID_GRID_RUBY_BELOW:
2255             rVal.setValue( &bRubyTextBelow, ::getBooleanCppuType() );
2256             break;
2257         case MID_GRID_PRINT:
2258             rVal.setValue( &bPrintGrid, ::getBooleanCppuType() );
2259             break;
2260         case MID_GRID_DISPLAY:
2261             rVal.setValue( &bDisplayGrid, ::getBooleanCppuType() );
2262             break;
2263         case MID_GRID_BASEHEIGHT:
2264             DBG_ASSERT( (nMemberId & CONVERT_TWIPS) != 0,
2265                         "This value needs TWIPS-MM100 conversion" );
2266             rVal <<= (sal_Int32) TWIP_TO_MM100_UNSIGNED(nBaseHeight);
2267             break;
2268         case MID_GRID_BASEWIDTH:
2269             DBG_ASSERT( (nMemberId & CONVERT_TWIPS) != 0,
2270                         "This value needs TWIPS-MM100 conversion" );
2271             rVal <<= (sal_Int32) TWIP_TO_MM100_UNSIGNED(nBaseWidth);
2272             break;
2273         case MID_GRID_RUBYHEIGHT:
2274             DBG_ASSERT( (nMemberId & CONVERT_TWIPS) != 0,
2275                         "This value needs TWIPS-MM100 conversion" );
2276             rVal <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(nRubyHeight);
2277             break;
2278         case MID_GRID_TYPE:
2279             switch( GetGridType() )
2280             {
2281                 case GRID_NONE:
2282                     rVal <<= text::TextGridMode::NONE;
2283                     break;
2284                 case GRID_LINES_ONLY:
2285                     rVal <<= text::TextGridMode::LINES;
2286                     break;
2287                 case GRID_LINES_CHARS:
2288                     rVal <<= text::TextGridMode::LINES_AND_CHARS;
2289                     break;
2290                 default:
2291                     DBG_ERROR("unknown SwTextGrid value");
2292                     bRet = sal_False;
2293                     break;
2294             }
2295             break;
2296         case MID_GRID_SNAPTOCHARS:
2297             rVal.setValue( &bSnapToChars, ::getBooleanCppuType() );
2298             break;
2299         case MID_GRID_STANDARD_MODE:
2300 			{
2301 				sal_Bool bStandardMode = !bSquaredMode;
2302     	        rVal.setValue( &bStandardMode, ::getBooleanCppuType() );
2303 			}
2304             break;
2305         default:
2306             DBG_ERROR("Unknown SwTextGridItem member");
2307             bRet = sal_False;
2308             break;
2309     }
2310 
2311 	return bRet;
2312 }
2313 
2314 sal_Bool SwTextGridItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
2315 {
2316 	sal_Bool bRet = sal_True;
2317     switch( nMemberId & ~CONVERT_TWIPS )
2318     {
2319         case MID_GRID_COLOR:
2320         {
2321             sal_Int32 nTmp = 0;
2322             bRet = (rVal >>= nTmp);
2323             if( bRet )
2324                 SetColor( Color(nTmp) );
2325         }
2326         break;
2327         case MID_GRID_LINES:
2328         {
2329             sal_Int16 nTmp = 0;
2330             bRet = (rVal >>= nTmp);
2331             if( bRet && (nTmp >= 0) )
2332                 SetLines( (sal_uInt16)nTmp );
2333             else
2334                 bRet = sal_False;
2335         }
2336         break;
2337         case MID_GRID_RUBY_BELOW:
2338             SetRubyTextBelow( *(sal_Bool*)rVal.getValue() );
2339             break;
2340         case MID_GRID_PRINT:
2341             SetPrintGrid( *(sal_Bool*)rVal.getValue() );
2342             break;
2343         case MID_GRID_DISPLAY:
2344             SetDisplayGrid( *(sal_Bool*)rVal.getValue() );
2345             break;
2346         case MID_GRID_BASEHEIGHT:
2347         case MID_GRID_BASEWIDTH:
2348         case MID_GRID_RUBYHEIGHT:
2349         {
2350             DBG_ASSERT( (nMemberId & CONVERT_TWIPS) != 0,
2351                         "This value needs TWIPS-MM100 conversion" );
2352             sal_Int32 nTmp = 0;
2353             bRet = (rVal >>= nTmp);
2354             nTmp = MM100_TO_TWIP( nTmp );
2355             if( bRet && (nTmp >= 0) && ( nTmp <= USHRT_MAX) )
2356                 if( (nMemberId & ~CONVERT_TWIPS) == MID_GRID_BASEHEIGHT )
2357                     SetBaseHeight( (sal_uInt16)nTmp );
2358                 else if( (nMemberId & ~CONVERT_TWIPS) == MID_GRID_BASEWIDTH )
2359                     SetBaseWidth( (sal_uInt16)nTmp );
2360                 else
2361                     SetRubyHeight( (sal_uInt16)nTmp );
2362             else
2363                 bRet = sal_False;
2364         }
2365         break;
2366         case MID_GRID_TYPE:
2367         {
2368             sal_Int16 nTmp = 0;
2369             bRet = (rVal >>= nTmp);
2370             if( bRet )
2371             {
2372                 switch( nTmp )
2373                 {
2374                     case text::TextGridMode::NONE:
2375                         SetGridType( GRID_NONE );
2376                         break;
2377                     case text::TextGridMode::LINES:
2378                         SetGridType( GRID_LINES_ONLY );
2379                         break;
2380                     case text::TextGridMode::LINES_AND_CHARS:
2381                         SetGridType( GRID_LINES_CHARS );
2382                         break;
2383                     default:
2384                         bRet = sal_False;
2385                         break;
2386                 }
2387             }
2388             break;
2389 		}
2390         case MID_GRID_SNAPTOCHARS:
2391             SetSnapToChars( *(sal_Bool*)rVal.getValue() );
2392             break;
2393         case MID_GRID_STANDARD_MODE:
2394 		{
2395 			sal_Bool bStandard = *(sal_Bool*)rVal.getValue();
2396            	SetSquaredMode( !bStandard );
2397         	break;
2398 		}
2399         default:
2400             DBG_ERROR("Unknown SwTextGridItem member");
2401             bRet = sal_False;
2402     }
2403 
2404     return bRet;
2405 }
2406 
2407 void SwTextGridItem::SwitchPaperMode(sal_Bool bNew)
2408 {
2409 	if( bNew == bSquaredMode )
2410 	{
2411 		//same paper mode, not switch
2412 		return;
2413 	}
2414 
2415 	// use default value when grid is disable
2416 	if( eGridType == GRID_NONE )
2417 	{
2418 		bSquaredMode = bNew;
2419 		Init();
2420 		return;
2421 	}
2422 
2423 	if( bSquaredMode )
2424 	{
2425 		//switch from "squared mode" to "standard mode"
2426 		nBaseWidth = nBaseHeight;
2427 		nBaseHeight = nBaseHeight + nRubyHeight;
2428 		nRubyHeight = 0;
2429 	}
2430 	else
2431 	{
2432 		//switch from "standard mode" to "squared mode"
2433 		nRubyHeight = nBaseHeight/3;
2434 		nBaseHeight = nBaseHeight - nRubyHeight;
2435 		nBaseWidth = nBaseHeight;
2436 	}
2437 	bSquaredMode = !bSquaredMode;
2438 }
2439 
2440 void SwTextGridItem::Init()
2441 {
2442 	if( bSquaredMode )
2443 	{
2444 		nLines = 20;
2445 		nBaseHeight = 400;
2446 		nRubyHeight = 200;
2447 		eGridType = GRID_NONE;
2448 		bRubyTextBelow = 0;
2449 		bPrintGrid = 1;
2450 		bDisplayGrid = 1;
2451 		bSnapToChars = 1;
2452 		nBaseWidth = 400;
2453 	}
2454 	else
2455 	{
2456 		nLines = 44;
2457 		nBaseHeight = 312;
2458 		nRubyHeight = 0;
2459 		eGridType = GRID_NONE;
2460 		bRubyTextBelow = 0;
2461 		bPrintGrid = 1;
2462 		bDisplayGrid = 1;
2463 		nBaseWidth = 210;
2464 		bSnapToChars = 1;
2465 
2466 		//default grid type is line only in CJK env
2467 		//disable this function due to type area change
2468 		//if grid type change.
2469 		//if(SvtCJKOptions().IsAsianTypographyEnabled())
2470 		//{
2471 		//	bDisplayGrid = 0;
2472 		//	eGridType = GRID_LINES_ONLY;
2473 		//}
2474 	}
2475 }
2476 // class SwHeaderAndFooterEatSpacingItem
2477 
2478 SfxPoolItem* SwHeaderAndFooterEatSpacingItem::Clone( SfxItemPool* ) const
2479 {
2480     return new SwHeaderAndFooterEatSpacingItem( Which(), GetValue() );
2481 }
2482 
2483 //////////////////////////////////////////////////////////////////////////////
2484 //UUUU FillAttributes
2485 
2486 void FillAttributes::createPrimitive2DSequence(
2487     const basegfx::B2DRange& rPaintRange,
2488     const basegfx::B2DRange& rDefineRange)
2489 {
2490     // reset and remember new target range for object geometry
2491     maLastPaintRange = rPaintRange;
2492     maLastDefineRange = rDefineRange;
2493 
2494     if(isUsed())
2495     {
2496         maPrimitives.realloc(1);
2497         maPrimitives[0] = drawinglayer::primitive2d::createPolyPolygonFillPrimitive(
2498             basegfx::B2DPolyPolygon(
2499                 basegfx::tools::createPolygonFromRect(
2500                     maLastPaintRange)),
2501                 maLastDefineRange,
2502             maFillAttribute.get() ? *maFillAttribute.get() : drawinglayer::attribute::SdrFillAttribute(),
2503             maFillGradientAttribute.get() ? *maFillGradientAttribute.get() : drawinglayer::attribute::FillGradientAttribute());
2504     }
2505 }
2506 
2507 FillAttributes::FillAttributes()
2508 :   maLastPaintRange(),
2509     maLastDefineRange(),
2510     maFillAttribute(),
2511     maFillGradientAttribute(),
2512     maPrimitives()
2513 {
2514 }
2515 
2516 FillAttributes::FillAttributes(const Color& rColor)
2517 :   maLastPaintRange(),
2518     maLastDefineRange(),
2519     maFillAttribute(),
2520     maFillGradientAttribute(),
2521     maPrimitives()
2522 {
2523     maFillAttribute.reset(
2524         new drawinglayer::attribute::SdrFillAttribute(
2525             0.0,
2526             Color(rColor.GetRGBColor()).getBColor(),
2527             drawinglayer::attribute::FillGradientAttribute(),
2528             drawinglayer::attribute::FillHatchAttribute(),
2529             drawinglayer::attribute::SdrFillGraphicAttribute()));
2530 }
2531 
2532 FillAttributes::FillAttributes(const SfxItemSet& rSet)
2533 :   maLastPaintRange(),
2534     maLastDefineRange(),
2535     maFillAttribute(
2536         new drawinglayer::attribute::SdrFillAttribute(
2537             drawinglayer::primitive2d::createNewSdrFillAttribute(rSet))),
2538     maFillGradientAttribute(
2539         new drawinglayer::attribute::FillGradientAttribute(
2540             drawinglayer::primitive2d::createNewTransparenceGradientAttribute(rSet))),
2541     maPrimitives()
2542 {
2543 }
2544 
2545 FillAttributes::~FillAttributes()
2546 {
2547 }
2548 
2549 bool FillAttributes::isUsed() const
2550 {
2551     // only depends on fill, FillGradientAttribute alone defines no fill
2552     return maFillAttribute.get() && !maFillAttribute->isDefault();
2553 }
2554 
2555 bool FillAttributes::isTransparent() const
2556 {
2557     if(hasSdrFillAttribute() && 0.0 != maFillAttribute->getTransparence())
2558     {
2559         return true;
2560     }
2561 
2562     if(hasFillGradientAttribute() && !maFillGradientAttribute->isDefault())
2563     {
2564         return true;
2565     }
2566 
2567     return false;
2568 }
2569 
2570 const drawinglayer::attribute::SdrFillAttribute& FillAttributes::getFillAttribute() const
2571 {
2572     if(!maFillAttribute.get())
2573     {
2574         const_cast< FillAttributes* >(this)->maFillAttribute.reset(new drawinglayer::attribute::SdrFillAttribute());
2575     }
2576 
2577     return *maFillAttribute.get();
2578 }
2579 
2580 const drawinglayer::attribute::FillGradientAttribute& FillAttributes::getFillGradientAttribute() const
2581 {
2582     if(!maFillGradientAttribute.get())
2583     {
2584         const_cast< FillAttributes* >(this)->maFillGradientAttribute.reset(new drawinglayer::attribute::FillGradientAttribute());
2585     }
2586 
2587     return *maFillGradientAttribute.get();
2588 }
2589 
2590 const drawinglayer::primitive2d::Primitive2DSequence& FillAttributes::getPrimitive2DSequence(
2591     const basegfx::B2DRange& rPaintRange,
2592     const basegfx::B2DRange& rDefineRange) const
2593 {
2594     if(maPrimitives.getLength() && (maLastPaintRange != rPaintRange || maLastDefineRange != rDefineRange))
2595     {
2596         const_cast< FillAttributes* >(this)->maPrimitives.realloc(0);
2597     }
2598 
2599     if(!maPrimitives.getLength())
2600     {
2601         const_cast< FillAttributes* >(this)->createPrimitive2DSequence(rPaintRange, rDefineRange);
2602     }
2603 
2604     return maPrimitives;
2605 }
2606 
2607 //////////////////////////////////////////////////////////////////////////////
2608 //  class SwFrmFmt
2609 //	Implementierung teilweise inline im hxx
2610 
2611 TYPEINIT1( SwFrmFmt, SwFmt );
2612 IMPL_FIXEDMEMPOOL_NEWDEL_DLL( SwFrmFmt, 20, 20 )
2613 
2614 SwFrmFmt::SwFrmFmt(
2615     SwAttrPool& rPool,
2616     const sal_Char* pFmtNm,
2617     SwFrmFmt *pDrvdFrm,
2618     sal_uInt16 nFmtWhich,
2619     const sal_uInt16* pWhichRange)
2620 :   SwFmt(rPool, pFmtNm, (pWhichRange ? pWhichRange : aFrmFmtSetRange), pDrvdFrm, nFmtWhich),
2621     m_wXObject(),
2622     maFillAttributes(),
2623     pCaptionFmt(0)
2624 {
2625     //UUUU
2626     if(RES_FLYFRMFMT == nFmtWhich)
2627     {
2628         // when its a SwFlyFrmFmt do not do this, this setting
2629         // will be derived from the parent style. In the future this
2630         // may be needed for more formats; all which use the
2631         // XATTR_FILL_FIRST, XATTR_FILL_LAST range as fill attributes
2632 #ifdef DBG_UTIL
2633         bool bBla = true; // allow setting a breakpoint here in debug mode
2634 #endif
2635     }
2636     else
2637     {
2638         // set FillStyle to none; this is necessary since the pool default is
2639         // to fill objects by color (blue8)
2640         SetFmtAttr(XFillStyleItem(XFILL_NONE));
2641     }
2642 }
2643 
2644 SwFrmFmt::SwFrmFmt(
2645     SwAttrPool& rPool,
2646     const String &rFmtNm,
2647     SwFrmFmt *pDrvdFrm,
2648     sal_uInt16 nFmtWhich,
2649     const sal_uInt16* pWhichRange)
2650 :   SwFmt(rPool, rFmtNm, (pWhichRange ? pWhichRange : aFrmFmtSetRange), pDrvdFrm, nFmtWhich),
2651     m_wXObject(),
2652     maFillAttributes(),
2653     pCaptionFmt(0)
2654 {
2655     //UUUU
2656     if(RES_FLYFRMFMT == nFmtWhich)
2657     {
2658         // when its a SwFlyFrmFmt do not do this, this setting
2659         // will be derived from the parent style. In the future this
2660         // may be needed for more formats; all which use the
2661         // XATTR_FILL_FIRST, XATTR_FILL_LAST range as fill attributes
2662 #ifdef DBG_UTIL
2663         bool bBla = true; // allow setting a breakpoint here in debug mode
2664 #endif
2665     }
2666     else
2667     {
2668         // set FillStyle to none; this is necessary since the pool default is
2669         // to fill objects by color (blue8)
2670         SetFmtAttr(XFillStyleItem(XFILL_NONE));
2671     }
2672 }
2673 
2674 void SwFrmFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
2675 {
2676 	SwFmtHeader *pH = 0;
2677 	SwFmtFooter *pF = 0;
2678 
2679 	sal_uInt16 nWhich = pNew ? pNew->Which() : 0;
2680 
2681 	if( RES_ATTRSET_CHG == nWhich )
2682 	{
2683 		((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState(
2684 			RES_HEADER, sal_False, (const SfxPoolItem**)&pH );
2685 		((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState(
2686 			RES_FOOTER, sal_False, (const SfxPoolItem**)&pF );
2687 
2688         //UUUU reset fill information
2689         if(maFillAttributes.get())
2690         {
2691             SfxItemIter aIter(*((SwAttrSetChg*)pNew)->GetChgSet());
2692             bool bReset(false);
2693 
2694             for(const SfxPoolItem* pItem = aIter.FirstItem(); pItem && !bReset; pItem = aIter.NextItem())
2695             {
2696                 bReset = !IsInvalidItem(pItem) && pItem->Which() >= XATTR_FILL_FIRST && pItem->Which() <= XATTR_FILL_LAST;
2697             }
2698 
2699             if(bReset)
2700             {
2701                 maFillAttributes.reset();
2702             }
2703         }
2704     }
2705     else if(RES_FMT_CHG == nWhich) //UUUU
2706     {
2707         // reset fill information on format change (e.g. style changed)
2708         maFillAttributes.reset();
2709     }
2710     else if( RES_HEADER == nWhich )
2711         pH = (SwFmtHeader*)pNew;
2712     else if( RES_FOOTER == nWhich )
2713         pF = (SwFmtFooter*)pNew;
2714 
2715 	if( pH && pH->IsActive() && !pH->GetHeaderFmt() )
2716 	{	//Hat er keinen, mach ich ihm einen
2717         SwFrmFmt *pFmt = GetDoc()->MakeLayoutFmt( RND_STD_HEADER, 0 );
2718         pH->RegisterToFormat( *pFmt );
2719 	}
2720 
2721 	if( pF && pF->IsActive() && !pF->GetFooterFmt() )
2722 	{	//Hat er keinen, mach ich ihm einen
2723         SwFrmFmt *pFmt = GetDoc()->MakeLayoutFmt( RND_STD_FOOTER, 0 );
2724         pF->RegisterToFormat( *pFmt );
2725 	}
2726 
2727 	// MIB 24.3.98: Modify der Basisklasse muss immer gerufen werden, z.B.
2728 	// wegen RESET_FMTWRITTEN.
2729 //	if ( GetDepends() )
2730 		SwFmt::Modify( pOld, pNew );
2731 
2732     if (pOld && (RES_REMOVE_UNO_OBJECT == pOld->Which()))
2733     {   // invalidate cached uno object
2734         SetXObject(uno::Reference<uno::XInterface>(0));
2735     }
2736 }
2737 
2738 void SwFrmFmt::RegisterToFormat( SwFmt& rFmt )
2739 {
2740     rFmt.Add( this );
2741 }
2742 
2743 //Vernichtet alle Frms, die in aDepend angemeldet sind.
2744 
2745 void SwFrmFmt::DelFrms()
2746 {
2747 	SwIterator<SwFrm,SwFmt> aIter( *this );
2748 	SwFrm * pLast = aIter.First();
2749 	if( pLast )
2750 		do {
2751 				pLast->Cut();
2752 				delete pLast;
2753 		} while( 0 != ( pLast = aIter.Next() ));
2754 }
2755 
2756 void SwFrmFmt::MakeFrms()
2757 {
2758 	ASSERT( !this, "Sorry not implemented." );
2759 }
2760 
2761 
2762 
2763 SwRect SwFrmFmt::FindLayoutRect( const sal_Bool bPrtArea, const Point* pPoint,
2764 								 const sal_Bool bCalcFrm ) const
2765 {
2766 	SwRect aRet;
2767 	SwFrm *pFrm = 0;
2768 	if( ISA( SwSectionFmt ) )
2769 	{
2770         // dann den frame::Frame per Node2Layout besorgen
2771 		SwSectionNode* pSectNd = ((SwSectionFmt*)this)->GetSectionNode();
2772 		if( pSectNd )
2773 		{
2774 			SwNode2Layout aTmp( *pSectNd, pSectNd->GetIndex() - 1 );
2775 			pFrm = aTmp.NextFrm();
2776 
2777 			if( pFrm && !pFrm->KnowsFormat(*this) )
2778 			{
2779                 // die Section hat keinen eigenen frame::Frame, also falls
2780 				// jemand die tatsaechliche Groe?e braucht, so muss das
2781 				// noch implementier werden, in dem sich vom Ende noch
2782                 // der entsprechende frame::Frame besorgt wird.
2783 				// PROBLEM: was passiert bei SectionFrames, die auf unter-
2784 				//			schiedlichen Seiten stehen??
2785 				if( bPrtArea )
2786 					aRet = pFrm->Prt();
2787 				else
2788 				{
2789 					aRet = pFrm->Frm();
2790 					--aRet.Pos().Y();
2791 				}
2792 				pFrm = 0;		// das Rect ist ja jetzt fertig
2793 			}
2794 		}
2795 	}
2796 	else
2797 	{
2798 		sal_uInt16 nFrmType = RES_FLYFRMFMT == Which() ? FRM_FLY : USHRT_MAX;
2799 		pFrm = ::GetFrmOfModify( 0, *(SwModify*)this, nFrmType, pPoint,
2800 									0, bCalcFrm );
2801 	}
2802 
2803 	if( pFrm )
2804 	{
2805 		if( bPrtArea )
2806 			aRet = pFrm->Prt();
2807 		else
2808 			aRet = pFrm->Frm();
2809 	}
2810 	return aRet;
2811 }
2812 
2813 SwContact* SwFrmFmt::FindContactObj()
2814 {
2815 	return SwIterator<SwContact,SwFmt>::FirstElement( *this );
2816 }
2817 
2818 SdrObject* SwFrmFmt::FindSdrObject()
2819 {
2820     // --> OD 2005-01-06 #i30669# - use method <FindContactObj()> instead of
2821     // duplicated code.
2822     SwContact* pFoundContact = FindContactObj();
2823     return pFoundContact ? pFoundContact->GetMaster() : 0;
2824     // <--
2825 }
2826 
2827 SdrObject* SwFrmFmt::FindRealSdrObject()
2828 {
2829 	if( RES_FLYFRMFMT == Which() )
2830 	{
2831 		Point aNullPt;
2832 		SwFlyFrm* pFly = (SwFlyFrm*)::GetFrmOfModify( 0, *this, FRM_FLY,
2833 													&aNullPt, 0, sal_False );
2834 		return pFly ? pFly->GetVirtDrawObj() : 0;
2835 	}
2836 	return FindSdrObject();
2837 }
2838 
2839 
2840 sal_Bool SwFrmFmt::IsLowerOf( const SwFrmFmt& rFmt ) const
2841 {
2842 	//Auch eine Verkettung von Innen nach aussen oder von aussen
2843 	//nach innen ist nicht zulaessig.
2844 	SwFlyFrm *pSFly = SwIterator<SwFlyFrm,SwFmt>::FirstElement(*this);
2845 	if( pSFly )
2846 	{
2847 		SwFlyFrm *pAskFly = SwIterator<SwFlyFrm,SwFmt>::FirstElement(rFmt);
2848 		if( pAskFly )
2849             return pSFly->IsLowerOf( pAskFly );
2850 	}
2851 
2852 	// dann mal ueber die Node-Positionen versuchen
2853 	const SwFmtAnchor* pAnchor = &rFmt.GetAnchor();
2854     if ((FLY_AT_PAGE != pAnchor->GetAnchorId()) && pAnchor->GetCntntAnchor())
2855     {
2856 		const SwSpzFrmFmts& rFmts = *GetDoc()->GetSpzFrmFmts();
2857 		const SwNode* pFlyNd = pAnchor->GetCntntAnchor()->nNode.GetNode().
2858 								FindFlyStartNode();
2859 		while( pFlyNd )
2860 		{
2861 			// dann ueber den Anker nach oben "hangeln"
2862 			sal_uInt16 n;
2863 			for( n = 0; n < rFmts.Count(); ++n )
2864 			{
2865 				const SwFrmFmt* pFmt = rFmts[ n ];
2866 				const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
2867 				if( pIdx && pFlyNd == &pIdx->GetNode() )
2868 				{
2869 					if( pFmt == this )
2870 						return sal_True;
2871 
2872 					pAnchor = &pFmt->GetAnchor();
2873                     if ((FLY_AT_PAGE == pAnchor->GetAnchorId()) ||
2874                         !pAnchor->GetCntntAnchor() )
2875                     {
2876                         return sal_False;
2877                     }
2878 
2879 					pFlyNd = pAnchor->GetCntntAnchor()->nNode.GetNode().
2880 								FindFlyStartNode();
2881 					break;
2882 				}
2883 			}
2884 			if( n >= rFmts.Count() )
2885 			{
2886 				ASSERT( !this, "Fly-Section aber kein Format gefunden" );
2887 				return sal_False;
2888 			}
2889 		}
2890 	}
2891 	return sal_False;
2892 }
2893 
2894 // --> OD 2004-07-27 #i31698#
2895 SwFrmFmt::tLayoutDir SwFrmFmt::GetLayoutDir() const
2896 {
2897     return SwFrmFmt::HORI_L2R;
2898 }
2899 
2900 void SwFrmFmt::SetLayoutDir( const SwFrmFmt::tLayoutDir )
2901 {
2902     // empty body, because default implementation does nothing
2903 }
2904 // <--
2905 
2906 // --> OD 2004-08-06 #i28749#
2907 sal_Int16 SwFrmFmt::GetPositionLayoutDir() const
2908 {
2909     return text::PositionLayoutDir::PositionInLayoutDirOfAnchor;
2910 }
2911 void SwFrmFmt::SetPositionLayoutDir( const sal_Int16 )
2912 {
2913     // empty body, because default implementation does nothing
2914 }
2915 // <--
2916 String SwFrmFmt::GetDescription() const
2917 {
2918     return SW_RES(STR_FRAME);
2919 }
2920 
2921 //	class SwFlyFrmFmt
2922 //	Implementierung teilweise inline im hxx
2923 
2924 TYPEINIT1( SwFlyFrmFmt, SwFrmFmt );
2925 IMPL_FIXEDMEMPOOL_NEWDEL( SwFlyFrmFmt,	10, 10 )
2926 
2927 SwFlyFrmFmt::~SwFlyFrmFmt()
2928 {
2929 	SwIterator<SwFlyFrm,SwFmt> aIter( *this );
2930 	SwFlyFrm * pLast = aIter.First();
2931 	if( pLast )
2932 		do {
2933 				delete pLast;
2934 		} while( 0 != ( pLast = aIter.Next() ));
2935 
2936 	SwIterator<SwFlyDrawContact,SwFmt> a2ndIter( *this );
2937 	SwFlyDrawContact* pC = a2ndIter.First();
2938 	if( pC )
2939 		do {
2940 				delete pC;
2941 
2942 		} while( 0 != ( pC = a2ndIter.Next() ));
2943 }
2944 
2945 //Erzeugen der Frms wenn das Format einen Absatzgebundenen Rahmen beschreibt.
2946 //MA: 14. Feb. 94, Erzeugen der Frms auch fuer Seitengebundene Rahmen.
2947 
2948 void SwFlyFrmFmt::MakeFrms()
2949 {
2950 	// gibts ueberhaupt ein Layout ??
2951 	if( !GetDoc()->GetCurrentViewShell() )
2952 		return;	//swmod 071108//swmod 071225
2953 
2954 	SwModify *pModify = 0;
2955     // OD 24.07.2003 #111032# - create local copy of anchor attribute for possible changes.
2956     SwFmtAnchor aAnchorAttr( GetAnchor() );
2957     switch( aAnchorAttr.GetAnchorId() )
2958     {
2959     case FLY_AS_CHAR:
2960     case FLY_AT_PARA:
2961     case FLY_AT_CHAR:
2962         if( aAnchorAttr.GetCntntAnchor() )
2963         {
2964             pModify = aAnchorAttr.GetCntntAnchor()->nNode.GetNode().GetCntntNode();
2965         }
2966 		break;
2967 
2968 	case FLY_AT_FLY:
2969         if( aAnchorAttr.GetCntntAnchor() )
2970 		{
2971 			//Erst einmal ueber den Inhalt suchen, weil konstant schnell. Kann
2972 			//Bei verketteten Rahmen aber auch schief gehen, weil dann evtl.
2973             //niemals ein frame::Frame zu dem Inhalt existiert. Dann muss leider noch
2974 			//die Suche vom StartNode zum FrameFormat sein.
2975             SwNodeIndex aIdx( aAnchorAttr.GetCntntAnchor()->nNode );
2976 			SwCntntNode *pCNd = GetDoc()->GetNodes().GoNext( &aIdx );
2977             // --> OD 2009-12-28 #i105535#
2978             if ( pCNd == 0 )
2979             {
2980                 pCNd = aAnchorAttr.GetCntntAnchor()->nNode.GetNode().GetCntntNode();
2981             }
2982             if ( pCNd )
2983             // <--
2984             {
2985                 if( SwIterator<SwFrm,SwCntntNode>::FirstElement( *pCNd ) )
2986                 {
2987                     pModify = pCNd;
2988                 }
2989             }
2990             // --> OD 2009-12-28 #i105535#
2991             if ( pModify == 0 )
2992             // <--
2993             {
2994                 const SwNodeIndex &rIdx = aAnchorAttr.GetCntntAnchor()->nNode;
2995 				SwSpzFrmFmts& rFmts = *GetDoc()->GetSpzFrmFmts();
2996 				for( sal_uInt16 i = 0; i < rFmts.Count(); ++i )
2997 				{
2998 					SwFrmFmt* pFlyFmt = rFmts[i];
2999 					if( pFlyFmt->GetCntnt().GetCntntIdx() &&
3000 						rIdx == *pFlyFmt->GetCntnt().GetCntntIdx() )
3001 					{
3002 						pModify = pFlyFmt;
3003 						break;
3004 					}
3005 				}
3006 			}
3007 		}
3008 		break;
3009 
3010     case FLY_AT_PAGE:
3011         {
3012             sal_uInt16 nPgNum = aAnchorAttr.GetPageNum();
3013             SwPageFrm *pPage = (SwPageFrm*)GetDoc()->GetCurrentLayout()->Lower();	//swmod 080218
3014             if( nPgNum == 0 && aAnchorAttr.GetCntntAnchor() )
3015             {
3016                 SwCntntNode *pCNd = aAnchorAttr.GetCntntAnchor()->nNode.GetNode().GetCntntNode();
3017                 SwIterator<SwFrm,SwCntntNode> aIter( *pCNd );
3018                 for ( SwFrm* pFrm = aIter.First(); pFrm != NULL; pFrm = aIter.Next() )
3019                 {
3020                     pPage = pFrm->FindPageFrm();
3021                     if( pPage )
3022                     {
3023                         nPgNum = pPage->GetPhyPageNum();
3024                         aAnchorAttr.SetPageNum( nPgNum );
3025                         aAnchorAttr.SetAnchor( 0 );
3026                         SetFmtAttr( aAnchorAttr );
3027                         break;
3028                     }
3029                 }
3030             }
3031             while ( pPage )
3032             {
3033                 if ( pPage->GetPhyPageNum() == nPgNum )
3034                 {
3035                     pPage->PlaceFly( 0, this );
3036                     break;
3037                 }
3038                 pPage = (SwPageFrm*)pPage->GetNext();
3039             }
3040         }
3041         break;
3042     default:
3043         break;
3044 	}
3045 
3046 	if( pModify )
3047 	{
3048         SwIterator<SwFrm,SwModify> aIter( *pModify );
3049 		for( SwFrm *pFrm = aIter.First(); pFrm; pFrm = aIter.Next() )
3050 		{
3051 			sal_Bool bAdd = !pFrm->IsCntntFrm() ||
3052 							!((SwCntntFrm*)pFrm)->IsFollow();
3053 
3054             if ( FLY_AT_FLY == aAnchorAttr.GetAnchorId() && !pFrm->IsFlyFrm() )
3055             {
3056                 // --> OD 2009-12-28 #i105535#
3057                 // fallback to anchor type at-paragraph, if no fly frame is found.
3058 //                pFrm = pFrm->FindFlyFrm();
3059                 SwFrm* pFlyFrm = pFrm->FindFlyFrm();
3060                 if ( pFlyFrm )
3061                 {
3062                     pFrm = pFlyFrm;
3063                 }
3064                 else
3065                 {
3066                     aAnchorAttr.SetType( FLY_AT_PARA );
3067                     SetFmtAttr( aAnchorAttr );
3068                     MakeFrms();
3069                     return;
3070                 }
3071                 // <--
3072             }
3073 
3074 			if( pFrm->GetDrawObjs() )
3075 			{
3076                 // --> OD 2004-07-01 #i28701# - new type <SwSortedObjs>
3077                 SwSortedObjs &rObjs = *pFrm->GetDrawObjs();
3078 				for( sal_uInt16 i = 0; i < rObjs.Count(); ++i)
3079 				{
3080                     // --> OD 2004-07-01 #i28701# - consider changed type of
3081                     // <SwSortedObjs> entries.
3082                     SwAnchoredObject* pObj = rObjs[i];
3083                     if( pObj->ISA(SwFlyFrm) &&
3084                         (&pObj->GetFrmFmt()) == this )
3085 					{
3086 						bAdd = sal_False;
3087 						break;
3088 					}
3089 				}
3090 			}
3091 
3092 			if( bAdd )
3093 			{
3094 				SwFlyFrm *pFly = 0;
3095                 switch( aAnchorAttr.GetAnchorId() )
3096 				{
3097 				case FLY_AT_FLY:
3098 					pFly = new SwFlyLayFrm( this, pFrm, pFrm );
3099 					break;
3100 
3101                 case FLY_AT_PARA:
3102                 case FLY_AT_CHAR:
3103 					pFly = new SwFlyAtCntFrm( this, pFrm, pFrm );
3104 					break;
3105 
3106                 case FLY_AS_CHAR:
3107 					pFly = new SwFlyInCntFrm( this, pFrm, pFrm );
3108 					break;
3109                 default:
3110                     ASSERT( !this, "Neuer Ankertyp" )
3111                     break;
3112                 }
3113 				pFrm->AppendFly( pFly );
3114 				SwPageFrm *pPage = pFly->FindPageFrm();
3115 				if( pPage )
3116 					::RegistFlys( pPage, pFly );
3117             }
3118 		}
3119 	}
3120 }
3121 
3122 SwFlyFrm* SwFlyFrmFmt::GetFrm( const Point* pPoint, const sal_Bool bCalcFrm ) const
3123 {
3124 	return (SwFlyFrm*)::GetFrmOfModify( 0, *(SwModify*)this, FRM_FLY,
3125 											pPoint, 0, bCalcFrm );
3126 }
3127 
3128 SwAnchoredObject* SwFlyFrmFmt::GetAnchoredObj( const Point* pPoint, const sal_Bool bCalcFrm ) const
3129 {
3130     SwFlyFrm* pFlyFrm( GetFrm( pPoint, bCalcFrm ) );
3131     if ( pFlyFrm )
3132     {
3133         return dynamic_cast<SwAnchoredObject*>(pFlyFrm);
3134     }
3135     else
3136     {
3137         return 0L;
3138     }
3139 }
3140 
3141 
3142 sal_Bool SwFlyFrmFmt::GetInfo( SfxPoolItem& rInfo ) const
3143 {
3144     sal_Bool bRet = sal_True;
3145     switch( rInfo.Which() )
3146     {
3147     case RES_CONTENT_VISIBLE:
3148         {
3149             ((SwPtrMsgPoolItem&)rInfo).pObject = SwIterator<SwFrm,SwFmt>::FirstElement( *this );
3150         }
3151         bRet = sal_False;
3152         break;
3153 
3154     default:
3155         bRet = SwFrmFmt::GetInfo( rInfo );
3156         break;
3157     }
3158     return bRet;
3159 }
3160 
3161 // --> OD 2009-07-14 #i73249#
3162 void SwFlyFrmFmt::SetObjTitle( const String& rTitle, bool bBroadcast )
3163 {
3164     SdrObject* pMasterObject = FindSdrObject();
3165     ASSERT( pMasterObject,
3166             "<SwNoTxtNode::SetObjTitle(..)> - missing <SdrObject> instance" );
3167     if ( !pMasterObject )
3168     {
3169         return;
3170     }
3171 
3172     if( bBroadcast )
3173     {
3174         SwStringMsgPoolItem aOld( RES_TITLE_CHANGED, pMasterObject->GetTitle() );
3175         SwStringMsgPoolItem aNew( RES_TITLE_CHANGED, rTitle );
3176         pMasterObject->SetTitle( rTitle );
3177         ModifyNotification( &aOld, &aNew );
3178     }
3179     else
3180     {
3181         pMasterObject->SetTitle( rTitle );
3182     }
3183 }
3184 
3185 const String SwFlyFrmFmt::GetObjTitle() const
3186 {
3187     const SdrObject* pMasterObject = FindSdrObject();
3188     ASSERT( pMasterObject,
3189             "<SwFlyFrmFmt::GetObjTitle(..)> - missing <SdrObject> instance" );
3190     if ( !pMasterObject )
3191     {
3192         return aEmptyStr;
3193     }
3194 
3195     return pMasterObject->GetTitle();
3196 }
3197 
3198 void SwFlyFrmFmt::SetObjDescription( const String& rDescription, bool bBroadcast )
3199 {
3200     SdrObject* pMasterObject = FindSdrObject();
3201     ASSERT( pMasterObject,
3202             "<SwFlyFrmFmt::SetDescription(..)> - missing <SdrObject> instance" );
3203     if ( !pMasterObject )
3204     {
3205         return;
3206     }
3207 
3208     if( bBroadcast )
3209     {
3210         SwStringMsgPoolItem aOld( RES_DESCRIPTION_CHANGED, pMasterObject->GetDescription() );
3211         SwStringMsgPoolItem aNew( RES_DESCRIPTION_CHANGED, rDescription );
3212         pMasterObject->SetDescription( rDescription );
3213         ModifyNotification( &aOld, &aNew );
3214     }
3215     else
3216     {
3217         pMasterObject->SetDescription( rDescription );
3218     }
3219 }
3220 
3221 const String SwFlyFrmFmt::GetObjDescription() const
3222 {
3223     const SdrObject* pMasterObject = FindSdrObject();
3224     ASSERT( pMasterObject,
3225             "<SwNoTxtNode::GetDescription(..)> - missing <SdrObject> instance" );
3226     if ( !pMasterObject )
3227     {
3228         return aEmptyStr;
3229     }
3230 
3231     return pMasterObject->GetDescription();
3232 }
3233 // <--
3234 
3235 /** SwFlyFrmFmt::IsBackgroundTransparent - for #99657#
3236 
3237     OD 22.08.2002 - overloading virtual method and its default implementation,
3238     because format of fly frame provides transparent backgrounds.
3239     Method determines, if background of fly frame is transparent.
3240 
3241     @author OD
3242 
3243     @return true, if background color is transparent, but not "no fill"
3244     or the transparency of a existing background graphic is set.
3245 */
3246 sal_Bool SwFlyFrmFmt::IsBackgroundTransparent() const
3247 {
3248     sal_Bool bReturn = sal_False;
3249 
3250     /// NOTE: If background color is "no fill"/"auto fill" (COL_TRANSPARENT)
3251     ///     and there is no background graphic, it "inherites" the background
3252     ///     from its anchor.
3253     if ( (GetBackground().GetColor().GetTransparency() != 0) &&
3254          (GetBackground().GetColor() != COL_TRANSPARENT)
3255        )
3256     {
3257         bReturn = sal_True;
3258     }
3259     else
3260     {
3261         const GraphicObject *pTmpGrf =
3262                 static_cast<const GraphicObject*>(GetBackground().GetGraphicObject());
3263         if ( (pTmpGrf) &&
3264              (pTmpGrf->GetAttr().GetTransparency() != 0)
3265            )
3266         {
3267             bReturn = sal_True;
3268         }
3269     }
3270 
3271     return bReturn;
3272 }
3273 
3274 /** SwFlyFrmFmt::IsBackgroundBrushInherited - for #103898#
3275 
3276     OD 08.10.2002 - method to determine, if the brush for drawing the
3277     background is "inherited" from its parent/grandparent.
3278     This is the case, if no background graphic is set and the background
3279     color is "no fill"/"auto fill"
3280     NOTE: condition is "copied" from method <SwFrm::GetBackgroundBrush(..).
3281 
3282     @author OD
3283 
3284     @return true, if background brush is "inherited" from parent/grandparent
3285 */
3286 sal_Bool SwFlyFrmFmt::IsBackgroundBrushInherited() const
3287 {
3288     sal_Bool bReturn = sal_False;
3289 
3290     if ( (GetBackground().GetColor() == COL_TRANSPARENT) &&
3291          !(GetBackground().GetGraphicObject()) )
3292     {
3293         bReturn = sal_True;
3294     }
3295 
3296     return bReturn;
3297 }
3298 
3299 // --> OD 2006-02-28 #125892#
3300 SwHandleAnchorNodeChg::SwHandleAnchorNodeChg( SwFlyFrmFmt& _rFlyFrmFmt,
3301                                               const SwFmtAnchor& _rNewAnchorFmt,
3302                                               SwFlyFrm* _pKeepThisFlyFrm )
3303     : mrFlyFrmFmt( _rFlyFrmFmt ),
3304       mbAnchorNodeChanged( false )
3305 {
3306     const RndStdIds nNewAnchorType( _rNewAnchorFmt.GetAnchorId() );
3307     if ( ((nNewAnchorType == FLY_AT_PARA) ||
3308           (nNewAnchorType == FLY_AT_CHAR)) &&
3309          _rNewAnchorFmt.GetCntntAnchor() &&
3310          _rNewAnchorFmt.GetCntntAnchor()->nNode.GetNode().GetCntntNode() )
3311     {
3312         const SwFmtAnchor& aOldAnchorFmt( _rFlyFrmFmt.GetAnchor() );
3313         if ( aOldAnchorFmt.GetAnchorId() == nNewAnchorType &&
3314              aOldAnchorFmt.GetCntntAnchor() &&
3315              aOldAnchorFmt.GetCntntAnchor()->nNode.GetNode().GetCntntNode() &&
3316              aOldAnchorFmt.GetCntntAnchor()->nNode !=
3317                                     _rNewAnchorFmt.GetCntntAnchor()->nNode )
3318         {
3319             // determine 'old' number of anchor frames
3320             sal_uInt32 nOldNumOfAnchFrm( 0L );
3321             SwIterator<SwFrm,SwCntntNode> aOldIter( *(aOldAnchorFmt.GetCntntAnchor()->nNode.GetNode().GetCntntNode()) );
3322             for( SwFrm* pOld = aOldIter.First(); pOld; pOld = aOldIter.Next() )
3323             {
3324                 ++nOldNumOfAnchFrm;
3325             }
3326             // determine 'new' number of anchor frames
3327             sal_uInt32 nNewNumOfAnchFrm( 0L );
3328             SwIterator<SwFrm,SwCntntNode> aNewIter( *(_rNewAnchorFmt.GetCntntAnchor()->nNode.GetNode().GetCntntNode()) );
3329             for( SwFrm* pNew = aNewIter.First(); pNew; pNew = aNewIter.Next() )
3330             {
3331                 ++nNewNumOfAnchFrm;
3332             }
3333             if ( nOldNumOfAnchFrm != nNewNumOfAnchFrm )
3334             {
3335                 // delete existing fly frames except <_pKeepThisFlyFrm>
3336                 SwIterator<SwFrm,SwFmt> aIter( mrFlyFrmFmt );
3337                 SwFrm* pFrm = aIter.First();
3338                 if ( pFrm )
3339                 {
3340                     do {
3341                         if ( pFrm != _pKeepThisFlyFrm )
3342                         {
3343                             pFrm->Cut();
3344                             delete pFrm;
3345                         }
3346                     } while( 0 != ( pFrm = aIter.Next() ));
3347                 }
3348                 // indicate, that re-creation of fly frames necessary
3349                 mbAnchorNodeChanged = true;
3350             }
3351         }
3352     }
3353 }
3354 
3355 SwHandleAnchorNodeChg::~SwHandleAnchorNodeChg()
3356 {
3357     if ( mbAnchorNodeChanged )
3358     {
3359         mrFlyFrmFmt.MakeFrms();
3360     }
3361 }
3362 // <--
3363 //	class SwDrawFrmFmt
3364 //	Implementierung teilweise inline im hxx
3365 
3366 TYPEINIT1( SwDrawFrmFmt, SwFrmFmt );
3367 IMPL_FIXEDMEMPOOL_NEWDEL( SwDrawFrmFmt,	10, 10 )
3368 
3369 SwDrawFrmFmt::~SwDrawFrmFmt()
3370 {
3371 	SwContact *pContact = FindContactObj();
3372 	delete pContact;
3373 }
3374 
3375 void SwDrawFrmFmt::MakeFrms()
3376 {
3377 	SwDrawContact *pContact = (SwDrawContact*)FindContactObj();
3378     if ( pContact )
3379          pContact->ConnectToLayout();
3380 }
3381 
3382 void SwDrawFrmFmt::DelFrms()
3383 {
3384 	SwDrawContact *pContact = (SwDrawContact *)FindContactObj();
3385 	if ( pContact ) //fuer den Reader und andere Unabwaegbarkeiten.
3386 		pContact->DisconnectFromLayout();
3387 }
3388 
3389 // --> OD 2004-07-27 #i31698#
3390 SwFrmFmt::tLayoutDir SwDrawFrmFmt::GetLayoutDir() const
3391 {
3392     return meLayoutDir;
3393 }
3394 
3395 void SwDrawFrmFmt::SetLayoutDir( const SwFrmFmt::tLayoutDir _eLayoutDir )
3396 {
3397     meLayoutDir = _eLayoutDir;
3398 }
3399 // <--
3400 
3401 // --> OD 2004-08-06 #i28749#
3402 sal_Int16 SwDrawFrmFmt::GetPositionLayoutDir() const
3403 {
3404     return mnPositionLayoutDir;
3405 }
3406 void SwDrawFrmFmt::SetPositionLayoutDir( const sal_Int16 _nPositionLayoutDir )
3407 {
3408     switch ( _nPositionLayoutDir )
3409     {
3410         case text::PositionLayoutDir::PositionInHoriL2R:
3411         case text::PositionLayoutDir::PositionInLayoutDirOfAnchor:
3412         {
3413             mnPositionLayoutDir = _nPositionLayoutDir;
3414         }
3415         break;
3416         default:
3417         {
3418             ASSERT( false,
3419                     "<SwDrawFrmFmt::SetPositionLayoutDir(..)> - invalid attribute value." );
3420         }
3421     }
3422 }
3423 // <--
3424 
3425 String SwDrawFrmFmt::GetDescription() const
3426 {
3427     String aResult;
3428     const SdrObject * pSdrObj = FindSdrObject();
3429 
3430     if (pSdrObj)
3431     {
3432         if (pSdrObj != pSdrObjCached)
3433         {
3434             SdrObject * pSdrObjCopy = pSdrObj->Clone();
3435             SdrUndoNewObj * pSdrUndo = new SdrUndoNewObj(*pSdrObjCopy);
3436             sSdrObjCachedComment = pSdrUndo->GetComment();
3437 
3438             delete pSdrUndo;
3439 
3440             pSdrObjCached = pSdrObj;
3441         }
3442 
3443         aResult = sSdrObjCachedComment;
3444     }
3445     else
3446         aResult = SW_RES(STR_GRAPHIC);
3447 
3448     return aResult;
3449 }
3450 
3451 IMapObject* SwFrmFmt::GetIMapObject( const Point& rPoint,
3452 										const SwFlyFrm *pFly ) const
3453 {
3454 	const SwFmtURL &rURL = GetURL();
3455 	if( !rURL.GetMap() )
3456 		return 0;
3457 
3458 	if( !pFly )
3459 	{
3460 		pFly = SwIterator<SwFlyFrm,SwFmt>::FirstElement( *this );
3461 		if( !pFly )
3462 			return 0;
3463 	}
3464 
3465 	//Orignialgroesse fuer OLE und Grafik ist die TwipSize,
3466 	//ansonsten die Groesse vom FrmFmt des Fly.
3467 	const SwFrm *pRef;
3468     SwNoTxtNode *pNd = 0;
3469 	Size aOrigSz;
3470 	if( pFly->Lower() && pFly->Lower()->IsNoTxtFrm() )
3471 	{
3472 		pRef = pFly->Lower();
3473 		pNd = ((SwCntntFrm*)pRef)->GetNode()->GetNoTxtNode();
3474 		aOrigSz = pNd->GetTwipSize();
3475 	}
3476 	else
3477 	{
3478 		pRef = pFly;
3479 		aOrigSz = pFly->GetFmt()->GetFrmSize().GetSize();
3480 	}
3481 
3482 	if( aOrigSz.Width() != 0 && aOrigSz.Height() != 0 )
3483 	{
3484 		Point aPos( rPoint );
3485 		Size aActSz ( pRef == pFly ? pFly->Frm().SSize() : pRef->Prt().SSize() );
3486 		const MapMode aSrc ( MAP_TWIP );
3487 		const MapMode aDest( MAP_100TH_MM );
3488 		aOrigSz = OutputDevice::LogicToLogic( aOrigSz, aSrc, aDest );
3489 		aActSz  = OutputDevice::LogicToLogic( aActSz,  aSrc, aDest );
3490 		aPos -= pRef->Frm().Pos();
3491 		aPos -= pRef->Prt().Pos();
3492 		aPos    = OutputDevice::LogicToLogic( aPos, aSrc, aDest );
3493 		sal_uInt32 nFlags = 0;
3494 		if ( pFly != pRef && pNd->IsGrfNode() )
3495 		{
3496 			const sal_uInt16 nMirror = pNd->GetSwAttrSet().
3497 										GetMirrorGrf().GetValue();
3498             if ( RES_MIRROR_GRAPH_BOTH == nMirror )
3499 				nFlags = IMAP_MIRROR_HORZ | IMAP_MIRROR_VERT;
3500             else if ( RES_MIRROR_GRAPH_VERT == nMirror )
3501 				nFlags = IMAP_MIRROR_VERT;
3502             else if ( RES_MIRROR_GRAPH_HOR == nMirror )
3503 				nFlags = IMAP_MIRROR_HORZ;
3504 
3505 		}
3506 		return ((ImageMap*)rURL.GetMap())->GetHitIMapObject( aOrigSz,
3507 												aActSz, aPos, nFlags );
3508 	}
3509 
3510 	return 0;
3511 }
3512 
3513 sal_Bool SwFrmFmt::HasCaption() const
3514 {
3515 	if(pCaptionFmt != NULL && pCaptionFmt->GetDepends())
3516 		return sal_True;
3517 	return sal_False;
3518 }
3519 
3520 void SwFrmFmt::SetCaptionFmt(SwFrmFmt * pFmt)
3521 {
3522 	pCaptionFmt = pFmt;
3523 }
3524 
3525 SwFrmFmt* SwFrmFmt::GetCaptionFmt() const
3526 {
3527 	return pCaptionFmt;
3528 }
3529 
3530 //UUUU
3531 FillAttributesPtr SwFrmFmt::getFillAttributes() const
3532 {
3533     if(!maFillAttributes.get())
3534     {
3535         const_cast< SwFrmFmt* >(this)->maFillAttributes.reset(new FillAttributes(GetAttrSet()));
3536     }
3537 
3538     return maFillAttributes;
3539 }
3540 
3541 // eof
3542