Update ooo320-m1
[ooovba.git] / svx / source / editeng / SvXMLAutoCorrectExport.cxx
blob460212a11266b94cee1292ef2b999204742e500e
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: SvXMLAutoCorrectExport.cxx,v $
10 * $Revision: 1.9 $
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_svx.hxx"
33 #include <SvXMLAutoCorrectExport.hxx>
34 #define _SVSTDARR_STRINGSISORTDTOR
35 #define _SVSTDARR_STRINGSDTOR
36 #include <svtools/svstdarr.hxx>
37 #include <xmloff/xmltoken.hxx>
39 using namespace ::com::sun::star::uno;
40 using namespace ::com::sun::star;
41 using namespace ::xmloff::token;
42 using namespace ::rtl;
44 // #110680#
45 SvXMLAutoCorrectExport::SvXMLAutoCorrectExport(
46 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
47 const SvxAutocorrWordList * pNewAutocorr_List,
48 const rtl::OUString &rFileName,
49 com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler> &rHandler)
50 : SvXMLExport( xServiceFactory, rFileName, rHandler ),
51 pAutocorr_List( pNewAutocorr_List )
53 _GetNamespaceMap().Add( GetXMLToken ( XML_NP_BLOCK_LIST),
54 GetXMLToken ( XML_N_BLOCK_LIST ),
55 XML_NAMESPACE_BLOCKLIST );
58 sal_uInt32 SvXMLAutoCorrectExport::exportDoc(enum XMLTokenEnum /*eClass*/)
60 GetDocHandler()->startDocument();
62 AddAttribute ( XML_NAMESPACE_NONE,
63 _GetNamespaceMap().GetAttrNameByKey ( XML_NAMESPACE_BLOCKLIST ),
64 _GetNamespaceMap().GetNameByKey ( XML_NAMESPACE_BLOCKLIST ) );
66 SvXMLElementExport aRoot (*this, XML_NAMESPACE_BLOCKLIST, XML_BLOCK_LIST, sal_True, sal_True);
67 sal_uInt16 nBlocks= pAutocorr_List->Count();
68 for ( sal_uInt16 i = 0; i < nBlocks; i++)
70 SvxAutocorrWord* p = pAutocorr_List->GetObject(i);
72 AddAttribute( XML_NAMESPACE_BLOCKLIST,
73 XML_ABBREVIATED_NAME,
74 OUString(p->GetShort()));
75 AddAttribute( XML_NAMESPACE_BLOCKLIST,
76 XML_NAME,
77 OUString(p->IsTextOnly() ? p->GetLong() : p->GetShort()));
79 SvXMLElementExport aBlock( *this, XML_NAMESPACE_BLOCKLIST, XML_BLOCK, sal_True, sal_True);
82 GetDocHandler()->endDocument();
83 return 0;
86 // #110680#
87 SvXMLExceptionListExport::SvXMLExceptionListExport(
88 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
89 const SvStringsISortDtor &rNewList,
90 const rtl::OUString &rFileName,
91 com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler> &rHandler)
92 : SvXMLExport( xServiceFactory, rFileName, rHandler ),
93 rList( rNewList )
95 _GetNamespaceMap().Add( GetXMLToken ( XML_NP_BLOCK_LIST ),
96 GetXMLToken ( XML_N_BLOCK_LIST ),
97 XML_NAMESPACE_BLOCKLIST );
100 sal_uInt32 SvXMLExceptionListExport::exportDoc(enum XMLTokenEnum /*eClass*/)
102 GetDocHandler()->startDocument();
104 AddAttribute ( XML_NAMESPACE_NONE,
105 _GetNamespaceMap().GetAttrNameByKey ( XML_NAMESPACE_BLOCKLIST ),
106 _GetNamespaceMap().GetNameByKey ( XML_NAMESPACE_BLOCKLIST ) );
108 SvXMLElementExport aRoot (*this, XML_NAMESPACE_BLOCKLIST, XML_BLOCK_LIST, sal_True, sal_True);
109 sal_uInt16 nBlocks= rList.Count();
110 for ( sal_uInt16 i = 0; i < nBlocks; i++)
112 AddAttribute( XML_NAMESPACE_BLOCKLIST,
113 XML_ABBREVIATED_NAME,
114 OUString( *rList[i] ) );
115 SvXMLElementExport aBlock( *this, XML_NAMESPACE_BLOCKLIST, XML_BLOCK, sal_True, sal_True);
118 GetDocHandler()->endDocument();
119 return 0;