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
27namespace {
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: */
general base class for all free-flowing frames
Definition: flyfrm.hxx:79
SwFlyFrame * GetPrevLink() const
Definition: flyfrm.hxx:193
Represents one footnote or endnote in the layout.
Definition: ftnfrm.hxx:84
const SwFootnoteFrame * GetMaster() const
Definition: ftnfrm.hxx:123
Base class of the Writer layout elements.
Definition: frame.hxx:315
bool IsHeaderFrame() const
Definition: frame.hxx:1196
bool IsRootFrame() const
Definition: frame.hxx:1180
bool IsFooterFrame() const
Definition: frame.hxx:1200
bool IsFootnoteFrame() const
Definition: frame.hxx:1208
SwLayoutFrame * GetUpper()
Definition: frame.hxx:684
bool IsFlyFrame() const
Definition: frame.hxx:1216
const SwFrame * m_pContext
bool checkContext(const SwFrame *pCheck)
Checks if the context of the list is equal to the context of the frame.
SwSelectionList(const SwFrame *pInitCxt)
Ctor to create an empty list for a given context.