build fix
[LibreOffice.git] / sw / source / filter / html / htmlfly.cxx
blobddabe12afee2a3d42fe9fe7ad63c84a30f5001c3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
24 #include <fmturl.hxx>
25 #include <fmtfsize.hxx>
26 #include <fmtclds.hxx>
27 #include <fmtcntnt.hxx>
28 #include <fmtsrnd.hxx>
29 #include <fmtinfmt.hxx>
30 #include <flypos.hxx>
31 #include <docary.hxx>
33 #include "doc.hxx"
34 #include "frmfmt.hxx"
36 using namespace css;
38 SwHTMLPosFlyFrame::SwHTMLPosFlyFrame( const SwPosFlyFrame& rPosFly,
39 const SdrObject *pSdrObj,
40 sal_uInt8 nOutMode ) :
41 pFrameFormat( &rPosFly.GetFormat() ),
42 pSdrObject( pSdrObj ),
43 pNdIdx( new SwNodeIndex( rPosFly.GetNdIndex() ) ),
44 nOrdNum( rPosFly.GetOrdNum() ),
45 nContentIdx( 0 ),
46 nOutputMode( nOutMode )
48 const SwFormatAnchor& rAnchor = rPosFly.GetFormat().GetAnchor();
49 if ((FLY_AT_CHAR == rAnchor.GetAnchorId()) &&
50 HTML_POS_INSIDE == GetOutPos() )
52 // Auto-gebundene Rahmen werden ein Zeichen weiter hinten
53 // ausgegeben, weil dann die Positionierung mit Netscape
54 // uebereinstimmt.
55 OSL_ENSURE( rAnchor.GetContentAnchor(), "Keine Anker-Position?" );
56 if( rAnchor.GetContentAnchor() )
58 nContentIdx = rAnchor.GetContentAnchor()->nContent.GetIndex();
59 sal_Int16 eHoriRel = rPosFly.GetFormat().GetHoriOrient().
60 GetRelationOrient();
61 if( text::RelOrientation::FRAME == eHoriRel || text::RelOrientation::PRINT_AREA == eHoriRel )
63 const SwContentNode *pCNd = pNdIdx->GetNode().GetContentNode();
64 OSL_ENSURE( pCNd, "Kein Content-Node an PaM-Position" );
65 if( pCNd && nContentIdx < pCNd->Len() )
66 nContentIdx++;
72 bool SwHTMLPosFlyFrame::operator<( const SwHTMLPosFlyFrame& rFrame ) const
74 if( pNdIdx->GetIndex() == rFrame.pNdIdx->GetIndex() )
76 if( nContentIdx == rFrame.nContentIdx )
78 if( GetOutPos() == rFrame.GetOutPos() )
79 return nOrdNum < rFrame.nOrdNum;
80 else
81 return GetOutPos() < rFrame.GetOutPos();
83 else
84 return nContentIdx < rFrame.nContentIdx;
86 else
87 return pNdIdx->GetIndex() < rFrame.pNdIdx->GetIndex();
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */