48 "DrawShapeSubsetting::ensureInitializedNodeTree(): Invalid mtf" );
60 sal_Int32 nActionIndex(0);
61 sal_Int32 nLastTextActionIndex(0);
62 for( pCurrAct =
mpMtf->FirstAction(); pCurrAct; pCurrAct =
mpMtf->NextAction() )
67 case MetaActionType::COMMENT:
72 if( pAct->
GetComment().matchIgnoreAsciiCase(
"XTEXT" ) )
79 if( pAct->
GetComment().equalsIgnoreAsciiCase(
"XTEXT_EOC") )
89 "DrawShapeSubsetting::ensureInitializedNodeTree(): sentence index out of range" );
93 else if( pAct->
GetComment().equalsIgnoreAsciiCase(
"XTEXT_EOW") )
100 const sal_Int32
nIndex( nLastTextActionIndex + pAct->
GetValue() );
103 "DrawShapeSubsetting::ensureInitializedNodeTree(): sentence index out of range" );
107 else if( pAct->
GetComment().equalsIgnoreAsciiCase(
"XTEXT_EOS") )
114 const sal_Int32
nIndex( nLastTextActionIndex + pAct->
GetValue() );
117 "DrawShapeSubsetting::ensureInitializedNodeTree(): sentence index out of range" );
121 else if( pAct->
GetComment().equalsIgnoreAsciiCase(
"XTEXT_EOL") )
125 else if( pAct->
GetComment().equalsIgnoreAsciiCase(
"XTEXT_EOP") )
129 else if( pAct->
GetComment().equalsIgnoreAsciiCase(
"XTEXT_PAINTSHAPE_END") )
133 else if( pAct->
GetComment().equalsIgnoreAsciiCase(
"XTEXT_PAINTSHAPE_BEGIN") )
140 "Shape text structure: " << pAct->
GetComment()
141 <<
" at action #" << nActionIndex);
145 case MetaActionType::TEXT:
146 case MetaActionType::TEXTARRAY:
147 case MetaActionType::STRETCHTEXT:
148 nLastTextActionIndex = nActionIndex;
149 SAL_INFO(
"slideshow.verbose",
"Shape text \"" <<
151 "\" at action #" << nActionIndex );
177 if (
i->getStartIndex() < nExcludedStart)
179 if (
i->getEndIndex() > nExcludedStart)
182 if (
i->getEndIndex() > nExcludedEnd)
184 aNodesToAppend.emplace_back(nExcludedEnd,
i->getEndIndex());
186 i->setEndIndex(nExcludedStart);
190 else if (
i->getStartIndex() < nExcludedEnd)
192 if (
i->getEndIndex() > nExcludedEnd)
195 i->setStartIndex(nExcludedEnd);
212 aNodesToAppend.end());
241 excludeSubset(rSubsetShape.mnStartActionIndex, rSubsetShape.mnEndActionIndex);
250 maActionClassVector(),
255 mbNodeTreeInitialized( false )
261 maActionClassVector(),
263 maSubset( rShapeSubset ),
266 mbNodeTreeInitialized( false )
269 "DrawShapeSubsetting::DrawShapeSubsetting(): Invalid metafile" );
308 SAL_INFO(
"slideshow",
"::presentation::internal::DrawShapeSubsetting::getSubsetShape()" );
316 ShapeSet::const_iterator aIter;
320 return aIter->mpShape;
328 SAL_INFO(
"slideshow",
"::presentation::internal::DrawShapeSubsetting::addSubsetShape()" );
332 const DocTreeNode& rEffectiveSubset( rShape->getSubsetNode() );
337 ShapeSet::const_iterator aIter;
360 SAL_INFO(
"slideshow",
"::presentation::internal::DrawShapeSubsetting::revokeSubsetShape()" );
364 const DocTreeNode& rEffectiveSubset( rShape->getSubsetNode() );
369 ShapeSet::iterator aIter;
374 if( aIter->mnSubsetQueriedCount > 1 )
382 "Subset summary: shape " <<
this <<
", "
384 <<
" open subsets, revoked subset has refcount "
385 << aIter->mnSubsetQueriedCount);
392 "Subset summary: shape " <<
this <<
", "
394 <<
" open subsets, cleared subset has range ["
455 template<
typename FunctorT >
void iterateActionClassifications(
456 FunctorT& io_rFunctor,
457 const DrawShapeSubsetting::IndexClassificatorVector::const_iterator& rBegin,
458 const DrawShapeSubsetting::IndexClassificatorVector::const_iterator& rEnd )
460 sal_Int32 nCurrShapeCount( 0 );
461 sal_Int32 nCurrParaCount( 0 );
462 sal_Int32 nCurrLineCount( 0 );
463 sal_Int32 nCurrSentenceCount( 0 );
464 sal_Int32 nCurrWordCount( 0 );
465 sal_Int32 nCurrCharCount( 0 );
467 DrawShapeSubsetting::IndexClassificatorVector::const_iterator aLastShapeStart(rBegin);
468 DrawShapeSubsetting::IndexClassificatorVector::const_iterator aLastParaStart(rBegin);
469 DrawShapeSubsetting::IndexClassificatorVector::const_iterator aLastLineStart(rBegin);
470 DrawShapeSubsetting::IndexClassificatorVector::const_iterator aLastSentenceStart(rBegin);
471 DrawShapeSubsetting::IndexClassificatorVector::const_iterator aLastWordStart(rBegin);
472 DrawShapeSubsetting::IndexClassificatorVector::const_iterator aLastCharStart(rBegin);
474 DrawShapeSubsetting::IndexClassificatorVector::const_iterator aNext;
475 DrawShapeSubsetting::IndexClassificatorVector::const_iterator aCurr( rBegin );
476 while( aCurr != rEnd )
489 "Unexpected type in iterateDocShapes()" );
504 aLastCharStart = aCurr;
528 aLastParaStart = aNext;
540 aLastLineStart = aNext;
566 ++nCurrSentenceCount;
567 aLastSentenceStart = aNext;
579 aLastWordStart = aNext;
599 aLastCharStart = aCurr;
612 SAL_WARN(
"slideshow",
"DrawShapeSubsetting::mapDocTreeNode(): unexpected node type");
627 class CountClassFunctor
638 const DrawShapeSubsetting::IndexClassificatorVector::const_iterator& ,
639 const DrawShapeSubsetting::IndexClassificatorVector::const_iterator& )
641 if( eCurrElemClassification ==
meClass )
647 sal_Int32 getCount()
const
659 const DrawShapeSubsetting::IndexClassificatorVector::const_iterator& rEnd,
663 mapDocTreeNode( eNodeType ) );
667 CountClassFunctor aFunctor( eRequestedClass );
670 iterateActionClassifications( aFunctor, rBegin, rEnd );
672 return aFunctor.getCount();
694 class FindNthElementFunctor
697 FindNthElementFunctor( sal_Int32 nNodeIndex,
698 DrawShapeSubsetting::IndexClassificatorVector::const_iterator& rLastBegin,
699 DrawShapeSubsetting::IndexClassificatorVector::const_iterator& rLastEnd,
709 sal_Int32 nCurrElemCount,
710 const DrawShapeSubsetting::IndexClassificatorVector::const_iterator& rCurrElemBegin,
711 const DrawShapeSubsetting::IndexClassificatorVector::const_iterator& rCurrElemEnd )
713 if( eCurrElemClassification ==
meClass &&
729 DrawShapeSubsetting::IndexClassificatorVector::const_iterator&
mrLastBegin;
730 DrawShapeSubsetting::IndexClassificatorVector::const_iterator&
mrLastEnd;
734 DocTreeNode makeTreeNode(
const DrawShapeSubsetting::IndexClassificatorVector::const_iterator& rBegin,
735 const DrawShapeSubsetting::IndexClassificatorVector::const_iterator& rStart,
736 const DrawShapeSubsetting::IndexClassificatorVector::const_iterator& rEnd )
738 return DocTreeNode( ::std::distance(rBegin,
740 ::std::distance(rBegin,
746 const IndexClassificatorVector::const_iterator& rEnd,
747 sal_Int32 nNodeIndex,
751 mapDocTreeNode( eNodeType ) );
753 DrawShapeSubsetting::IndexClassificatorVector::const_iterator aLastBegin(rEnd);
754 DrawShapeSubsetting::IndexClassificatorVector::const_iterator aLastEnd(rEnd);
758 FindNthElementFunctor aFunctor( nNodeIndex,
764 iterateActionClassifications( aFunctor, rBegin, rEnd );
767 aLastBegin, aLastEnd );
787 const DrawShapeSubsetting::IndexClassificatorVector::const_iterator aBegin(
maActionClassVector.begin() );
788 const DrawShapeSubsetting::IndexClassificatorVector::const_iterator aParentBegin( aBegin + rParentNode.
getStartIndex() );
789 const DrawShapeSubsetting::IndexClassificatorVector::const_iterator aParentEnd( aBegin + rParentNode.
getEndIndex() );
797 sal_Int32 nNodeIndex,
803 const DrawShapeSubsetting::IndexClassificatorVector::const_iterator aBegin(
maActionClassVector.begin() );
804 const DrawShapeSubsetting::IndexClassificatorVector::const_iterator aParentBegin( aBegin + rParentNode.
getStartIndex() );
805 const DrawShapeSubsetting::IndexClassificatorVector::const_iterator aParentEnd( aBegin + rParentNode.
getEndIndex() );
GDIMetaFileSharedPtr mpMtf
The metafile actually representing the Shape.
This class represents kind of a DOM tree node for shape text.
sal_Int32 getStartIndex() const
sal_Int32 getEndIndex() const
NodeType
Type of shape entity represented by this node.
@ LogicalCharacterCell
This node represents a character.
@ LogicalWord
This node represents a word.
@ LogicalParagraph
This node represents a paragraph.
void excludeSubset(sal_Int32 nExcludedStart, sal_Int32 nExcludedEnd)
DrawShapeSubsetting()
Create empty shape subset handling.
IndexClassificator
This enum classifies each action index in the metafile.
@ CLASS_CHARACTER_CELL_END
ShapeSet maSubsetShapes
the list of subset shapes spawned from this one.
void addSubsetShape(const AttributableShapeSharedPtr &rShape)
Add child subset shape (or increase use count, if already existent)
bool mbNodeTreeInitialized
Whether the shape's doc tree has been initialized successfully, or not.
void initCurrentSubsets()
sal_Int32 getNumberOfTreeNodes(DocTreeNode::NodeType eNodeType) const
Return overall number of nodes for given type.
const DocTreeNode & getSubsetNode() const
Return subset node for this shape.
sal_Int32 getNumberOfSubsetTreeNodes(const DocTreeNode &rParentNode, DocTreeNode::NodeType eNodeType) const
Return number of nodes of given type, below parent node.
void ensureInitializedNodeTree() const
DocTreeNode getSubsetTreeNode(const DocTreeNode &rParentNode, sal_Int32 nNodeIndex, DocTreeNode::NodeType eNodeType) const
Return tree node of given index and given type, relative to parent node.
bool revokeSubsetShape(const AttributableShapeSharedPtr &rShape)
Revoke subset shape.
IndexClassificatorVector maActionClassVector
::std::shared_ptr< GDIMetaFile > mpMtf
Metafile to retrieve subset info from.
DocTreeNode maSubset
Subset of the metafile represented by this object.
DocTreeNode implGetTreeNode(const IndexClassificatorVector::const_iterator &rBegin, const IndexClassificatorVector::const_iterator &rEnd, sal_Int32 nNodeIndex, DocTreeNode::NodeType eNodeType) const
AttributableShapeSharedPtr getSubsetShape(const DocTreeNode &rTreeNode) const
Get subset shape for given node, if any.
static sal_Int32 implGetNumberOfTreeNodes(const IndexClassificatorVector::const_iterator &rBegin, const IndexClassificatorVector::const_iterator &rEnd, DocTreeNode::NodeType eNodeType)
VectorOfDocTreeNodes maCurrentSubsets
Current number of subsets to render (calculated from maSubset and mnMin/MaxSubsetActionIndex).
DocTreeNode getTreeNode(sal_Int32 nNodeIndex, DocTreeNode::NodeType eNodeType) const
Return tree node of given index and given type.
#define ENSURE_OR_THROW(c, m)
DrawShapeSubsetting::IndexClassificatorVector::const_iterator & mrLastEnd
DrawShapeSubsetting::IndexClassificator meClass
DrawShapeSubsetting::IndexClassificatorVector::const_iterator & mrLastBegin
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
::std::vector< DocTreeNode > VectorOfDocTreeNodes
std::shared_ptr< GDIMetaFile > GDIMetaFileSharedPtr
sal_Int32 getNextActionOffset(MetaAction *pCurrAct)
Gets the next action offset for iterating meta actions which is most often returns 1.
::std::shared_ptr< AttributableShape > AttributableShapeSharedPtr
AttributableShapeSharedPtr mpShape
int mnSubsetQueriedCount
Number of times this subset was queried, and not yet revoked.
sal_Int32 mnStartActionIndex
sal_Int32 mnEndActionIndex