forked from amazingfate/loongoffice
Remove trivial class XMLTransformerContextVector
Change-Id: I140614895d5727ffd97681ddd06bf7439fe7a443
This commit is contained in:
@ -19,8 +19,11 @@
|
||||
#ifndef INCLUDED_XMLOFF_SOURCE_TRANSFORM_CHARTPLOTAREAOOOTCONTEXT_HXX
|
||||
#define INCLUDED_XMLOFF_SOURCE_TRANSFORM_CHARTPLOTAREAOOOTCONTEXT_HXX
|
||||
|
||||
#include <sal/config.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "ProcAttrTContext.hxx"
|
||||
#include "TContextVector.hxx"
|
||||
|
||||
class XMLAxisOOoContext;
|
||||
|
||||
|
||||
@ -17,11 +17,14 @@
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#include <sal/config.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "CreateElemTContext.hxx"
|
||||
#include "MutableAttrList.hxx"
|
||||
#include "TransformerBase.hxx"
|
||||
#include "TransformerActions.hxx"
|
||||
#include "TContextVector.hxx"
|
||||
#include "FlatTContext.hxx"
|
||||
#include "AttrTransformerAction.hxx"
|
||||
#include <xmloff/nmspmap.hxx>
|
||||
@ -49,7 +52,7 @@ void XMLCreateElemTransformerContext::StartElement(
|
||||
{
|
||||
Reference< XAttributeList > xAttrList( rAttrList );
|
||||
|
||||
XMLTransformerContextVector aChildContexts;
|
||||
std::vector<rtl::Reference<XMLTransformerContext>> aChildContexts;
|
||||
|
||||
XMLMutableAttributeList *pMutableAttrList = nullptr;
|
||||
XMLTransformerActions *pActions =
|
||||
@ -106,11 +109,9 @@ void XMLCreateElemTransformerContext::StartElement(
|
||||
}
|
||||
XMLTransformerContext::StartElement( xAttrList );
|
||||
|
||||
XMLTransformerContextVector::iterator aIter = aChildContexts.begin();
|
||||
|
||||
for( ; aIter != aChildContexts.end(); ++aIter )
|
||||
for (auto const & i: aChildContexts)
|
||||
{
|
||||
(*aIter)->Export();
|
||||
i->Export();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -152,11 +152,9 @@ rtl::Reference<XMLTransformerContext> XMLPersElemContentTContext::CreateChildCon
|
||||
|
||||
void XMLPersElemContentTContext::ExportContent()
|
||||
{
|
||||
XMLTransformerContextVector::iterator aIter = m_aChildContexts.begin();
|
||||
|
||||
for( ; aIter != m_aChildContexts.end(); ++aIter )
|
||||
for (auto const & i: m_aChildContexts)
|
||||
{
|
||||
(*aIter)->Export();
|
||||
i->Export();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -24,11 +24,10 @@
|
||||
|
||||
#include <vector>
|
||||
#include "PersAttrListTContext.hxx"
|
||||
#include "TContextVector.hxx"
|
||||
|
||||
class XMLPersElemContentTContext : public XMLPersAttrListTContext
|
||||
{
|
||||
XMLTransformerContextVector m_aChildContexts;
|
||||
std::vector<rtl::Reference<XMLTransformerContext>> m_aChildContexts;
|
||||
|
||||
public:
|
||||
// element content persistence only
|
||||
|
||||
@ -1,35 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_XMLOFF_SOURCE_TRANSFORM_TCONTEXTVECTOR_HXX
|
||||
#define INCLUDED_XMLOFF_SOURCE_TRANSFORM_TCONTEXTVECTOR_HXX
|
||||
|
||||
#include <rtl/ref.hxx>
|
||||
|
||||
#include <vector>
|
||||
#include "TransformerContext.hxx"
|
||||
|
||||
class XMLTransformerContextVector :
|
||||
public ::std::vector< ::rtl::Reference< XMLTransformerContext > >
|
||||
{
|
||||
};
|
||||
|
||||
#endif // INCLUDED_XMLOFF_SOURCE_TRANSFORM_TCONTEXTVECTOR_HXX
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
@ -40,7 +40,6 @@
|
||||
#include "TransformerTokenMap.hxx"
|
||||
|
||||
#include "TransformerBase.hxx"
|
||||
#include "TContextVector.hxx"
|
||||
|
||||
using namespace ::osl;
|
||||
using namespace ::xmloff::token;
|
||||
@ -187,7 +186,6 @@ XMLTransformerBase::XMLTransformerBase( XMLTransformerActionInit *pInit,
|
||||
throw () :
|
||||
m_pNamespaceMap( new SvXMLNamespaceMap ),
|
||||
m_pReplaceNamespaceMap( new SvXMLNamespaceMap ),
|
||||
m_pContexts( new XMLTransformerContextVector ),
|
||||
m_pElemActions( new XMLTransformerActions( pInit ) ),
|
||||
m_pTokenMap( new XMLTransformerTokenMap( pTKMapInit ) )
|
||||
{
|
||||
@ -204,7 +202,6 @@ XMLTransformerBase::~XMLTransformerBase() throw ()
|
||||
{
|
||||
delete m_pNamespaceMap;
|
||||
delete m_pReplaceNamespaceMap;
|
||||
delete m_pContexts;
|
||||
delete m_pElemActions;
|
||||
delete m_pTokenMap;
|
||||
}
|
||||
@ -288,9 +285,9 @@ void SAL_CALL XMLTransformerBase::startElement( const OUString& rName,
|
||||
// If there are contexts already, call a CreateChildContext at the topmost
|
||||
// context. Otherwise, create a default context.
|
||||
::rtl::Reference < XMLTransformerContext > xContext;
|
||||
if( !m_pContexts->empty() )
|
||||
if( !m_pContexts.empty() )
|
||||
{
|
||||
xContext = m_pContexts->back()->CreateChildContext( nPrefix,
|
||||
xContext = m_pContexts.back()->CreateChildContext( nPrefix,
|
||||
aLocalName,
|
||||
rName,
|
||||
xAttrList );
|
||||
@ -309,7 +306,7 @@ void SAL_CALL XMLTransformerBase::startElement( const OUString& rName,
|
||||
xContext->SetRewindMap( pRewindMap );
|
||||
|
||||
// Push context on stack.
|
||||
m_pContexts->push_back( xContext );
|
||||
m_pContexts.push_back( xContext );
|
||||
|
||||
// Call a startElement at the new context.
|
||||
xContext->StartElement( xAttrList );
|
||||
@ -322,10 +319,10 @@ rName
|
||||
)
|
||||
throw(SAXException, RuntimeException, std::exception)
|
||||
{
|
||||
if( !m_pContexts->empty() )
|
||||
if( !m_pContexts.empty() )
|
||||
{
|
||||
// Get topmost context
|
||||
::rtl::Reference< XMLTransformerContext > xContext = m_pContexts->back();
|
||||
::rtl::Reference< XMLTransformerContext > xContext = m_pContexts.back();
|
||||
|
||||
#if OSL_DEBUG_LEVEL > 0
|
||||
OSL_ENSURE( xContext->GetQName() == rName,
|
||||
@ -336,7 +333,7 @@ rName
|
||||
xContext->EndElement();
|
||||
|
||||
// and remove it from the stack.
|
||||
m_pContexts->pop_back();
|
||||
m_pContexts.pop_back();
|
||||
|
||||
// Get a namespace map to rewind.
|
||||
SvXMLNamespaceMap *pRewindMap = xContext->GetRewindMap();
|
||||
@ -356,9 +353,9 @@ rName
|
||||
void SAL_CALL XMLTransformerBase::characters( const OUString& rChars )
|
||||
throw(SAXException, RuntimeException, std::exception)
|
||||
{
|
||||
if( !m_pContexts->empty() )
|
||||
if( !m_pContexts.empty() )
|
||||
{
|
||||
m_pContexts->back()->Characters( rChars );
|
||||
m_pContexts.back()->Characters( rChars );
|
||||
}
|
||||
}
|
||||
|
||||
@ -852,7 +849,7 @@ XMLMutableAttributeList *XMLTransformerBase::ProcessAttrList(
|
||||
case XML_ATACTION_WRITER_BACK_GRAPHIC_TRANSPARENCY:
|
||||
{
|
||||
// determine, if it's the transparency of a document style
|
||||
XMLTransformerContext* pFirstContext = (*m_pContexts)[0].get();
|
||||
XMLTransformerContext* pFirstContext = m_pContexts[0].get();
|
||||
OUString aFirstContextLocalName;
|
||||
/* sal_uInt16 nFirstContextPrefix = */
|
||||
GetNamespaceMap().GetKeyByAttrName( pFirstContext->GetQName(),
|
||||
@ -1427,23 +1424,20 @@ XMLTokenEnum XMLTransformerBase::GetToken( const OUString& rStr ) const
|
||||
|
||||
const XMLTransformerContext *XMLTransformerBase::GetCurrentContext() const
|
||||
{
|
||||
OSL_ENSURE( !m_pContexts->empty(), "empty stack" );
|
||||
OSL_ENSURE( !m_pContexts.empty(), "empty stack" );
|
||||
|
||||
|
||||
return m_pContexts->empty() ? nullptr : m_pContexts->back().get();
|
||||
return m_pContexts.empty() ? nullptr : m_pContexts.back().get();
|
||||
}
|
||||
|
||||
const XMLTransformerContext *XMLTransformerBase::GetAncestorContext(
|
||||
sal_uInt32 n ) const
|
||||
{
|
||||
XMLTransformerContextVector::size_type nSize =
|
||||
m_pContexts->size();
|
||||
XMLTransformerContextVector::size_type nPos =
|
||||
static_cast<XMLTransformerContextVector::size_type>( n );
|
||||
auto nSize = m_pContexts.size();
|
||||
|
||||
OSL_ENSURE( nSize >nPos+2 , "invalid context" );
|
||||
OSL_ENSURE( nSize > n + 2 , "invalid context" );
|
||||
|
||||
return nSize > nPos+2 ? (*m_pContexts)[nSize-(nPos+2)].get() : nullptr;
|
||||
return nSize > n + 2 ? m_pContexts[nSize - (n + 2)].get() : nullptr;
|
||||
}
|
||||
|
||||
bool XMLTransformerBase::isWriter() const
|
||||
|
||||
@ -20,12 +20,17 @@
|
||||
#ifndef INCLUDED_XMLOFF_SOURCE_TRANSFORM_TRANSFORMERBASE_HXX
|
||||
#define INCLUDED_XMLOFF_SOURCE_TRANSFORM_TRANSFORMERBASE_HXX
|
||||
|
||||
#include <sal/config.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <com/sun/star/xml/sax/SAXParseException.hpp>
|
||||
#include <com/sun/star/xml/sax/SAXException.hpp>
|
||||
#include <com/sun/star/xml/sax/XAttributeList.hpp>
|
||||
#include <com/sun/star/xml/sax/XLocator.hpp>
|
||||
#include <com/sun/star/beans/XPropertySet.hpp>
|
||||
#include <com/sun/star/frame/XModel.hpp>
|
||||
#include <rtl/ref.hxx>
|
||||
#include <xmloff/xmltoken.hxx>
|
||||
|
||||
#include "Transformer.hxx"
|
||||
@ -36,7 +41,6 @@ namespace com { namespace sun { namespace star {
|
||||
|
||||
class SvXMLNamespaceMap;
|
||||
class XMLTransformerContext;
|
||||
class XMLTransformerContextVector;
|
||||
class XMLTransformerActions;
|
||||
struct XMLTransformerActionInit;
|
||||
struct TransformerAction_Impl;
|
||||
@ -60,7 +64,7 @@ class XMLTransformerBase : public XMLTransformer
|
||||
|
||||
SvXMLNamespaceMap *m_pNamespaceMap;
|
||||
SvXMLNamespaceMap *m_pReplaceNamespaceMap;
|
||||
XMLTransformerContextVector *m_pContexts;
|
||||
std::vector<rtl::Reference<XMLTransformerContext>> m_pContexts;
|
||||
XMLTransformerActions *m_pElemActions;
|
||||
XMLTransformerTokenMap *m_pTokenMap;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user