diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-02-14 15:52:53 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-02-15 08:33:37 +0200 |
commit | 0102b85e4e2506299e034e623b75f9400450eb90 (patch) | |
tree | 6ff58b2410ad85b33ebba8b283610fd5fa092b87 | |
parent | 602a07e110df440a02692b607b6fc08ddfb074d5 (diff) |
convert DocTreeNode::NodeType to scoped enum
and drop unused enumerators
Change-Id: I0b9220cc2a70847ee43b63accec5bede3dbb99fa
7 files changed, 31 insertions, 51 deletions
diff --git a/slideshow/source/engine/animationnodes/animationbasenode.cxx b/slideshow/source/engine/animationnodes/animationbasenode.cxx index fbd9bb8e13e8..c25cdf5ef392 100644 --- a/slideshow/source/engine/animationnodes/animationbasenode.cxx +++ b/slideshow/source/engine/animationnodes/animationbasenode.cxx @@ -131,12 +131,12 @@ AnimationBaseNode::AnimationBaseNode( // provide the given paragraph? if( aTarget.Paragraph >= 0 && mpShape->getTreeNodeSupplier().getNumberOfTreeNodes( - DocTreeNode::NODETYPE_LOGICAL_PARAGRAPH) > aTarget.Paragraph ) + DocTreeNode::NodeType::LogicalParagraph) > aTarget.Paragraph ) { const DocTreeNode& rTreeNode( mpShape->getTreeNodeSupplier().getTreeNode( aTarget.Paragraph, - DocTreeNode::NODETYPE_LOGICAL_PARAGRAPH ) ); + DocTreeNode::NodeType::LogicalParagraph ) ); // CAUTION: the creation of the subset shape // _must_ stay in the node constructor, since diff --git a/slideshow/source/engine/animationnodes/animationnodefactory.cxx b/slideshow/source/engine/animationnodes/animationnodefactory.cxx index 9881e636aa9b..94ee2e1505ee 100644 --- a/slideshow/source/engine/animationnodes/animationnodefactory.cxx +++ b/slideshow/source/engine/animationnodes/animationnodefactory.cxx @@ -239,7 +239,7 @@ bool implCreateIteratedNodes( ENSURE_OR_RETURN_FALSE( aTarget.Paragraph >= 0 && rTreeNodeSupplier.getNumberOfTreeNodes( - DocTreeNode::NODETYPE_LOGICAL_PARAGRAPH ) > aTarget.Paragraph, + DocTreeNode::NodeType::LogicalParagraph ) > aTarget.Paragraph, "implCreateIteratedNodes(): paragraph index out of range" ); pTargetSubset.reset( @@ -249,7 +249,7 @@ bool implCreateIteratedNodes( // type PARAGRAPH from this shape rTreeNodeSupplier.getTreeNode( aTarget.Paragraph, - DocTreeNode::NODETYPE_LOGICAL_PARAGRAPH ), + DocTreeNode::NodeType::LogicalParagraph ), rContext.maContext.mpSubsettableShapeManager ) ); // iterate target is not the whole shape, but only @@ -325,20 +325,20 @@ bool implCreateIteratedNodes( // determine type of subitem iteration (logical // text unit to animate) DocTreeNode::NodeType eIterateNodeType( - DocTreeNode::NODETYPE_LOGICAL_CHARACTER_CELL ); + DocTreeNode::NodeType::LogicalCharacterCell ); switch( xIterNode->getIterateType() ) { case presentation::TextAnimationType::BY_PARAGRAPH: - eIterateNodeType = DocTreeNode::NODETYPE_LOGICAL_PARAGRAPH; + eIterateNodeType = DocTreeNode::NodeType::LogicalParagraph; break; case presentation::TextAnimationType::BY_WORD: - eIterateNodeType = DocTreeNode::NODETYPE_LOGICAL_WORD; + eIterateNodeType = DocTreeNode::NodeType::LogicalWord; break; case presentation::TextAnimationType::BY_LETTER: - eIterateNodeType = DocTreeNode::NODETYPE_LOGICAL_CHARACTER_CELL; + eIterateNodeType = DocTreeNode::NodeType::LogicalCharacterCell; break; default: @@ -349,8 +349,8 @@ bool implCreateIteratedNodes( } if( bParagraphTarget && - eIterateNodeType != DocTreeNode::NODETYPE_LOGICAL_WORD && - eIterateNodeType != DocTreeNode::NODETYPE_LOGICAL_CHARACTER_CELL ) + eIterateNodeType != DocTreeNode::NodeType::LogicalWord && + eIterateNodeType != DocTreeNode::NodeType::LogicalCharacterCell ) { // will not animate the whole paragraph, when // only the paragraph is animated at all. diff --git a/slideshow/source/engine/shapes/drawinglayeranimation.cxx b/slideshow/source/engine/shapes/drawinglayeranimation.cxx index 0ca3695d8b99..e82072d6559b 100644 --- a/slideshow/source/engine/shapes/drawinglayeranimation.cxx +++ b/slideshow/source/engine/shapes/drawinglayeranimation.cxx @@ -738,17 +738,17 @@ ActivityImpl::ActivityImpl( { // get doctreenode: sal_Int32 const nNodes = pParentDrawShape->getNumberOfTreeNodes( - DocTreeNode::NODETYPE_LOGICAL_PARAGRAPH ); + DocTreeNode::NodeType::LogicalParagraph ); DocTreeNode scrollTextNode( pParentDrawShape->getTreeNode( - 0, DocTreeNode::NODETYPE_LOGICAL_PARAGRAPH )); + 0, DocTreeNode::NodeType::LogicalParagraph )); // xxx todo: remove this hack if( nNodes > 1 ) scrollTextNode.setEndIndex( pParentDrawShape->getTreeNode( nNodes - 1, - DocTreeNode::NODETYPE_LOGICAL_PARAGRAPH ).getEndIndex()); + DocTreeNode::NodeType::LogicalParagraph ).getEndIndex()); // TODO(Q3): Doing this manually, instead of using // ShapeSubset. This is because of lifetime issues (ShapeSubset diff --git a/slideshow/source/engine/shapes/drawshape.cxx b/slideshow/source/engine/shapes/drawshape.cxx index 8ee2dc7d6688..143786adebb9 100644 --- a/slideshow/source/engine/shapes/drawshape.cxx +++ b/slideshow/source/engine/shapes/drawshape.cxx @@ -527,7 +527,7 @@ namespace slideshow { OSL_ASSERT( pShape->maAnimationFrames.empty() ); if( pShape->getNumberOfTreeNodes( - DocTreeNode::NODETYPE_LOGICAL_PARAGRAPH) > 0 ) + DocTreeNode::NodeType::LogicalParagraph) > 0 ) { pShape->mpIntrinsicAnimationActivity = createDrawingLayerAnimActivity( diff --git a/slideshow/source/engine/shapes/drawshapesubsetting.cxx b/slideshow/source/engine/shapes/drawshapesubsetting.cxx index d8a1ad127f55..dccca64df6cf 100644 --- a/slideshow/source/engine/shapes/drawshapesubsetting.cxx +++ b/slideshow/source/engine/shapes/drawshapesubsetting.cxx @@ -187,10 +187,10 @@ namespace slideshow // that subtract from it maCurrentSubsets.push_back( DocTreeNode( 0, mnMinSubsetActionIndex, - DocTreeNode::NODETYPE_INVALID ) ); + DocTreeNode::NodeType::Invalid ) ); maCurrentSubsets.push_back( DocTreeNode( mnMaxSubsetActionIndex, maActionClassVector.size(), - DocTreeNode::NODETYPE_INVALID ) ); + DocTreeNode::NodeType::Invalid ) ); } else { @@ -198,10 +198,10 @@ namespace slideshow // subsets subtract content maCurrentSubsets.push_back( DocTreeNode( maSubset.getStartIndex(), mnMinSubsetActionIndex, - DocTreeNode::NODETYPE_INVALID ) ); + DocTreeNode::NodeType::Invalid ) ); maCurrentSubsets.push_back( DocTreeNode( mnMaxSubsetActionIndex, maSubset.getEndIndex(), - DocTreeNode::NODETYPE_INVALID ) ); + DocTreeNode::NodeType::Invalid ) ); } } else @@ -590,30 +590,19 @@ namespace slideshow { switch( eNodeType ) { - case DocTreeNode::NODETYPE_INVALID: + case DocTreeNode::NodeType::Invalid: // FALLTHROUGH intended default: SAL_WARN( "slideshow", "DrawShapeSubsetting::mapDocTreeNode(): unexpected node type"); return DrawShapeSubsetting::CLASS_NOOP; - case DocTreeNode::NODETYPE_LOGICAL_SHAPE: - // FALLTHROUGH intended - case DocTreeNode::NODETYPE_FORMATTING_SHAPE: - return DrawShapeSubsetting::CLASS_SHAPE_END; - - case DocTreeNode::NODETYPE_FORMATTING_LINE: - return DrawShapeSubsetting::CLASS_LINE_END; - - case DocTreeNode::NODETYPE_LOGICAL_PARAGRAPH: + case DocTreeNode::NodeType::LogicalParagraph: return DrawShapeSubsetting::CLASS_PARAGRAPH_END; - case DocTreeNode::NODETYPE_LOGICAL_SENTENCE: - return DrawShapeSubsetting::CLASS_SENTENCE_END; - - case DocTreeNode::NODETYPE_LOGICAL_WORD: + case DocTreeNode::NodeType::LogicalWord: return DrawShapeSubsetting::CLASS_WORD_END; - case DocTreeNode::NODETYPE_LOGICAL_CHARACTER_CELL: + case DocTreeNode::NodeType::LogicalCharacterCell: return DrawShapeSubsetting::CLASS_CHARACTER_CELL_END; }; } diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx index 49e1aba38770..a5ed1e2f9391 100644 --- a/slideshow/source/engine/slide/slideimpl.cxx +++ b/slideshow/source/engine/slide/slideimpl.cxx @@ -905,7 +905,7 @@ void SlideImpl::applyShapeAttributes( const DocTreeNodeSupplier& rNodeSupplier( pAttrShape->getTreeNodeSupplier() ); if( rNodeSupplier.getNumberOfTreeNodes( - DocTreeNode::NODETYPE_LOGICAL_PARAGRAPH ) <= nParaIndex ) + DocTreeNode::NodeType::LogicalParagraph ) <= nParaIndex ) { OSL_FAIL( "SlideImpl::applyInitialShapeAttributes(): shape found does not " "provide a subset for requested paragraph index" ); @@ -915,7 +915,7 @@ void SlideImpl::applyShapeAttributes( pAttrShape = pAttrShape->getSubset( rNodeSupplier.getTreeNode( nParaIndex, - DocTreeNode::NODETYPE_LOGICAL_PARAGRAPH ) ); + DocTreeNode::NodeType::LogicalParagraph ) ); if( !pAttrShape ) { diff --git a/slideshow/source/inc/doctreenode.hxx b/slideshow/source/inc/doctreenode.hxx index 584832cc3b9d..f619a4b87659 100644 --- a/slideshow/source/inc/doctreenode.hxx +++ b/slideshow/source/inc/doctreenode.hxx @@ -47,25 +47,16 @@ namespace slideshow { public: /// Type of shape entity represented by this node - enum NodeType + enum class NodeType { - NODETYPE_INVALID=0, + Invalid=0, - /// This node represents a full shape - NODETYPE_FORMATTING_SHAPE=1, - /// This node represents a line - NODETYPE_FORMATTING_LINE=2, - - /// This node represents a full shape - NODETYPE_LOGICAL_SHAPE=128, /// This node represents a paragraph - NODETYPE_LOGICAL_PARAGRAPH=129, - /// This node represents a sentence - NODETYPE_LOGICAL_SENTENCE=130, + LogicalParagraph=129, /// This node represents a word - NODETYPE_LOGICAL_WORD=131, + LogicalWord=131, /// This node represents a character - NODETYPE_LOGICAL_CHARACTER_CELL=132 + LogicalCharacterCell=132 }; /** Create empty tree node @@ -73,7 +64,7 @@ namespace slideshow DocTreeNode() : mnStartIndex(-1), mnEndIndex(-1), - meType(NODETYPE_INVALID) + meType(NodeType::Invalid) { } @@ -109,7 +100,7 @@ namespace slideshow { mnStartIndex = -1; mnEndIndex = -1; - meType = NODETYPE_INVALID; + meType = NodeType::Invalid; } private: |