LibreOffice Module sw (master)  1
atrref.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 <fmtrfmrk.hxx>
21 
22 #include <hintids.hxx>
23 #include <hints.hxx>
24 #include <txtrfmrk.hxx>
25 
27 {
28 }
29 
30 SwFormatRefMark::SwFormatRefMark( const OUString& rName )
32  , sw::BroadcastingModify()
33  , m_pTextAttr(nullptr)
34  , m_aRefName(rName)
35 {
36 }
37 
40  , sw::BroadcastingModify()
41  , m_pTextAttr(nullptr)
42  , m_aRefName(rAttr.m_aRefName)
43 {
44 }
45 
46 bool SwFormatRefMark::operator==( const SfxPoolItem& rAttr ) const
47 {
48  assert(SfxPoolItem::operator==(rAttr));
49  return m_aRefName == static_cast<const SwFormatRefMark&>(rAttr).m_aRefName;
50 }
51 
53 {
54  return new SwFormatRefMark( *this );
55 }
56 
58 {
59  auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
60  if(!pLegacy)
61  return;
62  CallSwClientNotify(rHint);
63  if(RES_REMOVE_UNO_OBJECT == pLegacy->GetWhich())
64  SetXRefMark(css::uno::Reference<css::text::XTextContent>(nullptr));
65 }
66 
68 {
70  &static_cast<sw::BroadcastingModify&>(*this)); // cast to base class (void*)
72 }
73 
74 // attribute for content references in the text
75 
77  sal_Int32 const nStartPos, sal_Int32 const*const pEnd)
78  : SwTextAttr(rAttr, nStartPos)
79  , SwTextAttrEnd( rAttr, nStartPos, nStartPos )
80  , m_pTextNode( nullptr )
81  , m_pEnd( nullptr )
82 {
83  rAttr.m_pTextAttr = this;
84  if ( pEnd )
85  {
86  m_nEnd = *pEnd;
87  m_pEnd = & m_nEnd;
88  }
89  else
90  {
91  SetHasDummyChar(true);
92  }
93  SetDontMoveAttr( true );
94  SetOverlapAllowedAttr( true );
95 }
96 
97 const sal_Int32* SwTextRefMark::GetEnd() const
98 {
99  return m_pEnd;
100 }
101 
102 void SwTextRefMark::SetEnd(sal_Int32 n)
103 {
104  *m_pEnd = n;
105  if (m_pHints)
107 }
108 
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int32 m_nEnd
Definition: txatbase.hxx:134
void SetHasDummyChar(const bool bFlag)
Definition: txatbase.hxx:76
constexpr TypedWhichId< SwPtrMsgPoolItem > RES_REMOVE_UNO_OBJECT(181)
SwpHints * m_pHints
Definition: txatbase.hxx:65
sal_Int32 * m_pEnd
Definition: txtrfmrk.hxx:30
Dialog to specify the properties of date form field.
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
A wrapper around SfxPoolItem to store the start position of (usually) a text portion, with an optional end.
Definition: txatbase.hxx:41
void SetOverlapAllowedAttr(bool bFlag)
Definition: txatbase.hxx:73
virtual ~SwFormatRefMark() override
Definition: atrref.cxx:26
virtual void SetEnd(sal_Int32) override
Definition: atrref.cxx:102
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
Definition: atrref.cxx:57
void SetDontMoveAttr(bool bFlag)
Definition: txatbase.hxx:71
SwTextRefMark * m_pTextAttr
Definition: fmtrfmrk.hxx:41
void InvalidateRefMark()
Definition: atrref.cxx:67
void SetXRefMark(css::uno::Reference< css::text::XTextContent > const &xMark)
Definition: fmtrfmrk.hxx:69
virtual const sal_Int32 * GetEnd() const override
end position
Definition: atrref.cxx:97
virtual bool operator==(const SfxPoolItem &) const override
"Pure virtual methods" of SfxPoolItem.
Definition: atrref.cxx:46
SwFormatRefMark(const OUString &rText)
Definition: atrref.cxx:30
void EndPosChanged() const
Definition: ndhints.hxx:213
virtual SwFormatRefMark * Clone(SfxItemPool *pPool=nullptr) const override
Definition: atrref.cxx:52
virtual void CallSwClientNotify(const SfxHint &rHint) const override
Definition: calbck.cxx:324
OUString m_aRefName
Definition: fmtrfmrk.hxx:44
constexpr TypedWhichId< SwFormatRefMark > RES_TXTATR_REFMARK(RES_TXTATR_WITHEND_BEGIN)
SwTextRefMark(SwFormatRefMark &rAttr, sal_Int32 const nStart, sal_Int32 const *const pEnd=nullptr)
Definition: atrref.cxx:76