Kaydet (Commit) 759c5373 authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Michael Stahl

Convert SV_DECL_PTRARR_DEL to boost::ptr_vector

üst 8b229762
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <rtl/ustring.hxx> #include <rtl/ustring.hxx>
#include <rtl/ustrbuf.hxx> #include <rtl/ustrbuf.hxx>
#include <tools/debug.hxx> #include <tools/debug.hxx>
#include <boost/ptr_container/ptr_vector.hpp>
#include <svl/svarray.hxx> #include <svl/svarray.hxx>
#include <com/sun/star/text/XTextFrame.hpp> #include <com/sun/star/text/XTextFrame.hpp>
...@@ -64,9 +65,7 @@ ...@@ -64,9 +65,7 @@
// OD 2004-04-21 #i26791# // OD 2004-04-21 #i26791#
#include <txtparaimphint.hxx> #include <txtparaimphint.hxx>
typedef XMLHint_Impl *XMLHint_ImplPtr; class XMLHints_Impl : public boost::ptr_vector<XMLHint_Impl> {};
SV_DECL_PTRARR_DEL( XMLHints_Impl, XMLHint_ImplPtr, 5 )
SV_IMPL_PTRARR( XMLHints_Impl, XMLHint_ImplPtr )
// OD 2004-04-21 #i26791# // OD 2004-04-21 #i26791#
using ::rtl::OUString; using ::rtl::OUString;
...@@ -211,7 +210,7 @@ XMLStartReferenceContext_Impl::XMLStartReferenceContext_Impl( ...@@ -211,7 +210,7 @@ XMLStartReferenceContext_Impl::XMLStartReferenceContext_Impl(
// degenerates to point reference, if no end is found! // degenerates to point reference, if no end is found!
pHint->SetEnd(rImport.GetTextImport()->GetCursor()->getStart() ); pHint->SetEnd(rImport.GetTextImport()->GetCursor()->getStart() );
rHints.Insert(pHint, rHints.Count()); rHints.push_back(pHint);
} }
} }
...@@ -275,10 +274,10 @@ XMLEndReferenceContext_Impl::XMLEndReferenceContext_Impl( ...@@ -275,10 +274,10 @@ XMLEndReferenceContext_Impl::XMLEndReferenceContext_Impl(
if (XMLStartReferenceContext_Impl::FindName(GetImport(), xAttrList, sName)) if (XMLStartReferenceContext_Impl::FindName(GetImport(), xAttrList, sName))
{ {
// search for reference start // search for reference start
sal_uInt16 nCount = rHints.Count(); sal_uInt16 nCount = rHints.size();
for(sal_uInt16 nPos = 0; nPos < nCount; nPos++) for(sal_uInt16 nPos = 0; nPos < nCount; nPos++)
{ {
XMLHint_Impl *pHint = rHints[nPos]; XMLHint_Impl *pHint = &rHints[nPos];
if ( pHint->IsReference() && if ( pHint->IsReference() &&
sName.equals( ((XMLReferenceHint_Impl *)pHint)->GetRefName()) ) sName.equals( ((XMLReferenceHint_Impl *)pHint)->GetRefName()) )
{ {
...@@ -426,7 +425,7 @@ XMLImpHyperlinkContext_Impl::XMLImpHyperlinkContext_Impl( ...@@ -426,7 +425,7 @@ XMLImpHyperlinkContext_Impl::XMLImpHyperlinkContext_Impl(
pHint->SetTargetFrameName( pHint->SetTargetFrameName(
OUString( RTL_CONSTASCII_USTRINGPARAM("_self" ) ) ); OUString( RTL_CONSTASCII_USTRINGPARAM("_self" ) ) );
} }
rHints.Insert( pHint, rHints.Count() ); rHints.push_back( pHint );
} }
XMLImpHyperlinkContext_Impl::~XMLImpHyperlinkContext_Impl() XMLImpHyperlinkContext_Impl::~XMLImpHyperlinkContext_Impl()
...@@ -1127,7 +1126,7 @@ void XMLIndexMarkImportContext_Impl::StartElement( ...@@ -1127,7 +1126,7 @@ void XMLIndexMarkImportContext_Impl::StartElement(
{ {
ProcessAttributes(xAttrList, xMark); ProcessAttributes(xAttrList, xMark);
XMLHint_Impl* pHint = new XMLIndexMarkHint_Impl(xMark, xPos); XMLHint_Impl* pHint = new XMLIndexMarkHint_Impl(xMark, xPos);
rHints.Insert(pHint, rHints.Count()); rHints.push_back(pHint);
} }
// else: can't create mark -> ignore // else: can't create mark -> ignore
break; break;
...@@ -1148,7 +1147,7 @@ void XMLIndexMarkImportContext_Impl::StartElement( ...@@ -1148,7 +1147,7 @@ void XMLIndexMarkImportContext_Impl::StartElement(
// process only if we find an ID // process only if we find an ID
XMLHint_Impl* pHint = XMLHint_Impl* pHint =
new XMLIndexMarkHint_Impl(xMark, xPos, sID); new XMLIndexMarkHint_Impl(xMark, xPos, sID);
rHints.Insert(pHint, rHints.Count()); rHints.push_back(pHint);
} }
// else: no ID -> we'll never find the end -> ignore // else: no ID -> we'll never find the end -> ignore
} }
...@@ -1167,10 +1166,10 @@ void XMLIndexMarkImportContext_Impl::StartElement( ...@@ -1167,10 +1166,10 @@ void XMLIndexMarkImportContext_Impl::StartElement(
if (!sID.isEmpty()) if (!sID.isEmpty())
{ {
// if we have an ID, find the hint and set the end position // if we have an ID, find the hint and set the end position
sal_uInt16 nCount = rHints.Count(); sal_uInt16 nCount = rHints.size();
for(sal_uInt16 nPos = 0; nPos < nCount; nPos++) for(sal_uInt16 nPos = 0; nPos < nCount; nPos++)
{ {
XMLHint_Impl *pHint = rHints[nPos]; XMLHint_Impl *pHint = &rHints[nPos];
if ( pHint->IsIndexMark() && if ( pHint->IsIndexMark() &&
sID.equals( sID.equals(
((XMLIndexMarkHint_Impl *)pHint)->GetID()) ) ((XMLIndexMarkHint_Impl *)pHint)->GetID()) )
...@@ -1599,7 +1598,7 @@ XMLImpSpanContext_Impl::XMLImpSpanContext_Impl( ...@@ -1599,7 +1598,7 @@ XMLImpSpanContext_Impl::XMLImpSpanContext_Impl(
{ {
pHint = new XMLStyleHint_Impl( aStyleName, pHint = new XMLStyleHint_Impl( aStyleName,
GetImport().GetTextImport()->GetCursorAsRange()->getStart() ); GetImport().GetTextImport()->GetCursorAsRange()->getStart() );
rHints.Insert( pHint, rHints.Count() ); rHints.push_back( pHint );
} }
} }
...@@ -1749,9 +1748,8 @@ SvXMLImportContext *XMLImpSpanContext_Impl::CreateChildContext( ...@@ -1749,9 +1748,8 @@ SvXMLImportContext *XMLImpSpanContext_Impl::CreateChildContext(
if( TextContentAnchorType_AT_CHARACTER == if( TextContentAnchorType_AT_CHARACTER ==
pTextFrameContext->GetAnchorType() ) pTextFrameContext->GetAnchorType() )
{ {
rHints.Insert( new XMLTextFrameHint_Impl( rHints.push_back( new XMLTextFrameHint_Impl(
pTextFrameContext, xAnchorPos ), pTextFrameContext, xAnchorPos ) );
rHints.Count() );
} }
pContext = pTextFrameContext; pContext = pTextFrameContext;
rIgnoreLeadingSpace = sal_False; rIgnoreLeadingSpace = sal_False;
...@@ -1766,7 +1764,7 @@ SvXMLImportContext *XMLImpSpanContext_Impl::CreateChildContext( ...@@ -1766,7 +1764,7 @@ SvXMLImportContext *XMLImpSpanContext_Impl::CreateChildContext(
TextContentAnchorType_AS_CHARACTER ); TextContentAnchorType_AS_CHARACTER );
XMLTextFrameHint_Impl *pHint = XMLTextFrameHint_Impl *pHint =
new XMLTextFrameHint_Impl( pContext, xAnchorPos); new XMLTextFrameHint_Impl( pContext, xAnchorPos);
rHints.Insert( pHint, rHints.Count() ); rHints.push_back( pHint );
} }
break; break;
...@@ -1839,8 +1837,7 @@ SvXMLImportContext *XMLImpSpanContext_Impl::CreateChildContext( ...@@ -1839,8 +1837,7 @@ SvXMLImportContext *XMLImpSpanContext_Impl::CreateChildContext(
// adjust its anchor position, if its at-character anchored // adjust its anchor position, if its at-character anchored
Reference < XTextRange > xAnchorPos = Reference < XTextRange > xAnchorPos =
rImport.GetTextImport()->GetCursor()->getStart(); rImport.GetTextImport()->GetCursor()->getStart();
rHints.Insert( new XMLDrawHint_Impl( pShapeContext, xAnchorPos ), rHints.push_back( new XMLDrawHint_Impl( pShapeContext, xAnchorPos ) );
rHints.Count() );
} }
if( !pContext ) if( !pContext )
{ {
...@@ -2135,11 +2132,11 @@ XMLParaContext::~XMLParaContext() ...@@ -2135,11 +2132,11 @@ XMLParaContext::~XMLParaContext()
} }
} }
if( pHints && pHints->Count() ) if( pHints && !pHints->empty() )
{ {
for( sal_uInt16 i=0; i<pHints->Count(); i++ ) for( sal_uInt16 i=0; i<pHints->size(); i++ )
{ {
XMLHint_Impl *pHint = (*pHints)[i]; XMLHint_Impl *pHint = &(*pHints)[i];
xAttrCursor->gotoRange( pHint->GetStart(), sal_False ); xAttrCursor->gotoRange( pHint->GetStart(), sal_False );
xAttrCursor->gotoRange( pHint->GetEnd(), sal_True ); xAttrCursor->gotoRange( pHint->GetEnd(), sal_True );
switch( pHint->GetType() ) switch( pHint->GetType() )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment