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 <flypos.hxx>
25
26#include <frmfmt.hxx>
27#include <ndindex.hxx>
28#include <pam.hxx>
29#include <osl/diagnose.h>
30
31using namespace css;
32
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() ),
40 m_nContentIndex( 0 ),
41 m_nAllFlags( nFlags )
42{
43 const SwFormatAnchor& rAnchor = rPosFly.GetFormat().GetAnchor();
44 if ((RndStdIds::FLY_AT_CHAR != rAnchor.GetAnchorId()) ||
46 return;
47
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() )
52 return;
53
55 sal_Int16 eHoriRel = rPosFly.GetFormat().GetHoriOrient().
56 GetRelationOrient();
57 if( text::RelOrientation::FRAME == eHoriRel || text::RelOrientation::PRINT_AREA == eHoriRel )
58 {
60 OSL_ENSURE( pCNd, "No Content-Node at PaM position" );
61 if( pCNd && m_nContentIndex < pCNd->Len() )
63 }
64}
65
67{
68 if( m_aNodeIndex.GetIndex() == rFrame.m_aNodeIndex.GetIndex() )
69 {
70 if( m_nContentIndex == rFrame.m_nContentIndex )
71 {
72 if( GetOutPos() == rFrame.GetOutPos() )
73 return m_nOrdNum < rFrame.m_nOrdNum;
74 else
75 return GetOutPos() < rFrame.GetOutPos();
76 }
77 else
78 return m_nContentIndex < rFrame.m_nContentIndex;
79 }
80 else
81 return m_aNodeIndex.GetIndex() < rFrame.m_aNodeIndex.GetIndex();
82}
83
84/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
FlyAnchors.
Definition: fmtanchr.hxx:37
sal_Int32 GetAnchorContentOffset() const
Definition: atrfrm.cxx:1631
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:67
SwNode * GetAnchorNode() const
Definition: atrfrm.cxx:1614
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:88
const SwFormatHoriOrient & GetHoriOrient(bool=true) const
Definition: fmtornt.hxx:115
sal_uInt32 m_nOrdNum
Definition: htmlfly.hxx:99
SwNodeIndex m_aNodeIndex
Definition: htmlfly.hxx:98
bool operator<(const SwHTMLPosFlyFrame &) const
Definition: htmlfly.cxx:66
SwHTMLPosFlyFrame(const SwHTMLPosFlyFrame &)=delete
HtmlPosition GetOutPos() const
Definition: htmlfly.hxx:119
sal_Int32 m_nContentIndex
Definition: htmlfly.hxx:100
SwNode & GetNode() const
Definition: ndindex.hxx:123
SwNodeOffset GetIndex() const
Definition: ndindex.hxx:111
SwContentNode * GetContentNode()
Definition: node.hxx:666
For querying current flys in document.
Definition: flypos.hxx:31
const SwFrameFormat & GetFormat() const
Definition: flypos.hxx:39
virtual SotClipboardFormatId GetFormat(const TransferableDataHelper &aHelper) override
SwContentNode * GetNode(SwPaM &rPam, bool &rbFirst, SwMoveFnCollection const &fnMove, bool const bInReadOnly, SwRootFrame const *const i_pLayout)
This function returns the next node in direction of search.
Definition: pam.cxx:1043