diff options
author | Tor Lillqvist <tml@collabora.com> | 2013-09-16 15:59:35 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2013-09-16 18:32:36 +0300 |
commit | 2770de8b66e2f2a628ad0b6b00a66002c26b3cd7 (patch) | |
tree | b87d5b828821d9c45da3212a96470e658ab97408 | |
parent | 4b139b8d939376be2f6e5ca3568b0ec875a3f834 (diff) |
Insert impastp3.cxx into impastpl.cxx
Change-Id: I8038a724d79a81ac5502f926f8b8f19e2a277e74
-rw-r--r-- | xmloff/Library_xo.mk | 1 | ||||
-rw-r--r-- | xmloff/source/style/impastp3.cxx | 143 | ||||
-rw-r--r-- | xmloff/source/style/impastpl.cxx | 122 |
3 files changed, 121 insertions, 145 deletions
diff --git a/xmloff/Library_xo.mk b/xmloff/Library_xo.mk index 66bbb147fe09..d2d52a7d629f 100644 --- a/xmloff/Library_xo.mk +++ b/xmloff/Library_xo.mk @@ -247,7 +247,6 @@ $(eval $(call gb_Library_add_exception_objects,xo,\ xmloff/source/style/escphdl \ xmloff/source/style/fonthdl \ xmloff/source/style/impastpl \ - xmloff/source/style/impastp3 \ xmloff/source/style/impastp4 \ xmloff/source/style/kernihdl \ xmloff/source/style/lspachdl \ diff --git a/xmloff/source/style/impastp3.cxx b/xmloff/source/style/impastp3.cxx deleted file mode 100644 index 589d7e39e10b..000000000000 --- a/xmloff/source/style/impastp3.cxx +++ /dev/null @@ -1,143 +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 . - */ - -#include "impastpl.hxx" -#include <xmloff/xmlprmap.hxx> - -using namespace std; - -XMLAutoStylePoolParent::~XMLAutoStylePoolParent() -{ -} - -// Adds a array of XMLPropertyState ( vector< XMLPropertyState > ) to list -// if not added, yet. - -sal_Bool XMLAutoStylePoolParent::Add( XMLAutoStyleFamily& rFamilyData, const vector< XMLPropertyState >& rProperties, OUString& rName, bool bDontSeek ) -{ - sal_Bool bAdded = sal_False; - XMLAutoStylePoolProperties *pProperties = 0; - sal_Int32 nProperties = rProperties.size(); - size_t i = 0; - for (size_t n = maPropertiesList.size(); i < n; ++i) - { - XMLAutoStylePoolProperties* pIS = &maPropertiesList[i]; - if( nProperties > (sal_Int32)pIS->GetProperties().size() ) - { - continue; - } - else if( nProperties < (sal_Int32)pIS->GetProperties().size() ) - { - break; - } - else if( !bDontSeek && rFamilyData.mxMapper->Equals( pIS->GetProperties(), rProperties ) ) - { - pProperties = pIS; - break; - } - } - - if( !pProperties ) - { - pProperties = new XMLAutoStylePoolProperties( rFamilyData, rProperties ); - PropertiesListType::iterator it = maPropertiesList.begin(); - ::std::advance( it, i ); - maPropertiesList.insert( it, pProperties ); - bAdded = sal_True; - } - - rName = pProperties->GetName(); - - return bAdded; -} - -// -// Adds a array of XMLPropertyState ( vector< XMLPropertyState > ) with a given name. -// If the name exists already, nothing is done. If a style with a different name and -// the same properties exists, a new one is added (like with bDontSeek). -// - -sal_Bool XMLAutoStylePoolParent::AddNamed( XMLAutoStyleFamily& rFamilyData, const vector< XMLPropertyState >& rProperties, const OUString& rName ) -{ - sal_Bool bAdded = sal_False; - sal_Int32 nProperties = rProperties.size(); - size_t i = 0; - for (size_t n = maPropertiesList.size(); i < n; ++i) - { - XMLAutoStylePoolProperties* pIS = &maPropertiesList[i]; - if( nProperties > (sal_Int32)pIS->GetProperties().size() ) - { - continue; - } - else if( nProperties < (sal_Int32)pIS->GetProperties().size() ) - { - break; - } - } - - if (rFamilyData.maNameList.find(rName) == rFamilyData.maNameList.end()) - { - XMLAutoStylePoolProperties* pProperties = - new XMLAutoStylePoolProperties( rFamilyData, rProperties ); - // ignore the generated name - pProperties->SetName( rName ); - PropertiesListType::iterator it = maPropertiesList.begin(); - ::std::advance( it, i ); - maPropertiesList.insert( it, pProperties ); - bAdded = sal_True; - } - - return bAdded; -} - -// -// Search for a array of XMLPropertyState ( vector< XMLPropertyState > ) in list -// - -OUString XMLAutoStylePoolParent::Find( const XMLAutoStyleFamily& rFamilyData, const vector< XMLPropertyState >& rProperties ) const -{ - OUString sName; - vector< XMLPropertyState>::size_type nItems = rProperties.size(); - for (size_t i = 0, n = maPropertiesList.size(); i < n; ++i) - { - const XMLAutoStylePoolProperties* pIS = &maPropertiesList[i]; - if( nItems > pIS->GetProperties().size() ) - { - continue; - } - else if( nItems < pIS->GetProperties().size() ) - { - break; - } - else if( rFamilyData.mxMapper->Equals( pIS->GetProperties(), rProperties ) ) - { - sName = pIS->GetName(); - break; - } - } - - return sName; -} - -bool XMLAutoStylePoolParent::operator< (const XMLAutoStylePoolParent& rOther) const -{ - return msParent < rOther.msParent; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/style/impastpl.cxx b/xmloff/source/style/impastpl.cxx index fce37ef4cd48..608575f839fc 100644 --- a/xmloff/source/style/impastpl.cxx +++ b/xmloff/source/style/impastpl.cxx @@ -17,8 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <tools/debug.hxx> #include <rtl/ustrbuf.hxx> +#include <tools/debug.hxx> +#include <xmloff/xmlprmap.hxx> #include "impastpl.hxx" @@ -72,4 +73,123 @@ bool operator<( const XMLAutoStyleFamily& r1, const XMLAutoStyleFamily& r2) return r1.mnFamily < r2.mnFamily; } + +XMLAutoStylePoolParent::~XMLAutoStylePoolParent() +{ +} + +// Adds a array of XMLPropertyState ( vector< XMLPropertyState > ) to list +// if not added, yet. + +sal_Bool XMLAutoStylePoolParent::Add( XMLAutoStyleFamily& rFamilyData, const vector< XMLPropertyState >& rProperties, OUString& rName, bool bDontSeek ) +{ + sal_Bool bAdded = sal_False; + XMLAutoStylePoolProperties *pProperties = 0; + sal_Int32 nProperties = rProperties.size(); + size_t i = 0; + for (size_t n = maPropertiesList.size(); i < n; ++i) + { + XMLAutoStylePoolProperties* pIS = &maPropertiesList[i]; + if( nProperties > (sal_Int32)pIS->GetProperties().size() ) + { + continue; + } + else if( nProperties < (sal_Int32)pIS->GetProperties().size() ) + { + break; + } + else if( !bDontSeek && rFamilyData.mxMapper->Equals( pIS->GetProperties(), rProperties ) ) + { + pProperties = pIS; + break; + } + } + + if( !pProperties ) + { + pProperties = new XMLAutoStylePoolProperties( rFamilyData, rProperties ); + PropertiesListType::iterator it = maPropertiesList.begin(); + ::std::advance( it, i ); + maPropertiesList.insert( it, pProperties ); + bAdded = sal_True; + } + + rName = pProperties->GetName(); + + return bAdded; +} + +// +// Adds a array of XMLPropertyState ( vector< XMLPropertyState > ) with a given name. +// If the name exists already, nothing is done. If a style with a different name and +// the same properties exists, a new one is added (like with bDontSeek). +// + +sal_Bool XMLAutoStylePoolParent::AddNamed( XMLAutoStyleFamily& rFamilyData, const vector< XMLPropertyState >& rProperties, const OUString& rName ) +{ + sal_Bool bAdded = sal_False; + sal_Int32 nProperties = rProperties.size(); + size_t i = 0; + for (size_t n = maPropertiesList.size(); i < n; ++i) + { + XMLAutoStylePoolProperties* pIS = &maPropertiesList[i]; + if( nProperties > (sal_Int32)pIS->GetProperties().size() ) + { + continue; + } + else if( nProperties < (sal_Int32)pIS->GetProperties().size() ) + { + break; + } + } + + if (rFamilyData.maNameList.find(rName) == rFamilyData.maNameList.end()) + { + XMLAutoStylePoolProperties* pProperties = + new XMLAutoStylePoolProperties( rFamilyData, rProperties ); + // ignore the generated name + pProperties->SetName( rName ); + PropertiesListType::iterator it = maPropertiesList.begin(); + ::std::advance( it, i ); + maPropertiesList.insert( it, pProperties ); + bAdded = sal_True; + } + + return bAdded; +} + +// +// Search for a array of XMLPropertyState ( vector< XMLPropertyState > ) in list +// + +OUString XMLAutoStylePoolParent::Find( const XMLAutoStyleFamily& rFamilyData, const vector< XMLPropertyState >& rProperties ) const +{ + OUString sName; + vector< XMLPropertyState>::size_type nItems = rProperties.size(); + for (size_t i = 0, n = maPropertiesList.size(); i < n; ++i) + { + const XMLAutoStylePoolProperties* pIS = &maPropertiesList[i]; + if( nItems > pIS->GetProperties().size() ) + { + continue; + } + else if( nItems < pIS->GetProperties().size() ) + { + break; + } + else if( rFamilyData.mxMapper->Equals( pIS->GetProperties(), rProperties ) ) + { + sName = pIS->GetName(); + break; + } + } + + return sName; +} + +bool XMLAutoStylePoolParent::operator< (const XMLAutoStylePoolParent& rOther) const +{ + return msParent < rOther.msParent; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |