LibreOffice Module sw (master)  1
htmlfly.cxx
Go to the documentation of this file.
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 #include <ndindex.hxx>
36 #include <pam.hxx>
37 #include <osl/diagnose.h>
38 
39 using namespace css;
40 
42  const SdrObject *pSdrObj,
43  AllHtmlFlags nFlags ) :
44  pFrameFormat( &rPosFly.GetFormat() ),
45  pSdrObject( pSdrObj ),
46  pNdIdx( new SwNodeIndex( rPosFly.GetNdIndex() ) ),
47  nOrdNum( rPosFly.GetOrdNum() ),
48  nContentIdx( 0 ),
49  nAllFlags( nFlags )
50 {
51  const SwFormatAnchor& rAnchor = rPosFly.GetFormat().GetAnchor();
52  if ((RndStdIds::FLY_AT_CHAR == rAnchor.GetAnchorId()) &&
54  {
55  // Output of auto-bound frames will be a character farther back,
56  // because then the position aligns with Netscape.
57  OSL_ENSURE( rAnchor.GetContentAnchor(), "No anchor position?" );
58  if( rAnchor.GetContentAnchor() )
59  {
61  sal_Int16 eHoriRel = rPosFly.GetFormat().GetHoriOrient().
62  GetRelationOrient();
63  if( text::RelOrientation::FRAME == eHoriRel || text::RelOrientation::PRINT_AREA == eHoriRel )
64  {
65  const SwContentNode *pCNd = pNdIdx->GetNode().GetContentNode();
66  OSL_ENSURE( pCNd, "No Content-Node at PaM position" );
67  if( pCNd && nContentIdx < pCNd->Len() )
68  nContentIdx++;
69  }
70  }
71  }
72 }
73 
75 {
76  if( pNdIdx->GetIndex() == rFrame.pNdIdx->GetIndex() )
77  {
78  if( nContentIdx == rFrame.nContentIdx )
79  {
80  if( GetOutPos() == rFrame.GetOutPos() )
81  return nOrdNum < rFrame.nOrdNum;
82  else
83  return GetOutPos() < rFrame.GetOutPos();
84  }
85  else
86  return nContentIdx < rFrame.nContentIdx;
87  }
88  else
89  return pNdIdx->GetIndex() < rFrame.pNdIdx->GetIndex();
90 }
91 
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool operator<(const SwHTMLPosFlyFrame &) const
Definition: htmlfly.cxx:74
SwNode & GetNode() const
Definition: ndindex.hxx:118
HtmlPosition GetOutPos() const
Definition: htmlfly.hxx:120
SwIndex nContent
Definition: pam.hxx:38
SwHTMLPosFlyFrame(const SwHTMLPosFlyFrame &)=delete
sal_uLong GetIndex() const
Definition: ndindex.hxx:151
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:81
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:65
const SwFormatHoriOrient & GetHoriOrient(bool=true) const
Definition: fmtornt.hxx:108
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:67
SwContentNode * GetContentNode()
Definition: node.hxx:615
FlyAnchors.
Definition: fmtanchr.hxx:34
SwNodeIndex * pNdIdx
Definition: htmlfly.hxx:99
const SwFrameFormat & GetFormat() const
Definition: flypos.hxx:39
Marks a node in the document model.
Definition: ndindex.hxx:31
sal_uInt32 const nOrdNum
Definition: htmlfly.hxx:100
sal_Int32 GetIndex() const
Definition: index.hxx:95
For querying current flys in document.
Definition: flypos.hxx:30
sal_Int32 nContentIdx
Definition: htmlfly.hxx:101