1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
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.
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).
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.
27 ************************************************************************/
29 #ifndef _GSICHECK_HXX_
30 #define _GSICHECK_HXX_
32 #include "sal/config.h"
37 #include "tagtest.hxx"
42 enum LineFormat
{ FORMAT_SDF
, FORMAT_UNKNOWN
};
47 ParserMessageList aMessages
;
49 std::size_t nLineNumber
;
52 rtl::OString aLineType
;
55 rtl::OString aQuickHelpText
;
61 void ReassembleLine();
66 GSILine( const rtl::OString
&rLine
, std::size_t nLine
);
67 LineFormat
GetLineFormat() const { return aFormat
; }
68 std::size_t GetLineNumber() const { return nLineNumber
; }
70 rtl::OString
const GetUniqId() const { return aUniqId
; }
71 rtl::OString
const GetLineType() const { return aLineType
; }
72 rtl::OString
const GetLanguageId() const { return aLangId
; }
73 rtl::OString
const GetText() const { return aText
; }
74 rtl::OUString
const GetUText() const { return rtl::OStringToOUString( aText
, RTL_TEXTENCODING_UTF8
); }
75 rtl::OString
const GetQuickHelpText() const { return aQuickHelpText
; }
76 rtl::OString
const GetTitle() const { return aTitle
; }
78 void SetUText( rtl::OUString
const &aNew
) { aText
= rtl::OUStringToOString(aNew
, RTL_TEXTENCODING_UTF8
); ReassembleLine(); }
79 void SetText( rtl::OString
const &aNew
) { aText
= aNew
; ReassembleLine(); }
80 void SetQuickHelpText( rtl::OString
const &aNew
) { aQuickHelpText
= aNew
; ReassembleLine(); }
81 void SetTitle( rtl::OString
const &aNew
) { aTitle
= aNew
; ReassembleLine(); }
83 ParserMessageList
* GetMessageList() { return &aMessages
; };
84 sal_Bool
HasMessages(){ return ( aMessages
.size() > 0 ); };
86 sal_Bool
IsOK() const { return bOK
; }
89 sal_Bool
IsFixed() const { return bFixed
; }
90 void SetFixed() { bFixed
= sal_True
; };
97 typedef std::vector
< GSILine
* > GSIBlock_Impl
;
104 GSIBlock_Impl maList
;
105 GSILine
*pSourceLine
;
106 GSILine
*pReferenceLine
;
107 void PrintList( ParserMessageList
*pList
, rtl::OString
const & aPrefix
, GSILine
*pLine
);
108 sal_Bool bPrintContext
;
109 sal_Bool bCheckSourceLang
;
110 sal_Bool bCheckTranslationLang
;
112 sal_Bool bAllowSuspicious
;
114 sal_Bool bHasBlockError
;
116 sal_Bool
IsUTF8( const rtl::OString
&aTestee
, sal_Bool bFixTags
, sal_Int32
&nErrorPos
, rtl::OString
&aErrorMsg
, sal_Bool
&bHasBeenFixed
, rtl::OString
&aFixed
) const;
117 sal_Bool
TestUTF8( GSILine
* pTestee
, sal_Bool bFixTags
);
118 sal_Bool
HasSuspiciousChars( GSILine
* pTestee
, GSILine
* pSource
);
121 GSIBlock( sal_Bool PbPrintContext
, sal_Bool bSource
, sal_Bool bTrans
, sal_Bool bRef
, sal_Bool bAllowSusp
);
123 void PrintMessage( rtl::OString
const & aType
, rtl::OString
const & aMsg
, rtl::OString
const & aPrefix
, rtl::OString
const & aContext
, std::size_t nLine
, rtl::OString
const & aUniqueId
= rtl::OString() );
124 void PrintError( rtl::OString
const & aMsg
, rtl::OString
const & aPrefix
, rtl::OString
const & aContext
, std::size_t nLine
, rtl::OString
const & aUniqueId
= rtl::OString() );
125 void InsertLine( GSILine
* pLine
, const rtl::OString
&rSourceLang
);
126 void SetReferenceLine( GSILine
* pLine
);
127 sal_Bool
CheckSyntax( std::size_t nLine
, sal_Bool bRequireSourceLine
, sal_Bool bFixTags
);
129 void WriteError( LazyStream
&aErrOut
, sal_Bool bRequireSourceLine
);
130 void WriteCorrect( LazyStream
&aOkOut
, sal_Bool bRequireSourceLine
);
131 void WriteFixed( LazyStream
&aFixOut
);
136 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */