1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "htmlfly.hxx"
22 #include <fmtanchr.hxx>
23 #include <fmtornt.hxx>
27 #include <ndindex.hxx>
29 #include <osl/diagnose.h>
33 SwHTMLPosFlyFrame::SwHTMLPosFlyFrame( const SwPosFlyFrame
& rPosFly
,
34 const SdrObject
*pSdrObj
,
35 AllHtmlFlags nFlags
) :
36 m_pFrameFormat( &rPosFly
.GetFormat() ),
37 m_pSdrObject( pSdrObj
),
38 m_aNodeIndex( rPosFly
.GetNode() ),
39 m_nOrdNum( rPosFly
.GetOrdNum() ),
43 const SwFormatAnchor
& rAnchor
= rPosFly
.GetFormat().GetAnchor();
44 if ((RndStdIds::FLY_AT_CHAR
!= rAnchor
.GetAnchorId()) ||
45 HtmlPosition::Inside
!= GetOutPos())
48 // Output of auto-bound frames will be a character farther back,
49 // because then the position aligns with Netscape.
50 OSL_ENSURE( rAnchor
.GetAnchorNode(), "No anchor position?" );
51 if( !rAnchor
.GetAnchorNode() )
54 m_nContentIndex
= rAnchor
.GetAnchorContentOffset();
55 sal_Int16 eHoriRel
= rPosFly
.GetFormat().GetHoriOrient().
57 if( text::RelOrientation::FRAME
== eHoriRel
|| text::RelOrientation::PRINT_AREA
== eHoriRel
)
59 const SwContentNode
*pCNd
= m_aNodeIndex
.GetNode().GetContentNode();
60 OSL_ENSURE( pCNd
, "No Content-Node at PaM position" );
61 if( pCNd
&& m_nContentIndex
< pCNd
->Len() )
66 bool SwHTMLPosFlyFrame::operator<( const SwHTMLPosFlyFrame
& rFrame
) const
68 if( m_aNodeIndex
.GetIndex() == rFrame
.m_aNodeIndex
.GetIndex() )
70 if( m_nContentIndex
== rFrame
.m_nContentIndex
)
72 if( GetOutPos() == rFrame
.GetOutPos() )
73 return m_nOrdNum
< rFrame
.m_nOrdNum
;
75 return GetOutPos() < rFrame
.GetOutPos();
78 return m_nContentIndex
< rFrame
.m_nContentIndex
;
81 return m_aNodeIndex
.GetIndex() < rFrame
.m_aNodeIndex
.GetIndex();
84 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */