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 <dcontact.hxx>
24 #include <flyfrm.hxx>
25 #include <dflyobj.hxx>
26 #include <calbck.hxx>
27 #include <pam.hxx>
28 
30 {
31  if(rA->GetNdIndex() == rB->GetNdIndex())
32  {
33  // In this case, the order number decides!
34  return rA->GetOrdNum() < rB->GetOrdNum();
35  }
36 
37  return rA->GetNdIndex() < rB->GetNdIndex();
38 }
39 
40 SwPosFlyFrame::SwPosFlyFrame(const SwNodeIndex& rIdx, const SwFrameFormat* pFormat, sal_uInt16 nArrPos)
41  : m_pFrameFormat(pFormat), m_pNodeIndex(const_cast<SwNodeIndex*>(&rIdx)), m_nOrdNum(SAL_MAX_UINT32)
42 {
43  const SwFormatAnchor& rAnchor = pFormat->GetAnchor();
44  if(RndStdIds::FLY_AT_PAGE == rAnchor.GetAnchorId())
45  m_pNodeIndex = new SwNodeIndex(rIdx);
46  else if(pFormat->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell())
49  {
50  m_nOrdNum = pFormat->GetDoc()->GetSpzFrameFormats()->size();
51  m_nOrdNum += nArrPos;
52  }
53 }
54 
56 {
57  const SwFormatAnchor& rAnchor = m_pFrameFormat->GetAnchor();
58  if (RndStdIds::FLY_AT_PAGE == rAnchor.GetAnchorId())
59  {
60  delete m_pNodeIndex;
61  }
62 }
63 
64 /* 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:55
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:737
#define SAL_MAX_UINT32
Style of a layout element.
Definition: frmfmt.hxx:57
SwPosFlyFrame(const SwNodeIndex &, const SwFrameFormat *, sal_uInt16 nArrPos)
Definition: flypos.cxx:40
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:437
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:29
virtual void CallSwClientNotify(const SfxHint &rHint) const override
Definition: calbck.cxx:376
size_t size() const
Definition: docary.hxx:225