LibreOffice Module sw (master)  1
swselectionlist.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 <swselectionlist.hxx>
21 #include <flyfrm.hxx>
22 #include <ftnfrm.hxx>
23 
27 namespace {
28 
44  const SwFrame* getContext( const SwFrame* pFrame )
45  {
46  while( pFrame )
47  {
48  if( pFrame->IsRootFrame() || pFrame->IsHeaderFrame() || pFrame->IsFooterFrame() )
49  break;
50  if( pFrame->IsFlyFrame() )
51  {
52  const SwFlyFrame* pFly = static_cast<const SwFlyFrame*>( pFrame );
53  while( pFly->GetPrevLink() )
54  pFly = pFly->GetPrevLink();
55  break;
56  }
57  if( pFrame->IsFootnoteFrame() )
58  {
59  const SwFootnoteFrame* pFootnote = static_cast<const SwFootnoteFrame*>( pFrame );
60  while( pFootnote->GetMaster() )
61  pFootnote = pFootnote->GetMaster();
62  break;
63  }
64  pFrame = pFrame->GetUpper();
65  }
66  return pFrame;
67  }
68 }
69 
71  m_pContext( getContext( pInitCxt ) )
72 {
73 }
74 
76 {
77  pCheck = getContext( pCheck );
78  if( !m_pContext )
79  m_pContext = pCheck;
80  return m_pContext == pCheck;
81 }
82 
83 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Base class of the Writer layout elements.
Definition: frame.hxx:295
bool IsRootFrame() const
Definition: frame.hxx:1150
bool checkContext(const SwFrame *pCheck)
Checks if the context of the list is equal to the context of the frame.
bool IsFootnoteFrame() const
Definition: frame.hxx:1178
bool IsFlyFrame() const
Definition: frame.hxx:1186
SwFlyFrame * GetPrevLink() const
Definition: flyfrm.hxx:172
const SwFrame * m_pContext
SwSelectionList(const SwFrame *pInitCxt)
Ctor to create an empty list for a given context.
SwLayoutFrame * GetUpper()
Definition: frame.hxx:656
const SwFootnoteFrame * GetMaster() const
Definition: ftnfrm.hxx:104
general base class for all free-flowing frames
Definition: flyfrm.hxx:60
bool IsFooterFrame() const
Definition: frame.hxx:1170
bool IsHeaderFrame() const
Definition: frame.hxx:1166