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