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: forbiddencharacterstable.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_svx.hxx"
34 #include <forbiddencharacterstable.hxx>
36 #include <unotools/localedatawrapper.hxx>
37 #include <unolingu.hxx>
39 #ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
40 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
43 SvxForbiddenCharactersTable::SvxForbiddenCharactersTable( ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> xMSF
, USHORT nISize
, USHORT nGrow
)
44 : SvxForbiddenCharactersTableImpl( nISize
, nGrow
)
50 SvxForbiddenCharactersTable::~SvxForbiddenCharactersTable()
52 for ( ULONG n
= Count(); n
; )
53 delete GetObject( --n
);
58 const com::sun::star::i18n::ForbiddenCharacters
* SvxForbiddenCharactersTable::GetForbiddenCharacters( USHORT nLanguage
, BOOL bGetDefault
) const
60 ForbiddenCharactersInfo
* pInf
= Get( nLanguage
);
61 if ( !pInf
&& bGetDefault
&& mxMSF
.is() )
63 const SvxForbiddenCharactersTableImpl
*pConstImpl
= dynamic_cast<const SvxForbiddenCharactersTableImpl
*>(this);
64 SvxForbiddenCharactersTableImpl
* pImpl
= const_cast<SvxForbiddenCharactersTableImpl
*>(pConstImpl
);
65 pInf
= new ForbiddenCharactersInfo
;
66 pImpl
->Insert( nLanguage
, pInf
);
68 pInf
->bTemporary
= TRUE
;
69 LocaleDataWrapper
aWrapper( mxMSF
, SvxCreateLocale( nLanguage
) );
70 pInf
->aForbiddenChars
= aWrapper
.getForbiddenCharacters();
72 return pInf
? &pInf
->aForbiddenChars
: NULL
;
77 void SvxForbiddenCharactersTable::SetForbiddenCharacters( USHORT nLanguage
, const com::sun::star::i18n::ForbiddenCharacters
& rForbiddenChars
)
79 ForbiddenCharactersInfo
* pInf
= Get( nLanguage
);
82 pInf
= new ForbiddenCharactersInfo
;
83 Insert( nLanguage
, pInf
);
85 pInf
->bTemporary
= FALSE
;
86 pInf
->aForbiddenChars
= rForbiddenChars
;
89 void SvxForbiddenCharactersTable::ClearForbiddenCharacters( USHORT nLanguage
)
91 ForbiddenCharactersInfo
* pInf
= Get( nLanguage
);