Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <SvXMLAutoCorrectExport.hxx>
30 : :
31 : : #include <com/sun/star/util/MeasureUnit.hpp>
32 : : #include <xmloff/xmltoken.hxx>
33 : :
34 : : using namespace ::com::sun::star::uno;
35 : : using namespace ::com::sun::star;
36 : : using namespace ::xmloff::token;
37 : : using namespace ::rtl;
38 : :
39 : 0 : SvXMLAutoCorrectExport::SvXMLAutoCorrectExport(
40 : : const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
41 : : const SvxAutocorrWordList * pNewAutocorr_List,
42 : : const rtl::OUString &rFileName,
43 : : com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler> &rHandler)
44 : : : SvXMLExport( xServiceFactory, rFileName, util::MeasureUnit::CM, rHandler ),
45 : 0 : pAutocorr_List( pNewAutocorr_List )
46 : : {
47 [ # # ]: 0 : _GetNamespaceMap().Add( GetXMLToken ( XML_NP_BLOCK_LIST),
48 [ # # ]: 0 : GetXMLToken ( XML_N_BLOCK_LIST ),
49 [ # # ]: 0 : XML_NAMESPACE_BLOCKLIST );
50 : 0 : }
51 : :
52 : 0 : sal_uInt32 SvXMLAutoCorrectExport::exportDoc(enum XMLTokenEnum /*eClass*/)
53 : : {
54 : 0 : GetDocHandler()->startDocument();
55 : :
56 : 0 : addChaffWhenEncryptedStorage();
57 : :
58 : : AddAttribute ( XML_NAMESPACE_NONE,
59 : 0 : _GetNamespaceMap().GetAttrNameByKey ( XML_NAMESPACE_BLOCKLIST ),
60 [ # # ]: 0 : _GetNamespaceMap().GetNameByKey ( XML_NAMESPACE_BLOCKLIST ) );
61 : : {
62 [ # # ]: 0 : SvXMLElementExport aRoot (*this, XML_NAMESPACE_BLOCKLIST, XML_BLOCK_LIST, sal_True, sal_True);
63 [ # # ][ # # ]: 0 : for ( SvxAutocorrWordList::const_iterator it = pAutocorr_List->begin(); it != pAutocorr_List->end(); ++it )
[ # # ]
64 : : {
65 [ # # ]: 0 : const SvxAutocorrWord* p = *it;
66 : :
67 : : AddAttribute( XML_NAMESPACE_BLOCKLIST,
68 : : XML_ABBREVIATED_NAME,
69 [ # # ][ # # ]: 0 : OUString(p->GetShort()));
70 : : AddAttribute( XML_NAMESPACE_BLOCKLIST,
71 : : XML_NAME,
72 [ # # ][ # # ]: 0 : OUString(p->IsTextOnly() ? p->GetLong() : p->GetShort()));
[ # # ]
73 : :
74 [ # # ]: 0 : SvXMLElementExport aBlock( *this, XML_NAMESPACE_BLOCKLIST, XML_BLOCK, sal_True, sal_True);
75 [ # # ][ # # ]: 0 : }
76 : : }
77 : 0 : GetDocHandler()->endDocument();
78 : 0 : return 0;
79 : : }
80 : :
81 : 0 : SvXMLExceptionListExport::SvXMLExceptionListExport(
82 : : const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
83 : : const SvStringsISortDtor &rNewList,
84 : : const rtl::OUString &rFileName,
85 : : com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler> &rHandler)
86 : : : SvXMLExport( xServiceFactory, rFileName, util::MeasureUnit::CM, rHandler ),
87 : 0 : rList( rNewList )
88 : : {
89 [ # # ]: 0 : _GetNamespaceMap().Add( GetXMLToken ( XML_NP_BLOCK_LIST ),
90 [ # # ]: 0 : GetXMLToken ( XML_N_BLOCK_LIST ),
91 [ # # ]: 0 : XML_NAMESPACE_BLOCKLIST );
92 : 0 : }
93 : :
94 : 0 : sal_uInt32 SvXMLExceptionListExport::exportDoc(enum XMLTokenEnum /*eClass*/)
95 : : {
96 : 0 : GetDocHandler()->startDocument();
97 : :
98 : 0 : addChaffWhenEncryptedStorage();
99 : :
100 : : AddAttribute ( XML_NAMESPACE_NONE,
101 : 0 : _GetNamespaceMap().GetAttrNameByKey ( XML_NAMESPACE_BLOCKLIST ),
102 [ # # ]: 0 : _GetNamespaceMap().GetNameByKey ( XML_NAMESPACE_BLOCKLIST ) );
103 : : {
104 [ # # ]: 0 : SvXMLElementExport aRoot (*this, XML_NAMESPACE_BLOCKLIST, XML_BLOCK_LIST, sal_True, sal_True);
105 : 0 : sal_uInt16 nBlocks= rList.size();
106 [ # # ]: 0 : for ( sal_uInt16 i = 0; i < nBlocks; i++)
107 : : {
108 : : AddAttribute( XML_NAMESPACE_BLOCKLIST,
109 : : XML_ABBREVIATED_NAME,
110 [ # # ][ # # ]: 0 : OUString( *rList[i] ) );
[ # # ]
111 [ # # ]: 0 : SvXMLElementExport aBlock( *this, XML_NAMESPACE_BLOCKLIST, XML_BLOCK, sal_True, sal_True);
112 [ # # ][ # # ]: 0 : }
113 : : }
114 : 0 : GetDocHandler()->endDocument();
115 : 0 : return 0;
116 : : }
117 : :
118 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|