1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <textchain.hxx>
21 #include <svx/svdotext.hxx>
24 * Definition of Properties Interface
27 CursorChainingEvent
const & TextChain::GetCursorEvent(const SdrTextObj
*pTarget
)
29 ImpChainLinkProperties
*pLinkProperties
= GetLinkProperties(pTarget
);
30 return pLinkProperties
->aCursorEvent
;
32 void TextChain::SetCursorEvent(const SdrTextObj
*pTarget
, CursorChainingEvent
const & rPropParam
)
34 ImpChainLinkProperties
*pLinkProperties
= GetLinkProperties(pTarget
);
35 pLinkProperties
->aCursorEvent
= rPropParam
;
38 bool TextChain::GetNilChainingEvent(const SdrTextObj
*pTarget
)
40 ImpChainLinkProperties
*pLinkProperties
= GetLinkProperties(pTarget
);
41 return pLinkProperties
->aNilChainingEvent
;
43 void TextChain::SetNilChainingEvent(const SdrTextObj
*pTarget
, bool b
)
45 ImpChainLinkProperties
*pLinkProperties
= GetLinkProperties(pTarget
);
46 pLinkProperties
->aNilChainingEvent
= b
;
49 ESelection
const & TextChain::GetPreChainingSel(const SdrTextObj
*pTarget
)
51 ImpChainLinkProperties
*pLinkProperties
= GetLinkProperties(pTarget
);
52 return pLinkProperties
->aPreChainingSel
;
54 void TextChain::SetPreChainingSel(const SdrTextObj
*pTarget
, ESelection
const & rPropParam
)
56 ImpChainLinkProperties
*pLinkProperties
= GetLinkProperties(pTarget
);
57 pLinkProperties
->aPreChainingSel
= rPropParam
;
60 ESelection
const & TextChain::GetPostChainingSel(const SdrTextObj
*pTarget
)
62 ImpChainLinkProperties
*pLinkProperties
= GetLinkProperties(pTarget
);
63 return pLinkProperties
->aPostChainingSel
;
65 void TextChain::SetPostChainingSel(const SdrTextObj
*pTarget
, ESelection
const & rPropParam
)
67 ImpChainLinkProperties
*pLinkProperties
= GetLinkProperties(pTarget
);
68 pLinkProperties
->aPostChainingSel
= rPropParam
;
71 bool TextChain::GetIsPartOfLastParaInNextLink(const SdrTextObj
*pTarget
)
73 ImpChainLinkProperties
*pLinkProperties
= GetLinkProperties(pTarget
);
74 return pLinkProperties
->aIsPartOfLastParaInNextLink
;
76 void TextChain::SetIsPartOfLastParaInNextLink(const SdrTextObj
*pTarget
, bool b
)
78 ImpChainLinkProperties
*pLinkProperties
= GetLinkProperties(pTarget
);
79 pLinkProperties
->aIsPartOfLastParaInNextLink
= b
;
82 bool TextChain::GetSwitchingToNextBox(const SdrTextObj
*pTarget
)
84 ImpChainLinkProperties
*pLinkProperties
= GetLinkProperties(pTarget
);
85 return pLinkProperties
->aSwitchingToNextBox
;
87 void TextChain::SetSwitchingToNextBox(const SdrTextObj
*pTarget
, bool b
)
89 ImpChainLinkProperties
*pLinkProperties
= GetLinkProperties(pTarget
);
90 pLinkProperties
->aSwitchingToNextBox
= b
;
93 /* End Definition of Properties Interface */
97 // NOTE: All getters in the class assume that the guy is in the chain
99 TextChain::TextChain()
103 TextChain::~TextChain()
105 // XXX: Should free all LinkProperties
110 ChainLinkId
GetId(const SdrTextObj
*pLink
)
112 return pLink
->GetName();
117 ImpChainLinkProperties
*TextChain::GetLinkProperties(const SdrTextObj
*pLink
)
119 // if the guy does not already have properties in the map make them
120 ChainLinkId aLinkId
= GetId(pLink
);
121 if (maLinkPropertiesMap
.find(aLinkId
) == maLinkPropertiesMap
.end()) {
122 maLinkPropertiesMap
[aLinkId
] = new ImpChainLinkProperties
;
125 return maLinkPropertiesMap
[aLinkId
];
128 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */