From 1c9bf21bee488abe83875c9fe9e31da56423a12d Mon Sep 17 00:00:00 2001 From: jp Date: Fri, 19 Jan 2001 15:45:37 +0000 Subject: new: store the forbidden characters of a language in the document --- sw/inc/doc.hxx | 22 ++++++++++++++-- sw/inc/docary.hxx | 24 +++++++++++++++-- sw/source/core/doc/docnew.cxx | 60 +++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 100 insertions(+), 6 deletions(-) diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index ec8c6c0bd64d..1459c78f49a3 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -2,9 +2,9 @@ * * $RCSfile: doc.hxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: jp $ $Date: 2000-12-21 09:27:52 $ + * last change: $Author: jp $ $Date: 2001-01-19 16:45:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -155,6 +155,7 @@ class SwFmt; class SwFmtCol; class SwFmtINetFmt; class SwFmtRefMark; +class SwForbiddenCharacterTable; class SwFrmFmt; class SwFrmFmts; class SwFtnIdxs; @@ -219,6 +220,10 @@ struct SwHash; struct SwSortOptions; struct SwDefTOXBase_Impl; +namespace com { namespace sun { namespace star { namespace i18n { + struct ForbiddenCharacters; // comes from the I18N UNO interface +}}}}; + namespace utl { class TransliterationWrapper; }; @@ -351,6 +356,9 @@ class SwDoc // like footnote/endnote in sections SwUnoCallBack *pUnoCallBack; + + SwForbiddenCharacterTable* pForbiddenCharsTbl; // table of forbidden + // characters of this document // ------------------------------------------------------------------- // sonstige sal_uInt16 nUndoPos; // akt. Undo-InsertPosition (fuers Redo!) @@ -1733,6 +1741,16 @@ public: sal_Bool ContainsMSVBasic() const { return bContains_MSVBasic; } void SetContainsMSVBasic( sal_Bool bFlag ) { bContains_MSVBasic = bFlag; } + // Interface for the forbidden characters of any asian/.. languages + const com::sun::star::i18n:: + ForbiddenCharacters* GetForbiddenCharacters( ULONG nLang, + BOOL bLocaleData ) const; + void SetForbiddenCharacters( ULONG nLang, + const com::sun::star::i18n::ForbiddenCharacters& ); + void ClearForbiddenCharacters( ULONG nLang ); + const SwForbiddenCharacterTable* GetForbiddenCharacterTbl() const + { return pForbiddenCharsTbl; } + // ------------------- Zugriff auf Dummy-Member -------------------- sal_Bool IsParaSpaceMax() const { return n8Dummy1 & DUMMY_PARASPACEMAX; } diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx index d904c90b1cdc..a0fa7137cf21 100644 --- a/sw/inc/docary.hxx +++ b/sw/inc/docary.hxx @@ -2,9 +2,9 @@ * * $RCSfile: docary.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 17:14:25 $ + * last change: $Author: jp $ $Date: 2001-01-19 16:45:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -73,6 +73,14 @@ class SwRedline; class SwUnoCrsr; class SwOLENode; +namespace com { namespace sun { namespace star { namespace i18n { + struct ForbiddenCharacters; // comes from the I18N UNO interface +}}}}; + +#ifndef _TABLE_HXX //autogen +#include +#endif + #ifndef _SWTYPES_HXX //autogen #include #endif @@ -163,4 +171,16 @@ typedef SwOLENode* SwOLENodePtr; SV_DECL_PTRARR(SwOLENodes,SwOLENodePtr,16,16) +DECLARE_TABLE( _SwForbiddenCharacterTable_Impl, + com::sun::star::i18n::ForbiddenCharacters* ) + +class SwForbiddenCharacterTable : public _SwForbiddenCharacterTable_Impl +{ +public: + SwForbiddenCharacterTable( USHORT nISize = 4, USHORT nGrow = 4 ) + : _SwForbiddenCharacterTable_Impl( nISize, nGrow ) + {} + ~SwForbiddenCharacterTable(); +}; + #endif //_DOCARY_HXX diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 6f28781d8165..631477ea8940 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -2,9 +2,9 @@ * * $RCSfile: docnew.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: ama $ $Date: 2000-12-06 12:24:14 $ + * last change: $Author: jp $ $Date: 2001-01-19 16:45:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -67,6 +67,10 @@ #define ROLBCK_HISTORY_ONLY // Der Kampf gegen die CLOOK's +#ifndef _COM_SUN_STAR_I18N_FORBIDDENCHARACTERS_HDL_ +#include +#endif + #ifndef _SFX_PRINTER_HXX //autogen #include #endif @@ -193,6 +197,9 @@ #ifndef _UNOCLBCK_HXX #include #endif +#ifndef _BREAKIT_HXX +#include +#endif #ifndef _CMDID_H #include // fuer den dflt - Printer in SetJob @@ -288,6 +295,7 @@ SwDoc::SwDoc() : pPgPViewPrtData( 0 ), pAutoFmtRedlnComment( 0 ), pUnoCallBack(new SwUnoCallBack(0)), + pForbiddenCharsTbl( 0 ), nAutoFmtRedlnCommentNo( 0 ), nLatin_CJK( 0 ), nLatin_CTL( 0 ), nCJK_CTL( 0 ), n32Dummy1( 0 ), n32Dummy2( 0 ), n8Dummy1( 0 ), n8Dummy2( 0 ), @@ -574,6 +582,8 @@ SwDoc::~SwDoc() // dieser immer gesetzt ist. DELETEZ( pLinkMgr ); + delete pForbiddenCharsTbl; + //Tables vor dem loeschen der Defaults leeren, sonst GPF wegen Def-Abhaengigen. //Die Arrays sollten (wegen includes) bei Gelegenheit auch zu Pointern werden. delete pFrmFmtTbl; @@ -790,6 +800,7 @@ void SwDoc::ClearDoc() pCharFmtTbl->DeleteAndDestroy( 1, pCharFmtTbl->Count()-1 ); ReleaseDrawModel(); + delete pForbiddenCharsTbl, pForbiddenCharsTbl = 0; pFldTypes->DeleteAndDestroy( INIT_FLDTYPES, pFldTypes->Count() - INIT_FLDTYPES ); @@ -821,6 +832,51 @@ SwModify* SwDoc::GetUnoCallBack() const return pUnoCallBack; } +/* ------------------------------------------------------------------------*/ +const com::sun::star::i18n:: + ForbiddenCharacters* SwDoc::GetForbiddenCharacters( ULONG nLang, + BOOL bLocaleData ) const +{ + const com::sun::star::i18n::ForbiddenCharacters* pRet = 0; + if( pForbiddenCharsTbl ) + pRet = pForbiddenCharsTbl->Get( nLang ); + if( bLocaleData && !pRet && pBreakIt ) + pRet = &pBreakIt->GetForbidden( (LanguageType)nLang ); + return pRet; +} +void SwDoc::SetForbiddenCharacters( ULONG nLang, + const com::sun::star::i18n::ForbiddenCharacters& rFChars ) +{ + if( !pForbiddenCharsTbl ) + pForbiddenCharsTbl = new SwForbiddenCharacterTable; + com::sun::star::i18n::ForbiddenCharacters* pOld = + pForbiddenCharsTbl->Get( nLang ); + if( !pOld ) + pForbiddenCharsTbl->Insert( nLang, + new com::sun::star::i18n::ForbiddenCharacters( rFChars ) ); + else + *pOld = rFChars; +} + +void SwDoc::ClearForbiddenCharacters( ULONG nLang ) +{ + if( pForbiddenCharsTbl ) + { + com::sun::star::i18n::ForbiddenCharacters* pDel = + pForbiddenCharsTbl->Remove( nLang ); + if( pDel ) + delete pDel; + if( !pForbiddenCharsTbl->Count() ) + delete pForbiddenCharsTbl, pForbiddenCharsTbl = 0; + } +} + +SwForbiddenCharacterTable::~SwForbiddenCharacterTable() +{ + for( com::sun::star::i18n::ForbiddenCharacters* pDel = First(); + pDel; pDel = Next() ) + delete pDel; +} -- cgit v1.2.3