Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include "htmlfly.hxx"
21 :
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>
32 :
33 : #include "doc.hxx"
34 : #include "frmfmt.hxx"
35 :
36 : using namespace css;
37 :
38 3 : SwHTMLPosFlyFrm::SwHTMLPosFlyFrm( const SwPosFlyFrm& rPosFly,
39 : const SdrObject *pSdrObj,
40 : sal_uInt8 nOutMode ) :
41 3 : pFrameFormat( &rPosFly.GetFormat() ),
42 : pSdrObject( pSdrObj ),
43 3 : pNdIdx( new SwNodeIndex( rPosFly.GetNdIndex() ) ),
44 3 : nOrdNum( rPosFly.GetOrdNum() ),
45 : nContentIdx( 0 ),
46 9 : nOutputMode( nOutMode )
47 : {
48 3 : const SwFormatAnchor& rAnchor = rPosFly.GetFormat().GetAnchor();
49 5 : if ((FLY_AT_CHAR == rAnchor.GetAnchorId()) &&
50 2 : HTML_POS_INSIDE == GetOutPos() )
51 : {
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 2 : if( rAnchor.GetContentAnchor() )
57 : {
58 2 : nContentIdx = rAnchor.GetContentAnchor()->nContent.GetIndex();
59 2 : sal_Int16 eHoriRel = rPosFly.GetFormat().GetHoriOrient().
60 2 : GetRelationOrient();
61 2 : if( text::RelOrientation::FRAME == eHoriRel || text::RelOrientation::PRINT_AREA == eHoriRel )
62 : {
63 2 : const SwContentNode *pCNd = pNdIdx->GetNode().GetContentNode();
64 : OSL_ENSURE( pCNd, "Kein Content-Node an PaM-Position" );
65 2 : if( pCNd && nContentIdx < pCNd->Len() )
66 0 : nContentIdx++;
67 : }
68 : }
69 : }
70 3 : }
71 :
72 0 : bool SwHTMLPosFlyFrm::operator<( const SwHTMLPosFlyFrm& rFrm ) const
73 : {
74 0 : if( pNdIdx->GetIndex() == rFrm.pNdIdx->GetIndex() )
75 : {
76 0 : if( nContentIdx == rFrm.nContentIdx )
77 : {
78 0 : if( GetOutPos() == rFrm.GetOutPos() )
79 0 : return nOrdNum < rFrm.nOrdNum;
80 : else
81 0 : return GetOutPos() < rFrm.GetOutPos();
82 : }
83 : else
84 0 : return nContentIdx < rFrm.nContentIdx;
85 : }
86 : else
87 0 : return pNdIdx->GetIndex() < rFrm.pNdIdx->GetIndex();
88 177 : }
89 :
90 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|