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#include <unorefmark.hxx>
26#include <utility>
27
29{
30}
31
34 , sw::BroadcastingModify()
35 , m_pTextAttr(nullptr)
36 , m_aRefName(std::move(aName))
37{
38}
39
42 , sw::BroadcastingModify()
43 , m_pTextAttr(nullptr)
44 , m_aRefName(rAttr.m_aRefName)
45{
46}
47
49{ m_wXReferenceMark = xMark.get(); }
50
51bool SwFormatRefMark::operator==( const SfxPoolItem& rAttr ) const
52{
53 assert(SfxPoolItem::operator==(rAttr));
54 return m_aRefName == static_cast<const SwFormatRefMark&>(rAttr).m_aRefName;
55}
56
58{
59 return new SwFormatRefMark( *this );
60}
61
63{
64 if (rHint.GetId() != SfxHintId::SwLegacyModify)
65 return;
66 auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
67 CallSwClientNotify(rHint);
68 if(RES_REMOVE_UNO_OBJECT == pLegacy->GetWhich())
69 SetXRefMark(nullptr);
70}
71
73{
75 &static_cast<sw::BroadcastingModify&>(*this)); // cast to base class (void*)
77}
78
79// attribute for content references in the text
80
82 sal_Int32 const nStartPos, sal_Int32 const*const pEnd)
83 : SwTextAttr(rAttr, nStartPos)
84 , SwTextAttrEnd( rAttr, nStartPos, nStartPos )
85 , m_pTextNode( nullptr )
86 , m_pEnd( nullptr )
87{
88 rAttr.m_pTextAttr = this;
89 if ( pEnd )
90 {
91 m_nEnd = *pEnd;
92 m_pEnd = & m_nEnd;
93 }
94 else
95 {
96 SetHasDummyChar(true);
97 }
98 SetDontMoveAttr( true );
100}
101
102const sal_Int32* SwTextRefMark::GetEnd() const
103{
104 return m_pEnd;
105}
106
107void SwTextRefMark::SetEnd(sal_Int32 n)
108{
109 *m_pEnd = n;
110 if (m_pHints)
112}
113
114/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SfxHintId GetId() const
OUString m_aRefName
Definition: fmtrfmrk.hxx:43
void SetXRefMark(rtl::Reference< SwXReferenceMark > const &xMark)
Definition: atrref.cxx:48
SwFormatRefMark(OUString aText)
Definition: atrref.cxx:32
virtual ~SwFormatRefMark() override
Definition: atrref.cxx:28
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
Definition: atrref.cxx:62
unotools::WeakReference< SwXReferenceMark > m_wXReferenceMark
Definition: fmtrfmrk.hxx:45
virtual SwFormatRefMark * Clone(SfxItemPool *pPool=nullptr) const override
Definition: atrref.cxx:57
SwTextRefMark * m_pTextAttr
Definition: fmtrfmrk.hxx:40
virtual bool operator==(const SfxPoolItem &) const override
"Pure virtual methods" of SfxPoolItem.
Definition: atrref.cxx:51
void InvalidateRefMark()
Definition: atrref.cxx:72
sal_Int32 m_nEnd
Definition: txatbase.hxx:138
A wrapper around SfxPoolItem to store the start position of (usually) a text portion,...
Definition: txatbase.hxx:44
void SetDontMoveAttr(bool bFlag)
Definition: txatbase.hxx:73
void SetOverlapAllowedAttr(bool bFlag)
Definition: txatbase.hxx:75
void SetHasDummyChar(const bool bFlag)
Definition: txatbase.hxx:78
SwpHints * m_pHints
Definition: txatbase.hxx:67
virtual void SetEnd(sal_Int32) override
Definition: atrref.cxx:107
sal_Int32 * m_pEnd
Definition: txtrfmrk.hxx:30
SwTextRefMark(SwFormatRefMark &rAttr, sal_Int32 const nStart, sal_Int32 const *const pEnd=nullptr)
Definition: atrref.cxx:81
virtual const sal_Int32 * GetEnd() const override
end position
Definition: atrref.cxx:102
void EndPosChanged() const
Definition: ndhints.hxx:213
virtual void CallSwClientNotify(const SfxHint &rHint) const override
Definition: calbck.cxx:325
constexpr TypedWhichId< SwPtrMsgPoolItem > RES_REMOVE_UNO_OBJECT(181)
constexpr TypedWhichId< SwFormatRefMark > RES_TXTATR_REFMARK(RES_TXTATR_WITHEND_BEGIN)
OUString aName
sal_Int64 n
Dialog to specify the properties of date form field.