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