1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef INCLUDED_SLIDESHOW_SHAPESUBSET_HXX 29*cdf0e10cSrcweir #define INCLUDED_SLIDESHOW_SHAPESUBSET_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "attributableshape.hxx" 32*cdf0e10cSrcweir #include "subsettableshapemanager.hxx" 33*cdf0e10cSrcweir #include "doctreenode.hxx" 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir #include <boost/shared_ptr.hpp> 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir namespace slideshow 38*cdf0e10cSrcweir { 39*cdf0e10cSrcweir namespace internal 40*cdf0e10cSrcweir { 41*cdf0e10cSrcweir class ShapeSubset; 42*cdf0e10cSrcweir typedef ::boost::shared_ptr< ShapeSubset > ShapeSubsetSharedPtr; 43*cdf0e10cSrcweir 44*cdf0e10cSrcweir /* Definition of ShapeSubset class */ 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir /** Subset RAII wrapper for shapes. 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir This class wraps the plain Shape with a wrapper for subset 49*cdf0e10cSrcweir functionality. Subsetting can be turned on and off. Note 50*cdf0e10cSrcweir that the reason to have shape subsetting RAII implemented 51*cdf0e10cSrcweir separately (i.e. not within the DrawShape) was that 52*cdf0e10cSrcweir subsetting (and de-subsetting) needs the 53*cdf0e10cSrcweir SubsettableShapeManager. And holding that at the DrawShape 54*cdf0e10cSrcweir creates one heck of a circular reference. 55*cdf0e10cSrcweir */ 56*cdf0e10cSrcweir class ShapeSubset 57*cdf0e10cSrcweir { 58*cdf0e10cSrcweir public: 59*cdf0e10cSrcweir /** Create a subset directly from a Shape. 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir @param rOriginalShape 62*cdf0e10cSrcweir Original shape to subset 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir @param rTreeNode 65*cdf0e10cSrcweir Subset this object should represent 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir @param rShapeManager 68*cdf0e10cSrcweir Manager object, where subsets are 69*cdf0e10cSrcweir registered/unregistered 70*cdf0e10cSrcweir */ 71*cdf0e10cSrcweir ShapeSubset( const AttributableShapeSharedPtr& rOriginalShape, 72*cdf0e10cSrcweir const DocTreeNode& rTreeNode, 73*cdf0e10cSrcweir const SubsettableShapeManagerSharedPtr& rSubsetManager ); 74*cdf0e10cSrcweir 75*cdf0e10cSrcweir /** Create a subset from another subset. 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir Note: if you want this subset to subtract from the 78*cdf0e10cSrcweir passed subset reference (and not from the original, 79*cdf0e10cSrcweir unsubsetted shape), the passed subset must be enabled 80*cdf0e10cSrcweir (enableSubsetShape() must have been called) 81*cdf0e10cSrcweir 82*cdf0e10cSrcweir @param rOriginalSubset 83*cdf0e10cSrcweir Original subset, which to subset again. 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir @param rTreeNode 86*cdf0e10cSrcweir Subset of the original subset 87*cdf0e10cSrcweir */ 88*cdf0e10cSrcweir ShapeSubset( const ShapeSubsetSharedPtr& rOriginalSubset, 89*cdf0e10cSrcweir const DocTreeNode& rTreeNode ); 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir /** Create full set for the given shape. 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir @param rOriginalShape 94*cdf0e10cSrcweir Original shape, which will be represented as a whole 95*cdf0e10cSrcweir by this object 96*cdf0e10cSrcweir */ 97*cdf0e10cSrcweir ShapeSubset( const AttributableShapeSharedPtr& rOriginalShape, 98*cdf0e10cSrcweir const SubsettableShapeManagerSharedPtr& rShapeManager ); 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir ~ShapeSubset(); 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir /** Get the actual subset shape. 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir If the subset is currently revoked, this method 105*cdf0e10cSrcweir returns the original shape. 106*cdf0e10cSrcweir */ 107*cdf0e10cSrcweir AttributableShapeSharedPtr getSubsetShape() const; 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir /** Enable the subset shape. 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir This method enables the subset. That means, on 112*cdf0e10cSrcweir successful completion of this method, the original 113*cdf0e10cSrcweir shape will cease to show the subset range, and 114*cdf0e10cSrcweir getSubsetShape() will return a valid shape. 115*cdf0e10cSrcweir 116*cdf0e10cSrcweir @return true, if subsetting was successfully enabled. 117*cdf0e10cSrcweir */ 118*cdf0e10cSrcweir bool enableSubsetShape(); 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir /** Disable the subset shape. 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir This method revokes the subset from the original 123*cdf0e10cSrcweir shape. That means, the original shape will again show 124*cdf0e10cSrcweir the hidden range. 125*cdf0e10cSrcweir */ 126*cdf0e10cSrcweir void disableSubsetShape(); 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir /** Query whether this subset actually is none, but 129*cdf0e10cSrcweir contains the whole original shape's content 130*cdf0e10cSrcweir */ 131*cdf0e10cSrcweir bool isFullSet() const; 132*cdf0e10cSrcweir 133*cdf0e10cSrcweir /** Query subset this object represents 134*cdf0e10cSrcweir */ 135*cdf0e10cSrcweir DocTreeNode getSubset() const; 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir private: 138*cdf0e10cSrcweir // default copy/assignment are okay 139*cdf0e10cSrcweir //ShapeSubset(const ShapeSubset&); 140*cdf0e10cSrcweir //ShapeSubset& operator=( const ShapeSubset& ); 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir AttributableShapeSharedPtr mpOriginalShape; 143*cdf0e10cSrcweir AttributableShapeSharedPtr mpSubsetShape; 144*cdf0e10cSrcweir DocTreeNode maTreeNode; 145*cdf0e10cSrcweir SubsettableShapeManagerSharedPtr mpShapeManager; 146*cdf0e10cSrcweir }; 147*cdf0e10cSrcweir } 148*cdf0e10cSrcweir } 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir #endif /* INCLUDED_SLIDESHOW_SHAPESUBSET_HXX */ 151