1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: impastp1.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_xmloff.hxx"
33 #include <tools/debug.hxx>
34 #include "impastpl.hxx"
38 //#############################################################################
40 // Class XMLFamilyData_Impl
43 ///////////////////////////////////////////////////////////////////////////////
45 // ctor/dtor class XMLFamilyData_Impl
48 XMLFamilyData_Impl::XMLFamilyData_Impl(
50 const ::rtl::OUString
& rStrName
,
51 const UniReference
< SvXMLExportPropertyMapper
> &rMapper
,
52 const OUString
& rStrPrefix
,
54 : pCache( 0 ), mnFamily( nFamily
), maStrFamilyName( rStrName
), mxMapper( rMapper
),
55 mnCount( 0 ), mnName( 0 ), maStrPrefix( rStrPrefix
), bAsFamily( bAsFam
)
58 mpParentList
= new SvXMLAutoStylePoolParentsP_Impl( 5, 5 );
59 mpNameList
= new SvXMLAutoStylePoolNamesP_Impl( 5, 5 );
62 XMLFamilyData_Impl::~XMLFamilyData_Impl()
64 if( mpParentList
) delete mpParentList
;
65 if( mpNameList
) delete mpNameList
;
66 DBG_ASSERT( !pCache
|| !pCache
->Count(),
67 "auto style pool cache is not empty!" );
70 while( pCache
->Count() )
71 delete pCache
->Remove( 0UL );
75 void XMLFamilyData_Impl::ClearEntries()
79 mpParentList
= new SvXMLAutoStylePoolParentsP_Impl( 5, 5 );
80 DBG_ASSERT( !pCache
|| !pCache
->Count(),
81 "auto style pool cache is not empty!" );
84 while( pCache
->Count() )
85 delete pCache
->Remove( 0UL );
89 ///////////////////////////////////////////////////////////////////////////////
91 // friendfunction of class XMLFamilyData_Impl for sorting listelements
94 int XMLFamilyDataSort_Impl( const XMLFamilyData_Impl
& r1
, const XMLFamilyData_Impl
& r2
)
98 if( r1
.mnFamily
!= r2
.mnFamily
)
99 nRet
= ( r1
.mnFamily
> r2
.mnFamily
? 1 : -1 );
104 ///////////////////////////////////////////////////////////////////////////////
106 // Implementation of sorted list of XMLFamilyData_Impl - elements
109 IMPL_CONTAINER_SORT( XMLFamilyDataList_Impl
, XMLFamilyData_Impl
, XMLFamilyDataSort_Impl
)
111 //#############################################################################
113 // Sorted list of OUString - elements
116 ///////////////////////////////////////////////////////////////////////////////
118 // Sort-function for OUString-list
121 int SvXMLAutoStylePoolNamesPCmp_Impl( const OUString
& r1
,
124 return (int)r1
.compareTo( r2
);
127 ///////////////////////////////////////////////////////////////////////////////
129 // Implementation of sorted OUString-list
132 IMPL_CONTAINER_SORT( SvXMLAutoStylePoolNamesP_Impl
,
134 SvXMLAutoStylePoolNamesPCmp_Impl
)