LibreOffice Module sw (master)  1
flypos.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 <doc.hxx>
22 #include <docary.hxx>
23 #include <fmtanchr.hxx>
24 #include <ndindex.hxx>
25 #include <frameformats.hxx>
26 #include <svx/swframetypes.hxx>
27 
29 {
30  if (rA->GetNdIndex() == rB->GetNdIndex())
31  {
32  // In this case, the order number decides!
33  return rA->GetOrdNum() < rB->GetOrdNum();
34  }
35 
36  return rA->GetNdIndex() < rB->GetNdIndex();
37 }
38 
40  sal_uInt16 nArrPos)
41  : m_pFrameFormat(pFormat)
42  , m_pNodeIndex(const_cast<SwNodeIndex*>(&rIdx))
43  , m_nOrdNum(SAL_MAX_UINT32)
44 {
45  const SwFormatAnchor& rAnchor = pFormat->GetAnchor();
46  if (RndStdIds::FLY_AT_PAGE == rAnchor.GetAnchorId())
47  m_pNodeIndex = new SwNodeIndex(rIdx);
48  else if (pFormat->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell())
51  {
52  m_nOrdNum = pFormat->GetDoc()->GetSpzFrameFormats()->size();
53  m_nOrdNum += nArrPos;
54  }
55 }
56 
58 {
59  const SwFormatAnchor& rAnchor = m_pFrameFormat->GetAnchor();
60  if (RndStdIds::FLY_AT_PAGE == rAnchor.GetAnchorId())
61  {
62  delete m_pNodeIndex;
63  }
64 }
65 
66 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwNodeIndex * m_pNodeIndex
Index for node is sufficient.
Definition: flypos.hxx:33
virtual ~SwPosFlyFrame()
Virtual for Writer (DLL !!)
Definition: flypos.cxx:57
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:741
#define SAL_MAX_UINT32
Style of a layout element.
Definition: frmfmt.hxx:58
SwPosFlyFrame(const SwNodeIndex &, const SwFrameFormat *, sal_uInt16 nArrPos)
Definition: flypos.cxx:39
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:81
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:65
std::shared_ptr< SwPosFlyFrame > SwPosFlyFramePtr
Definition: flypos.hxx:49
FlyAnchors.
Definition: fmtanchr.hxx:34
Marks a node in the document model.
Definition: ndindex.hxx:31
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:119
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:405
sal_uInt32 m_nOrdNum
Definition: flypos.hxx:34
const SwFrameFormat * m_pFrameFormat
FlyFrameFormat.
Definition: flypos.hxx:32
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
bool operator()(const SwPosFlyFramePtr &rA, const SwPosFlyFramePtr &rB) const
Definition: flypos.cxx:28
virtual void CallSwClientNotify(const SfxHint &rHint) const override
Definition: calbck.cxx:370
size_t size() const