LibreOffice Module slideshow (master) 1
shapesubset.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
22
23#include <shapesubset.hxx>
24#include <utility>
25
26
27using namespace ::com::sun::star;
28
29namespace slideshow::internal
30{
32 const DocTreeNode& rTreeNode,
33 SubsettableShapeManagerSharedPtr xShapeManager ) :
34 mpOriginalShape(std::move( xOriginalShape )),
35 mpSubsetShape(),
36 maTreeNode( rTreeNode ),
37 mpShapeManager(std::move( xShapeManager ))
38 {
40 "ShapeSubset::ShapeSubset(): Invalid shape manager" );
41 }
42
44 const DocTreeNode& rTreeNode ) :
45 mpOriginalShape( rOriginalSubset->mpSubsetShape ?
46 rOriginalSubset->mpSubsetShape :
47 rOriginalSubset->mpOriginalShape ),
48 mpSubsetShape(),
49 maTreeNode( rTreeNode ),
50 mpShapeManager( rOriginalSubset->mpShapeManager )
51 {
53 "ShapeSubset::ShapeSubset(): Invalid shape manager" );
54 ENSURE_OR_THROW( rOriginalSubset->maTreeNode.isEmpty() ||
55 (rTreeNode.getStartIndex() >= rOriginalSubset->maTreeNode.getStartIndex() &&
56 rTreeNode.getEndIndex() <= rOriginalSubset->maTreeNode.getEndIndex()),
57 "ShapeSubset::ShapeSubset(): Subset is bigger than parent" );
58 }
59
61 SubsettableShapeManagerSharedPtr xShapeManager ) :
62 mpOriginalShape(std::move( xOriginalShape )),
63 mpSubsetShape(),
64 maTreeNode(),
65 mpShapeManager(std::move( xShapeManager ))
66 {
68 "ShapeSubset::ShapeSubset(): Invalid shape manager" );
69 }
70
72 {
73 try
74 {
75 // if not done yet: revoke subset from original
77 }
78 catch (const uno::Exception&)
79 {
80 TOOLS_WARN_EXCEPTION("slideshow", "");
81 }
82 }
83
85 {
87 }
88
90 {
91 if( !mpSubsetShape &&
93 {
94 mpSubsetShape = mpShapeManager->getSubsetShape(
96 maTreeNode );
97 }
98 }
99
101 {
102 if( mpSubsetShape )
103 {
104 mpShapeManager->revokeSubset( mpOriginalShape,
106 mpSubsetShape.reset();
107 }
108 }
109
111 {
112 return maTreeNode.isEmpty();
113 }
114
116 {
117 return maTreeNode;
118 }
119
120}
121
122/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ShapeManagerSharedPtr mpShapeManager
This class represents kind of a DOM tree node for shape text.
Definition: doctreenode.hxx:45
void disableSubsetShape()
Disable the subset shape.
SubsettableShapeManagerSharedPtr mpShapeManager
AttributableShapeSharedPtr mpSubsetShape
AttributableShapeSharedPtr mpOriginalShape
bool isFullSet() const
Query whether this subset actually is none, but contains the whole original shape's content.
ShapeSubset(AttributableShapeSharedPtr xOriginalShape, const DocTreeNode &rTreeNode, SubsettableShapeManagerSharedPtr xSubsetManager)
Create a subset directly from a Shape.
Definition: shapesubset.cxx:31
void enableSubsetShape()
Enable the subset shape.
Definition: shapesubset.cxx:89
AttributableShapeSharedPtr const & getSubsetShape() const
Get the actual subset shape.
Definition: shapesubset.cxx:84
const DocTreeNode & getSubset() const
Query subset this object represents.
#define TOOLS_WARN_EXCEPTION(area, stream)
#define ENSURE_OR_THROW(c, m)
::std::shared_ptr< SubsettableShapeManager > SubsettableShapeManagerSharedPtr
::std::shared_ptr< ShapeSubset > ShapeSubsetSharedPtr
Definition: shapesubset.hxx:30
::std::shared_ptr< AttributableShape > AttributableShapeSharedPtr