1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: atrfrm.cxx,v $
10 * $Revision: 1.72.144.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
35 #include <hintids.hxx>
36 #include <com/sun/star/text/RelOrientation.hpp>
37 #include <com/sun/star/text/VertOrientation.hpp>
38 #include <com/sun/star/text/HorizontalAdjust.hpp>
39 #include <com/sun/star/text/DocumentStatistic.hpp>
40 #include <com/sun/star/text/HoriOrientation.hpp>
41 #include <com/sun/star/text/HoriOrientationFormat.hpp>
42 #include <com/sun/star/text/NotePrintMode.hpp>
43 #include <com/sun/star/text/SizeType.hpp>
44 #include <com/sun/star/text/VertOrientationFormat.hpp>
45 #include <com/sun/star/text/WrapTextMode.hpp>
46 #include <com/sun/star/text/XTextFrame.hpp>
47 #include <com/sun/star/text/TextContentAnchorType.hpp>
48 #include <com/sun/star/text/InvalidTextContentException.hpp>
49 #include <com/sun/star/container/XIndexContainer.hpp>
50 #include <com/sun/star/text/TextGridMode.hpp>
51 #include <com/sun/star/awt/Size.hpp>
52 #include <svtools/unoimap.hxx>
53 #include <svtools/unoevent.hxx>
54 #ifndef __SBX_SBXVARIABLE_HXX //autogen
55 #include <basic/sbxvar.hxx>
57 #include <svtools/imap.hxx>
58 #include <svtools/imapobj.hxx>
59 #include <svx/ulspitem.hxx>
60 #include <svx/lrspitem.hxx>
61 #include <svx/svdmodel.hxx>
62 #include <svx/svdpage.hxx>
63 #include <unosett.hxx>
64 #include <unostyle.hxx>
65 #include <fmtclds.hxx>
66 #include <fmtornt.hxx>
67 #include <fmthdft.hxx>
68 #include <fmtpdsc.hxx>
69 #include <fmtcntnt.hxx>
70 #include <fmtfsize.hxx>
71 #include <fmtfordr.hxx>
72 #include <fmtsrnd.hxx>
73 #include <fmtanchr.hxx>
74 #include <fmtlsplt.hxx>
75 #include <fmtrowsplt.hxx>
76 #include <fmtftntx.hxx>
77 #include <fmteiro.hxx>
79 #include <fmtcnct.hxx>
81 #include <section.hxx>
83 #include <fmtline.hxx>
85 #include <tgrditem.hxx>
86 #include <hfspacingitem.hxx>
88 #include <pagefrm.hxx>
89 #include <rootfrm.hxx>
93 #include <dflyobj.hxx>
94 #include <dcontact.hxx>
96 #include <frmtool.hxx>
97 #include <flyfrms.hxx>
98 #include <pagedesc.hxx>
100 #include <ndnotxt.hxx>
101 #include <docary.hxx>
102 #include <node2lay.hxx>
103 #include <fmtclbl.hxx>
104 #include <swunohelper.hxx>
105 #include <unoframe.hxx>
106 #include <SwStyleNameMapper.hxx>
107 /// OD 22.08.2002 #99657#
108 /// include definition of class SvxBrushItem and GraphicObject
109 /// in order to determine, if background is transparent.
110 #include <svx/brshitem.hxx>
111 #include <goodies/grfmgr.hxx>
120 #include <comcore.hrc>
122 #ifndef _SVX_SVUNDO_HXX
123 #include <svx/svdundo.hxx> // #111827#
125 // OD 2004-05-24 #i28701#
126 #include <sortedobjs.hxx>
127 // --> OD 2006-03-06 #125892#
128 #include <HandleAnchorNodeChg.hxx>
130 #include <svtools/cjkoptions.hxx>
132 using namespace ::com::sun::star
;
133 using ::rtl::OUString
;
135 SV_IMPL_PTRARR(SwColumns
,SwColumn
*)
137 TYPEINIT1(SwFmtVertOrient
, SfxPoolItem
);
138 TYPEINIT1(SwFmtHoriOrient
, SfxPoolItem
);
139 TYPEINIT2(SwFmtHeader
, SfxPoolItem
, SwClient
);
140 TYPEINIT2(SwFmtFooter
, SfxPoolItem
, SwClient
);
141 TYPEINIT2(SwFmtPageDesc
, SfxPoolItem
, SwClient
);
142 TYPEINIT1_AUTOFACTORY(SwFmtLineNumber
, SfxPoolItem
);
144 /* -----------------19.05.98 09:26-------------------
145 * Umwandlung fuer QueryValue
146 * --------------------------------------------------*/
147 sal_Int16
lcl_RelToINT(sal_Int16 eRelation
)
149 sal_Int16 nRet
= text::RelOrientation::FRAME
;
152 case text::RelOrientation::PRINT_AREA
: nRet
= text::RelOrientation::PRINT_AREA
; break;
153 case text::RelOrientation::CHAR
: nRet
= text::RelOrientation::CHAR
; break;
154 case text::RelOrientation::PAGE_LEFT
: nRet
= text::RelOrientation::PAGE_LEFT
; break;
155 case text::RelOrientation::PAGE_RIGHT
: nRet
= text::RelOrientation::PAGE_RIGHT
; break;
156 case text::RelOrientation::FRAME_LEFT
: nRet
= text::RelOrientation::FRAME_LEFT
; break;
157 case text::RelOrientation::FRAME_RIGHT
: nRet
= text::RelOrientation::FRAME_RIGHT
; break;
158 case text::RelOrientation::PAGE_FRAME
: nRet
= text::RelOrientation::PAGE_FRAME
; break;
159 case text::RelOrientation::PAGE_PRINT_AREA
: nRet
= text::RelOrientation::PAGE_PRINT_AREA
; break;
160 // OD 13.11.2003 #i22341#
161 case text::RelOrientation::TEXT_LINE
: nRet
= text::RelOrientation::TEXT_LINE
; break;
167 sal_Int16
lcl_IntToRelation(const uno::Any
& rVal
)
169 sal_Int16 eRet
= text::RelOrientation::FRAME
;
174 case text::RelOrientation::PRINT_AREA
: eRet
= text::RelOrientation::PRINT_AREA
; break;
175 case text::RelOrientation::CHAR
: eRet
= text::RelOrientation::CHAR
; break;
176 case text::RelOrientation::PAGE_LEFT
: eRet
= text::RelOrientation::PAGE_LEFT
; break;
177 case text::RelOrientation::PAGE_RIGHT
: eRet
= text::RelOrientation::PAGE_RIGHT
; break;
178 case text::RelOrientation::FRAME_LEFT
: eRet
= text::RelOrientation::FRAME_LEFT
; break;
179 case text::RelOrientation::FRAME_RIGHT
: eRet
= text::RelOrientation::FRAME_RIGHT
; break;
180 case text::RelOrientation::PAGE_FRAME
: eRet
= text::RelOrientation::PAGE_FRAME
; break;
181 case text::RelOrientation::PAGE_PRINT_AREA
: eRet
= text::RelOrientation::PAGE_PRINT_AREA
; break;
182 // OD 13.11.2003 #i22341#
183 case text::RelOrientation::TEXT_LINE
: eRet
= text::RelOrientation::TEXT_LINE
; break;
188 void DelHFFormat( SwClient
*pToRemove
, SwFrmFmt
*pFmt
)
190 //Wenn der Client der letzte ist der das Format benutzt, so muss dieses
191 //vernichtet werden. Zuvor muss jedoch ggf. die Inhaltssection vernichtet
193 SwDoc
* pDoc
= pFmt
->GetDoc();
194 pFmt
->Remove( pToRemove
);
195 if( pDoc
->IsInDtor() )
201 //Nur noch Frms angemeldet?
202 sal_Bool bDel
= sal_True
;
204 // Klammer, weil im DTOR SwClientIter das Flag bTreeChg zurueck
205 // gesetzt wird. Unguenstig, wenn das Format vorher zerstoert wird.
206 SwClientIter
aIter( *pFmt
);
207 SwClient
*pLast
= aIter
.GoStart();
210 bDel
= pLast
->IsA( TYPE(SwFrm
) )|| pLast
->IsA(TYPE(SwXHeadFootText
));
211 } while( bDel
&& 0 != ( pLast
= aIter
++ ));
216 //Wenn in einem der Nodes noch ein Crsr angemeldet ist, muss das
217 //ParkCrsr einer (beliebigen) Shell gerufen werden.
218 SwFmtCntnt
& rCnt
= (SwFmtCntnt
&)pFmt
->GetCntnt();
219 if ( rCnt
.GetCntntIdx() )
223 // --> OD 2008-10-07 #i92993#
224 // Begin with start node of page header/footer to assure that
225 // complete content is checked for cursors and the complete content
226 // is deleted on below made method call <pDoc->DeleteSection(pNode)>
227 // SwNodeIndex aIdx( *rCnt.GetCntntIdx(), 1 );
228 SwNodeIndex
aIdx( *rCnt
.GetCntntIdx(), 0 );
230 //Wenn in einem der Nodes noch ein Crsr angemeldet ist, muss das
231 //ParkCrsr einer (beliebigen) Shell gerufen werden.
232 pNode
= pDoc
->GetNodes()[ aIdx
];
233 sal_uInt32 nEnd
= pNode
->EndOfSectionIndex();
234 while ( aIdx
< nEnd
)
236 if ( pNode
->IsCntntNode() &&
237 ((SwCntntNode
*)pNode
)->GetDepends() )
239 SwClientIter
aIter( *(SwCntntNode
*)pNode
);
242 if( aIter()->ISA( SwCrsrShell
) )
244 ((SwCrsrShell
*)aIter())->ParkCrsr( aIdx
);
251 pNode
= pDoc
->GetNodes()[ aIdx
];
254 rCnt
.SetNewCntntIdx( (const SwNodeIndex
*)0 );
256 // beim Loeschen von Header/Footer-Formaten IMMER das Undo
257 // abschalten! (Bug 31069)
258 sal_Bool bDoesUndo
= pDoc
->DoesUndo();
259 pDoc
->DoUndo( sal_False
);
261 ASSERT( pNode
, "Ein grosses Problem." );
262 pDoc
->DeleteSection( pNode
);
265 pDoc
->DoUndo( sal_True
);
271 // class SwFmtFrmSize
272 // Implementierung teilweise inline im hxx
274 SwFmtFrmSize::SwFmtFrmSize( SwFrmSize eSize
, SwTwips nWidth
, SwTwips nHeight
)
275 : SfxPoolItem( RES_FRM_SIZE
),
276 aSize( nWidth
, nHeight
),
277 eFrmHeightType( eSize
),
278 eFrmWidthType( ATT_FIX_SIZE
)
280 nWidthPercent
= nHeightPercent
= 0;
283 SwFmtFrmSize
& SwFmtFrmSize::operator=( const SwFmtFrmSize
& rCpy
)
285 aSize
= rCpy
.GetSize();
286 eFrmHeightType
= rCpy
.GetHeightSizeType();
287 eFrmWidthType
= rCpy
.GetWidthSizeType();
288 nHeightPercent
= rCpy
.GetHeightPercent();
289 nWidthPercent
= rCpy
.GetWidthPercent();
293 int SwFmtFrmSize::operator==( const SfxPoolItem
& rAttr
) const
295 ASSERT( SfxPoolItem::operator==( rAttr
), "keine gleichen Attribute" );
296 return( eFrmHeightType
== ((SwFmtFrmSize
&)rAttr
).eFrmHeightType
&&
297 eFrmWidthType
== ((SwFmtFrmSize
&)rAttr
).eFrmWidthType
&&
298 aSize
== ((SwFmtFrmSize
&)rAttr
).GetSize()&&
299 nWidthPercent
== ((SwFmtFrmSize
&)rAttr
).GetWidthPercent() &&
300 nHeightPercent
== ((SwFmtFrmSize
&)rAttr
).GetHeightPercent() );
303 SfxPoolItem
* SwFmtFrmSize::Clone( SfxItemPool
* ) const
305 return new SwFmtFrmSize( *this );
309 /* -----------------24.04.98 11:36-------------------
311 * --------------------------------------------------*/
312 BOOL
SwFmtFrmSize::QueryValue( uno::Any
& rVal
, BYTE nMemberId
) const
314 // hier wird immer konvertiert!
315 nMemberId
&= ~CONVERT_TWIPS
;
318 case MID_FRMSIZE_SIZE
:
321 aTmp
.Height
= TWIP_TO_MM100(aSize
.Height());
322 aTmp
.Width
= TWIP_TO_MM100(aSize
.Width());
323 rVal
.setValue(&aTmp
, ::getCppuType((const awt::Size
*)0));
326 case MID_FRMSIZE_REL_HEIGHT
:
327 rVal
<<= (sal_Int16
)(GetHeightPercent() != 0xFF ? GetHeightPercent() : 0);
329 case MID_FRMSIZE_REL_WIDTH
:
330 rVal
<<= (sal_Int16
)(GetWidthPercent() != 0xFF ? GetWidthPercent() : 0);
332 case MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH
:
334 BOOL bTmp
= 0xFF == GetHeightPercent();
335 rVal
.setValue(&bTmp
, ::getBooleanCppuType());
338 case MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT
:
340 BOOL bTmp
= 0xFF == GetWidthPercent();
341 rVal
.setValue(&bTmp
, ::getBooleanCppuType());
344 case MID_FRMSIZE_WIDTH
:
345 rVal
<<= (sal_Int32
)TWIP_TO_MM100(aSize
.Width());
347 case MID_FRMSIZE_HEIGHT
:
348 // #95848# returned size should never be zero.
349 // (there was a bug that allowed for setting height to 0.
350 // Thus there some documents existing with that not allowed
351 // attribut value which may cause problems on import.)
352 rVal
<<= (sal_Int32
)TWIP_TO_MM100(aSize
.Height() < MINLAY
? MINLAY
: aSize
.Height() );
354 case MID_FRMSIZE_SIZE_TYPE
:
355 rVal
<<= (sal_Int16
)GetHeightSizeType();
357 case MID_FRMSIZE_IS_AUTO_HEIGHT
:
359 BOOL bTmp
= ATT_FIX_SIZE
!= GetHeightSizeType();
360 rVal
.setValue(&bTmp
, ::getBooleanCppuType());
363 case MID_FRMSIZE_WIDTH_TYPE
:
364 rVal
<<= (sal_Int16
)GetWidthSizeType();
370 /* -----------------24.04.98 11:36-------------------
372 * --------------------------------------------------*/
373 BOOL
SwFmtFrmSize::PutValue( const uno::Any
& rVal
, BYTE nMemberId
)
375 sal_Bool bConvert
= 0 != (nMemberId
&CONVERT_TWIPS
);
376 nMemberId
&= ~CONVERT_TWIPS
;
377 sal_Bool bRet
= sal_True
;
380 case MID_FRMSIZE_SIZE
:
387 Size
aTmp(aVal
.Width
, aVal
.Height
);
390 aTmp
.Height() = MM100_TO_TWIP(aTmp
.Height());
391 aTmp
.Width() = MM100_TO_TWIP(aTmp
.Width());
393 if(aTmp
.Height() && aTmp
.Width())
400 case MID_FRMSIZE_REL_HEIGHT
:
404 if(nSet
>= 0 && nSet
<= 0xfe)
405 SetHeightPercent((BYTE
)nSet
);
410 case MID_FRMSIZE_REL_WIDTH
:
414 if(nSet
>= 0 && nSet
<= 0xfe)
415 SetWidthPercent((BYTE
)nSet
);
420 case MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH
:
422 sal_Bool bSet
= *(sal_Bool
*)rVal
.getValue();
424 SetHeightPercent(0xff);
425 else if( 0xff == GetHeightPercent() )
426 SetHeightPercent( 0 );
429 case MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT
:
431 sal_Bool bSet
= *(sal_Bool
*)rVal
.getValue();
433 SetWidthPercent(0xff);
434 else if( 0xff == GetWidthPercent() )
438 case MID_FRMSIZE_WIDTH
:
444 nWd
= MM100_TO_TWIP(nWd
);
453 case MID_FRMSIZE_HEIGHT
:
459 nHg
= MM100_TO_TWIP(nHg
);
462 aSize
.Height() = nHg
;
468 case MID_FRMSIZE_SIZE_TYPE
:
471 if((rVal
>>= nType
) && nType
>= 0 && nType
<= ATT_MIN_SIZE
)
473 SetHeightSizeType((SwFrmSize
)nType
);
479 case MID_FRMSIZE_IS_AUTO_HEIGHT
:
481 sal_Bool bSet
= *(sal_Bool
*)rVal
.getValue();
482 SetHeightSizeType(bSet
? ATT_VAR_SIZE
: ATT_FIX_SIZE
);
485 case MID_FRMSIZE_WIDTH_TYPE
:
488 if((rVal
>>= nType
) && nType
>= 0 && nType
<= ATT_MIN_SIZE
)
490 SetWidthSizeType((SwFrmSize
)nType
);
502 // class SwFmtFillOrder
503 // Implementierung teilweise inline im hxx
505 SwFmtFillOrder::SwFmtFillOrder( SwFillOrder nFO
)
506 : SfxEnumItem( RES_FILL_ORDER
, sal_uInt16(nFO
) )
509 SfxPoolItem
* SwFmtFillOrder::Clone( SfxItemPool
* ) const
511 return new SwFmtFillOrder( GetFillOrder() );
514 sal_uInt16
SwFmtFillOrder::GetValueCount() const
516 return SW_FILL_ORDER_END
- SW_FILL_ORDER_BEGIN
;
520 // Implementierung teilweise inline im hxx
522 SwFmtHeader::SwFmtHeader( SwFrmFmt
*pHeaderFmt
)
523 : SfxPoolItem( RES_HEADER
),
524 SwClient( pHeaderFmt
),
525 bActive( pHeaderFmt
? sal_True
: sal_False
)
529 SwFmtHeader::SwFmtHeader( const SwFmtHeader
&rCpy
)
530 : SfxPoolItem( RES_HEADER
),
531 SwClient( (SwModify
*)rCpy
.GetRegisteredIn() ),
532 bActive( rCpy
.IsActive() )
536 SwFmtHeader::SwFmtHeader( sal_Bool bOn
)
537 : SfxPoolItem( RES_HEADER
),
543 SwFmtHeader::~SwFmtHeader()
545 if ( GetHeaderFmt() )
546 DelHFFormat( this, GetHeaderFmt() );
549 int SwFmtHeader::operator==( const SfxPoolItem
& rAttr
) const
551 ASSERT( SfxPoolItem::operator==( rAttr
), "keine gleichen Attribute" );
552 return ( pRegisteredIn
== ((SwFmtHeader
&)rAttr
).GetRegisteredIn() &&
553 bActive
== ((SwFmtHeader
&)rAttr
).IsActive() );
556 SfxPoolItem
* SwFmtHeader::Clone( SfxItemPool
* ) const
558 return new SwFmtHeader( *this );
562 // Implementierung teilweise inline im hxx
564 SwFmtFooter::SwFmtFooter( SwFrmFmt
*pFooterFmt
)
565 : SfxPoolItem( RES_FOOTER
),
566 SwClient( pFooterFmt
),
567 bActive( pFooterFmt
? sal_True
: sal_False
)
571 SwFmtFooter::SwFmtFooter( const SwFmtFooter
&rCpy
)
572 : SfxPoolItem( RES_FOOTER
),
573 SwClient( (SwModify
*)rCpy
.GetRegisteredIn() ),
574 bActive( rCpy
.IsActive() )
578 SwFmtFooter::SwFmtFooter( sal_Bool bOn
)
579 : SfxPoolItem( RES_FOOTER
),
585 SwFmtFooter::~SwFmtFooter()
587 if ( GetFooterFmt() )
588 DelHFFormat( this, GetFooterFmt() );
591 int SwFmtFooter::operator==( const SfxPoolItem
& rAttr
) const
593 ASSERT( SfxPoolItem::operator==( rAttr
), "keine gleichen Attribute" );
594 return ( pRegisteredIn
== ((SwFmtFooter
&)rAttr
).GetRegisteredIn() &&
595 bActive
== ((SwFmtFooter
&)rAttr
).IsActive() );
598 SfxPoolItem
* SwFmtFooter::Clone( SfxItemPool
* ) const
600 return new SwFmtFooter( *this );
604 // Implementierung teilweise inline im hxx
606 SwFmtCntnt::SwFmtCntnt( const SwFmtCntnt
&rCpy
)
607 : SfxPoolItem( RES_CNTNT
)
609 pStartNode
= rCpy
.GetCntntIdx() ?
610 new SwNodeIndex( *rCpy
.GetCntntIdx() ) : 0;
613 SwFmtCntnt::SwFmtCntnt( const SwStartNode
*pStartNd
)
614 : SfxPoolItem( RES_CNTNT
)
616 pStartNode
= pStartNd
? new SwNodeIndex( *pStartNd
) : 0;
619 SwFmtCntnt::~SwFmtCntnt()
624 void SwFmtCntnt::SetNewCntntIdx( const SwNodeIndex
*pIdx
)
627 pStartNode
= pIdx
? new SwNodeIndex( *pIdx
) : 0;
630 int SwFmtCntnt::operator==( const SfxPoolItem
& rAttr
) const
632 ASSERT( SfxPoolItem::operator==( rAttr
), "keine gleichen Attribute" );
633 if( (long)pStartNode
^ (long)((SwFmtCntnt
&)rAttr
).pStartNode
)
636 return ( *pStartNode
== *((SwFmtCntnt
&)rAttr
).GetCntntIdx() );
640 SfxPoolItem
* SwFmtCntnt::Clone( SfxItemPool
* ) const
642 return new SwFmtCntnt( *this );
645 // class SwFmtPageDesc
646 // Implementierung teilweise inline im hxx
648 SwFmtPageDesc::SwFmtPageDesc( const SwFmtPageDesc
&rCpy
)
649 : SfxPoolItem( RES_PAGEDESC
),
650 SwClient( (SwPageDesc
*)rCpy
.GetPageDesc() ),
651 nNumOffset( rCpy
.nNumOffset
),
652 nDescNameIdx( rCpy
.nDescNameIdx
),
657 SwFmtPageDesc::SwFmtPageDesc( const SwPageDesc
*pDesc
)
658 : SfxPoolItem( RES_PAGEDESC
),
659 SwClient( (SwPageDesc
*)pDesc
),
661 nDescNameIdx( 0xFFFF ), // IDX_NO_VALUE
666 SwFmtPageDesc::~SwFmtPageDesc() {}
668 int SwFmtPageDesc::operator==( const SfxPoolItem
& rAttr
) const
670 ASSERT( SfxPoolItem::operator==( rAttr
), "keine gleichen Attribute" );
671 return ( pDefinedIn
== ((SwFmtPageDesc
&)rAttr
).pDefinedIn
) &&
672 ( nNumOffset
== ((SwFmtPageDesc
&)rAttr
).nNumOffset
) &&
673 ( GetPageDesc() == ((SwFmtPageDesc
&)rAttr
).GetPageDesc() );
676 SfxPoolItem
* SwFmtPageDesc::Clone( SfxItemPool
* ) const
678 return new SwFmtPageDesc( *this );
681 void SwFmtPageDesc::Modify( SfxPoolItem
* pOld
, SfxPoolItem
* pNew
)
686 const sal_uInt16 nWhichId
= pOld
? pOld
->Which() : pNew
? pNew
->Which() : 0;
689 case RES_OBJECTDYING
:
690 //Der Pagedesc, bei dem ich angemeldet bin stirbt, ich trage
691 //mich also bei meinem Format aus.
692 //Dabei werden ich Deletet!!!
693 if( IS_TYPE( SwFmt
, pDefinedIn
))
696 sal_Bool bDel
= ((SwFmt
*)pDefinedIn
)->ResetFmtAttr( RES_PAGEDESC
);
697 ASSERT( bDel
, ";-) FmtPageDesc nicht zerstoert." );
700 ((SwFmt
*)pDefinedIn
)->ResetFmtAttr( RES_PAGEDESC
);
702 else if( IS_TYPE( SwCntntNode
, pDefinedIn
))
705 sal_Bool bDel
= ((SwCntntNode
*)pDefinedIn
)->ResetAttr( RES_PAGEDESC
);
706 ASSERT( bDel
, ";-) FmtPageDesc nicht zerstoert." );
709 ((SwCntntNode
*)pDefinedIn
)->ResetAttr( RES_PAGEDESC
);
718 BOOL
SwFmtPageDesc::QueryValue( uno::Any
& rVal
, BYTE nMemberId
) const
720 // hier wird immer konvertiert!
721 nMemberId
&= ~CONVERT_TWIPS
;
722 sal_Bool bRet
= sal_True
;
725 case MID_PAGEDESC_PAGENUMOFFSET
:
726 rVal
<<= (sal_Int16
)GetNumOffset();
729 case MID_PAGEDESC_PAGEDESCNAME
:
731 const SwPageDesc
* pDesc
= GetPageDesc();
735 SwStyleNameMapper::FillProgName(pDesc
->GetName(), aString
, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC
, sal_True
);
736 rVal
<<= OUString( aString
);
743 ASSERT( !this, "unknown MemberId" );
749 BOOL
SwFmtPageDesc::PutValue( const uno::Any
& rVal
, BYTE nMemberId
)
751 // hier wird immer konvertiert!
752 nMemberId
&= ~CONVERT_TWIPS
;
753 sal_Bool bRet
= sal_True
;
756 case MID_PAGEDESC_PAGENUMOFFSET
:
758 sal_Int16 nOffset
= 0;
760 SetNumOffset( nOffset
);
766 case MID_PAGEDESC_PAGEDESCNAME
:
767 /* geht nicht, weil das Attribut eigentlich nicht den Namen
768 * sondern einen Pointer auf den PageDesc braucht (ist Client davon).
769 * Der Pointer waere aber ueber den Namen nur vom Dokument zu erfragen.
772 ASSERT( !this, "unknown MemberId" );
780 // Implementierung teilweise inline im hxx
782 SwColumn::SwColumn() :
791 sal_Bool
SwColumn::operator==( const SwColumn
&rCmp
)
793 return (nWish
== rCmp
.GetWishWidth() &&
794 GetLeft() == rCmp
.GetLeft() &&
795 GetRight() == rCmp
.GetRight() &&
796 GetUpper() == rCmp
.GetUpper() &&
797 GetLower() == rCmp
.GetLower()) ? sal_True
: sal_False
;
800 SwFmtCol::SwFmtCol( const SwFmtCol
& rCpy
)
801 : SfxPoolItem( RES_COL
),
802 nLineWidth( rCpy
.nLineWidth
),
803 aLineColor( rCpy
.aLineColor
),
804 nLineHeight( rCpy
.GetLineHeight() ),
805 eAdj( rCpy
.GetLineAdj() ),
806 aColumns( (sal_Int8
)rCpy
.GetNumCols(), 1 ),
807 nWidth( rCpy
.GetWishWidth() ),
808 bOrtho( rCpy
.IsOrtho() )
810 for ( sal_uInt16 i
= 0; i
< rCpy
.GetNumCols(); ++i
)
812 SwColumn
*pCol
= new SwColumn( *rCpy
.GetColumns()[i
] );
813 aColumns
.Insert( pCol
, aColumns
.Count() );
817 SwFmtCol::~SwFmtCol() {}
819 SwFmtCol
& SwFmtCol::operator=( const SwFmtCol
& rCpy
)
821 nLineWidth
= rCpy
.nLineWidth
;
822 aLineColor
= rCpy
.aLineColor
;
823 nLineHeight
= rCpy
.GetLineHeight();
824 eAdj
= rCpy
.GetLineAdj();
825 nWidth
= rCpy
.GetWishWidth();
826 bOrtho
= rCpy
.IsOrtho();
828 if ( aColumns
.Count() )
829 aColumns
.DeleteAndDestroy( 0, aColumns
.Count() );
830 for ( sal_uInt16 i
= 0; i
< rCpy
.GetNumCols(); ++i
)
832 SwColumn
*pCol
= new SwColumn( *rCpy
.GetColumns()[i
] );
833 aColumns
.Insert( pCol
, aColumns
.Count() );
839 : SfxPoolItem( RES_COL
),
848 int SwFmtCol::operator==( const SfxPoolItem
& rAttr
) const
850 ASSERT( SfxPoolItem::operator==( rAttr
), "keine gleichen Attribute" );
851 const SwFmtCol
&rCmp
= (const SwFmtCol
&)rAttr
;
852 if( !(nLineWidth
== rCmp
.nLineWidth
&&
853 aLineColor
== rCmp
.aLineColor
&&
854 nLineHeight
== rCmp
.GetLineHeight() &&
855 eAdj
== rCmp
.GetLineAdj() &&
856 nWidth
== rCmp
.GetWishWidth() &&
857 bOrtho
== rCmp
.IsOrtho() &&
858 aColumns
.Count() == rCmp
.GetNumCols()) )
861 for ( sal_uInt16 i
= 0; i
< aColumns
.Count(); ++i
)
862 if ( !(*aColumns
[i
] == *rCmp
.GetColumns()[i
]) )
868 SfxPoolItem
* SwFmtCol::Clone( SfxItemPool
* ) const
870 return new SwFmtCol( *this );
873 sal_uInt16
SwFmtCol::GetGutterWidth( sal_Bool bMin
) const
876 if ( aColumns
.Count() == 2 )
877 nRet
= aColumns
[0]->GetRight() + aColumns
[1]->GetLeft();
878 else if ( aColumns
.Count() > 2 )
880 sal_Bool bSet
= sal_False
;
881 for ( sal_uInt16 i
= 1; i
< aColumns
.Count()-1; ++i
)
883 const sal_uInt16 nTmp
= aColumns
[i
]->GetRight() + aColumns
[i
+1]->GetLeft();
903 void SwFmtCol::SetGutterWidth( sal_uInt16 nNew
, sal_uInt16 nAct
)
909 sal_uInt16 nHalf
= nNew
/ 2;
910 for ( sal_uInt16 i
= 0; i
< aColumns
.Count(); ++i
)
911 { SwColumn
*pCol
= aColumns
[i
];
912 pCol
->SetLeft ( nHalf
);
913 pCol
->SetRight( nHalf
);
916 else if ( i
== (aColumns
.Count() - 1) )
922 void SwFmtCol::Init( sal_uInt16 nNumCols
, sal_uInt16 nGutterWidth
, sal_uInt16 nAct
)
924 //Loeschen scheint hier auf den erste Blick vielleicht etwas zu heftig;
925 //anderfalls muessten allerdings alle Werte der verbleibenden SwColumn's
926 //initialisiert werden.
927 if ( aColumns
.Count() )
928 aColumns
.DeleteAndDestroy( 0, aColumns
.Count() );
929 for ( sal_uInt16 i
= 0; i
< nNumCols
; ++i
)
930 { SwColumn
*pCol
= new SwColumn
;
931 aColumns
.Insert( pCol
, i
);
936 Calc( nGutterWidth
, nAct
);
939 void SwFmtCol::SetOrtho( sal_Bool bNew
, sal_uInt16 nGutterWidth
, sal_uInt16 nAct
)
942 if ( bNew
&& aColumns
.Count() )
943 Calc( nGutterWidth
, nAct
);
946 sal_uInt16
SwFmtCol::CalcColWidth( sal_uInt16 nCol
, sal_uInt16 nAct
) const
948 ASSERT( nCol
< aColumns
.Count(), ":-( ColumnsArr ueberindiziert." );
949 if ( nWidth
!= nAct
)
951 long nW
= aColumns
[nCol
]->GetWishWidth();
954 return sal_uInt16(nW
);
957 return aColumns
[nCol
]->GetWishWidth();
960 sal_uInt16
SwFmtCol::CalcPrtColWidth( sal_uInt16 nCol
, sal_uInt16 nAct
) const
962 ASSERT( nCol
< aColumns
.Count(), ":-( ColumnsArr ueberindiziert." );
963 sal_uInt16 nRet
= CalcColWidth( nCol
, nAct
);
964 SwColumn
*pCol
= aColumns
[nCol
];
965 nRet
= nRet
- pCol
->GetLeft();
966 nRet
= nRet
- pCol
->GetRight();
970 void SwFmtCol::Calc( sal_uInt16 nGutterWidth
, sal_uInt16 nAct
)
974 //Erstmal die Spalten mit der Aktuellen Breite einstellen, dann die
975 //Wunschbreite der Spalten anhand der Gesamtwunschbreite hochrechnen.
977 const sal_uInt16 nGutterHalf
= nGutterWidth
? nGutterWidth
/ 2 : 0;
979 //Breite der PrtAreas ist Gesamtbreite - Zwischenraeume / Anzahl
980 const sal_uInt16 nPrtWidth
=
981 (nAct
- ((GetNumCols()-1) * nGutterWidth
)) / GetNumCols();
982 sal_uInt16 nAvail
= nAct
;
984 //Die erste Spalte ist PrtBreite + (Zwischenraumbreite/2)
985 const sal_uInt16 nLeftWidth
= nPrtWidth
+ nGutterHalf
;
986 SwColumn
*pCol
= aColumns
[0];
987 pCol
->SetWishWidth( nLeftWidth
);
988 pCol
->SetRight( nGutterHalf
);
990 nAvail
= nAvail
- nLeftWidth
;
992 //Spalte 2 bis n-1 ist PrtBreite + Zwischenraumbreite
993 const sal_uInt16 nMidWidth
= nPrtWidth
+ nGutterWidth
;
996 for ( i
= 1; i
< GetNumCols()-1; ++i
)
999 pCol
->SetWishWidth( nMidWidth
);
1000 pCol
->SetLeft ( nGutterHalf
);
1001 pCol
->SetRight( nGutterHalf
);
1002 nAvail
= nAvail
- nMidWidth
;
1005 //Die Letzte Spalte entspricht wieder der ersten, um Rundungsfehler
1006 //auszugleichen wird der letzten Spalte alles zugeschlagen was die
1007 //anderen nicht verbraucht haben.
1008 pCol
= aColumns
[aColumns
.Count()-1];
1009 pCol
->SetWishWidth( nAvail
);
1010 pCol
->SetLeft ( nGutterHalf
);
1011 pCol
->SetRight( 0 );
1013 //Umrechnen der aktuellen Breiten in Wunschbreiten.
1014 for ( i
= 0; i
< aColumns
.Count(); ++i
)
1017 long nTmp
= pCol
->GetWishWidth();
1018 nTmp
*= GetWishWidth();
1020 pCol
->SetWishWidth( sal_uInt16(nTmp
) );
1024 BOOL
SwFmtCol::QueryValue( uno::Any
& rVal
, BYTE nMemberId
) const
1026 // hier wird immer konvertiert!
1027 nMemberId
&= ~CONVERT_TWIPS
;
1028 if(MID_COLUMN_SEPARATOR_LINE
== nMemberId
)
1030 DBG_ERROR("not implemented");
1034 uno::Reference
< text::XTextColumns
> xCols
= new SwXTextColumns(*this);
1035 rVal
.setValue(&xCols
, ::getCppuType((uno::Reference
< text::XTextColumns
>*)0));
1040 BOOL
SwFmtCol::PutValue( const uno::Any
& rVal
, BYTE nMemberId
)
1042 // hier wird immer konvertiert!
1043 nMemberId
&= ~CONVERT_TWIPS
;
1044 sal_Bool bRet
= sal_False
;
1045 if(MID_COLUMN_SEPARATOR_LINE
== nMemberId
)
1047 DBG_ERROR("not implemented");
1051 uno::Reference
< text::XTextColumns
> xCols
;
1055 uno::Sequence
<text::TextColumn
> aSetColumns
= xCols
->getColumns();
1056 const text::TextColumn
* pArray
= aSetColumns
.getConstArray();
1057 aColumns
.DeleteAndDestroy(0, aColumns
.Count());
1058 //max. Count ist hier 64K - das kann das Array aber nicht
1059 sal_uInt16 nCount
= Min( (sal_uInt16
)aSetColumns
.getLength(),
1060 (sal_uInt16
) 0x3fff );
1061 sal_uInt16 nWidthSum
= 0;
1062 // #101224# one column is no column
1065 for(sal_uInt16 i
= 0; i
< nCount
; i
++)
1067 SwColumn
* pCol
= new SwColumn
;
1068 pCol
->SetWishWidth( static_cast<USHORT
>(pArray
[i
].Width
) );
1069 nWidthSum
= static_cast<USHORT
>(nWidthSum
+ pArray
[i
].Width
);
1070 pCol
->SetLeft ( static_cast<USHORT
>(MM100_TO_TWIP(pArray
[i
].LeftMargin
)) );
1071 pCol
->SetRight( static_cast<USHORT
>(MM100_TO_TWIP(pArray
[i
].RightMargin
)) );
1072 aColumns
.Insert(pCol
, i
);
1078 uno::Reference
<lang::XUnoTunnel
> xNumTunnel(xCols
, uno::UNO_QUERY
);
1079 SwXTextColumns
* pSwColums
= 0;
1082 pSwColums
= reinterpret_cast< SwXTextColumns
* >(
1083 sal::static_int_cast
< sal_IntPtr
>(
1084 xNumTunnel
->getSomething( SwXTextColumns::getUnoTunnelId() )));
1088 bOrtho
= pSwColums
->IsAutomaticWidth();
1089 nLineWidth
= pSwColums
->GetSepLineWidth();
1090 aLineColor
.SetColor(pSwColums
->GetSepLineColor());
1091 nLineHeight
= pSwColums
->GetSepLineHeightRelative();
1092 if(!pSwColums
->GetSepLineIsOn())
1094 else switch(pSwColums
->GetSepLineVertAlign())
1096 case 0: eAdj
= COLADJ_TOP
; break; //VerticalAlignment_TOP
1097 case 1: eAdj
= COLADJ_CENTER
;break; //VerticalAlignment_MIDDLE
1098 case 2: eAdj
= COLADJ_BOTTOM
;break; //VerticalAlignment_BOTTOM
1099 default: ASSERT( !this, "unknown alignment" ); break;
1108 // class SwFmtSurround
1109 // Implementierung teilweise inline im hxx
1111 SwFmtSurround::SwFmtSurround( SwSurround eFly
) :
1112 SfxEnumItem( RES_SURROUND
, sal_uInt16( eFly
) )
1114 bAnchorOnly
= bContour
= bOutside
= sal_False
;
1117 SwFmtSurround::SwFmtSurround( const SwFmtSurround
&rCpy
) :
1118 SfxEnumItem( RES_SURROUND
, rCpy
.GetValue() )
1120 bAnchorOnly
= rCpy
.bAnchorOnly
;
1121 bContour
= rCpy
.bContour
;
1122 bOutside
= rCpy
.bOutside
;
1125 int SwFmtSurround::operator==( const SfxPoolItem
& rAttr
) const
1127 ASSERT( SfxPoolItem::operator==( rAttr
), "keine gleichen Attribute" );
1128 return ( GetValue() == ((SwFmtSurround
&)rAttr
).GetValue() &&
1129 bAnchorOnly
== ((SwFmtSurround
&)rAttr
).bAnchorOnly
&&
1130 bContour
== ((SwFmtSurround
&)rAttr
).bContour
&&
1131 bOutside
== ((SwFmtSurround
&)rAttr
).bOutside
);
1134 SfxPoolItem
* SwFmtSurround::Clone( SfxItemPool
* ) const
1136 return new SwFmtSurround( *this );
1139 sal_uInt16
SwFmtSurround::GetValueCount() const
1141 return SURROUND_END
- SURROUND_BEGIN
;
1145 BOOL
SwFmtSurround::QueryValue( uno::Any
& rVal
, BYTE nMemberId
) const
1147 // hier wird immer konvertiert!
1148 nMemberId
&= ~CONVERT_TWIPS
;
1149 sal_Bool bRet
= sal_True
;
1150 switch ( nMemberId
)
1152 case MID_SURROUND_SURROUNDTYPE
:
1153 rVal
<<= (text::WrapTextMode
)GetSurround();
1155 case MID_SURROUND_ANCHORONLY
:
1157 BOOL bTmp
= IsAnchorOnly();
1158 rVal
.setValue(&bTmp
, ::getBooleanCppuType());
1161 case MID_SURROUND_CONTOUR
:
1163 BOOL bTmp
= IsContour();
1164 rVal
.setValue(&bTmp
, ::getBooleanCppuType());
1167 case MID_SURROUND_CONTOUROUTSIDE
:
1169 BOOL bTmp
= IsOutside();
1170 rVal
.setValue(&bTmp
, ::getBooleanCppuType());
1174 ASSERT( !this, "unknown MemberId" );
1180 BOOL
SwFmtSurround::PutValue( const uno::Any
& rVal
, BYTE nMemberId
)
1182 // hier wird immer konvertiert!
1183 nMemberId
&= ~CONVERT_TWIPS
;
1184 sal_Bool bRet
= sal_True
;
1185 switch ( nMemberId
)
1187 case MID_SURROUND_SURROUNDTYPE
:
1189 sal_Int32 eVal
= SWUnoHelper::GetEnumAsInt32( rVal
);
1190 if( eVal
>= 0 && eVal
< (sal_Int16
)SURROUND_END
)
1191 SetValue( static_cast<USHORT
>(eVal
) );
1199 case MID_SURROUND_ANCHORONLY
:
1200 SetAnchorOnly( *(sal_Bool
*)rVal
.getValue() );
1202 case MID_SURROUND_CONTOUR
:
1203 SetContour( *(sal_Bool
*)rVal
.getValue() );
1205 case MID_SURROUND_CONTOUROUTSIDE
:
1206 SetOutside( *(sal_Bool
*)rVal
.getValue() );
1209 ASSERT( !this, "unknown MemberId" );
1215 // class SwFmtVertOrient
1216 // Implementierung teilweise inline im hxx
1218 SwFmtVertOrient::SwFmtVertOrient( SwTwips nY
, sal_Int16 eVert
,
1220 : SfxPoolItem( RES_VERT_ORIENT
),
1226 int SwFmtVertOrient::operator==( const SfxPoolItem
& rAttr
) const
1228 ASSERT( SfxPoolItem::operator==( rAttr
), "keine gleichen Attribute" );
1229 return ( nYPos
== ((SwFmtVertOrient
&)rAttr
).nYPos
&&
1230 eOrient
== ((SwFmtVertOrient
&)rAttr
).eOrient
&&
1231 eRelation
== ((SwFmtVertOrient
&)rAttr
).eRelation
);
1234 SfxPoolItem
* SwFmtVertOrient::Clone( SfxItemPool
* ) const
1236 return new SwFmtVertOrient( nYPos
, eOrient
, eRelation
);
1239 BOOL
SwFmtVertOrient::QueryValue( uno::Any
& rVal
, BYTE nMemberId
) const
1241 // hier wird immer konvertiert!
1242 nMemberId
&= ~CONVERT_TWIPS
;
1243 sal_Bool bRet
= sal_True
;
1244 switch ( nMemberId
)
1246 case MID_VERTORIENT_ORIENT
:
1248 sal_Int16 nRet
= text::VertOrientation::NONE
;
1251 case text::VertOrientation::TOP
: nRet
= text::VertOrientation::TOP
;break;
1252 case text::VertOrientation::CENTER
: nRet
= text::VertOrientation::CENTER
;break;
1253 case text::VertOrientation::BOTTOM
: nRet
= text::VertOrientation::BOTTOM
;break;
1254 case text::VertOrientation::CHAR_TOP
: nRet
= text::VertOrientation::CHAR_TOP
;break;
1255 case text::VertOrientation::CHAR_CENTER
: nRet
= text::VertOrientation::CHAR_CENTER
;break;
1256 case text::VertOrientation::CHAR_BOTTOM
: nRet
= text::VertOrientation::CHAR_BOTTOM
;break;
1257 case text::VertOrientation::LINE_TOP
: nRet
= text::VertOrientation::LINE_TOP
;break;
1258 case text::VertOrientation::LINE_CENTER
: nRet
= text::VertOrientation::LINE_CENTER
;break;
1259 case text::VertOrientation::LINE_BOTTOM
: nRet
= text::VertOrientation::LINE_BOTTOM
;break;
1265 case MID_VERTORIENT_RELATION
:
1266 rVal
<<= lcl_RelToINT(eRelation
);
1268 case MID_VERTORIENT_POSITION
:
1269 rVal
<<= (sal_Int32
)TWIP_TO_MM100(GetPos());
1272 ASSERT( !this, "unknown MemberId" );
1278 BOOL
SwFmtVertOrient::PutValue( const uno::Any
& rVal
, BYTE nMemberId
)
1280 sal_Bool bConvert
= 0 != (nMemberId
&CONVERT_TWIPS
);
1281 nMemberId
&= ~CONVERT_TWIPS
;
1282 sal_Bool bRet
= sal_True
;
1283 switch ( nMemberId
)
1285 case MID_VERTORIENT_ORIENT
:
1287 sal_uInt16 nVal
= 0;
1291 case text::VertOrientation::NONE
: eOrient
= text::VertOrientation::NONE
; break;
1292 case text::VertOrientation::TOP
: eOrient
= text::VertOrientation::TOP
; break;
1293 case text::VertOrientation::CENTER
: eOrient
= text::VertOrientation::CENTER
; break;
1294 case text::VertOrientation::BOTTOM
: eOrient
= text::VertOrientation::BOTTOM
; break;
1295 case text::VertOrientation::CHAR_TOP
: eOrient
= text::VertOrientation::CHAR_TOP
; break;
1296 case text::VertOrientation::CHAR_CENTER
: eOrient
= text::VertOrientation::CHAR_CENTER
;break;
1297 case text::VertOrientation::CHAR_BOTTOM
: eOrient
= text::VertOrientation::CHAR_BOTTOM
;break;
1298 case text::VertOrientation::LINE_TOP
: eOrient
= text::VertOrientation::LINE_TOP
; break;
1299 case text::VertOrientation::LINE_CENTER
: eOrient
= text::VertOrientation::LINE_CENTER
;break;
1300 case text::VertOrientation::LINE_BOTTOM
: eOrient
= text::VertOrientation::LINE_BOTTOM
;break;
1304 case MID_VERTORIENT_RELATION
:
1306 eRelation
= lcl_IntToRelation(rVal
);
1309 case MID_VERTORIENT_POSITION
:
1314 nVal
= MM100_TO_TWIP(nVal
);
1319 ASSERT( !this, "unknown MemberId" );
1327 // class SwFmtHoriOrient
1328 // Implementierung teilweise inline im hxx
1330 SwFmtHoriOrient::SwFmtHoriOrient( SwTwips nX
, sal_Int16 eHori
,
1331 sal_Int16 eRel
, sal_Bool bPos
)
1332 : SfxPoolItem( RES_HORI_ORIENT
),
1339 int SwFmtHoriOrient::operator==( const SfxPoolItem
& rAttr
) const
1341 ASSERT( SfxPoolItem::operator==( rAttr
), "keine gleichen Attribute" );
1342 return ( nXPos
== ((SwFmtHoriOrient
&)rAttr
).nXPos
&&
1343 eOrient
== ((SwFmtHoriOrient
&)rAttr
).eOrient
&&
1344 eRelation
== ((SwFmtHoriOrient
&)rAttr
).eRelation
&&
1345 bPosToggle
== ((SwFmtHoriOrient
&)rAttr
).bPosToggle
);
1348 SfxPoolItem
* SwFmtHoriOrient::Clone( SfxItemPool
* ) const
1350 return new SwFmtHoriOrient( nXPos
, eOrient
, eRelation
, bPosToggle
);
1353 BOOL
SwFmtHoriOrient::QueryValue( uno::Any
& rVal
, BYTE nMemberId
) const
1355 // hier wird immer konvertiert!
1356 nMemberId
&= ~CONVERT_TWIPS
;
1357 sal_Bool bRet
= sal_True
;
1358 switch ( nMemberId
)
1360 case MID_HORIORIENT_ORIENT
:
1362 sal_Int16 nRet
= text::HoriOrientation::NONE
;
1365 case text::HoriOrientation::RIGHT
: nRet
= text::HoriOrientation::RIGHT
; break;
1366 case text::HoriOrientation::CENTER
: nRet
= text::HoriOrientation::CENTER
; break;
1367 case text::HoriOrientation::LEFT
: nRet
= text::HoriOrientation::LEFT
; break;
1368 case text::HoriOrientation::INSIDE
: nRet
= text::HoriOrientation::INSIDE
; break;
1369 case text::HoriOrientation::OUTSIDE
: nRet
= text::HoriOrientation::OUTSIDE
; break;
1370 case text::HoriOrientation::FULL
: nRet
= text::HoriOrientation::FULL
; break;
1371 case text::HoriOrientation::LEFT_AND_WIDTH
:
1372 nRet
= text::HoriOrientation::LEFT_AND_WIDTH
;
1381 case MID_HORIORIENT_RELATION
:
1382 rVal
<<= lcl_RelToINT(eRelation
);
1384 case MID_HORIORIENT_POSITION
:
1385 rVal
<<= (sal_Int32
)TWIP_TO_MM100(GetPos());
1387 case MID_HORIORIENT_PAGETOGGLE
:
1389 BOOL bTmp
= IsPosToggle();
1390 rVal
.setValue(&bTmp
, ::getBooleanCppuType());
1394 ASSERT( !this, "unknown MemberId" );
1400 BOOL
SwFmtHoriOrient::PutValue( const uno::Any
& rVal
, BYTE nMemberId
)
1402 sal_Bool bConvert
= 0 != (nMemberId
&CONVERT_TWIPS
);
1403 nMemberId
&= ~CONVERT_TWIPS
;
1404 sal_Bool bRet
= sal_True
;
1405 switch ( nMemberId
)
1407 case MID_HORIORIENT_ORIENT
:
1413 case text::HoriOrientation::NONE
: eOrient
= text::HoriOrientation::NONE
; break;
1414 case text::HoriOrientation::RIGHT
: eOrient
= text::HoriOrientation::RIGHT
; break;
1415 case text::HoriOrientation::CENTER
: eOrient
= text::HoriOrientation::CENTER
; break;
1416 case text::HoriOrientation::LEFT
: eOrient
= text::HoriOrientation::LEFT
; break;
1417 case text::HoriOrientation::INSIDE
: eOrient
= text::HoriOrientation::INSIDE
; break;
1418 case text::HoriOrientation::OUTSIDE
: eOrient
= text::HoriOrientation::OUTSIDE
; break;
1419 case text::HoriOrientation::FULL
: eOrient
= text::HoriOrientation::FULL
; break;
1420 case text::HoriOrientation::LEFT_AND_WIDTH
:
1421 eOrient
= text::HoriOrientation::LEFT_AND_WIDTH
;
1426 case MID_HORIORIENT_RELATION
:
1428 eRelation
= lcl_IntToRelation(rVal
);
1431 case MID_HORIORIENT_POSITION
:
1434 if(!(rVal
>>= nVal
))
1437 nVal
= MM100_TO_TWIP(nVal
);
1441 case MID_HORIORIENT_PAGETOGGLE
:
1442 SetPosToggle( *(sal_Bool
*)rVal
.getValue());
1445 ASSERT( !this, "unknown MemberId" );
1453 // class SwFmtAnchor
1454 // Implementierung teilweise inline im hxx
1456 SwFmtAnchor::SwFmtAnchor( RndStdIds nRnd
, sal_uInt16 nPage
)
1457 : SfxPoolItem( RES_ANCHOR
),
1461 // OD 2004-05-05 #i28701# - get always new increased order number
1462 mnOrder( ++mnOrderCounter
)
1465 SwFmtAnchor::SwFmtAnchor( const SwFmtAnchor
&rCpy
)
1466 : SfxPoolItem( RES_ANCHOR
),
1467 nAnchorId( rCpy
.GetAnchorId() ),
1468 nPageNum( rCpy
.GetPageNum() ),
1469 // OD 2004-05-05 #i28701# - get always new increased order number
1470 mnOrder( ++mnOrderCounter
)
1472 pCntntAnchor
= rCpy
.GetCntntAnchor() ?
1473 new SwPosition( *rCpy
.GetCntntAnchor() ) : 0;
1476 SwFmtAnchor::~SwFmtAnchor()
1478 delete pCntntAnchor
;
1481 void SwFmtAnchor::SetAnchor( const SwPosition
*pPos
)
1484 delete pCntntAnchor
;
1485 pCntntAnchor
= pPos
? new SwPosition( *pPos
) : 0;
1486 //AM Absatz gebundene Flys sollten nie in den Absatz hineinzeigen.
1487 if ( pCntntAnchor
&& ( FLY_AT_CNTNT
== nAnchorId
||
1488 FLY_AT_FLY
== nAnchorId
))
1489 pCntntAnchor
->nContent
.Assign( 0, 0 );
1492 SwFmtAnchor
& SwFmtAnchor::operator=(const SwFmtAnchor
& rAnchor
)
1494 nAnchorId
= rAnchor
.GetAnchorId();
1495 nPageNum
= rAnchor
.GetPageNum();
1496 // OD 2004-05-05 #i28701# - get always new increased order number
1497 mnOrder
= ++mnOrderCounter
;
1499 delete pCntntAnchor
;
1500 pCntntAnchor
= rAnchor
.pCntntAnchor
?
1501 new SwPosition(*(rAnchor
.pCntntAnchor
)) : 0;
1505 int SwFmtAnchor::operator==( const SfxPoolItem
& rAttr
) const
1507 ASSERT( SfxPoolItem::operator==( rAttr
), "keine gleichen Attribute" );
1508 // OD 2004-05-05 #i28701# - Note: <mnOrder> hasn't to be considered.
1509 return ( nAnchorId
== ((SwFmtAnchor
&)rAttr
).GetAnchorId() &&
1510 nPageNum
== ((SwFmtAnchor
&)rAttr
).GetPageNum() &&
1511 //Anker vergleichen. Entweder zeigen beide auf das gleiche
1512 //Attribut bzw. sind 0 oder die SwPosition* sind beide
1513 //gueltig und die SwPositions sind gleich.
1514 (pCntntAnchor
== ((SwFmtAnchor
&)rAttr
).GetCntntAnchor() ||
1515 (pCntntAnchor
&& ((SwFmtAnchor
&)rAttr
).GetCntntAnchor() &&
1516 *pCntntAnchor
== *((SwFmtAnchor
&)rAttr
).GetCntntAnchor())));
1519 SfxPoolItem
* SwFmtAnchor::Clone( SfxItemPool
* ) const
1521 return new SwFmtAnchor( *this );
1524 // OD 2004-05-05 #i28701#
1525 sal_uInt32
SwFmtAnchor::mnOrderCounter
= 0;
1527 // OD 2004-05-05 #i28701#
1528 sal_uInt32
SwFmtAnchor::GetOrder() const
1533 /*-----------------16.02.98 15:21-------------------
1535 --------------------------------------------------*/
1536 BOOL
SwFmtAnchor::QueryValue( uno::Any
& rVal
, BYTE nMemberId
) const
1538 // hier wird immer konvertiert!
1539 nMemberId
&= ~CONVERT_TWIPS
;
1540 sal_Bool bRet
= sal_True
;
1541 switch ( nMemberId
)
1543 case MID_ANCHOR_ANCHORTYPE
:
1545 text::TextContentAnchorType eRet
;
1546 switch((sal_Int16
)GetAnchorId())
1548 case FLY_AUTO_CNTNT
: eRet
= text::TextContentAnchorType_AT_CHARACTER
;break;
1549 case FLY_PAGE
: eRet
= text::TextContentAnchorType_AT_PAGE
; break;
1550 case FLY_AT_FLY
: eRet
= text::TextContentAnchorType_AT_FRAME
; break;
1551 case FLY_IN_CNTNT
: eRet
= text::TextContentAnchorType_AS_CHARACTER
;break;
1552 //case FLY_AT_CNTNT :
1553 default: eRet
= text::TextContentAnchorType_AT_PARAGRAPH
;
1557 case MID_ANCHOR_PAGENUM
:
1558 rVal
<<= (sal_Int16
)GetPageNum();
1560 case MID_ANCHOR_ANCHORFRAME
:
1562 if(pCntntAnchor
&& FLY_AT_FLY
== nAnchorId
)
1564 SwFrmFmt
* pFmt
= pCntntAnchor
->nNode
.GetNode().GetFlyFmt();
1567 uno::Reference
<container::XNamed
> xNamed
= SwXFrames::GetObject( *pFmt
, FLYCNTTYPE_FRM
);
1568 uno::Reference
<text::XTextFrame
> xRet(xNamed
, uno::UNO_QUERY
);
1575 ASSERT( !this, "unknown MemberId" );
1581 BOOL
SwFmtAnchor::PutValue( const uno::Any
& rVal
, BYTE nMemberId
)
1583 // hier wird immer konvertiert!
1584 nMemberId
&= ~CONVERT_TWIPS
;
1585 sal_Bool bRet
= sal_True
;
1586 switch ( nMemberId
)
1588 case MID_ANCHOR_ANCHORTYPE
:
1591 switch( SWUnoHelper::GetEnumAsInt32( rVal
) )
1593 case text::TextContentAnchorType_AS_CHARACTER
:
1594 eAnchor
= FLY_IN_CNTNT
;
1596 case text::TextContentAnchorType_AT_PAGE
:
1598 if( GetPageNum() > 0 && pCntntAnchor
)
1600 // If the anchor type is page and a valid page number
1601 // has been set, the content position isn't required
1603 delete pCntntAnchor
;
1607 case text::TextContentAnchorType_AT_FRAME
:
1608 eAnchor
= FLY_AT_FLY
;
1610 case text::TextContentAnchorType_AT_CHARACTER
:
1611 eAnchor
= FLY_AUTO_CNTNT
;
1613 //case text::TextContentAnchorType_AT_PARAGRAPH:
1615 eAnchor
= FLY_AT_CNTNT
;
1621 case MID_ANCHOR_PAGENUM
:
1624 if((rVal
>>= nVal
) && nVal
> 0)
1627 if( FLY_PAGE
== GetAnchorId() && pCntntAnchor
)
1629 // If the anchor type is page and a valid page number
1630 // is set, the content paoition has to be deleted to not
1631 // confuse the layout (frmtool.cxx). However, if the
1632 // anchor type is not page, any content position will
1634 delete pCntntAnchor
;
1642 case MID_ANCHOR_ANCHORFRAME
:
1645 ASSERT( !this, "unknown MemberId" );
1652 // Implementierung teilweise inline im hxx
1654 SwFmtURL::SwFmtURL() :
1655 SfxPoolItem( RES_URL
),
1657 bIsServerMap( sal_False
)
1661 SwFmtURL::SwFmtURL( const SwFmtURL
&rURL
) :
1662 SfxPoolItem( RES_URL
),
1663 sTargetFrameName( rURL
.GetTargetFrameName() ),
1664 sURL( rURL
.GetURL() ),
1665 sName( rURL
.GetName() ),
1666 bIsServerMap( rURL
.IsServerMap() )
1668 pMap
= rURL
.GetMap() ? new ImageMap( *rURL
.GetMap() ) : 0;
1671 SwFmtURL::~SwFmtURL()
1677 int SwFmtURL::operator==( const SfxPoolItem
&rAttr
) const
1679 ASSERT( SfxPoolItem::operator==( rAttr
), "keine gleichen Attribute" );
1680 const SwFmtURL
&rCmp
= (SwFmtURL
&)rAttr
;
1681 sal_Bool bRet
= bIsServerMap
== rCmp
.IsServerMap() &&
1682 sURL
== rCmp
.GetURL() &&
1683 sTargetFrameName
== rCmp
.GetTargetFrameName() &&
1684 sName
== rCmp
.GetName();
1687 if ( pMap
&& rCmp
.GetMap() )
1688 bRet
= *pMap
== *rCmp
.GetMap();
1690 bRet
= pMap
== rCmp
.GetMap();
1695 SfxPoolItem
* SwFmtURL::Clone( SfxItemPool
* ) const
1697 return new SwFmtURL( *this );
1700 void SwFmtURL::SetURL( const XubString
&rURL
, sal_Bool bServerMap
)
1703 bIsServerMap
= bServerMap
;
1706 void SwFmtURL::SetMap( const ImageMap
*pM
)
1710 pMap
= pM
? new ImageMap( *pM
) : 0;
1712 extern const SvEventDescription
* lcl_GetSupportedMacroItems();
1714 BOOL
SwFmtURL::QueryValue( uno::Any
& rVal
, BYTE nMemberId
) const
1716 // hier wird immer konvertiert!
1717 nMemberId
&= ~CONVERT_TWIPS
;
1718 sal_Bool bRet
= sal_True
;
1719 switch ( nMemberId
)
1723 OUString sRet
= GetURL();
1727 case MID_URL_TARGET
:
1729 OUString sRet
= GetTargetFrameName();
1733 case MID_URL_HYPERLINKNAME
:
1734 rVal
<<= OUString( GetName() );
1736 case MID_URL_CLIENTMAP
:
1738 uno::Reference
< uno::XInterface
> xInt
;
1741 xInt
= SvUnoImageMap_createInstance( *pMap
, lcl_GetSupportedMacroItems() );
1746 xInt
= SvUnoImageMap_createInstance( aEmptyMap
, lcl_GetSupportedMacroItems() );
1748 uno::Reference
< container::XIndexContainer
> xCont(xInt
, uno::UNO_QUERY
);
1752 case MID_URL_SERVERMAP
:
1754 BOOL bTmp
= IsServerMap();
1755 rVal
.setValue(&bTmp
, ::getBooleanCppuType());
1759 ASSERT( !this, "unknown MemberId" );
1765 BOOL
SwFmtURL::PutValue( const uno::Any
& rVal
, BYTE nMemberId
)
1767 // hier wird immer konvertiert!
1768 nMemberId
&= ~CONVERT_TWIPS
;
1769 sal_Bool bRet
= sal_True
;
1770 switch ( nMemberId
)
1776 SetURL( sTmp
, bIsServerMap
);
1779 case MID_URL_TARGET
:
1783 SetTargetFrameName( sTmp
);
1786 case MID_URL_HYPERLINKNAME
:
1793 case MID_URL_CLIENTMAP
:
1795 uno::Reference
<container::XIndexContainer
> xCont
;
1796 if(!rVal
.hasValue())
1798 else if(rVal
>>= xCont
)
1801 pMap
= new ImageMap
;
1802 bRet
= SvUnoImageMap_fillImageMap( xCont
, *pMap
);
1808 case MID_URL_SERVERMAP
:
1809 bIsServerMap
= *(sal_Bool
*)rVal
.getValue();
1812 ASSERT( !this, "unknown MemberId" );
1819 // class SwNoReadOnly
1821 SfxPoolItem
* SwFmtEditInReadonly::Clone( SfxItemPool
* ) const
1823 return new SwFmtEditInReadonly( Which(), GetValue() );
1826 // class SwFmtLayoutSplit
1828 SfxPoolItem
* SwFmtLayoutSplit::Clone( SfxItemPool
* ) const
1830 return new SwFmtLayoutSplit( GetValue() );
1833 // class SwFmtRowSplit
1835 SfxPoolItem
* SwFmtRowSplit::Clone( SfxItemPool
* ) const
1837 return new SwFmtRowSplit( GetValue() );
1841 // class SwFmtNoBalancedColumns
1843 SfxPoolItem
* SwFmtNoBalancedColumns::Clone( SfxItemPool
* ) const
1845 return new SwFmtNoBalancedColumns( GetValue() );
1848 // class SwFmtFtnEndAtTxtEnd
1850 sal_uInt16
SwFmtFtnEndAtTxtEnd::GetValueCount() const
1852 return sal_uInt16( FTNEND_ATTXTEND_END
);
1855 SwFmtFtnEndAtTxtEnd
& SwFmtFtnEndAtTxtEnd::operator=(
1856 const SwFmtFtnEndAtTxtEnd
& rAttr
)
1858 SfxEnumItem::SetValue( rAttr
.GetValue() );
1860 nOffset
= rAttr
.nOffset
;
1861 sPrefix
= rAttr
.sPrefix
;
1862 sSuffix
= rAttr
.sSuffix
;
1866 int SwFmtFtnEndAtTxtEnd::operator==( const SfxPoolItem
& rItem
) const
1868 const SwFmtFtnEndAtTxtEnd
& rAttr
= (SwFmtFtnEndAtTxtEnd
&)rItem
;
1869 return SfxEnumItem::operator==( rAttr
) &&
1870 aFmt
.GetNumberingType() == rAttr
.aFmt
.GetNumberingType() &&
1871 nOffset
== rAttr
.nOffset
&&
1872 sPrefix
== rAttr
.sPrefix
&&
1873 sSuffix
== rAttr
.sSuffix
;
1876 BOOL
SwFmtFtnEndAtTxtEnd::QueryValue( uno::Any
& rVal
, BYTE nMemberId
) const
1878 nMemberId
&= ~CONVERT_TWIPS
;
1883 sal_Bool bVal
= GetValue() >= FTNEND_ATTXTEND
;
1884 rVal
.setValue(&bVal
, ::getBooleanCppuType());
1887 case MID_RESTART_NUM
:
1889 sal_Bool bVal
= GetValue() >= FTNEND_ATTXTEND_OWNNUMSEQ
;
1890 rVal
.setValue(&bVal
, ::getBooleanCppuType());
1893 case MID_NUM_START_AT
: rVal
<<= (sal_Int16
) nOffset
; break;
1896 sal_Bool bVal
= GetValue() >= FTNEND_ATTXTEND_OWNNUMANDFMT
;
1897 rVal
.setValue(&bVal
, ::getBooleanCppuType());
1900 case MID_NUM_TYPE
: rVal
<<= aFmt
.GetNumberingType(); break;
1901 case MID_PREFIX
: rVal
<<= OUString(sPrefix
); break;
1902 case MID_SUFFIX
: rVal
<<= OUString(sSuffix
); break;
1903 default: return FALSE
;
1908 BOOL
SwFmtFtnEndAtTxtEnd::PutValue( const uno::Any
& rVal
, BYTE nMemberId
)
1911 nMemberId
&= ~CONVERT_TWIPS
;
1916 sal_Bool bVal
= *(sal_Bool
*)rVal
.getValue();
1917 if(!bVal
&& GetValue() >= FTNEND_ATTXTEND
)
1918 SetValue(FTNEND_ATPGORDOCEND
);
1919 else if(bVal
&& GetValue() < FTNEND_ATTXTEND
)
1920 SetValue(FTNEND_ATTXTEND
);
1923 case MID_RESTART_NUM
:
1925 sal_Bool bVal
= *(sal_Bool
*)rVal
.getValue();
1926 if(!bVal
&& GetValue() >= FTNEND_ATTXTEND_OWNNUMSEQ
)
1927 SetValue(FTNEND_ATTXTEND
);
1928 else if(bVal
&& GetValue() < FTNEND_ATTXTEND_OWNNUMSEQ
)
1929 SetValue(FTNEND_ATTXTEND_OWNNUMSEQ
);
1932 case MID_NUM_START_AT
:
1944 sal_Bool bVal
= *(sal_Bool
*)rVal
.getValue();
1945 if(!bVal
&& GetValue() >= FTNEND_ATTXTEND_OWNNUMANDFMT
)
1946 SetValue(FTNEND_ATTXTEND_OWNNUMSEQ
);
1947 else if(bVal
&& GetValue() < FTNEND_ATTXTEND_OWNNUMANDFMT
)
1948 SetValue(FTNEND_ATTXTEND_OWNNUMANDFMT
);
1956 (nVal
<= SVX_NUM_ARABIC
||
1957 SVX_NUM_CHARS_UPPER_LETTER_N
== nVal
||
1958 SVX_NUM_CHARS_LOWER_LETTER_N
== nVal
))
1959 aFmt
.SetNumberingType(nVal
);
1966 OUString sVal
; rVal
>>= sVal
;
1972 OUString sVal
; rVal
>>= sVal
;
1976 default: bRet
= FALSE
;
1982 // class SwFmtFtnAtTxtEnd
1984 SfxPoolItem
* SwFmtFtnAtTxtEnd::Clone( SfxItemPool
* ) const
1986 SwFmtFtnAtTxtEnd
* pNew
= new SwFmtFtnAtTxtEnd
;
1991 // class SwFmtEndAtTxtEnd
1993 SfxPoolItem
* SwFmtEndAtTxtEnd::Clone( SfxItemPool
* ) const
1995 SwFmtEndAtTxtEnd
* pNew
= new SwFmtEndAtTxtEnd
;
2003 int SwFmtChain::operator==( const SfxPoolItem
&rAttr
) const
2005 ASSERT( SfxPoolItem::operator==( rAttr
), "keine gleichen Attribute" );
2007 return GetPrev() == ((SwFmtChain
&)rAttr
).GetPrev() &&
2008 GetNext() == ((SwFmtChain
&)rAttr
).GetNext();
2011 SwFmtChain::SwFmtChain( const SwFmtChain
&rCpy
) :
2012 SfxPoolItem( RES_CHAIN
)
2014 SetPrev( rCpy
.GetPrev() );
2015 SetNext( rCpy
.GetNext() );
2018 SfxPoolItem
* SwFmtChain::Clone( SfxItemPool
* ) const
2020 SwFmtChain
*pRet
= new SwFmtChain
;
2021 pRet
->SetPrev( GetPrev() );
2022 pRet
->SetNext( GetNext() );
2026 void SwFmtChain::SetPrev( SwFlyFrmFmt
*pFmt
)
2029 pFmt
->Add( &aPrev
);
2030 else if ( aPrev
.GetRegisteredIn() )
2031 ((SwModify
*)aPrev
.GetRegisteredIn())->Remove( &aPrev
);
2034 void SwFmtChain::SetNext( SwFlyFrmFmt
*pFmt
)
2037 pFmt
->Add( &aNext
);
2038 else if ( aNext
.GetRegisteredIn() )
2039 ((SwModify
*)aNext
.GetRegisteredIn())->Remove( &aNext
);
2042 BOOL
SwFmtChain::QueryValue( uno::Any
& rVal
, BYTE nMemberId
) const
2044 // hier wird immer konvertiert!
2045 nMemberId
&= ~CONVERT_TWIPS
;
2046 sal_Bool bRet
= sal_True
;
2048 switch ( nMemberId
)
2050 case MID_CHAIN_PREVNAME
:
2052 aRet
= GetPrev()->GetName();
2054 case MID_CHAIN_NEXTNAME
:
2056 aRet
= GetNext()->GetName();
2059 ASSERT( !this, "unknown MemberId" );
2062 rVal
<<= OUString(aRet
);
2069 //class SwFmtLineNumber
2071 SwFmtLineNumber::SwFmtLineNumber() :
2072 SfxPoolItem( RES_LINENUMBER
)
2075 bCountLines
= sal_True
;
2078 SwFmtLineNumber::~SwFmtLineNumber()
2082 int SwFmtLineNumber::operator==( const SfxPoolItem
&rAttr
) const
2084 ASSERT( SfxPoolItem::operator==( rAttr
), "keine gleichen Attribute" );
2086 return nStartValue
== ((SwFmtLineNumber
&)rAttr
).GetStartValue() &&
2087 bCountLines
== ((SwFmtLineNumber
&)rAttr
).IsCount();
2090 SfxPoolItem
* SwFmtLineNumber::Clone( SfxItemPool
* ) const
2092 return new SwFmtLineNumber( *this );
2095 BOOL
SwFmtLineNumber::QueryValue( uno::Any
& rVal
, BYTE nMemberId
) const
2097 // hier wird immer konvertiert!
2098 nMemberId
&= ~CONVERT_TWIPS
;
2099 sal_Bool bRet
= sal_True
;
2100 switch ( nMemberId
)
2102 case MID_LINENUMBER_COUNT
:
2104 BOOL bTmp
= IsCount();
2105 rVal
.setValue(&bTmp
, ::getBooleanCppuType());
2108 case MID_LINENUMBER_STARTVALUE
:
2109 rVal
<<= (sal_Int32
)GetStartValue();
2112 ASSERT( !this, "unknown MemberId" );
2118 BOOL
SwFmtLineNumber::PutValue( const uno::Any
& rVal
, BYTE nMemberId
)
2120 // hier wird immer konvertiert!
2121 nMemberId
&= ~CONVERT_TWIPS
;
2122 sal_Bool bRet
= sal_True
;
2123 switch ( nMemberId
)
2125 case MID_LINENUMBER_COUNT
:
2126 SetCountLines( *(sal_Bool
*)rVal
.getValue() );
2128 case MID_LINENUMBER_STARTVALUE
:
2132 SetStartValue( nVal
);
2138 ASSERT( !this, "unknown MemberId" );
2144 /*************************************************************************
2145 * class SwTextGridItem
2146 *************************************************************************/
2148 SwTextGridItem::SwTextGridItem()
2149 : SfxPoolItem( RES_TEXTGRID
), aColor( COL_LIGHTGRAY
), nLines( 20 ),
2150 nBaseHeight( 400 ), nRubyHeight( 200 ), eGridType( GRID_NONE
),
2151 bRubyTextBelow( 0 ), bPrintGrid( 1 ), bDisplayGrid( 1 ),
2152 nBaseWidth(400), bSnapToChars( 1 ), bSquaredMode(1)
2156 SwTextGridItem::~SwTextGridItem()
2160 int SwTextGridItem::operator==( const SfxPoolItem
& rAttr
) const
2162 ASSERT( SfxPoolItem::operator==( rAttr
), "keine gleichen Attribute" );
2163 return eGridType
== ((SwTextGridItem
&)rAttr
).GetGridType() &&
2164 nLines
== ((SwTextGridItem
&)rAttr
).GetLines() &&
2165 nBaseHeight
== ((SwTextGridItem
&)rAttr
).GetBaseHeight() &&
2166 nRubyHeight
== ((SwTextGridItem
&)rAttr
).GetRubyHeight() &&
2167 bRubyTextBelow
== ((SwTextGridItem
&)rAttr
).GetRubyTextBelow() &&
2168 bDisplayGrid
== ((SwTextGridItem
&)rAttr
).GetDisplayGrid() &&
2169 bPrintGrid
== ((SwTextGridItem
&)rAttr
).GetPrintGrid() &&
2170 aColor
== ((SwTextGridItem
&)rAttr
).GetColor() &&
2171 nBaseWidth
== ((SwTextGridItem
&)rAttr
).GetBaseWidth() &&
2172 bSnapToChars
== ((SwTextGridItem
&)rAttr
).GetSnapToChars() &&
2173 bSquaredMode
== ((SwTextGridItem
&)rAttr
).GetSquaredMode();
2176 SfxPoolItem
* SwTextGridItem::Clone( SfxItemPool
* ) const
2178 return new SwTextGridItem( *this );
2181 SwTextGridItem
& SwTextGridItem::operator=( const SwTextGridItem
& rCpy
)
2183 aColor
= rCpy
.GetColor();
2184 nLines
= rCpy
.GetLines();
2185 nBaseHeight
= rCpy
.GetBaseHeight();
2186 nRubyHeight
= rCpy
.GetRubyHeight();
2187 eGridType
= rCpy
.GetGridType();
2188 bRubyTextBelow
= rCpy
.GetRubyTextBelow();
2189 bPrintGrid
= rCpy
.GetPrintGrid();
2190 bDisplayGrid
= rCpy
.GetDisplayGrid();
2191 nBaseWidth
= rCpy
.GetBaseWidth();
2192 bSnapToChars
= rCpy
.GetSnapToChars();
2193 bSquaredMode
= rCpy
.GetSquaredMode();
2198 BOOL
SwTextGridItem::QueryValue( uno::Any
& rVal
, BYTE nMemberId
) const
2202 switch( nMemberId
& ~CONVERT_TWIPS
)
2204 case MID_GRID_COLOR
:
2205 rVal
<<= GetColor().GetColor();
2207 case MID_GRID_LINES
:
2208 rVal
<<= GetLines();
2210 case MID_GRID_RUBY_BELOW
:
2211 rVal
.setValue( &bRubyTextBelow
, ::getBooleanCppuType() );
2213 case MID_GRID_PRINT
:
2214 rVal
.setValue( &bPrintGrid
, ::getBooleanCppuType() );
2216 case MID_GRID_DISPLAY
:
2217 rVal
.setValue( &bDisplayGrid
, ::getBooleanCppuType() );
2219 case MID_GRID_BASEHEIGHT
:
2220 DBG_ASSERT( (nMemberId
& CONVERT_TWIPS
) != 0,
2221 "This value needs TWIPS-MM100 conversion" );
2222 rVal
<<= (sal_Int32
) TWIP_TO_MM100_UNSIGNED(nBaseHeight
);
2224 case MID_GRID_BASEWIDTH
:
2225 DBG_ASSERT( (nMemberId
& CONVERT_TWIPS
) != 0,
2226 "This value needs TWIPS-MM100 conversion" );
2227 rVal
<<= (sal_Int32
) TWIP_TO_MM100_UNSIGNED(nBaseWidth
);
2229 case MID_GRID_RUBYHEIGHT
:
2230 DBG_ASSERT( (nMemberId
& CONVERT_TWIPS
) != 0,
2231 "This value needs TWIPS-MM100 conversion" );
2232 rVal
<<= (sal_Int32
)TWIP_TO_MM100_UNSIGNED(nRubyHeight
);
2235 switch( GetGridType() )
2238 rVal
<<= text::TextGridMode::NONE
;
2240 case GRID_LINES_ONLY
:
2241 rVal
<<= text::TextGridMode::LINES
;
2243 case GRID_LINES_CHARS
:
2244 rVal
<<= text::TextGridMode::LINES_AND_CHARS
;
2247 DBG_ERROR("unknown SwTextGrid value");
2252 case MID_GRID_SNAPTOCHARS
:
2253 rVal
.setValue( &bSnapToChars
, ::getBooleanCppuType() );
2255 case MID_GRID_STANDARD_MODE
:
2257 sal_Bool bStandardMode
= !bSquaredMode
;
2258 rVal
.setValue( &bStandardMode
, ::getBooleanCppuType() );
2262 DBG_ERROR("Unknown SwTextGridItem member");
2270 BOOL
SwTextGridItem::PutValue( const uno::Any
& rVal
, BYTE nMemberId
)
2273 switch( nMemberId
& ~CONVERT_TWIPS
)
2275 case MID_GRID_COLOR
:
2278 bRet
= (rVal
>>= nTmp
);
2280 SetColor( Color(nTmp
) );
2283 case MID_GRID_LINES
:
2286 bRet
= (rVal
>>= nTmp
);
2287 if( bRet
&& (nTmp
>= 0) )
2288 SetLines( (sal_uInt16
)nTmp
);
2293 case MID_GRID_RUBY_BELOW
:
2294 SetRubyTextBelow( *(sal_Bool
*)rVal
.getValue() );
2296 case MID_GRID_PRINT
:
2297 SetPrintGrid( *(sal_Bool
*)rVal
.getValue() );
2299 case MID_GRID_DISPLAY
:
2300 SetDisplayGrid( *(sal_Bool
*)rVal
.getValue() );
2302 case MID_GRID_BASEHEIGHT
:
2303 case MID_GRID_BASEWIDTH
:
2304 case MID_GRID_RUBYHEIGHT
:
2306 DBG_ASSERT( (nMemberId
& CONVERT_TWIPS
) != 0,
2307 "This value needs TWIPS-MM100 conversion" );
2309 bRet
= (rVal
>>= nTmp
);
2310 nTmp
= MM100_TO_TWIP( nTmp
);
2311 if( bRet
&& (nTmp
>= 0) && ( nTmp
<= USHRT_MAX
) )
2312 if( (nMemberId
& ~CONVERT_TWIPS
) == MID_GRID_BASEHEIGHT
)
2313 SetBaseHeight( (USHORT
)nTmp
);
2314 else if( (nMemberId
& ~CONVERT_TWIPS
) == MID_GRID_BASEWIDTH
)
2315 SetBaseWidth( (USHORT
)nTmp
);
2317 SetRubyHeight( (USHORT
)nTmp
);
2325 bRet
= (rVal
>>= nTmp
);
2330 case text::TextGridMode::NONE
:
2331 SetGridType( GRID_NONE
);
2333 case text::TextGridMode::LINES
:
2334 SetGridType( GRID_LINES_ONLY
);
2336 case text::TextGridMode::LINES_AND_CHARS
:
2337 SetGridType( GRID_LINES_CHARS
);
2346 case MID_GRID_SNAPTOCHARS
:
2347 SetSnapToChars( *(sal_Bool
*)rVal
.getValue() );
2349 case MID_GRID_STANDARD_MODE
:
2351 sal_Bool bStandard
= *(sal_Bool
*)rVal
.getValue();
2352 SetSquaredMode( !bStandard
);
2356 DBG_ERROR("Unknown SwTextGridItem member");
2363 void SwTextGridItem::SwitchPaperMode(BOOL bNew
)
2365 if( bNew
== bSquaredMode
)
2367 //same paper mode, not switch
2371 // use default value when grid is disable
2372 if( eGridType
== GRID_NONE
)
2374 bSquaredMode
= bNew
;
2381 //switch from "squared mode" to "standard mode"
2382 nBaseWidth
= nBaseHeight
;
2383 nBaseHeight
= nBaseHeight
+ nRubyHeight
;
2388 //switch from "standard mode" to "squared mode"
2389 nRubyHeight
= nBaseHeight
/3;
2390 nBaseHeight
= nBaseHeight
- nRubyHeight
;
2391 nBaseWidth
= nBaseHeight
;
2393 bSquaredMode
= !bSquaredMode
;
2396 void SwTextGridItem::Init()
2403 eGridType
= GRID_NONE
;
2415 eGridType
= GRID_NONE
;
2422 //default grid type is line only in CJK env
2423 //disable this function due to type area change
2424 //if grid type change.
2425 //if(SvtCJKOptions().IsAsianTypographyEnabled())
2427 // bDisplayGrid = 0;
2428 // eGridType = GRID_LINES_ONLY;
2432 // class SwHeaderAndFooterEatSpacingItem
2434 SfxPoolItem
* SwHeaderAndFooterEatSpacingItem::Clone( SfxItemPool
* ) const
2436 return new SwHeaderAndFooterEatSpacingItem( Which(), GetValue() );
2441 // Implementierung teilweise inline im hxx
2443 TYPEINIT1( SwFrmFmt
, SwFmt
);
2444 IMPL_FIXEDMEMPOOL_NEWDEL_DLL( SwFrmFmt
, 20, 20 )
2446 void SwFrmFmt::Modify( SfxPoolItem
* pOld
, SfxPoolItem
* pNew
)
2448 SwFmtHeader
*pH
= 0;
2449 SwFmtFooter
*pF
= 0;
2451 sal_uInt16 nWhich
= pNew
? pNew
->Which() : 0;
2453 if( RES_ATTRSET_CHG
== nWhich
)
2455 ((SwAttrSetChg
*)pNew
)->GetChgSet()->GetItemState(
2456 RES_HEADER
, sal_False
, (const SfxPoolItem
**)&pH
);
2457 ((SwAttrSetChg
*)pNew
)->GetChgSet()->GetItemState(
2458 RES_FOOTER
, sal_False
, (const SfxPoolItem
**)&pF
);
2460 else if( RES_HEADER
== nWhich
)
2461 pH
= (SwFmtHeader
*)pNew
;
2462 else if( RES_FOOTER
== nWhich
)
2463 pF
= (SwFmtFooter
*)pNew
;
2465 if( pH
&& pH
->IsActive() && !pH
->GetHeaderFmt() )
2466 { //Hat er keinen, mach ich ihm einen
2467 SwFrmFmt
*pFmt
= GetDoc()->MakeLayoutFmt( RND_STD_HEADER
, 0 );
2471 if( pF
&& pF
->IsActive() && !pF
->GetFooterFmt() )
2472 { //Hat er keinen, mach ich ihm einen
2473 SwFrmFmt
*pFmt
= GetDoc()->MakeLayoutFmt( RND_STD_FOOTER
, 0 );
2477 // MIB 24.3.98: Modify der Basisklasse muss immer gerufen werden, z.B.
2478 // wegen RESET_FMTWRITTEN.
2479 // if ( GetDepends() )
2480 SwFmt::Modify( pOld
, pNew
);
2483 //Vernichtet alle Frms, die in aDepend angemeldet sind.
2485 void SwFrmFmt::DelFrms()
2487 SwClientIter
aIter( *this );
2488 SwClient
* pLast
= aIter
.GoStart();
2491 if ( pLast
->ISA(SwFrm
) )
2493 ((SwFrm
*)pLast
)->Cut();
2496 } while( 0 != ( pLast
= aIter
++ ));
2499 void SwFrmFmt::MakeFrms()
2501 ASSERT( !this, "Sorry not implemented." );
2506 SwRect
SwFrmFmt::FindLayoutRect( const sal_Bool bPrtArea
, const Point
* pPoint
,
2507 const sal_Bool bCalcFrm
) const
2511 if( ISA( SwSectionFmt
) )
2513 // dann den frame::Frame per Node2Layout besorgen
2514 SwSectionNode
* pSectNd
= ((SwSectionFmt
*)this)->GetSectionNode();
2517 SwNode2Layout
aTmp( *pSectNd
, pSectNd
->GetIndex() - 1 );
2518 pFrm
= aTmp
.NextFrm();
2520 if( pFrm
&& pFrm
->GetRegisteredIn() != this )
2522 // die Section hat keinen eigenen frame::Frame, also falls
2523 // jemand die tatsaechliche Groe?e braucht, so muss das
2524 // noch implementier werden, in dem sich vom Ende noch
2525 // der entsprechende frame::Frame besorgt wird.
2526 // PROBLEM: was passiert bei SectionFrames, die auf unter-
2527 // schiedlichen Seiten stehen??
2535 pFrm
= 0; // das Rect ist ja jetzt fertig
2541 sal_uInt16 nFrmType
= RES_FLYFRMFMT
== Which() ? FRM_FLY
: USHRT_MAX
;
2542 pFrm
= ::GetFrmOfModify( *(SwModify
*)this, nFrmType
, pPoint
,
2556 SwContact
* SwFrmFmt::FindContactObj()
2558 SwClientIter
aIter( *this );
2559 return (SwContact
*)aIter
.First( TYPE( SwContact
) );
2562 SdrObject
* SwFrmFmt::FindSdrObject()
2564 // --> OD 2005-01-06 #i30669# - use method <FindContactObj()> instead of
2566 SwContact
* pFoundContact
= FindContactObj();
2567 return pFoundContact
? pFoundContact
->GetMaster() : 0;
2571 SdrObject
* SwFrmFmt::FindRealSdrObject()
2573 if( RES_FLYFRMFMT
== Which() )
2576 SwFlyFrm
* pFly
= (SwFlyFrm
*)::GetFrmOfModify( *this, FRM_FLY
,
2577 &aNullPt
, 0, sal_False
);
2578 return pFly
? pFly
->GetVirtDrawObj() : 0;
2580 return FindSdrObject();
2584 sal_Bool
SwFrmFmt::IsLowerOf( const SwFrmFmt
& rFmt
) const
2586 //Auch eine Verkettung von Innen nach aussen oder von aussen
2587 //nach innen ist nicht zulaessig.
2588 SwClientIter
aIter( *(SwModify
*)this );
2589 SwFlyFrm
*pSFly
= (SwFlyFrm
*)aIter
.First( TYPE(SwFlyFrm
) );
2592 SwClientIter
aOtherIter( (SwModify
&)rFmt
);
2593 SwFlyFrm
*pAskFly
= (SwFlyFrm
*)aOtherIter
.First( TYPE(SwFlyFrm
) );
2595 return pSFly
->IsLowerOf( pAskFly
);
2598 // dann mal ueber die Node-Positionen versuchen
2599 const SwFmtAnchor
* pAnchor
= &rFmt
.GetAnchor();
2600 if( FLY_PAGE
!= pAnchor
->GetAnchorId() && pAnchor
->GetCntntAnchor() )
2602 const SwSpzFrmFmts
& rFmts
= *GetDoc()->GetSpzFrmFmts();
2603 const SwNode
* pFlyNd
= pAnchor
->GetCntntAnchor()->nNode
.GetNode().
2607 // dann ueber den Anker nach oben "hangeln"
2609 for( n
= 0; n
< rFmts
.Count(); ++n
)
2611 const SwFrmFmt
* pFmt
= rFmts
[ n
];
2612 const SwNodeIndex
* pIdx
= pFmt
->GetCntnt().GetCntntIdx();
2613 if( pIdx
&& pFlyNd
== &pIdx
->GetNode() )
2618 pAnchor
= &pFmt
->GetAnchor();
2619 if( FLY_PAGE
== pAnchor
->GetAnchorId() ||
2620 !pAnchor
->GetCntntAnchor() )
2623 pFlyNd
= pAnchor
->GetCntntAnchor()->nNode
.GetNode().
2628 if( n
>= rFmts
.Count() )
2630 ASSERT( !this, "Fly-Section aber kein Format gefunden" );
2638 // --> OD 2004-07-27 #i31698#
2639 SwFrmFmt::tLayoutDir
SwFrmFmt::GetLayoutDir() const
2641 return SwFrmFmt::HORI_L2R
;
2644 void SwFrmFmt::SetLayoutDir( const SwFrmFmt::tLayoutDir
)
2646 // empty body, because default implementation does nothing
2650 // --> OD 2004-08-06 #i28749#
2651 sal_Int16
SwFrmFmt::GetPositionLayoutDir() const
2653 return text::PositionLayoutDir::PositionInLayoutDirOfAnchor
;
2655 void SwFrmFmt::SetPositionLayoutDir( const sal_Int16
)
2657 // empty body, because default implementation does nothing
2660 String
SwFrmFmt::GetDescription() const
2662 return SW_RES(STR_FRAME
);
2665 // class SwFlyFrmFmt
2666 // Implementierung teilweise inline im hxx
2668 TYPEINIT1( SwFlyFrmFmt
, SwFrmFmt
);
2669 IMPL_FIXEDMEMPOOL_NEWDEL( SwFlyFrmFmt
, 10, 10 )
2671 SwFlyFrmFmt::~SwFlyFrmFmt()
2673 SwClientIter
aIter( *this );
2674 SwClient
* pLast
= aIter
.GoStart();
2677 if ( pLast
->ISA( SwFlyFrm
) )
2680 } while( 0 != ( pLast
= aIter
++ ));
2682 pLast
= aIter
.GoStart();
2685 if ( pLast
->ISA( SwFlyDrawContact
) )
2688 } while( 0 != ( pLast
= aIter
++ ));
2691 //Erzeugen der Frms wenn das Format einen Absatzgebundenen Rahmen beschreibt.
2692 //MA: 14. Feb. 94, Erzeugen der Frms auch fuer Seitengebundene Rahmen.
2694 void SwFlyFrmFmt::MakeFrms()
2696 // gibts ueberhaupt ein Layout ??
2697 if( !GetDoc()->GetRootFrm() )
2700 SwModify
*pModify
= 0;
2701 // OD 24.07.2003 #111032# - create local copy of anchor attribute for possible changes.
2702 SwFmtAnchor
aAnchorAttr( GetAnchor() );
2703 switch( aAnchorAttr
.GetAnchorId() )
2707 case FLY_AUTO_CNTNT
:
2708 if( aAnchorAttr
.GetCntntAnchor() )
2709 pModify
= aAnchorAttr
.GetCntntAnchor()->nNode
.GetNode().GetCntntNode();
2713 if( aAnchorAttr
.GetCntntAnchor() )
2715 //Erst einmal ueber den Inhalt suchen, weil konstant schnell. Kann
2716 //Bei verketteten Rahmen aber auch schief gehen, weil dann evtl.
2717 //niemals ein frame::Frame zu dem Inhalt existiert. Dann muss leider noch
2718 //die Suche vom StartNode zum FrameFormat sein.
2719 SwNodeIndex
aIdx( aAnchorAttr
.GetCntntAnchor()->nNode
);
2720 SwCntntNode
*pCNd
= GetDoc()->GetNodes().GoNext( &aIdx
);
2721 SwClientIter
aIter( *pCNd
);
2722 if ( aIter
.First( TYPE(SwFrm
) ) )
2726 const SwNodeIndex
&rIdx
= aAnchorAttr
.GetCntntAnchor()->nNode
;
2727 SwSpzFrmFmts
& rFmts
= *GetDoc()->GetSpzFrmFmts();
2728 for( sal_uInt16 i
= 0; i
< rFmts
.Count(); ++i
)
2730 SwFrmFmt
* pFlyFmt
= rFmts
[i
];
2731 if( pFlyFmt
->GetCntnt().GetCntntIdx() &&
2732 rIdx
== *pFlyFmt
->GetCntnt().GetCntntIdx() )
2744 sal_uInt16 nPgNum
= aAnchorAttr
.GetPageNum();
2745 SwPageFrm
*pPage
= (SwPageFrm
*)GetDoc()->GetRootFrm()->Lower();
2746 if( !nPgNum
&& aAnchorAttr
.GetCntntAnchor() )
2749 aAnchorAttr
.GetCntntAnchor()->nNode
.GetNode().GetCntntNode();
2750 SwClientIter
aIter( *pCNd
);
2753 if( aIter()->ISA( SwFrm
) )
2755 pPage
= ((SwFrm
*)aIter())->FindPageFrm();
2758 nPgNum
= pPage
->GetPhyPageNum();
2759 // OD 24.07.2003 #111032# - update anchor attribute
2760 aAnchorAttr
.SetPageNum( nPgNum
);
2761 aAnchorAttr
.SetAnchor( 0 );
2762 SetFmtAttr( aAnchorAttr
);
2766 } while ( aIter
++ );
2770 if ( pPage
->GetPhyPageNum() == nPgNum
)
2772 // --> OD 2005-06-09 #i50432# - adjust synopsis of <PlaceFly(..)>
2773 pPage
->PlaceFly( 0, this );
2777 pPage
= (SwPageFrm
*)pPage
->GetNext();
2787 SwClientIter
aIter( *pModify
);
2788 for( SwFrm
*pFrm
= (SwFrm
*)aIter
.First( TYPE(SwFrm
) );
2790 pFrm
= (SwFrm
*)aIter
.Next() )
2792 BOOL bAdd
= !pFrm
->IsCntntFrm() ||
2793 !((SwCntntFrm
*)pFrm
)->IsFollow();
2795 if ( FLY_AT_FLY
== aAnchorAttr
.GetAnchorId() && !pFrm
->IsFlyFrm() )
2796 pFrm
= pFrm
->FindFlyFrm();
2798 if( pFrm
->GetDrawObjs() )
2800 // --> OD 2004-07-01 #i28701# - new type <SwSortedObjs>
2801 SwSortedObjs
&rObjs
= *pFrm
->GetDrawObjs();
2802 for( sal_uInt16 i
= 0; i
< rObjs
.Count(); ++i
)
2804 // --> OD 2004-07-01 #i28701# - consider changed type of
2805 // <SwSortedObjs> entries.
2806 SwAnchoredObject
* pObj
= rObjs
[i
];
2807 if( pObj
->ISA(SwFlyFrm
) &&
2808 (&pObj
->GetFrmFmt()) == this )
2819 switch( aAnchorAttr
.GetAnchorId() )
2822 pFly
= new SwFlyLayFrm( this, pFrm
);
2826 case FLY_AUTO_CNTNT
:
2827 pFly
= new SwFlyAtCntFrm( this, pFrm
);
2831 pFly
= new SwFlyInCntFrm( this, pFrm
);
2834 ASSERT( !this, "Neuer Ankertyp" )
2837 pFrm
->AppendFly( pFly
);
2838 SwPageFrm
*pPage
= pFly
->FindPageFrm();
2840 ::RegistFlys( pPage
, pFly
);
2846 SwFlyFrm
* SwFlyFrmFmt::GetFrm( const Point
* pPoint
, const sal_Bool bCalcFrm
) const
2848 return (SwFlyFrm
*)::GetFrmOfModify( *(SwModify
*)this, FRM_FLY
,
2849 pPoint
, 0, bCalcFrm
);
2852 SwAnchoredObject
* SwFlyFrmFmt::GetAnchoredObj( const Point
* pPoint
, const sal_Bool bCalcFrm
) const
2854 SwFlyFrm
* pFlyFrm( GetFrm( pPoint
, bCalcFrm
) );
2857 return dynamic_cast<SwAnchoredObject
*>(pFlyFrm
);
2866 sal_Bool
SwFlyFrmFmt::GetInfo( SfxPoolItem
& rInfo
) const
2868 switch( rInfo
.Which() )
2870 case RES_CONTENT_VISIBLE
:
2872 ((SwPtrMsgPoolItem
&)rInfo
).pObject
=
2873 SwClientIter( *(SwFlyFrmFmt
*)this ).First( TYPE(SwFrm
) );
2878 return SwFrmFmt::GetInfo( rInfo
);
2883 // --> OD 2009-07-14 #i73249#
2884 void SwFlyFrmFmt::SetObjTitle( const String
& rTitle
, bool bBroadcast
)
2886 SdrObject
* pMasterObject
= FindSdrObject();
2887 ASSERT( pMasterObject
,
2888 "<SwNoTxtNode::SetObjTitle(..)> - missing <SdrObject> instance" );
2889 if ( !pMasterObject
)
2896 SwStringMsgPoolItem
aOld( RES_TITLE_CHANGED
, pMasterObject
->GetTitle() );
2897 SwStringMsgPoolItem
aNew( RES_TITLE_CHANGED
, rTitle
);
2898 pMasterObject
->SetTitle( rTitle
);
2899 Modify( &aOld
, &aNew
);
2903 pMasterObject
->SetTitle( rTitle
);
2907 const String
SwFlyFrmFmt::GetObjTitle() const
2909 const SdrObject
* pMasterObject
= FindSdrObject();
2910 ASSERT( pMasterObject
,
2911 "<SwFlyFrmFmt::GetObjTitle(..)> - missing <SdrObject> instance" );
2912 if ( !pMasterObject
)
2917 return pMasterObject
->GetTitle();
2920 void SwFlyFrmFmt::SetObjDescription( const String
& rDescription
, bool bBroadcast
)
2922 SdrObject
* pMasterObject
= FindSdrObject();
2923 ASSERT( pMasterObject
,
2924 "<SwFlyFrmFmt::SetDescription(..)> - missing <SdrObject> instance" );
2925 if ( !pMasterObject
)
2932 SwStringMsgPoolItem
aOld( RES_DESCRIPTION_CHANGED
, pMasterObject
->GetDescription() );
2933 SwStringMsgPoolItem
aNew( RES_DESCRIPTION_CHANGED
, rDescription
);
2934 pMasterObject
->SetDescription( rDescription
);
2935 Modify( &aOld
, &aNew
);
2939 pMasterObject
->SetDescription( rDescription
);
2943 const String
SwFlyFrmFmt::GetObjDescription() const
2945 const SdrObject
* pMasterObject
= FindSdrObject();
2946 ASSERT( pMasterObject
,
2947 "<SwNoTxtNode::GetDescription(..)> - missing <SdrObject> instance" );
2948 if ( !pMasterObject
)
2953 return pMasterObject
->GetDescription();
2957 /** SwFlyFrmFmt::IsBackgroundTransparent - for #99657#
2959 OD 22.08.2002 - overloading virtual method and its default implementation,
2960 because format of fly frame provides transparent backgrounds.
2961 Method determines, if background of fly frame is transparent.
2965 @return true, if background color is transparent, but not "no fill"
2966 or the transparency of a existing background graphic is set.
2968 sal_Bool
SwFlyFrmFmt::IsBackgroundTransparent() const
2970 sal_Bool bReturn
= sal_False
;
2972 /// NOTE: If background color is "no fill"/"auto fill" (COL_TRANSPARENT)
2973 /// and there is no background graphic, it "inherites" the background
2974 /// from its anchor.
2975 if ( (GetBackground().GetColor().GetTransparency() != 0) &&
2976 (GetBackground().GetColor() != COL_TRANSPARENT
)
2983 const GraphicObject
*pTmpGrf
=
2984 static_cast<const GraphicObject
*>(GetBackground().GetGraphicObject());
2986 (pTmpGrf
->GetAttr().GetTransparency() != 0)
2996 /** SwFlyFrmFmt::IsBackgroundBrushInherited - for #103898#
2998 OD 08.10.2002 - method to determine, if the brush for drawing the
2999 background is "inherited" from its parent/grandparent.
3000 This is the case, if no background graphic is set and the background
3001 color is "no fill"/"auto fill"
3002 NOTE: condition is "copied" from method <SwFrm::GetBackgroundBrush(..).
3006 @return true, if background brush is "inherited" from parent/grandparent
3008 sal_Bool
SwFlyFrmFmt::IsBackgroundBrushInherited() const
3010 sal_Bool bReturn
= sal_False
;
3012 if ( (GetBackground().GetColor() == COL_TRANSPARENT
) &&
3013 !(GetBackground().GetGraphicObject()) )
3021 // --> OD 2006-02-28 #125892#
3022 SwHandleAnchorNodeChg::SwHandleAnchorNodeChg( SwFlyFrmFmt
& _rFlyFrmFmt
,
3023 const SwFmtAnchor
& _rNewAnchorFmt
,
3024 SwFlyFrm
* _pKeepThisFlyFrm
)
3025 : mrFlyFrmFmt( _rFlyFrmFmt
),
3026 mbAnchorNodeChanged( false )
3028 const RndStdIds
nNewAnchorType( _rNewAnchorFmt
.GetAnchorId() );
3029 if ( ( nNewAnchorType
== FLY_AT_CNTNT
||
3030 nNewAnchorType
== FLY_AUTO_CNTNT
) &&
3031 _rNewAnchorFmt
.GetCntntAnchor() &&
3032 _rNewAnchorFmt
.GetCntntAnchor()->nNode
.GetNode().GetCntntNode() )
3034 const SwFmtAnchor
& aOldAnchorFmt( _rFlyFrmFmt
.GetAnchor() );
3035 if ( aOldAnchorFmt
.GetAnchorId() == nNewAnchorType
&&
3036 aOldAnchorFmt
.GetCntntAnchor() &&
3037 aOldAnchorFmt
.GetCntntAnchor()->nNode
.GetNode().GetCntntNode() &&
3038 aOldAnchorFmt
.GetCntntAnchor()->nNode
!=
3039 _rNewAnchorFmt
.GetCntntAnchor()->nNode
)
3041 // determine 'old' number of anchor frames
3042 sal_uInt32
nOldNumOfAnchFrm( 0L );
3043 SwClientIter
aOldIter( *(aOldAnchorFmt
.GetCntntAnchor()->nNode
.GetNode().GetCntntNode()) );
3044 for( aOldIter
.First( TYPE(SwFrm
) ); aOldIter(); aOldIter
.Next() )
3048 // determine 'new' number of anchor frames
3049 sal_uInt32
nNewNumOfAnchFrm( 0L );
3050 SwClientIter
aNewIter( *(_rNewAnchorFmt
.GetCntntAnchor()->nNode
.GetNode().GetCntntNode()) );
3051 for( aNewIter
.First( TYPE(SwFrm
) ); aNewIter(); aNewIter
.Next() )
3055 if ( nOldNumOfAnchFrm
!= nNewNumOfAnchFrm
)
3057 // delete existing fly frames except <_pKeepThisFlyFrm>
3058 SwClientIter
aIter( mrFlyFrmFmt
);
3059 SwClient
* pLast
= aIter
.GoStart();
3063 SwFrm
* pFrm( dynamic_cast<SwFrm
*>(pLast
) );
3064 if ( pFrm
&& pFrm
!= _pKeepThisFlyFrm
)
3069 } while( 0 != ( pLast
= aIter
++ ));
3071 // indicate, that re-creation of fly frames necessary
3072 mbAnchorNodeChanged
= true;
3078 SwHandleAnchorNodeChg::~SwHandleAnchorNodeChg()
3080 if ( mbAnchorNodeChanged
)
3082 mrFlyFrmFmt
.MakeFrms();
3086 // class SwDrawFrmFmt
3087 // Implementierung teilweise inline im hxx
3089 TYPEINIT1( SwDrawFrmFmt
, SwFrmFmt
);
3090 IMPL_FIXEDMEMPOOL_NEWDEL( SwDrawFrmFmt
, 10, 10 )
3092 SwDrawFrmFmt::~SwDrawFrmFmt()
3094 SwContact
*pContact
= FindContactObj();
3098 void SwDrawFrmFmt::MakeFrms()
3100 SwDrawContact
*pContact
= (SwDrawContact
*)FindContactObj();
3102 pContact
->ConnectToLayout();
3105 void SwDrawFrmFmt::DelFrms()
3107 SwDrawContact
*pContact
= (SwDrawContact
*)FindContactObj();
3108 if ( pContact
) //fuer den Reader und andere Unabwaegbarkeiten.
3109 pContact
->DisconnectFromLayout();
3112 // --> OD 2004-07-27 #i31698#
3113 SwFrmFmt::tLayoutDir
SwDrawFrmFmt::GetLayoutDir() const
3118 void SwDrawFrmFmt::SetLayoutDir( const SwFrmFmt::tLayoutDir _eLayoutDir
)
3120 meLayoutDir
= _eLayoutDir
;
3124 // --> OD 2004-08-06 #i28749#
3125 sal_Int16
SwDrawFrmFmt::GetPositionLayoutDir() const
3127 return mnPositionLayoutDir
;
3129 void SwDrawFrmFmt::SetPositionLayoutDir( const sal_Int16 _nPositionLayoutDir
)
3131 switch ( _nPositionLayoutDir
)
3133 case text::PositionLayoutDir::PositionInHoriL2R
:
3134 case text::PositionLayoutDir::PositionInLayoutDirOfAnchor
:
3136 mnPositionLayoutDir
= _nPositionLayoutDir
;
3142 "<SwDrawFrmFmt::SetPositionLayoutDir(..)> - invalid attribute value." );
3148 String
SwDrawFrmFmt::GetDescription() const
3151 const SdrObject
* pSdrObj
= FindSdrObject();
3155 if (pSdrObj
!= pSdrObjCached
)
3157 SdrObject
* pSdrObjCopy
= pSdrObj
->Clone();
3158 SdrUndoNewObj
* pSdrUndo
= new SdrUndoNewObj(*pSdrObjCopy
);
3159 sSdrObjCachedComment
= pSdrUndo
->GetComment();
3163 pSdrObjCached
= pSdrObj
;
3166 aResult
= sSdrObjCachedComment
;
3169 aResult
= SW_RES(STR_GRAPHIC
);
3174 IMapObject
* SwFrmFmt::GetIMapObject( const Point
& rPoint
,
3175 const SwFlyFrm
*pFly
) const
3177 const SwFmtURL
&rURL
= GetURL();
3178 if( !rURL
.GetMap() )
3183 pFly
= (SwFlyFrm
*) SwClientIter( *(SwFrmFmt
*)this ).First( TYPE( SwFlyFrm
));
3188 //Orignialgroesse fuer OLE und Grafik ist die TwipSize,
3189 //ansonsten die Groesse vom FrmFmt des Fly.
3191 SwNoTxtNode
*pNd
= 0;
3193 if( pFly
->Lower() && pFly
->Lower()->IsNoTxtFrm() )
3195 pRef
= pFly
->Lower();
3196 pNd
= ((SwCntntFrm
*)pRef
)->GetNode()->GetNoTxtNode();
3197 aOrigSz
= pNd
->GetTwipSize();
3202 aOrigSz
= pFly
->GetFmt()->GetFrmSize().GetSize();
3205 if( aOrigSz
.Width() != 0 && aOrigSz
.Height() != 0 )
3207 Point
aPos( rPoint
);
3208 Size
aActSz ( pRef
== pFly
? pFly
->Frm().SSize() : pRef
->Prt().SSize() );
3209 const MapMode
aSrc ( MAP_TWIP
);
3210 const MapMode
aDest( MAP_100TH_MM
);
3211 aOrigSz
= OutputDevice::LogicToLogic( aOrigSz
, aSrc
, aDest
);
3212 aActSz
= OutputDevice::LogicToLogic( aActSz
, aSrc
, aDest
);
3213 aPos
-= pRef
->Frm().Pos();
3214 aPos
-= pRef
->Prt().Pos();
3215 aPos
= OutputDevice::LogicToLogic( aPos
, aSrc
, aDest
);
3216 sal_uInt32 nFlags
= 0;
3217 if ( pFly
!= pRef
&& pNd
->IsGrfNode() )
3219 const sal_uInt16 nMirror
= pNd
->GetSwAttrSet().
3220 GetMirrorGrf().GetValue();
3221 if ( RES_MIRROR_GRAPH_BOTH
== nMirror
)
3222 nFlags
= IMAP_MIRROR_HORZ
| IMAP_MIRROR_VERT
;
3223 else if ( RES_MIRROR_GRAPH_VERT
== nMirror
)
3224 nFlags
= IMAP_MIRROR_VERT
;
3225 else if ( RES_MIRROR_GRAPH_HOR
== nMirror
)
3226 nFlags
= IMAP_MIRROR_HORZ
;
3229 return ((ImageMap
*)rURL
.GetMap())->GetHitIMapObject( aOrigSz
,
3230 aActSz
, aPos
, nFlags
);