LibreOffice Module sw (master) 1
txtcache.hxx
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#pragma once
21
22#include <swcache.hxx>
23#include "porlay.hxx"
24#include <memory>
25
26class SwTextFrame;
27
28class SwTextLine : public SwCacheObj
29{
30 std::unique_ptr<SwParaPortion> m_pLine;
31
32 virtual void UpdateCachePos() override;
33
34public:
35 SwTextLine(SwTextFrame const* pFrame, std::unique_ptr<SwParaPortion> pNew = nullptr);
36 virtual ~SwTextLine() override;
37
38 SwParaPortion* GetPara() { return m_pLine.get(); }
39 const SwParaPortion* GetPara() const { return m_pLine.get(); }
40
41 void SetPara(SwParaPortion* pNew, bool bDelete)
42 {
43 if (!bDelete)
44 {
45 // coverity[leaked_storage] - intentional, ownership transferred
46 (void)m_pLine.release();
47 }
48 m_pLine.reset(pNew);
49 }
50};
51
53{
54protected:
55 virtual SwCacheObj* NewObj() override;
56
57public:
58 explicit SwTextLineAccess(const SwTextFrame* pOwner);
59
61
62 bool IsAvailable() const;
63};
64
65/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Access class for the Cache.
Definition: swcache.hxx:198
The Cache object base class Users of the Cache must derive a class from the SwCacheObj and store thei...
Definition: swcache.hxx:137
Collection of SwLineLayout instances, represents the paragraph text in Writer layout.
Definition: porlay.hxx:251
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:168
virtual SwCacheObj * NewObj() override
Can be use in NewObj.
Definition: txtcache.cxx:45
SwTextLineAccess(const SwTextFrame *pOwner)
Definition: txtcache.cxx:65
bool IsAvailable() const
Definition: txtcache.cxx:70
SwParaPortion * GetPara()
Definition: txtcache.cxx:50
std::unique_ptr< SwParaPortion > m_pLine
Definition: txtcache.hxx:30
const SwParaPortion * GetPara() const
Definition: txtcache.hxx:39
SwParaPortion * GetPara()
Definition: txtcache.hxx:38
SwTextLine(SwTextFrame const *pFrame, std::unique_ptr< SwParaPortion > pNew=nullptr)
Definition: txtcache.cxx:28
virtual void UpdateCachePos() override
Definition: txtcache.cxx:38
virtual ~SwTextLine() override
Definition: txtcache.cxx:34
void SetPara(SwParaPortion *pNew, bool bDelete)
Definition: txtcache.hxx:41
SvLinkSource * pOwner