diff options
author | Rüdiger Timm <rt@openoffice.org> | 2008-12-15 12:01:46 +0000 |
---|---|---|
committer | Rüdiger Timm <rt@openoffice.org> | 2008-12-15 12:01:46 +0000 |
commit | 3e3396189e2acd863096376ad39e8a59aff47e7e (patch) | |
tree | 2c2f7cfc3442020ed55ba6a0bc3cbd521aadb508 /sw | |
parent | d6b3e99927528cd5ad313b36835abd287996519e (diff) |
CWS-TOOLING: integrate CWS tl56_DEV300
Diffstat (limited to 'sw')
61 files changed, 970 insertions, 646 deletions
diff --git a/sw/inc/dlelstnr.hxx b/sw/inc/dlelstnr.hxx index da84ab31d7c6..0fa2063e1d72 100644 --- a/sw/inc/dlelstnr.hxx +++ b/sw/inc/dlelstnr.hxx @@ -43,7 +43,7 @@ namespace com { namespace sun { namespace star { namespace linguistic2 { class XDictionaryList; class XLinguServiceManager; - class XGrammarCheckingIterator; + class XProofreadingIterator; } namespace frame { class XTerminateListener; @@ -69,7 +69,7 @@ class SwLinguServiceEventListener : com::sun::star::uno::Reference< com::sun::star::linguistic2::XLinguServiceManager > xLngSvcMgr; com::sun::star::uno::Reference< - com::sun::star::linguistic2::XGrammarCheckingIterator > xGCIterator; + com::sun::star::linguistic2::XProofreadingIterator > xGCIterator; // disallow use of copy-constructor and assignment operator SwLinguServiceEventListener(const SwLinguServiceEventListener &); diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index b03fbadaa681..dcc17451454f 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -106,7 +106,7 @@ class SwList; #include <svx/numitem.hxx> #include "comphelper/implementationreference.hxx" #include <com/sun/star/chart2/data/XDataProvider.hpp> -#include <com/sun/star/linguistic2/XGrammarCheckingIterator.hpp> +#include <com/sun/star/linguistic2/XProofreadingIterator.hpp> #include <hash_map> #include <stringhash.hxx> @@ -317,7 +317,7 @@ class SwDoc : SvStringsDtor aPatternNms; // Array fuer die Namen der Dokument-Vorlagen com::sun::star::uno::Reference<com::sun::star::container::XNameContainer> xXForms; // container with XForms models - mutable com::sun::star::uno::Reference< com::sun::star::linguistic2::XGrammarCheckingIterator > m_xGCIterator; + mutable com::sun::star::uno::Reference< com::sun::star::linguistic2::XProofreadingIterator > m_xGCIterator; // ------------------------------------------------------------------- // die Pointer @@ -2074,7 +2074,7 @@ public: com::sun::star::uno::Reference<com::sun::star::container::XNameContainer> getXForms() const; - com::sun::star::uno::Reference< com::sun::star::linguistic2::XGrammarCheckingIterator > GetGCIterator() const; + com::sun::star::uno::Reference< com::sun::star::linguistic2::XProofreadingIterator > GetGCIterator() const; /// is this an XForms document? bool isXForms() const; diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx index c3bdb302c75d..771e8bfcc8f3 100644 --- a/sw/inc/editsh.hxx +++ b/sw/inc/editsh.hxx @@ -41,7 +41,7 @@ #include <itabenum.hxx> #include <swdbdata.hxx> #include <com/sun/star/linguistic2/XSpellAlternatives.hpp> -#include <com/sun/star/linguistic2/GrammarCheckingResult.hpp> +#include <com/sun/star/linguistic2/ProofreadingResult.hpp> #include <fldupde.hxx> #include <tblenum.hxx> @@ -735,6 +735,8 @@ public: // spells on a sentence basis - the SpellPortions are needed // returns false if no error could be found bool SpellSentence(::svx::SpellPortions& rToFill, bool bIsGrammarCheck ); + // make SpellIter start with the current sentence when called next time + void PutSpellingToSentenceStart(); //applies a changed sentence void ApplyChangedSentence(const ::svx::SpellPortions& rNewPortions, bool bIsGrammarCheck); @@ -748,12 +750,13 @@ public: GetCorrection( const Point* pPt, SwRect& rSelectRect ); - bool GetGrammarCorrection( ::com::sun::star::linguistic2::GrammarCheckingResult /*out*/ &rResult, + bool GetGrammarCorrection( ::com::sun::star::linguistic2::ProofreadingResult /*out*/ &rResult, sal_Int32 /*out*/ &rErrorPosInText, sal_Int32 /*out*/ &rErrorIndexInResult, ::com::sun::star::uno::Sequence< rtl::OUString > /*out*/ &rSuggestions, const Point* pPt, SwRect& rSelectRect ); + void IgnoreGrammarErrorAt( SwPaM& rErrorPosition ); void SetLinguRange( SwDocPositions eStart, SwDocPositions eEnde ); // returne zum Namen die im Doc gesetzte Referenz diff --git a/sw/inc/helpid.h b/sw/inc/helpid.h index a60ea9893d89..f709c95038f0 100644 --- a/sw/inc/helpid.h +++ b/sw/inc/helpid.h @@ -431,6 +431,7 @@ #define HID_MD_COPY_TO_CLIPBOARD (HID_BASE + 673) #define HID_MD_GLOS_IMPORT (HID_BASE + 674) #define HID_SMARTTAG_MAIN (HID_BASE + 675) // SMARTTAGS +#define HID_LINGU_IGNORE_SELECTION (HID_BASE + 676) // grammar check context menu // Weiter Help-IDs ********************************************************** diff --git a/sw/inc/unomap.hxx b/sw/inc/unomap.hxx index 259e9f3a9e24..7b1b90cce3b2 100644 --- a/sw/inc/unomap.hxx +++ b/sw/inc/unomap.hxx @@ -302,7 +302,7 @@ #define WID_PAGE_COUNT 1100 #define WID_LINE_COUNT 1101 #define WID_IS_CONSTANT_SPELLCHECK 1102 -#define WID_IS_HIDE_SPELL_MARKS 1103 +#define WID_IS_HIDE_SPELL_MARKS 1103 /* deprecated #i91949 */ #define WID_LAYOUT_SIZE 1104 #define WID_DOC_DIALOG_LIBRARIES 1105 diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx index 80f277baef91..b49ccfaa0952 100644 --- a/sw/inc/unoprnms.hxx +++ b/sw/inc/unoprnms.hxx @@ -750,7 +750,7 @@ enum SwPropNameIds /* 0696 */ UNO_NAME_PAGE_COUNT, /* 0697 */ UNO_NAME_LINE_COUNT, /* 0698 */ UNO_NAME_IS_CONSTANT_SPELLCHECK, -/* 0699 */ UNO_NAME_IS_HIDE_SPELL_MARKS, +/* 0699 */ UNO_NAME_IS_HIDE_SPELL_MARKS, // deprecated #i91949 // <-- /* 0700 */ UNO_NAME_IS_FIELD_USED, /* 0701 */ UNO_NAME_IS_FIELD_DISPLAYED, diff --git a/sw/inc/unotextmarkup.hxx b/sw/inc/unotextmarkup.hxx index 3dba9316a692..84d22e1b7a72 100644 --- a/sw/inc/unotextmarkup.hxx +++ b/sw/inc/unotextmarkup.hxx @@ -32,7 +32,9 @@ #define _UNOTEXTMARKUP_HXX #include <cppuhelper/implbase1.hxx> +#include <cppuhelper/implbase2.hxx> #include <com/sun/star/text/XTextMarkup.hpp> +#include <com/sun/star/text/XMultiTextMarkup.hpp> #include <calbck.hxx> #include <modeltoviewhelper.hxx> @@ -49,18 +51,24 @@ class SfxPoolItem; /** Implementation of the css::text::XTextMarkup interface */ class SwXTextMarkup: - public ::cppu::WeakImplHelper1< - ::com::sun::star::text::XTextMarkup >, + public ::cppu::WeakImplHelper2 + < + ::com::sun::star::text::XTextMarkup, + ::com::sun::star::text::XMultiTextMarkup + >, public SwClient { public: SwXTextMarkup( SwTxtNode& rTxtNode, const ModelToViewHelper::ConversionMap* pConversionMap ); virtual ~SwXTextMarkup(); - // ::com::sun::star::smarttags::XTextMarkup: + // ::com::sun::star::text::XTextMarkup: virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XStringKeyMap > SAL_CALL getMarkupInfoContainer() throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL commitTextMarkup(::sal_Int32 nType, const ::rtl::OUString & aIdentifier, ::sal_Int32 nStart, ::sal_Int32 nLength, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XStringKeyMap > & xMarkupInfoContainer) throw (::com::sun::star::uno::RuntimeException); + // ::com::sun::star::text::XMultiTextMarkup: + virtual void SAL_CALL commitMultiTextMarkup( const ::com::sun::star::uno::Sequence< ::com::sun::star::text::TextMarkupDescriptor >& aMarkups ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + //SwClient virtual void Modify( SfxPoolItem *pOld, SfxPoolItem *pNew); diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx index be1488c36cd8..d650d90cf08e 100644 --- a/sw/inc/viewopt.hxx +++ b/sw/inc/viewopt.hxx @@ -71,7 +71,7 @@ namespace svtools{ class ColorConfig;} #define VIEWOPT_1_SYNCHRONIZE 0x01000000L #define VIEWOPT_1_GRIDVISIBLE 0x02000000L #define VIEWOPT_1_ONLINESPELL 0x04000000L -#define VIEWOPT_1_HIDESPELL 0x08000000L +//#define VIEWOPT_1_HIDESPELL 0x08000000L /* removed #i91949 */ #define VIEWOPT_1_RESERVED1 0x10000000L #define VIEWOPT_1_VIEWMETACHARS 0x20000000L #define VIEWOPT_1_PAGEBACK 0x40000000L @@ -333,11 +333,6 @@ public: inline void SetOnlineSpell( BOOL b ) { (b != 0) ? (nCoreOptions |= VIEWOPT_1_ONLINESPELL ) : ( nCoreOptions &= ~VIEWOPT_1_ONLINESPELL); } - inline BOOL IsHideSpell() const - { return nCoreOptions & VIEWOPT_1_HIDESPELL ? TRUE : FALSE; } - inline void SetHideSpell( BOOL b ) - { (b != 0) ? (nCoreOptions |= VIEWOPT_1_HIDESPELL ) : ( nCoreOptions &= ~VIEWOPT_1_HIDESPELL); } - inline BOOL IsViewMetaChars() const { return !bReadonly && (nCoreOptions & VIEWOPT_1_VIEWMETACHARS) ? TRUE : FALSE; } inline void SetViewMetaChars( BOOL b) diff --git a/sw/sdi/_viewsh.sdi b/sw/sdi/_viewsh.sdi index b4ce49dbfe11..7623da2c3ff0 100644 --- a/sw/sdi/_viewsh.sdi +++ b/sw/sdi/_viewsh.sdi @@ -266,6 +266,11 @@ interface BaseTextEditView : View ExecMethod = Execute ; DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + SID_RECHECK_DOCUMENT + [ + ExecMethod = Execute ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] FN_LINE_NUMBERING_DLG // status() [ ExecMethod = Execute; @@ -620,12 +625,6 @@ interface BaseTextEditView : View StateMethod = StateViewOptions ; ] - SID_AUTOSPELL_MARKOFF - [ - ExecMethod = ExecViewOptions ; - StateMethod = StateViewOptions ; - ] - //Extra/Optionen/Ansicht //Wird zusammen zum Property ViewSettings FN_VIEW_HIDDEN_PARA diff --git a/sw/sdi/annotsh.sdi b/sw/sdi/annotsh.sdi index cbaca47c97ab..a29ed5dbd55d 100755 --- a/sw/sdi/annotsh.sdi +++ b/sw/sdi/annotsh.sdi @@ -82,12 +82,6 @@ interface Annotation : _Annotation StateMethod = GetState; ] - SID_AUTOSPELL_MARKOFF - [ - ExecMethod = Exec; - StateMethod = GetState ; - ] - SID_HYPERLINK_SETLINK // status() [ ExecMethod = Exec ; diff --git a/sw/sdi/drwtxtsh.sdi b/sw/sdi/drwtxtsh.sdi index 6dcfe71c4b36..41ec7a88f857 100644 --- a/sw/sdi/drwtxtsh.sdi +++ b/sw/sdi/drwtxtsh.sdi @@ -455,12 +455,6 @@ interface TextDrawText StateMethod = GetDrawTxtCtrlState ] - SID_AUTOSPELL_MARKOFF - [ - ExecMethod = Execute; - StateMethod = GetDrawTxtCtrlState - ] - SID_SEARCH_DLG [ StateMethod = StateDisableItems diff --git a/sw/source/core/access/textmarkuphelper.cxx b/sw/source/core/access/textmarkuphelper.cxx index 611d40d5373b..be68370f7df3 100644 --- a/sw/source/core/access/textmarkuphelper.cxx +++ b/sw/source/core/access/textmarkuphelper.cxx @@ -62,7 +62,7 @@ namespace { pTextMarkupList = rTxtNode.GetWrong(); } break; - case text::TextMarkupType::GRAMMAR: + case text::TextMarkupType::PROOFREADING: { // support not implemented yet pTextMarkupList = 0; diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index b25c6e147f35..81afd2e0547e 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -77,6 +77,7 @@ #include "comcore.hrc" #include "editsh.hxx" #include <unoflatpara.hxx> +#include <SwGrammarMarkUp.hxx> using ::rtl::OUString; using namespace ::com::sun::star; @@ -1809,6 +1810,31 @@ bool SwDoc::Delete( SwPaM & rPam ) return sal_True; } +void lcl_syncGrammarError( SwTxtNode &rTxtNode, linguistic2::ProofreadingResult& rResult, + xub_StrLen /*nBeginGrammarCheck*/, const ModelToViewHelper::ConversionMap* pConversionMap ) +{ + if( rTxtNode.IsGrammarCheckDirty() ) + return; + SwGrammarMarkUp* pWrong = rTxtNode.GetGrammarCheck(); + linguistic2::SingleProofreadingError* pArray = rResult.aErrors.getArray(); + USHORT i, j = 0; + if( pWrong ) + { + for( i = 0; i < rResult.aErrors.getLength(); ++i ) + { + const linguistic2::SingleProofreadingError &rError = rResult.aErrors[i]; + xub_StrLen nStart = (xub_StrLen)ModelToViewHelper::ConvertToModelPosition( pConversionMap, rError.nErrorStart ).mnPos; + xub_StrLen nEnd = (xub_StrLen)ModelToViewHelper::ConvertToModelPosition( pConversionMap, rError.nErrorStart + rError.nErrorLength ).mnPos; + if( i != j ) + pArray[j] = pArray[i]; + if( pWrong->LookForEntry( nStart, nEnd ) ) + ++j; + } + } + if( rResult.aErrors.getLength() > j ) + rResult.aErrors.realloc( j ); +} + uno::Any SwDoc::Spell( SwPaM& rPaM, uno::Reference< XSpellChecker1 > &xSpeller, @@ -1878,6 +1904,19 @@ uno::Any SwDoc::Spell( SwPaM& rPaM, if( pSpellArgs && pSpellArgs->bIsGrammarCheck) { nBeginGrammarCheck = pSpellArgs->pStartNode == pNd ? pSpellArgs->pStartIdx->GetIndex() : 0; + // if grammar checking starts inside of a sentence the start position has to be adjusted + if( nBeginGrammarCheck ) + { + SwIndex aStartIndex( dynamic_cast< SwTxtNode* >( pNd ), nBeginGrammarCheck ); + SwPosition aStart( *pNd, aStartIndex ); + SwCursor aCrsr(aStart, 0, false); + SwPosition aOrigPos = *aCrsr.GetPoint(); + aCrsr.GoSentence( SwCursor::START_SENT ); + if( aOrigPos != *aCrsr.GetPoint() ) + { + nBeginGrammarCheck = aCrsr.GetPoint()->nContent.GetIndex(); + } + } nEndGrammarCheck = pSpellArgs->pEndNode == pNd ? pSpellArgs->pEndIdx->GetIndex() : ((SwTxtNode*)pNd)->GetTxt().Len(); } @@ -1892,13 +1931,15 @@ uno::Any SwDoc::Spell( SwPaM& rPaM, pEndPos->nNode = nCurrNd; nCurrNd = nEndNd; if( pSpellArgs ) - nSpellErrorPosition = pSpellArgs->pStartIdx->GetIndex(); + nSpellErrorPosition = pSpellArgs->pStartIdx->GetIndex() > pSpellArgs->pEndIdx->GetIndex() ? + pSpellArgs->pEndIdx->GetIndex() : + pSpellArgs->pStartIdx->GetIndex(); } if( pSpellArgs && pSpellArgs->bIsGrammarCheck ) { - uno::Reference< linguistic2::XGrammarCheckingIterator > xGCIterator( GetGCIterator() ); + uno::Reference< linguistic2::XProofreadingIterator > xGCIterator( GetGCIterator() ); if (xGCIterator.is()) { String aText( ((SwTxtNode*)pNd)->GetTxt().Copy( nBeginGrammarCheck, nEndGrammarCheck - nBeginGrammarCheck ) ); @@ -1912,33 +1953,38 @@ uno::Any SwDoc::Spell( SwPaM& rPaM, // get error position of cursor in XFlatParagraph sal_Int32 nGrammarErrorPosInText; - linguistic2::GrammarCheckingResult aResult; + linguistic2::ProofreadingResult aResult; sal_Int32 nGrammarErrors; do { nGrammarErrorPosInText = ModelToViewHelper::ConvertToViewPosition( pConversionMap, nBeginGrammarCheck ); - aResult = xGCIterator->checkGrammarAtPos( + aResult = xGCIterator->checkSentenceAtPosition( xDoc, xFlatPara, aExpandText, lang::Locale(), nBeginGrammarCheck, -1, -1 ); + lcl_syncGrammarError( *((SwTxtNode*)pNd), aResult, nBeginGrammarCheck, pConversionMap ); + // get suggestions to use for the specific error position - nGrammarErrors = aResult.aGrammarErrors.getLength(); + nGrammarErrors = aResult.aErrors.getLength(); + // if grammar checking doesn't have any progress then quit + if( aResult.nStartOfNextSentencePosition <= nBeginGrammarCheck ) + break; // prepare next iteration - nBeginGrammarCheck = (xub_StrLen)aResult.nEndOfSentencePos; + nBeginGrammarCheck = (xub_StrLen)aResult.nStartOfNextSentencePosition; } - while( nSpellErrorPosition > aResult.nEndOfSentencePos && !nGrammarErrors && aResult.nEndOfSentencePos < nEndGrammarCheck ); + while( nSpellErrorPosition > aResult.nBehindEndOfSentencePosition && !nGrammarErrors && aResult.nBehindEndOfSentencePosition < nEndGrammarCheck ); - if( nGrammarErrors > 0 && nSpellErrorPosition >= aResult.nEndOfSentencePos ) + if( nGrammarErrors > 0 && nSpellErrorPosition >= aResult.nBehindEndOfSentencePosition ) { aRet <<= aResult; //put the cursor to the current error - const linguistic2::SingleGrammarError &rError = aResult.aGrammarErrors[0]; + const linguistic2::SingleProofreadingError &rError = aResult.aErrors[0]; nCurrNd = pNd->GetIndex(); pSttPos->nNode = nCurrNd; pEndPos->nNode = nCurrNd; pSpellArgs->pStartNode = ((SwTxtNode*)pNd); pSpellArgs->pEndNode = ((SwTxtNode*)pNd); - pSpellArgs->pStartIdx->Assign(((SwTxtNode*)pNd), (xub_StrLen)rError.nErrorStart ); - pSpellArgs->pEndIdx->Assign(((SwTxtNode*)pNd), (xub_StrLen)(rError.nErrorStart + rError.nErrorLength)); + pSpellArgs->pStartIdx->Assign(((SwTxtNode*)pNd), (xub_StrLen)ModelToViewHelper::ConvertToModelPosition( pConversionMap, rError.nErrorStart ).mnPos ); + pSpellArgs->pEndIdx->Assign(((SwTxtNode*)pNd), (xub_StrLen)ModelToViewHelper::ConvertToModelPosition( pConversionMap, rError.nErrorStart + rError.nErrorLength ).mnPos ); nCurrNd = nEndNd; } } diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index 5980ee261b6a..a47126344fa0 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -30,6 +30,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + +#include <svtools/linguprops.hxx> +#include <svtools/lingucfg.hxx> #include <com/sun/star/embed/EmbedStates.hpp> #include <hintids.hxx> #include <com/sun/star/util/XCloseable.hpp> @@ -1849,7 +1852,12 @@ IMPL_LINK( SwDoc, DoIdleJobs, Timer *, pTimer ) if (GetRootFrm()->IsNeedGrammarCheck()) { BOOL bIsOnlineSpell = pSh->GetViewOptions()->IsOnlineSpell(); - if (bIsOnlineSpell) + + // right now we don't have view options for automatic grammar checking. Thus... + sal_Bool bIsAutoGrammar = sal_False; + SvtLinguConfig().GetProperty( C2U( UPN_IS_GRAMMAR_AUTO ) ) >>= bIsAutoGrammar; + + if (bIsOnlineSpell && bIsAutoGrammar) StartGrammarChecking( *this, *GetRootFrm() ); } diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 8129031bfdf2..4daadd9bea38 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -35,7 +35,7 @@ #include <com/sun/star/document/PrinterIndependentLayout.hpp> #include <com/sun/star/document/UpdateDocMode.hpp> #include <com/sun/star/text/XTextDocument.hpp> -#include <com/sun/star/linguistic2/XGrammarCheckingIterator.hpp> +#include <com/sun/star/linguistic2/XProofreadingIterator.hpp> #include <com/sun/star/text/XFlatParagraphIteratorProvider.hpp> #include <unotools/processfactory.hxx> @@ -149,7 +149,7 @@ SV_IMPL_PTRARR( SwGrfFmtColls, SwGrfFmtCollPtr) * global functions... */ - uno::Reference< linguistic2::XGrammarCheckingIterator > SwDoc::GetGCIterator() const + uno::Reference< linguistic2::XProofreadingIterator > SwDoc::GetGCIterator() const { if (!m_xGCIterator.is() && SvtLinguConfig().HasGrammarChecker()) { @@ -158,8 +158,8 @@ SV_IMPL_PTRARR( SwGrfFmtColls, SwGrfFmtCollPtr) { try { - rtl::OUString aServiceName( rtl::OUString::createFromAscii("com.sun.star.lingu2.GrammarCheckingIterator") ); - m_xGCIterator = uno::Reference< linguistic2::XGrammarCheckingIterator > + rtl::OUString aServiceName( rtl::OUString::createFromAscii("com.sun.star.linguistic2.ProofreadingIterator") ); + m_xGCIterator = uno::Reference< linguistic2::XProofreadingIterator > ( xMgr->createInstance( aServiceName ), uno::UNO_QUERY_THROW ); } catch (uno::Exception &) @@ -177,18 +177,18 @@ void StartGrammarChecking( SwDoc &rDoc, SwRootFrm &rRootFrame ) // if (rRootFrame.IsGrammarCheckActive()) // return; - uno::Reference< linguistic2::XGrammarCheckingIterator > xGCIterator( rDoc.GetGCIterator() ); + uno::Reference< linguistic2::XProofreadingIterator > xGCIterator( rDoc.GetGCIterator() ); if ( xGCIterator.is() ) { uno::Reference< lang::XComponent > xDoc( rDoc.GetDocShell()->GetBaseModel(), uno::UNO_QUERY ); uno::Reference< text::XFlatParagraphIteratorProvider > xFPIP( xDoc, uno::UNO_QUERY ); // start automatic background checking - if ( xFPIP.is() && !xGCIterator->isGrammarChecking( xDoc, sal_True ) ) + if ( xFPIP.is() && !xGCIterator->isProofreading( xDoc ) ) { rRootFrame.SetNeedGrammarCheck( false ); rRootFrame.SetGrammarCheckActive( true ); - xGCIterator->startGrammarChecking( xDoc, xFPIP, true /*bAutomatic*/ ); + xGCIterator->startProofreading( xDoc, xFPIP ); } } } diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx index d969426ed85a..82a9a984c3d8 100644 --- a/sw/source/core/edit/edlingu.cxx +++ b/sw/source/core/edit/edlingu.cxx @@ -31,9 +31,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" -#include <com/sun/star/linguistic2/GrammarCheckingResult.hpp> -#include <com/sun/star/linguistic2/XGrammarChecker.hpp> -#include <com/sun/star/linguistic2/XGrammarCheckingIterator.hpp> +#include <com/sun/star/linguistic2/ProofreadingResult.hpp> +#include <com/sun/star/linguistic2/XProofreader.hpp> +#include <com/sun/star/linguistic2/XProofreadingIterator.hpp> #include <com/sun/star/text/XFlatParagraph.hpp> #include <unoflatpara.hxx> @@ -79,6 +79,8 @@ using namespace ::com::sun::star::linguistic2; #define C2U(cChar) rtl::OUString::createFromAscii(cChar) +extern void repaintTextFrames( SwModify& rModify ); + /************************************************************************* * class SwLinguIter *************************************************************************/ @@ -135,23 +137,26 @@ class SwSpellIter : public SwLinguIter ::svx::SpellPortions aLastPortions; SpellContentPositions aLastPositions; + bool bBackToStartOfSentence; void CreatePortion(uno::Reference< XSpellAlternatives > xAlt, - linguistic2::GrammarCheckingResult* pGrammarResult, + linguistic2::ProofreadingResult* pGrammarResult, bool bIsField, bool bIsHidden); void AddPortion(uno::Reference< XSpellAlternatives > xAlt, - linguistic2::GrammarCheckingResult* pGrammarResult, + linguistic2::ProofreadingResult* pGrammarResult, const SpellContentPositions& rDeletedRedlines); public: - SwSpellIter() {} + SwSpellIter() : + bBackToStartOfSentence(false) {} void Start( SwEditShell *pSh, SwDocPositions eStart, SwDocPositions eEnd ); uno::Any Continue( sal_uInt16* pPageCnt, sal_uInt16* pPageSt ); bool SpellSentence(::svx::SpellPortions& rPortions, bool bIsGrammarCheck); + void ToSentenceStart(); const ::svx::SpellPortions GetLastPortions(){ return aLastPortions;} SpellContentPositions GetLastPositions() {return aLastPositions;} }; @@ -1046,10 +1051,6 @@ uno::Reference< XSpellAlternatives > xub_StrLen nLineEnd = GetCrsr()->GetPoint()->nContent.GetIndex(); Pop(FALSE); -#if OSL_DEBUG_LEVEL > 1 - pNode->GetWrong()->Invalidate( 0, STRING_LEN ); - pNode->SetWrongDirty( true ); -#endif // make sure the selection build later from the // data below does not include footnotes and other // "in word" character to the left and right in order @@ -1100,7 +1101,7 @@ uno::Reference< XSpellAlternatives > -----------------------------------------------------------------------*/ bool SwEditShell::GetGrammarCorrection( - linguistic2::GrammarCheckingResult /*out*/ &rResult, // the complete result + linguistic2::ProofreadingResult /*out*/ &rResult, // the complete result sal_Int32 /*out*/ &rErrorPosInText, // offset of error position in string that was grammar checked... sal_Int32 /*out*/ &rErrorIndexInResult, // index of error in rResult.aGrammarErrors uno::Sequence< rtl::OUString > /*out*/ &rSuggestions, // suggestions to be used for the error found @@ -1130,7 +1131,7 @@ bool SwEditShell::GetGrammarCorrection( String aWord( aText ); aWord.EraseAllChars( CH_TXTATR_BREAKWORD ).EraseAllChars( CH_TXTATR_INWORD ); - uno::Reference< linguistic2::XGrammarCheckingIterator > xGCIterator( pDoc->GetGCIterator() ); + uno::Reference< linguistic2::XProofreadingIterator > xGCIterator( pDoc->GetGCIterator() ); if (xGCIterator.is()) { // LanguageType eActLang = (LanguageType)pNode->GetLang( nBegin, nLen ); @@ -1150,26 +1151,26 @@ bool SwEditShell::GetGrammarCorrection( sal_Int32 nEndOfSentence = ModelToViewHelper::ConvertToViewPosition( pConversionMap, pWrong->getSentenceEnd( nBegin ) ); if( nEndOfSentence == STRING_LEN ) { - if( nStartOfSentence == 0 ) +/* if( nStartOfSentence == 0 ) { nStartOfSentence = -1; nEndOfSentence = -1; } - else + else */ nEndOfSentence = aExpandText.getLength(); } - rResult = xGCIterator->checkGrammarAtPos( + rResult = xGCIterator->checkSentenceAtPosition( xDoc, xFlatPara, aExpandText, lang::Locale(), nStartOfSentence, nEndOfSentence, rErrorPosInText ); bRes = true; // get suggestions to use for the specific error position - sal_Int32 nErrors = rResult.aGrammarErrors.getLength(); + sal_Int32 nErrors = rResult.aErrors.getLength(); rSuggestions.realloc( 0 ); for (sal_Int32 i = 0; i < nErrors; ++i ) { // return suggestions for first error that includes the given error position - const linguistic2::SingleGrammarError &rError = rResult.aGrammarErrors[i]; + const linguistic2::SingleProofreadingError &rError = rResult.aErrors[i]; if (rError.nErrorStart <= rErrorPosInText && rErrorPosInText < rError.nErrorStart + rError.nErrorLength) { @@ -1180,7 +1181,7 @@ bool SwEditShell::GetGrammarCorrection( } } - if (rResult.aGrammarErrors.getLength() > 0) // error found? + if (rResult.aErrors.getLength() > 0) // error found? { //save the start and end positons of the line and the starting point Push(); @@ -1256,6 +1257,16 @@ bool SwEditShell::SpellSentence(::svx::SpellPortions& rPortions, bool bIsGrammar EndAction(); return bRet; } +/*-- 08.09.2008 09:35:19--------------------------------------------------- + make SpellIter start with the current sentence when called next time + -----------------------------------------------------------------------*/ +void SwEditShell::PutSpellingToSentenceStart() +{ + ASSERT( pSpellIter, "SpellIter missing" ); + if(!pSpellIter) + return; + pSpellIter->ToSentenceStart(); +} /*-- 02.02.2005 14:34:41--------------------------------------------------- -----------------------------------------------------------------------*/ @@ -1338,6 +1349,12 @@ void SwEditShell::ApplyChangedSentence(const ::svx::SpellPortions& rNewPortions, //apply language SetAttr( SvxLanguageItem(aCurrentNewPortion->eLanguage, nLangWhichId), nLangWhichId ); } + else if( aCurrentNewPortion->bIgnoreThisError ) + { + //add the 'ignore' markup to the TextNode's grammar ignore markup list + IgnoreGrammarErrorAt( *pCrsr ); + DBG_ERROR("TODO: add ignore mark to text node") + } if(aCurrentNewPortion == rNewPortions.begin()) break; } @@ -1379,15 +1396,12 @@ void SwEditShell::ApplyChangedSentence(const ::svx::SpellPortions& rNewPortions, } } - if( !bIsGrammarCheck) - { - //set the cursor to the end of the new sentence - *pCrsr->Start() = *pCrsr->End(); - } - else + //set the cursor to the end of the new sentence + *pCrsr->Start() = *pCrsr->End(); + if( bIsGrammarCheck) { //in grammar check the current sentence has to be checked again - *pCrsr->Start() = *pSpellIter->GetStart(); + GoStartSentence(); } pDoc->EndUndo( UNDO_OVERWRITE, NULL ); EndAction(); @@ -1488,7 +1502,7 @@ bool SwSpellIter::SpellSentence(::svx::SpellPortions& rPortions, bool bIsGrammar ASSERT( GetEnd(), "SwEditShell::SpellSentence() ohne Start?"); uno::Reference< XSpellAlternatives > xSpellRet; - linguistic2::GrammarCheckingResult aGrammarResult; + linguistic2::ProofreadingResult aGrammarResult; sal_Bool bGoOn = sal_True; bool bGrammarErrorFound = false; do { @@ -1499,13 +1513,18 @@ bool SwSpellIter::SpellSentence(::svx::SpellPortions& rPortions, bool bIsGrammar *pCrsr->GetPoint() = *GetCurr(); *pCrsr->GetMark() = *GetEnd(); + if( bBackToStartOfSentence ) + { + pMySh->GoStartSentence(); + bBackToStartOfSentence = false; + } uno::Any aSpellRet = pMySh->GetDoc()->Spell(*pCrsr, xSpeller, 0, 0, bIsGrammarCheck ); aSpellRet >>= xSpellRet; aSpellRet >>= aGrammarResult; bGoOn = GetCrsrCnt() > 1; - bGrammarErrorFound = aGrammarResult.aGrammarErrors.getLength() > 0; + bGrammarErrorFound = aGrammarResult.aErrors.getLength() > 0; if( xSpellRet.is() || bGrammarErrorFound ) { bGoOn = sal_False; @@ -1539,9 +1558,12 @@ bool SwSpellIter::SpellSentence(::svx::SpellPortions& rPortions, bool bIsGrammar //an error has been found //To fill the spell portions the beginning of the sentence has to be found SwPaM *pCrsr = pMySh->GetCrsr(); - //set the mark to the left if necessary - if ( *pCrsr->GetPoint() < *pCrsr->GetMark() ) + //set the mark to the right if necessary + if ( *pCrsr->GetPoint() > *pCrsr->GetMark() ) pCrsr->Exchange(); + //the cursor has to be collapsed on the left to go to the start of the sentence - if sentence ends inside of the error + pCrsr->DeleteMark(); + pCrsr->SetMark(); BOOL bStartSent = 0 != pMySh->GoStartSentence(); SpellContentPositions aDeletedRedlines = lcl_CollectDeletedRedlines(pMySh); if(bStartSent) @@ -1555,14 +1577,31 @@ bool SwSpellIter::SpellSentence(::svx::SpellPortions& rPortions, bool bIsGrammar AddPortion(xSpellRet, &aGrammarResult, aDeletedRedlines); + //save the end position of the error to continue from here + SwPosition aSaveStartPos = *pCrsr->End(); //determine the end of the current sentence - if ( *pCrsr->GetPoint() > *pCrsr->GetMark() ) + if ( *pCrsr->GetPoint() < *pCrsr->GetMark() ) pCrsr->Exchange(); - - //save the end position of the error to continue from here - SwPosition aSaveStartPos = *pCrsr->GetMark(); + //again collapse to start marking after the end of the error + pCrsr->DeleteMark(); + pCrsr->SetMark(); pMySh->GoEndSentence(); + if( bGrammarErrorFound ) + { + rtl::OUString aExpandText; + const ModelToViewHelper::ConversionMap* pConversionMap = ((SwTxtNode*)pCrsr->GetNode())->BuildConversionMap( aExpandText ); + xub_StrLen nSentenceEnd = (xub_StrLen)ModelToViewHelper::ConvertToViewPosition( pConversionMap, aGrammarResult.nBehindEndOfSentencePosition ); + // remove trailing space + if( aExpandText[nSentenceEnd - 1] == ' ' ) + --nSentenceEnd; + if( pCrsr->End()->nContent.GetIndex() < nSentenceEnd ) + { + pCrsr->End()->nContent.Assign( + pCrsr->End()->nNode.GetNode().GetCntntNode(), nSentenceEnd); + } + } + lcl_CutRedlines( aDeletedRedlines, pMySh ); //save the 'global' end of the spellchecking const SwPosition aSaveEndPos = *GetEnd(); @@ -1622,8 +1661,6 @@ bool SwSpellIter::SpellSentence(::svx::SpellPortions& rPortions, bool bIsGrammar // and the mark points to the sentence end as if ( *pCrsr->GetPoint() < *pCrsr->GetMark() ) pCrsr->Exchange(); - if( aGrammarResult.nEndOfSentencePos != pCrsr->GetPoint()->nContent.GetIndex()) - pCrsr->GetPoint()->nContent.Assign( pCrsr->GetPoint()->nNode.GetNode().GetCntntNode(), (xub_StrLen)aGrammarResult.nEndOfSentencePos ); } // the part between the last error and the end of the sentence has to be added @@ -1653,6 +1690,14 @@ bool SwSpellIter::SpellSentence(::svx::SpellPortions& rPortions, bool bIsGrammar return bRet; } + +/*-- 08.09.2008 09:37:15--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SwSpellIter::ToSentenceStart() +{ + bBackToStartOfSentence = true; +} /*-- 08.10.2003 08:49:56--------------------------------------------------- -----------------------------------------------------------------------*/ @@ -1675,7 +1720,7 @@ LanguageType lcl_GetLanguage(SwEditShell& rSh) create a text portion at the given position -----------------------------------------------------------------------*/ void SwSpellIter::CreatePortion(uno::Reference< XSpellAlternatives > xAlt, - linguistic2::GrammarCheckingResult* pGrammarResult, + linguistic2::ProofreadingResult* pGrammarResult, bool bIsField, bool bIsHidden) { svx::SpellPortion aPortion; @@ -1690,10 +1735,20 @@ void SwSpellIter::CreatePortion(uno::Reference< XSpellAlternatives > xAlt, else if(pGrammarResult) { aPortion.bIsGrammarError = true; - if(pGrammarResult->aGrammarErrors.getLength()) + if(pGrammarResult->aErrors.getLength()) { - aPortion.aGrammarError = pGrammarResult->aGrammarErrors[0]; + aPortion.aGrammarError = pGrammarResult->aErrors[0]; aPortion.sText = pGrammarResult->aText.copy( aPortion.aGrammarError.nErrorStart, aPortion.aGrammarError.nErrorLength ); + aPortion.xGrammarChecker = pGrammarResult->xProofreader; + const beans::PropertyValue* pProperties = pGrammarResult->aProperties.getConstArray(); + for( sal_Int32 nProp = 0; nProp < pGrammarResult->aProperties.getLength(); ++nProp ) + { + if( pProperties->Name.equalsAscii("DialogTitle") ) + { + pProperties->Value >>= aPortion.sDialogTitle; + break; + } + } } } else @@ -1714,7 +1769,7 @@ void SwSpellIter::CreatePortion(uno::Reference< XSpellAlternatives > xAlt, -----------------------------------------------------------------------*/ void SwSpellIter::AddPortion(uno::Reference< XSpellAlternatives > xAlt, - linguistic2::GrammarCheckingResult* pGrammarResult, + linguistic2::ProofreadingResult* pGrammarResult, const SpellContentPositions& rDeletedRedlines) { SwEditShell *pMySh = GetSh(); @@ -1833,5 +1888,34 @@ void SwSpellIter::AddPortion(uno::Reference< XSpellAlternatives > xAlt, } } } +/*-- 07.08.2008 15:01:25--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SwEditShell::IgnoreGrammarErrorAt( SwPaM& rErrorPosition ) +{ + SwTxtNode *pNode; + SwWrongList *pWrong; + SwNodeIndex aIdx = rErrorPosition.Start()->nNode; + SwNodeIndex aEndIdx = rErrorPosition.Start()->nNode; + xub_StrLen nStart = rErrorPosition.Start()->nContent.GetIndex(); + xub_StrLen nEnd = STRING_LEN; + while( aIdx <= aEndIdx ) + { + pNode = aIdx.GetNode().GetTxtNode(); + if( pNode ) { + if( aIdx == aEndIdx ) + nEnd = rErrorPosition.End()->nContent.GetIndex(); + pWrong = pNode->GetGrammarCheck(); + if( pWrong ) + pWrong->RemoveEntry( nStart, nEnd ); + pWrong = pNode->GetWrong(); + if( pWrong ) + pWrong->RemoveEntry( nStart, nEnd ); + ::repaintTextFrames( *pNode ); + } + ++aIdx; + nStart = 0; + } +} diff --git a/sw/source/core/inc/SwGrammarMarkUp.hxx b/sw/source/core/inc/SwGrammarMarkUp.hxx index bf9cb2c3e606..bb8ccc96905e 100644 --- a/sw/source/core/inc/SwGrammarMarkUp.hxx +++ b/sw/source/core/inc/SwGrammarMarkUp.hxx @@ -49,6 +49,12 @@ class SwGrammarMarkUp : public SwWrongList std::vector< xub_StrLen > maSentence; public: SwGrammarMarkUp() : SwWrongList( WRONGLIST_GRAMMAR ) {} + SwGrammarMarkUp( const SwGrammarMarkUp* ); + + virtual ~SwGrammarMarkUp(); + virtual SwWrongList* Clone(); + virtual void CopyFrom( const SwWrongList& rCopy ); + /* SwWrongList::Move() + handling of maSentence */ void MoveGrammar( xub_StrLen nPos, long nDiff ); /* SwWrongList::SplitList() + handling of maSentence */ @@ -56,7 +62,7 @@ public: /* SwWrongList::JoinList() + handling of maSentence */ void JoinGrammarList( SwGrammarMarkUp* pNext, xub_StrLen nInsertPos ); /* SwWrongList::ClearList() + handling of maSentence */ - void ClearGrammarList(); + void ClearGrammarList( xub_StrLen nSentenceEnd = STRING_LEN ); /* setSentence to define the start positionof a sentence, at the moment the end position is given by the next start position */ void setSentence( xub_StrLen nStart ); diff --git a/sw/source/core/inc/wrong.hxx b/sw/source/core/inc/wrong.hxx index 19d24022bf0b..fe6a26f1a304 100644 --- a/sw/source/core/inc/wrong.hxx +++ b/sw/source/core/inc/wrong.hxx @@ -80,16 +80,15 @@ class SwWrongList void Remove( USHORT nIdx, USHORT nLen ); // forbidden and not implemented - SwWrongList( const SwWrongList& rCpy ); SwWrongList& operator= (const SwWrongList &); + SwWrongList( const SwWrongList& rCpy ); public: - SwWrongList( WrongListType eType ); - ~SwWrongList() - { - ClearList(); - } + + virtual ~SwWrongList(); + virtual SwWrongList* Clone(); + virtual void CopyFrom( const SwWrongList& rCopy ); inline WrongListType GetWrongListType() const { return meType; } inline xub_StrLen GetBeginInv() const { return nBeginInvalid; } @@ -157,6 +156,8 @@ public: { return nIdx < maList.size() ? &maList[nIdx] : 0; } + void RemoveEntry( xub_StrLen nBegin, xub_StrLen nEnd ); + bool LookForEntry( xub_StrLen nBegin, xub_StrLen nEnd ); }; #endif diff --git a/sw/source/core/text/SwGrammarMarkUp.cxx b/sw/source/core/text/SwGrammarMarkUp.cxx index 3ffac3fc0a80..74e6dbf27b30 100644 --- a/sw/source/core/text/SwGrammarMarkUp.cxx +++ b/sw/source/core/text/SwGrammarMarkUp.cxx @@ -33,6 +33,24 @@ #include "SwGrammarMarkUp.hxx" +SwGrammarMarkUp::~SwGrammarMarkUp() +{ +} + +SwWrongList* SwGrammarMarkUp::Clone() +{ + SwWrongList* pClone = new SwGrammarMarkUp(); + pClone->CopyFrom( *this ); + return pClone; +} + +void SwGrammarMarkUp::CopyFrom( const SwWrongList& rCopy ) +{ + maSentence = ((const SwGrammarMarkUp&)rCopy).maSentence; + SwWrongList::CopyFrom( rCopy ); +} + + void SwGrammarMarkUp::MoveGrammar( xub_StrLen nPos, long nDiff ) { Move( nPos, nDiff ); @@ -62,6 +80,10 @@ SwGrammarMarkUp* SwGrammarMarkUp::SplitGrammarList( xub_StrLen nSplitPos ) ++pIter; if( pIter != maSentence.begin() ) { + if( !pNew ) { + pNew = new SwGrammarMarkUp(); + pNew->SetInvalid( 0, STRING_LEN ); + } pNew->maSentence.insert( pNew->maSentence.begin(), maSentence.begin(), pIter ); maSentence.erase( maSentence.begin(), pIter ); } @@ -85,10 +107,27 @@ void SwGrammarMarkUp::JoinGrammarList( SwGrammarMarkUp* pNext, xub_StrLen nInser } } -void SwGrammarMarkUp::ClearGrammarList() +void SwGrammarMarkUp::ClearGrammarList( xub_StrLen nSentenceEnd ) { - ClearList(); - maSentence.clear(); + if( STRING_LEN == nSentenceEnd ) { + ClearList(); + maSentence.clear(); + Validate(); + } else if( GetBeginInv() <= nSentenceEnd ) { + std::vector< xub_StrLen >::iterator pIter = maSentence.begin(); + xub_StrLen nStart = 0; + while( pIter != maSentence.end() && *pIter < GetBeginInv() ) + { + nStart = *pIter; + ++pIter; + } + std::vector< xub_StrLen >::iterator pLast = pIter; + while( pLast != maSentence.end() && *pLast <= nSentenceEnd ) + ++pLast; + maSentence.erase( pIter, pLast ); + RemoveEntry( nStart, nSentenceEnd ); + SetInvalid( nSentenceEnd + 1, STRING_LEN ); + } } void SwGrammarMarkUp::setSentence( xub_StrLen nStart ) diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index 2e10a40a1b66..e367f72a7fd5 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -34,6 +34,7 @@ #include <com/sun/star/uno/Sequence.h> #include <svtools/linguprops.hxx> +#include <svtools/lingucfg.hxx> #include <hintids.hxx> #include <svtools/ctloptions.hxx> #include <sfx2/printer.hxx> @@ -703,11 +704,11 @@ void SwTxtPaintInfo::_DrawText( const XubString &rText, const SwLinePortion &rPo if ( ! IsMulti() ) nComp = GetKanaComp(); + sal_Bool bCfgIsAutoGrammar = sal_False; + SvtLinguConfig().GetProperty( C2U( UPN_IS_GRAMMAR_AUTO ) ) >>= bCfgIsAutoGrammar; const sal_Bool bBullet = OnWin() && GetOpt().IsBlank() && IsNoSymbol(); - const sal_Bool bTmpWrong = bWrong && OnWin() && GetOpt().IsOnlineSpell() && - !GetOpt().IsHideSpell(); - const sal_Bool bTmpGrammarCheck = bGrammarCheck && OnWin() && GetOpt().IsOnlineSpell() && - !GetOpt().IsHideSpell(); + const sal_Bool bTmpWrong = bWrong && OnWin() && GetOpt().IsOnlineSpell(); + const sal_Bool bTmpGrammarCheck = bGrammarCheck && OnWin() && bCfgIsAutoGrammar && GetOpt().IsOnlineSpell(); const sal_Bool bTmpSmart = bSmartTag && OnWin() && !GetOpt().IsPagePreview() && SwSmartTagMgr::Get().IsSmartTagsEnabled(); // SMARTTAGS ASSERT( GetParaPortion(), "No paragraph!"); diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index 6308aba3587e..6acf9352d785 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -812,11 +812,9 @@ void lcl_SetWrong( SwTxtFrm& rFrm, xub_StrLen nPos, long nCnt, bool bMove ) if( pTxtNode->GetWrong() ) pTxtNode->GetWrong()->Move( nPos, nCnt ); if( pWrongGrammar ) - { pWrongGrammar->MoveGrammar( nPos, nCnt ); - if( bGrammarProxy && pTxtNode->GetGrammarCheck() ) - pTxtNode->GetGrammarCheck()->MoveGrammar( nPos, nCnt ); - } + if( bGrammarProxy && pTxtNode->GetGrammarCheck() ) + pTxtNode->GetGrammarCheck()->MoveGrammar( nPos, nCnt ); if( pTxtNode->GetSmartTags() ) pTxtNode->GetSmartTags()->Move( nPos, nCnt ); } diff --git a/sw/source/core/text/wrong.cxx b/sw/source/core/text/wrong.cxx index b141ec6a9fcc..5897b38def4e 100644 --- a/sw/source/core/text/wrong.cxx +++ b/sw/source/core/text/wrong.cxx @@ -52,6 +52,39 @@ SwWrongList::SwWrongList( WrongListType eType ) : maList.reserve( 5 ); } +SwWrongList::~SwWrongList() +{ + ClearList(); +} + +/************************************************************************* + * SwWrongList* SwWrongList::Clone() + *************************************************************************/ + +SwWrongList* SwWrongList::Clone() +{ + SwWrongList* pClone = new SwWrongList( meType ); + pClone->CopyFrom( *this ); + return pClone; +} + +/************************************************************************* + * void SwWrongList::CopyFrom( const SwWrongList& rCopy ) + *************************************************************************/ + +void SwWrongList::CopyFrom( const SwWrongList& rCopy ) +{ + maList = rCopy.maList; + meType = rCopy.meType; + nBeginInvalid = rCopy.nBeginInvalid; + nEndInvalid = rCopy.nEndInvalid; + for( size_t i = 0; i < maList.size(); ++i ) + { + if( maList[i].mpSubList ) + maList[i].mpSubList = maList[i].mpSubList->Clone(); + } +} + /************************************************************************* * SwWrongList::ClearList() *************************************************************************/ @@ -225,18 +258,12 @@ void SwWrongList::_Invalidate( xub_StrLen nBegin, xub_StrLen nEnd ) nBeginInvalid = nBegin; if ( nEnd > GetEndInv() ) nEndInvalid = nEnd; - if( meType == WRONGLIST_GRAMMAR ) - { - ((SwGrammarMarkUp*)this)->removeSentence( nBegin, nEnd ); - } } void SwWrongList::SetInvalid( xub_StrLen nBegin, xub_StrLen nEnd ) { nBeginInvalid = nBegin; nEndInvalid = nEnd; - if( meType == WRONGLIST_GRAMMAR ) - ((SwGrammarMarkUp*)this)->removeSentence( nBegin, nEnd ); } @@ -540,6 +567,44 @@ void SwWrongList::Remove(USHORT nIdx, USHORT nLen ) #endif } +void SwWrongList::RemoveEntry( xub_StrLen nBegin, xub_StrLen nEnd ) { + USHORT nDelPos = 0; + USHORT nDel = 0; + std::vector<SwWrongArea>::iterator aIter = maList.begin(); + while( aIter != maList.end() && (*aIter).mnPos < nBegin ) + { + ++aIter; + ++nDelPos; + } + if( WRONGLIST_GRAMMAR == GetWrongListType() ) + { + while( aIter != maList.end() && nBegin < nEnd && nEnd > (*aIter).mnPos ) + { + ++aIter; + ++nDel; + } + } + else + { + while( aIter != maList.end() && nBegin == (*aIter).mnPos && nEnd == (*aIter).mnPos +(*aIter).mnLen ) + { + ++aIter; + ++nDel; + } + } + if( nDel ) + Remove( nDelPos, nDel ); +} + +bool SwWrongList::LookForEntry( xub_StrLen nBegin, xub_StrLen nEnd ) { + std::vector<SwWrongArea>::iterator aIter = maList.begin(); + while( aIter != maList.end() && (*aIter).mnPos < nBegin ) + ++aIter; + if( aIter != maList.end() && nBegin == (*aIter).mnPos && nEnd == (*aIter).mnPos +(*aIter).mnLen ) + return true; + return false; +} + void SwWrongList::Insert( const rtl::OUString& rType, com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > xPropertyBag, xub_StrLen nNewPos, xub_StrLen nNewLen ) diff --git a/sw/source/core/txtnode/SwGrammarContact.cxx b/sw/source/core/txtnode/SwGrammarContact.cxx index 03a83f2e1929..614924cbb838 100644 --- a/sw/source/core/txtnode/SwGrammarContact.cxx +++ b/sw/source/core/txtnode/SwGrammarContact.cxx @@ -41,6 +41,9 @@ #include <rootfrm.hxx> #include <viewsh.hxx> +extern void repaintTextFrames( SwModify& rModify ); + + /* SwGrammarContact This class is responsible for the delayed display of grammar checks when a paragraph is edited It's a client of the paragraph the cursor points to. @@ -59,7 +62,6 @@ class SwGrammarContact : public IGrammarContact, public SwClient SwGrammarMarkUp *mpProxyList; bool mbFinished; SwTxtNode* getMyTxtNode() { return (SwTxtNode*)pRegisteredIn; } - void repaintTextFrames( SwModify& rModify ) const; DECL_LINK( TimerRepaint, Timer * ); public: @@ -96,21 +98,6 @@ IMPL_LINK( SwGrammarContact, TimerRepaint, Timer *, pTimer ) return 0; } -/* repaint all text frames of the given text node */ -void SwGrammarContact::repaintTextFrames( SwModify& rModify ) const -{ - SwClientIter aIter( rModify ); - for( const SwTxtFrm *pFrm = (const SwTxtFrm*)aIter.First( TYPE(SwTxtFrm) ); - pFrm; pFrm = (const SwTxtFrm*)aIter.Next() ) - { - SwRect aRec( pFrm->PaintArea() ); - const SwRootFrm *pRootFrm = pFrm->FindRootFrm(); - ViewShell *pCurShell = pRootFrm ? pRootFrm->GetCurrShell() : NULL; - if( pCurShell ) - pCurShell->InvalidateWindows( aRec ); - } -} - /* I'm always a client of the current paragraph */ void SwGrammarContact::updateCursorPosition( const SwPosition& rNewPos ) { @@ -147,7 +134,15 @@ SwGrammarMarkUp* SwGrammarContact::getGrammarCheck( SwTxtNode& rTxtNode, bool bC mpProxyList = 0; } if( !mpProxyList ) - mpProxyList = new SwGrammarMarkUp(); + { + if( rTxtNode.GetGrammarCheck() ) + mpProxyList = (SwGrammarMarkUp*)rTxtNode.GetGrammarCheck()->Clone(); + else + { + mpProxyList = new SwGrammarMarkUp(); + mpProxyList->SetInvalid( 0, STRING_LEN ); + } + } mbFinished = false; } pRet = mpProxyList; @@ -158,6 +153,7 @@ SwGrammarMarkUp* SwGrammarContact::getGrammarCheck( SwTxtNode& rTxtNode, bool bC if( bCreate && !pRet ) // do you want to create a list? { pRet = new SwGrammarMarkUp(); + pRet->SetInvalid( 0, STRING_LEN ); rTxtNode.SetGrammarCheck( pRet ); rTxtNode.SetGrammarCheckDirty( true ); } @@ -204,6 +200,21 @@ IGrammarContact* createGrammarContact() return new SwGrammarContact(); } +/* repaint all text frames of the given text node */ +void repaintTextFrames( SwModify& rModify ) +{ + SwClientIter aIter( rModify ); + for( const SwTxtFrm *pFrm = (const SwTxtFrm*)aIter.First( TYPE(SwTxtFrm) ); + pFrm; pFrm = (const SwTxtFrm*)aIter.Next() ) + { + SwRect aRec( pFrm->PaintArea() ); + const SwRootFrm *pRootFrm = pFrm->FindRootFrm(); + ViewShell *pCurShell = pRootFrm ? pRootFrm->GetCurrShell() : NULL; + if( pCurShell ) + pCurShell->InvalidateWindows( aRec ); + } +} + void finishGrammarCheck( SwTxtNode& rTxtNode ) { IGrammarContact* pGrammarContact = getGrammarContact( rTxtNode ); diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 8c97a897c3c6..e51b7ac61fd4 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -3041,7 +3041,7 @@ const ModelToViewHelper::ConversionMap* if ( pConversionMap && pConversionMap->size() ) pConversionMap->push_back( ModelToViewHelper::ConversionMapEntry( - rNodeText.getLength(), rRetText.getLength() ) ); + rNodeText.getLength()+1, rRetText.getLength()+1 ) ); return pConversionMap; } diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index f532b0a51658..b00e9c0febcd 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -1284,7 +1284,7 @@ SwRect SwTxtFrm::_AutoSpell( const SwCntntNode* pActNode, const SwViewOption& rV // // Calculate repaint area: // - if( nChgStart < nChgEnd && !rViewOpt.IsHideSpell() ) + if( nChgStart < nChgEnd ) { aRect = lcl_CalculateRepaintRect( *this, nChgStart, nChgEnd ); } diff --git a/sw/source/core/unocore/unoflatpara.cxx b/sw/source/core/unocore/unoflatpara.cxx index 3cb6411001c4..5067dc754ed4 100644 --- a/sw/source/core/unocore/unoflatpara.cxx +++ b/sw/source/core/unocore/unoflatpara.cxx @@ -144,7 +144,7 @@ void SAL_CALL SwXFlatParagraph::setChecked( ::sal_Int32 nType, ::sal_Bool bVal ) mpTxtNode->SetWrongDirty( !bVal ); else if ( text::TextMarkupType::SMARTTAG == nType ) mpTxtNode->SetSmartTagDirty( !bVal ); - else if( text::TextMarkupType::GRAMMAR == nType ) + else if( text::TextMarkupType::PROOFREADING == nType ) { mpTxtNode->SetGrammarCheckDirty( !bVal ); if( bVal ) @@ -161,7 +161,7 @@ void SAL_CALL SwXFlatParagraph::setChecked( ::sal_Int32 nType, ::sal_Bool bVal ) { if ( text::TextMarkupType::SPELLCHECK == nType ) return mpTxtNode->IsWrongDirty(); - else if ( text::TextMarkupType::GRAMMAR == nType ) + else if ( text::TextMarkupType::PROOFREADING == nType ) return mpTxtNode->IsGrammarCheckDirty(); else if ( text::TextMarkupType::SMARTTAG == nType ) return mpTxtNode->IsSmartTagDirty(); @@ -337,7 +337,7 @@ uno::Reference< text::XFlatParagraph > SwXFlatParagraphIterator::getNextPara() if ( pTxtNode && ((mnType == text::TextMarkupType::SPELLCHECK && pTxtNode->IsWrongDirty()) || - (mnType == text::TextMarkupType::GRAMMAR && + (mnType == text::TextMarkupType::PROOFREADING && pTxtNode->IsGrammarCheckDirty())) ) { pRet = pTxtNode; @@ -402,7 +402,7 @@ uno::Reference< text::XFlatParagraph > SwXFlatParagraphIterator::getNextPara() // in case that grammar checking will be finished we now have to reset // the flag at the root frame that indicated grammar checking was still active. - if (!xRet.is() && mnType == text::TextMarkupType::GRAMMAR) + if (!xRet.is() && mnType == text::TextMarkupType::PROOFREADING) { SwRootFrm *pRootFrm = mpDoc? mpDoc->GetRootFrm() : NULL; if (pRootFrm) diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx index c9676d74c7af..022cdd003643 100644 --- a/sw/source/core/unocore/unomap.cxx +++ b/sw/source/core/unocore/unomap.cxx @@ -2557,7 +2557,7 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP {SW_PROP_NMID(UNO_NAME_PAGE_COUNT), WID_PAGE_COUNT, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::READONLY, 0}, {SW_PROP_NMID(UNO_NAME_LINE_COUNT), WID_LINE_COUNT, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::READONLY, 0}, {SW_PROP_NMID(UNO_NAME_IS_CONSTANT_SPELLCHECK), WID_IS_CONSTANT_SPELLCHECK, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0}, - {SW_PROP_NMID(UNO_NAME_IS_HIDE_SPELL_MARKS), WID_IS_HIDE_SPELL_MARKS, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0}, + {SW_PROP_NMID(UNO_NAME_IS_HIDE_SPELL_MARKS), WID_IS_HIDE_SPELL_MARKS, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0}, // deprecated #i91949 {0,0,0,0,0,0} }; aMapArr[nPropertyId] = pTextViewMap; diff --git a/sw/source/core/unocore/unoprnms.cxx b/sw/source/core/unocore/unoprnms.cxx index ff3576296da6..bf066ee17416 100644 --- a/sw/source/core/unocore/unoprnms.cxx +++ b/sw/source/core/unocore/unoprnms.cxx @@ -741,7 +741,7 @@ const SwPropNameTab aPropNameTab = { /* 0696 UNO_NAME_PAGE_COUNT*/ {MAP_CHAR_LEN("PageCount")}, /* 0697 UNO_NAME_LINE_COUNT*/ {MAP_CHAR_LEN("LineCount")}, /* 0698 UNO_NAME_IS_CONSTANT_SPELLCHECK*/ {MAP_CHAR_LEN("IsConstantSpellcheck")}, -/* 0699 UNO_NAME_IS_HIDE_SPELL_MARKS*/ {MAP_CHAR_LEN("IsHideSpellMarks")}, +/* 0699 UNO_NAME_IS_HIDE_SPELL_MARKS*/ {MAP_CHAR_LEN("IsHideSpellMarks")}, /* deprecated #i91949 */ /* 0700 UNO_NAME_IS_FIELD_USED */ {MAP_CHAR_LEN("IsFieldUsed")}, /* 0701 UNO_NAME_IS_FIELD_DISPLAYED */ {MAP_CHAR_LEN("IsFieldDisplayed")}, /* 0702 UNO_NAME_BUILDID */ {MAP_CHAR_LEN("BuildId")}, diff --git a/sw/source/core/unocore/unotextmarkup.cxx b/sw/source/core/unocore/unotextmarkup.cxx index 7c72b377acb6..8f95fed99cea 100644 --- a/sw/source/core/unocore/unotextmarkup.cxx +++ b/sw/source/core/unocore/unotextmarkup.cxx @@ -36,6 +36,7 @@ #include <vcl/svapp.hxx> #include <SwSmartTagMgr.hxx> #include <com/sun/star/text/TextMarkupType.hpp> +#include <com/sun/star/text/TextMarkupDescriptor.hpp> #include <com/sun/star/container/XStringKeyMap.hpp> #include <ndtxt.hxx> #include <SwGrammarMarkUp.hxx> @@ -96,7 +97,7 @@ void SAL_CALL SwXTextMarkup::commitTextMarkup( mpTxtNode->SetWrong( pWList ); } } - else if ( nType == text::TextMarkupType::GRAMMAR || nType == text::TextMarkupType::SENTENCE ) + else if ( nType == text::TextMarkupType::PROOFREADING || nType == text::TextMarkupType::SENTENCE ) { IGrammarContact *pGrammarContact = getGrammarContact( *mpTxtNode ); if( pGrammarContact ) @@ -115,10 +116,7 @@ void SAL_CALL SwXTextMarkup::commitTextMarkup( } bRepaint = pWList == mpTxtNode->GetGrammarCheck(); if( pWList->GetBeginInv() < STRING_LEN ) - { ((SwGrammarMarkUp*)pWList)->ClearGrammarList(); - pWList->Validate(); - } } else if ( nType == text::TextMarkupType::SMARTTAG ) { @@ -154,7 +152,7 @@ void SAL_CALL SwXTextMarkup::commitTextMarkup( SwWrongList* pSubList = pWList->SubList( nInsertPos ); if ( !pSubList ) { - if( nType == text::TextMarkupType::GRAMMAR || nType == text::TextMarkupType::SENTENCE ) + if( nType == text::TextMarkupType::PROOFREADING || nType == text::TextMarkupType::SENTENCE ) pSubList = new SwGrammarMarkUp(); else pSubList = new SwWrongList( pWList->GetWrongListType() ); @@ -170,7 +168,7 @@ void SAL_CALL SwXTextMarkup::commitTextMarkup( bCommit = true; nLength = aEndPos.mnPos + 1 - aStartPos.mnPos; } - else if( nType == text::TextMarkupType::GRAMMAR || nType == text::TextMarkupType::SENTENCE ) + else if( nType == text::TextMarkupType::PROOFREADING || nType == text::TextMarkupType::SENTENCE ) { bCommit = true; nStart = aStartPos.mnPos; @@ -235,6 +233,197 @@ void SAL_CALL SwXTextMarkup::commitTextMarkup( finishGrammarCheck( *mpTxtNode ); } + +void lcl_commitGrammarMarkUp( + const ModelToViewHelper::ConversionMap* pConversionMap, + SwGrammarMarkUp* pWList, + ::sal_Int32 nType, + const ::rtl::OUString & rIdentifier, + ::sal_Int32 nStart, + ::sal_Int32 nLength, + const uno::Reference< container::XStringKeyMap > & xMarkupInfoContainer) +{ + ASSERT( nType == text::TextMarkupType::GRAMMAR || nType == text::TextMarkupType::SENTENCE, "Wrong mark-up type" ) + const ModelToViewHelper::ModelPosition aStartPos = + ModelToViewHelper::ConvertToModelPosition( pConversionMap, nStart ); + const ModelToViewHelper::ModelPosition aEndPos = + ModelToViewHelper::ConvertToModelPosition( pConversionMap, nStart + nLength - 1); + + const bool bStartInField = aStartPos.mbIsField; + const bool bEndInField = aEndPos.mbIsField; + bool bCommit = false; + + if ( bStartInField && bEndInField && aStartPos.mnPos == aEndPos.mnPos ) + { + nStart = aStartPos.mnSubPos; + const xub_StrLen nFieldPosModel = static_cast< xub_StrLen >(aStartPos.mnPos); + const USHORT nInsertPos = pWList->GetWrongPos( nFieldPosModel ); + + SwGrammarMarkUp* pSubList = (SwGrammarMarkUp*)pWList->SubList( nInsertPos ); + if ( !pSubList ) + { + pSubList = new SwGrammarMarkUp(); + pWList->InsertSubList( nFieldPosModel, 1, nInsertPos, pSubList ); + } + + pWList = pSubList; + bCommit = true; + } + else if ( !bStartInField && !bEndInField ) + { + nStart = aStartPos.mnPos; + bCommit = true; + nLength = aEndPos.mnPos + 1 - aStartPos.mnPos; + } + else + { + bCommit = true; + nStart = aStartPos.mnPos; + sal_Int32 nEnd = aEndPos.mnPos; + if( bStartInField && nType != text::TextMarkupType::SENTENCE ) + { + const xub_StrLen nFieldPosModel = static_cast< xub_StrLen >(aStartPos.mnPos); + const USHORT nInsertPos = pWList->GetWrongPos( nFieldPosModel ); + SwGrammarMarkUp* pSubList = (SwGrammarMarkUp*)pWList->SubList( nInsertPos ); + if ( !pSubList ) + { + pSubList = new SwGrammarMarkUp(); + pWList->InsertSubList( nFieldPosModel, 1, nInsertPos, pSubList ); + } + const sal_uInt32 nTmpStart = ModelToViewHelper::ConvertToViewPosition( pConversionMap, aStartPos.mnPos ); + const sal_uInt32 nTmpLen = ModelToViewHelper::ConvertToViewPosition( pConversionMap, aStartPos.mnPos + 1 ) + - nTmpStart - aStartPos.mnSubPos; + if( nTmpLen > 0 ) + pSubList->Insert( rIdentifier, xMarkupInfoContainer, + static_cast< xub_StrLen >(aStartPos.mnSubPos), static_cast< xub_StrLen >(nTmpLen) ); + ++nStart; + } + if( bEndInField && nType != text::TextMarkupType::SENTENCE ) + { + const xub_StrLen nFieldPosModel = static_cast< xub_StrLen >(aEndPos.mnPos); + const USHORT nInsertPos = pWList->GetWrongPos( nFieldPosModel ); + SwGrammarMarkUp* pSubList = (SwGrammarMarkUp*)pWList->SubList( nInsertPos ); + if ( !pSubList ) + { + pSubList = new SwGrammarMarkUp(); + pWList->InsertSubList( nFieldPosModel, 1, nInsertPos, pSubList ); + } + const sal_uInt32 nTmpLen = aEndPos.mnSubPos + 1; + pSubList->Insert( rIdentifier, xMarkupInfoContainer, 0, static_cast< xub_StrLen >(nTmpLen) ); + } + else + ++nEnd; + if( nEnd > nStart ) + nLength = nEnd - nStart; + else + bCommit = false; + } + + if ( bCommit ) + { + if( nType == text::TextMarkupType::SENTENCE ) + ((SwGrammarMarkUp*)pWList)->setSentence( static_cast< xub_StrLen >(nStart+nLength) ); + else + pWList->Insert( rIdentifier, xMarkupInfoContainer, + static_cast< xub_StrLen >(nStart), static_cast< xub_StrLen >(nLength) ); + } +} + + +void SAL_CALL SwXTextMarkup::commitMultiTextMarkup( + const uno::Sequence< text::TextMarkupDescriptor > &rMarkups ) +throw (lang::IllegalArgumentException, uno::RuntimeException) +{ + vos::OGuard aGuard(Application::GetSolarMutex()); + + // paragraph already dead or modified? + if ( !mpTxtNode ) + return; + + // check for equal length of all sequnces + sal_Int32 nLen = rMarkups.getLength(); + + // for grammar checking there should be exactly one sentence markup + // and 0..n grammar markups. + // Different markups are not expected but may be applied anyway since + // that should be no problem... + // but it has to be implemented, at the moment only this function is for + // grammar markups and sentence markup only! + sal_Int32 nSentenceMarkUpIndex = -1; + const text::TextMarkupDescriptor *pMarkups = rMarkups.getConstArray(); + sal_Int32 i; + for( i = 0; i < nLen; ++i ) + { + if (pMarkups[i].nType == text::TextMarkupType::SENTENCE) + { + if (nSentenceMarkUpIndex == -1) + nSentenceMarkUpIndex = i; + else // there is already one sentence markup + throw lang::IllegalArgumentException(); + } + else if( pMarkups[i].nType != text::TextMarkupType::PROOFREADING ) + return; + } + + if( nSentenceMarkUpIndex == -1 ) + return; + + // get appropriate list to use... + SwGrammarMarkUp* pWList = 0; + bool bRepaint = false; + IGrammarContact *pGrammarContact = getGrammarContact( *mpTxtNode ); + if( pGrammarContact ) + { + pWList = pGrammarContact->getGrammarCheck( *mpTxtNode, true ); + ASSERT( pWList, "GrammarContact _has_ to deliver a wrong list" ) + } + else + { + pWList = mpTxtNode->GetGrammarCheck(); + if ( !pWList ) + { + mpTxtNode->SetGrammarCheck( new SwGrammarMarkUp() ); + pWList = mpTxtNode->GetGrammarCheck(); + pWList->SetInvalid( 0, STRING_LEN ); + } + } + bRepaint = pWList == mpTxtNode->GetGrammarCheck(); + + bool bAcceptGrammarError = false; + if( pWList->GetBeginInv() < STRING_LEN ) + { + const ModelToViewHelper::ModelPosition aSentenceEnd = + ModelToViewHelper::ConvertToModelPosition( mpConversionMap, + pMarkups[nSentenceMarkUpIndex].nOffset + pMarkups[nSentenceMarkUpIndex].nLength ); + bAcceptGrammarError = (xub_StrLen)aSentenceEnd.mnPos > pWList->GetBeginInv(); + pWList->ClearGrammarList( (xub_StrLen)aSentenceEnd.mnPos ); + } + + if( bAcceptGrammarError ) + { + for( i = 0; i < nLen; ++i ) + { + const text::TextMarkupDescriptor &rDesc = pMarkups[i]; + lcl_commitGrammarMarkUp( mpConversionMap, pWList, rDesc.nType, + rDesc.aIdentifier, rDesc.nOffset, rDesc.nLength, rDesc.xMarkupInfoContainer ); + } + } + else + { + bRepaint = false; + i = nSentenceMarkUpIndex; + const text::TextMarkupDescriptor &rDesc = pMarkups[i]; + lcl_commitGrammarMarkUp( mpConversionMap, pWList, rDesc.nType, + rDesc.aIdentifier, rDesc.nOffset, rDesc.nLength, rDesc.xMarkupInfoContainer ); + } + + if( bRepaint ) + finishGrammarCheck( *mpTxtNode ); + + return; +} + + void SwXTextMarkup::Modify( SfxPoolItem* /*pOld*/, SfxPoolItem* /*pNew*/ ) { // FME 2007-07-16 #i79641# In my opinion this is perfectly legal, diff --git a/sw/source/ui/app/appopt.cxx b/sw/source/ui/app/appopt.cxx index e500fcc63449..5f2285a2bce9 100644 --- a/sw/source/ui/app/appopt.cxx +++ b/sw/source/ui/app/appopt.cxx @@ -91,8 +91,6 @@ #include <globals.hrc> #endif #include <globals.h> // globale Konstanten z.B. -// #107253# -#include <swlinguconfig.hxx> #include <svtools/slstitm.hxx> #include "swabstdlg.hxx" #include <swwrtshitem.hxx> @@ -192,8 +190,7 @@ SfxItemSet* SwModule::CreateItemSet( USHORT nId ) pPrt = new SfxPrinter(pSet); pRet->Put(SwPtrItem(FN_PARAM_PRINTER, pPrt));*/ - // #107253# Replaced SvtLinguConfig with SwLinguConfig wrapper with UsageCount - SwLinguConfig aLinguCfg; + SvtLinguConfig aLinguCfg; Any aLang = aLinguCfg.GetProperty(C2U("DefaultLocale")); Locale aLocale; diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx index 781d60332376..dd163a3216eb 100644 --- a/sw/source/ui/app/docsh2.cxx +++ b/sw/source/ui/app/docsh2.cxx @@ -1201,7 +1201,6 @@ void SwDocShell::Execute(SfxRequest& rReq) SID_HTML_MODE, SID_RULER_PROTECT, SID_AUTOSPELL_CHECK, - SID_AUTOSPELL_MARKOFF, FN_RULER, /*20211*/ FN_VIEW_GRAPHIC, /*20213*/ FN_VIEW_BOUNDS, /**/ diff --git a/sw/source/ui/app/docshini.cxx b/sw/source/ui/app/docshini.cxx index 5ccbe67a58c7..900a1f7fd060 100644 --- a/sw/source/ui/app/docshini.cxx +++ b/sw/source/ui/app/docshini.cxx @@ -116,8 +116,6 @@ #include <globals.hrc> #endif -// #107253# -#include <swlinguconfig.hxx> // #i18732# #include <fmtfollowtextflow.hxx> @@ -791,8 +789,7 @@ void SwDocShell::SubInitNew() //! get lingu options without loading lingu DLL SvtLinguOptions aLinguOpt; - // #107253# Replaced SvtLinguConfig with SwLinguConfig wrapper with UsageCount - SwLinguConfig().GetOptions( aLinguOpt ); + SvtLinguConfig().GetOptions( aLinguOpt ); sal_Int16 nVal = aLinguOpt.nDefaultLanguage, eCJK = aLinguOpt.nDefaultLanguage_CJK, diff --git a/sw/source/ui/config/fontcfg.cxx b/sw/source/ui/config/fontcfg.cxx index c096d148f2c3..14793b511c6f 100644 --- a/sw/source/ui/config/fontcfg.cxx +++ b/sw/source/ui/config/fontcfg.cxx @@ -39,9 +39,6 @@ #include <com/sun/star/uno/Sequence.hxx> #include <swtypes.hxx> -// #107253# -#include <swlinguconfig.hxx> - #include <unomid.h> using namespace utl; @@ -117,8 +114,7 @@ SwStdFontConfig::SwStdFontConfig() : { SvtLinguOptions aLinguOpt; - // #107253# Replaced SvtLinguConfig with SwLinguConfig wrapper with UsageCount - SwLinguConfig().GetOptions( aLinguOpt ); + SvtLinguConfig().GetOptions( aLinguOpt ); sal_Int16 eWestern = aLinguOpt.nDefaultLanguage, eCJK = aLinguOpt.nDefaultLanguage_CJK, @@ -165,8 +161,7 @@ void SwStdFontConfig::Commit() Any* pValues = aValues.getArray(); SvtLinguOptions aLinguOpt; - // #107253# Replaced SvtLinguConfig with SwLinguConfig wrapper with UsageCount - SwLinguConfig().GetOptions( aLinguOpt ); + SvtLinguConfig().GetOptions( aLinguOpt ); sal_Int16 eWestern = aLinguOpt.nDefaultLanguage, eCJK = aLinguOpt.nDefaultLanguage_CJK, @@ -201,8 +196,7 @@ BOOL SwStdFontConfig::IsFontDefault(USHORT nFontType) const BOOL bSame = sal_False; SvtLinguOptions aLinguOpt; - // #107253# Replaced SvtLinguConfig with SwLinguConfig wrapper with UsageCount - SwLinguConfig().GetOptions( aLinguOpt ); + SvtLinguConfig().GetOptions( aLinguOpt ); sal_Int16 eWestern = aLinguOpt.nDefaultLanguage, eCJK = aLinguOpt.nDefaultLanguage_CJK, @@ -325,7 +319,7 @@ void SwStdFontConfig::ChangeInt( USHORT nFontType, sal_Int32 nHeight ) if( nFontType < DEF_FONT_COUNT && nDefaultFontHeight[nFontType] != nHeight) { SvtLinguOptions aLinguOpt; - SwLinguConfig().GetOptions( aLinguOpt ); + SvtLinguConfig().GetOptions( aLinguOpt ); sal_Int16 eWestern = aLinguOpt.nDefaultLanguage, eCJK = aLinguOpt.nDefaultLanguage_CJK, eCTL = aLinguOpt.nDefaultLanguage_CTL; diff --git a/sw/source/ui/config/makefile.mk b/sw/source/ui/config/makefile.mk index 2a5d53fa97ba..02ed4d075995 100644 --- a/sw/source/ui/config/makefile.mk +++ b/sw/source/ui/config/makefile.mk @@ -69,8 +69,7 @@ SLOFILES = \ $(SLO)$/prtopt.obj \ $(SLO)$/uinums.obj \ $(SLO)$/usrpref.obj \ - $(SLO)$/viewopt.obj \ - $(SLO)$/swlinguconfig.obj + $(SLO)$/viewopt.obj LIB1TARGET= $(SLB)$/$(TARGET).lib @@ -84,8 +83,8 @@ LIB1OBJFILES = \ $(SLO)$/prtopt.obj \ $(SLO)$/uinums.obj \ $(SLO)$/usrpref.obj \ - $(SLO)$/viewopt.obj \ - $(SLO)$/swlinguconfig.obj + $(SLO)$/viewopt.obj + # --- Targets ------------------------------------------------------- .INCLUDE : target.mk diff --git a/sw/source/ui/config/swlinguconfig.cxx b/sw/source/ui/config/swlinguconfig.cxx deleted file mode 100644 index 3bac33fe16ad..000000000000 --- a/sw/source/ui/config/swlinguconfig.cxx +++ /dev/null @@ -1,86 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: swlinguconfig.cxx,v $ - * $Revision: 1.6 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sw.hxx" - -// #107253# -#include <swlinguconfig.hxx> -#include <svtools/lingucfg.hxx> - -using namespace ::com::sun::star; - -// init static member -static SvtLinguConfig* mpImplLinguConfig = 0L; -static sal_uInt32 mnImplUseCount = 0L; - -void ImplCreateOnDemand() -{ - if(!mpImplLinguConfig && mnImplUseCount) - { - mpImplLinguConfig = new SvtLinguConfig(); - } -} - -SwLinguConfig::SwLinguConfig() -{ - mnImplUseCount++; -} - -SwLinguConfig::~SwLinguConfig() -{ - mnImplUseCount--; - - if(!mnImplUseCount && mpImplLinguConfig) - { - delete mpImplLinguConfig; - mpImplLinguConfig = 0L; - } -} - -sal_Bool SwLinguConfig::SetProperty(const rtl::OUString &rPropertyName, const uno::Any &rValue) -{ - ImplCreateOnDemand(); - return mpImplLinguConfig->SetProperty(rPropertyName, rValue); -} - -sal_Bool SwLinguConfig::GetOptions(SvtLinguOptions &rOptions) const -{ - ImplCreateOnDemand(); - return mpImplLinguConfig->GetOptions(rOptions); -} - -uno::Any SwLinguConfig::GetProperty(const rtl::OUString &rPropertyName) const -{ - ImplCreateOnDemand(); - return mpImplLinguConfig->GetProperty(rPropertyName); -} - -// eof diff --git a/sw/source/ui/dialog/SwSpellDialogChildWindow.cxx b/sw/source/ui/dialog/SwSpellDialogChildWindow.cxx index 4e1c60c67a1d..635abef2fb3b 100644 --- a/sw/source/ui/dialog/SwSpellDialogChildWindow.cxx +++ b/sw/source/ui/dialog/SwSpellDialogChildWindow.cxx @@ -49,7 +49,6 @@ #include <svx/svdogrp.hxx> #include <svtools/linguprops.hxx> #include <svtools/lingucfg.hxx> -#include <swlinguconfig.hxx> #include <doc.hxx> #ifndef _DOCSH_HXX #include <docsh.hxx> @@ -180,7 +179,7 @@ SwSpellDialogChildWindow::SwSpellDialogChildWindow ( { String aPropName( String::CreateFromAscii(UPN_IS_GRAMMAR_INTERACTIVE ) ); - SwLinguConfig().GetProperty( aPropName ) >>= m_bIsGrammarCheckingOn; + SvtLinguConfig().GetProperty( aPropName ) >>= m_bIsGrammarCheckingOn; } /*-- 09.09.2003 10:39:22--------------------------------------------------- @@ -323,8 +322,8 @@ svx::SpellPortions SwSpellDialogChildWindow::GetNextWrongSentence (void) if(bOtherText && m_pSpellState->m_bStartedInOther && m_pSpellState->pOtherCursor) { m_pSpellState->m_bStartedInOther = false; - pWrtShell->SpellEnd(); pWrtShell->SetSelection(*m_pSpellState->pOtherCursor); + pWrtShell->SpellEnd(); delete m_pSpellState->pOtherCursor; m_pSpellState->pOtherCursor = 0; pWrtShell->SpellStart(DOCPOS_OTHERSTART, DOCPOS_CURR, DOCPOS_OTHERSTART, FALSE ); @@ -493,40 +492,33 @@ void SwSpellDialogChildWindow::SetGrammarChecking(bool bOn) aVal <<= bOn; m_bIsGrammarCheckingOn = bOn; String aPropName( C2S(UPN_IS_GRAMMAR_INTERACTIVE ) ); - SwLinguConfig().SetProperty( aPropName, aVal ); -} -/*-- 16.06.2008 12:00:03--------------------------------------------------- - - -----------------------------------------------------------------------*/ -bool SwSpellDialogChildWindow::HasAnyVendor() -{ -#if DEBUG - return true; -#else - return false; -#endif -} -/*-- 16.06.2008 12:00:09--------------------------------------------------- - - -----------------------------------------------------------------------*/ -String SwSpellDialogChildWindow::GetVendorForLanguage( LanguageType eLanguage ) -{ - String sRet; -#if DEBUG - if( eLanguage == LANGUAGE_GERMAN_SWISS ) - sRet = String::CreateFromAscii( "SwissGrammar" ); -#endif - (void) eLanguage; - return sRet; -} -/*-- 19.06.2008 15:55:33--------------------------------------------------- - - -----------------------------------------------------------------------*/ -Image SwSpellDialogChildWindow::GetVendorLogoForLanguage( LanguageType /*eLanguage*/ ) -{ - return Image(); + SvtLinguConfig().SetProperty( aPropName, aVal ); + // set current spell position to the start of the current sentence to + // continue with this sentence after grammar checking state has been changed + SwWrtShell* pWrtShell = GetWrtShell_Impl(); + if(pWrtShell) + { + ShellModes eSelMode = pWrtShell->GetView().GetShellMode(); + bool bDrawText = SHELL_MODE_DRAWTEXT == eSelMode; + bool bNormalText = + SHELL_MODE_TABLE_TEXT == eSelMode || + SHELL_MODE_LIST_TEXT == eSelMode || + SHELL_MODE_TABLE_LIST_TEXT == eSelMode || + SHELL_MODE_TEXT == eSelMode; + if( bNormalText ) + pWrtShell->PutSpellingToSentenceStart(); + else if( bDrawText ) + { + SdrView* pSdrView = pWrtShell->GetDrawView(); + SdrOutliner* pOutliner = pSdrView ? pSdrView->GetTextEditOutliner() : 0; + DBG_ASSERT(pOutliner, "No Outliner in SwSpellDialogChildWindow::SetGrammarChecking") + if(pOutliner) + { + pOutliner->PutSpellingToSentenceStart( pSdrView->GetTextEditOutlinerView()->GetEditView() ); + } + } + } } - /*-- 28.10.2003 08:41:09--------------------------------------------------- -----------------------------------------------------------------------*/ diff --git a/sw/source/ui/dialog/ascfldlg.cxx b/sw/source/ui/dialog/ascfldlg.cxx index c119f367e02c..1e978dbdac4c 100644 --- a/sw/source/ui/dialog/ascfldlg.cxx +++ b/sw/source/ui/dialog/ascfldlg.cxx @@ -59,8 +59,6 @@ #include <ascfldlg.hrc> #endif -// #107253# -#include <swlinguconfig.hxx> using namespace ::com::sun::star; @@ -232,9 +230,7 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( Window* pParent, SwDocShell& rDocSh, else { SvtLinguOptions aLinguOpt; - - // #107253# Replaced SvtLinguConfig with SwLinguConfig wrapper with UsageCount - SwLinguConfig().GetOptions( aLinguOpt ); + SvtLinguConfig().GetOptions( aLinguOpt ); switch(nAppScriptType) { case SCRIPTTYPE_ASIAN: diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx index e205182620a4..d600a7e21ea0 100644 --- a/sw/source/ui/docvw/edtwin.cxx +++ b/sw/source/ui/docvw/edtwin.cxx @@ -4758,7 +4758,9 @@ void SwEditWin::Command( const CommandEvent& rCEvt ) aEvent.ExecutePosition.X = aPixPos.X(); aEvent.ExecutePosition.Y = aPixPos.Y(); Menu* pMenu = 0; - if( GetView().TryContextMenuInterception( *pROPopup, pMenu, aEvent ) ) + ::rtl::OUString sMenuName = + ::rtl::OUString::createFromAscii( "private:resource/ReadonlyContextMenu"); + if( GetView().TryContextMenuInterception( *pROPopup, sMenuName, pMenu, aEvent ) ) { if ( pMenu ) { diff --git a/sw/source/ui/docvw/postit.cxx b/sw/source/ui/docvw/postit.cxx index 8d644e94a663..08cba6066892 100644 --- a/sw/source/ui/docvw/postit.cxx +++ b/sw/source/ui/docvw/postit.cxx @@ -757,10 +757,6 @@ void SwPostIt::InitControls() nCntrl |= EE_CNTRL_MARKFIELDS; else nCntrl &= ~EE_CNTRL_MARKFIELDS; - if (pVOpt->IsHideSpell()) - nCntrl |= EE_CNTRL_NOREDLINES; - else - nCntrl &= ~EE_CNTRL_NOREDLINES; if (pVOpt->IsOnlineSpell()) nCntrl |= EE_CNTRL_ONLINESPELLING; else @@ -1435,10 +1431,6 @@ void SwPostIt::SetSpellChecking() { const SwViewOption* pVOpt = mpView->GetWrtShellPtr()->GetViewOptions(); ULONG nCntrl = mpOutliner->GetControlWord(); - if (pVOpt->IsHideSpell()) - nCntrl |= EE_CNTRL_NOREDLINES; - else - nCntrl &= ~EE_CNTRL_NOREDLINES; if (pVOpt->IsOnlineSpell()) nCntrl |= EE_CNTRL_ONLINESPELLING; else diff --git a/sw/source/ui/inc/SwSpellDialogChildWindow.hxx b/sw/source/ui/inc/SwSpellDialogChildWindow.hxx index ec595030237b..ae79a41343fe 100644 --- a/sw/source/ui/inc/SwSpellDialogChildWindow.hxx +++ b/sw/source/ui/inc/SwSpellDialogChildWindow.hxx @@ -58,9 +58,6 @@ protected: virtual bool HasGrammarChecking(); virtual bool IsGrammarChecking(); virtual void SetGrammarChecking(bool bOn); - virtual bool HasAnyVendor(); - virtual String GetVendorForLanguage( LanguageType eLanguage ); - virtual Image GetVendorLogoForLanguage( LanguageType eLanguage ); virtual void GetFocus(); virtual void LoseFocus(); diff --git a/sw/source/ui/inc/olmenu.hxx b/sw/source/ui/inc/olmenu.hxx index fdfa9ab6308c..0985c3bdc4da 100644 --- a/sw/source/ui/inc/olmenu.hxx +++ b/sw/source/ui/inc/olmenu.hxx @@ -32,10 +32,11 @@ #include <com/sun/star/linguistic2/XDictionary.hpp> #include <com/sun/star/linguistic2/XSpellAlternatives.hpp> -#include <com/sun/star/linguistic2/GrammarCheckingResult.hpp> +#include <com/sun/star/linguistic2/ProofreadingResult.hpp> #include <com/sun/star/uno/Sequence.h> #include <rtl/ustring.hxx> +#include <vcl/image.hxx> #include <vcl/menu.hxx> #include <map> @@ -67,6 +68,8 @@ class SwSpellPopup : public PopupMenu bool bGrammarResults; // show grammar results? Or show spellcheck results? + Image aInfo16; + USHORT fillLangPopupMenu( PopupMenu *pPopupMenu , USHORT Lang_Start, ::com::sun::star::uno::Sequence< ::rtl::OUString > aSeq,SwWrtShell* pWrtSh, USHORT nLangTable); using PopupMenu::Execute; @@ -78,7 +81,7 @@ public: const String & rParaText ); SwSpellPopup( SwWrtShell *pWrtSh, - const ::com::sun::star::linguistic2::GrammarCheckingResult &rResult, + const ::com::sun::star::linguistic2::ProofreadingResult &rResult, sal_Int32 nErrorInResult, const ::com::sun::star::uno::Sequence< rtl::OUString > &rSuggestions, const String & rParaText ); diff --git a/sw/source/ui/inc/swlinguconfig.hxx b/sw/source/ui/inc/swlinguconfig.hxx deleted file mode 100644 index 5987779c0459..000000000000 --- a/sw/source/ui/inc/swlinguconfig.hxx +++ /dev/null @@ -1,51 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: swlinguconfig.hxx,v $ - * $Revision: 1.6 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SWLINGUCONFIG_HXX -#define _SWLINGUCONFIG_HXX -#include <com/sun/star/uno/Any.h> -#include <rtl/ustring.hxx> -#include "swdllapi.h" - -// predeclarations -struct SvtLinguOptions; - -// #107253# -class SW_DLLPUBLIC SwLinguConfig -{ -public: - SwLinguConfig(); - ~SwLinguConfig(); - - sal_Bool SetProperty(const rtl::OUString &rPropertyName, const com::sun::star::uno::Any &rValue); - sal_Bool GetOptions(SvtLinguOptions &rOptions) const; - com::sun::star::uno::Any GetProperty(const rtl::OUString &rPropertyName) const; -}; - -#endif // _SWLINGUCONFIG_HXX diff --git a/sw/source/ui/lingu/olmenu.cxx b/sw/source/ui/lingu/olmenu.cxx index 5bc9a657b6ae..5c91287a84e1 100644 --- a/sw/source/ui/lingu/olmenu.cxx +++ b/sw/source/ui/lingu/olmenu.cxx @@ -31,7 +31,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - #include <hintids.hxx> #ifndef _SVSTDARR_HXX @@ -40,30 +39,34 @@ #endif #include <svtools/lingucfg.hxx> #include <svtools/linguprops.hxx> -#include <sfx2/dispatch.hxx> +#include <svtools/filter.hxx> +#include <svx/impgrf.hxx> #include <svx/svxacorr.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/imagemgr.hxx> +#include <osl/file.hxx> +#include <rtl/string.hxx> #include <i18npool/mslangid.hxx> #include <linguistic/lngprops.hxx> -#ifndef _LINGUISTIC_MISC_HHX_ #include <linguistic/misc.hxx> -#endif #include <comphelper/processfactory.hxx> #include <svx/unolingu.hxx> #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/linguistic2/XSpellChecker1.hpp> #include <com/sun/star/linguistic2/XLanguageGuessing.hpp> -#include <com/sun/star/linguistic2/SingleGrammarError.hpp> +#include <com/sun/star/linguistic2/SingleProofreadingError.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> #include <svx/dlgutil.hxx> #include <svtools/itemset.hxx> #include <svx/langitem.hxx> #include <svx/splwrap.hxx> #include <vcl/svapp.hxx> +#include <vcl/settings.hxx> #include <svtools/lingucfg.hxx> #include <svx/acorrcfg.hxx> #include <swmodule.hxx> -#include <swlinguconfig.hxx> #include <cmdid.h> #include <helpid.h> #include <swtypes.hxx> @@ -339,6 +342,25 @@ USHORT SwSpellPopup::fillLangPopupMenu( } +static Image lcl_GetImageFromPngUrl( const OUString &rFileUrl ) +{ + Image aRes; + OUString aTmp; + osl::FileBase::getSystemPathFromFileURL( rFileUrl, aTmp ); +// ::rtl::OString aPath = OString( aTmp.getStr(), aTmp.getLength(), osl_getThreadTextEncoding() ); +#if defined(WNT) +// aTmp = lcl_Win_GetShortPathName( aTmp ); +#endif + Graphic aGraphic; + const String aFilterName( RTL_CONSTASCII_USTRINGPARAM( IMP_PNG ) ); + if( GRFILTER_OK == LoadGraphic( aTmp, aFilterName, aGraphic ) ) + { + aRes = Image( aGraphic.GetBitmapEx() ); + } + return aRes; +} + + SwSpellPopup::SwSpellPopup( SwWrtShell* pWrtSh, const uno::Reference< linguistic2::XSpellAlternatives > &xAlt, @@ -359,11 +381,23 @@ bGrammarResults(false) } sal_Int16 nStringCount = static_cast< sal_Int16 >( aSuggestions.getLength() ); + SvtLinguConfig aCfg; + const bool bIsDark = Application::GetSettings().GetStyleSettings().GetWindowColor().IsDark(); + PopupMenu *pMenu = GetPopupMenu(MN_AUTOCORR); pMenu->SetMenuFlags(MENU_FLAG_NOAUTOMNEMONICS); sal_Bool bEnable = sal_False; if( nStringCount ) { + Image aImage; + OUString aSuggestionImageUrl; + uno::Reference< container::XNamed > xNamed( xSpellAlt, uno::UNO_QUERY ); + if (xNamed.is()) + { + aSuggestionImageUrl = aCfg.GetSpellAndGrammarContextSuggestionImage( xNamed->getName(), bIsDark ); + aImage = Image( lcl_GetImageFromPngUrl( aSuggestionImageUrl ) ); + } + InsertSeparator(0); bEnable = sal_True; for( sal_uInt16 i = 0, nPos = 1, nId = MN_AUTOCORR_START + 1; @@ -372,10 +406,29 @@ bGrammarResults(false) const String aEntry = aSuggestions[ i ]; InsertItem( nPos, aEntry, 0, i ); SetHelpId( nPos, HID_LINGU_REPLACE); + + if (aSuggestionImageUrl.getLength() > 0) + SetItemImage( nPos, aImage ); + pMenu->InsertItem( nId, aEntry ); - pMenu->SetHelpId( nId, HID_LINGU_AUTOCORR); + pMenu->SetHelpId( nPos, HID_LINGU_AUTOCORR); } } + + //!! hard wired translations to be removed or added to src file in OOo 3.1 (#i94216) !! + OUString aIgnoreSelection( C2U("Ignore") ); + OUString aSpellingAndGrammar( C2U("Spelling and Grammar...") ); + const lang::Locale aUILocale( Application::GetSettings().GetUILocale() ); + if (aUILocale.Language.equalsAscii("de")) + { + aIgnoreSelection = C2U("Ignorieren"); + aSpellingAndGrammar = C2U("Rechtschreibung und Grammatik..."); + } + SetItemText( MN_SPELLING, aSpellingAndGrammar ); + USHORT nItemPos = GetItemPos( MN_IGNORE ); + InsertItem( MN_IGNORE_SELECTION, aIgnoreSelection, 0, nItemPos ); + SetHelpId( MN_IGNORE_SELECTION, HID_LINGU_IGNORE_SELECTION); + EnableItem( MN_AUTOCORR, bEnable ); uno::Reference< linguistic2::XLanguageGuessing > xLG = SW_MOD()->GetLanguageGuesser(); @@ -403,10 +456,10 @@ bGrammarResults(false) uno::Reference< linguistic2::XDictionaryList > xDicList( SvxGetDictionaryList() ); if (xDicList.is()) { - // add active, positive dictionary to dic-list (if not already done). - // This is to ensure that there is at least on dictionary to which + // add the default positive dictionary to dic-list (if not already done). + // This is to ensure that there is at least one dictionary to which // words could be added. - uno::Reference< linguistic2::XDictionary1 > xDic( SvxGetOrCreatePosDic( xDicList ) ); + uno::Reference< linguistic2::XDictionary > xDic( SvxGetOrCreatePosDic( xDicList ) ); if (xDic.is()) xDic->setActive( sal_True ); @@ -416,12 +469,12 @@ bGrammarResults(false) for( USHORT i = 0; i < nDicCount; i++ ) { - uno::Reference< linguistic2::XDictionary1 > xDicTmp( pDic[i], uno::UNO_QUERY ); + uno::Reference< linguistic2::XDictionary > xDicTmp( pDic[i], uno::UNO_QUERY ); if (!xDicTmp.is() || SvxGetIgnoreAllList() == xDicTmp) continue; uno::Reference< frame::XStorable > xStor( xDicTmp, uno::UNO_QUERY ); - LanguageType nActLanguage = xDicTmp->getLanguage(); + LanguageType nActLanguage = SvxLocaleToLanguage( xDicTmp->getLocale() ); if( xDicTmp->isActive() && xDicTmp->getDictionaryType() != linguistic2::DictionaryType_NEGATIVE && (nCheckedLanguage == nActLanguage || LANGUAGE_NONE == nActLanguage ) @@ -429,8 +482,21 @@ bGrammarResults(false) { // the extra 1 is because of the (possible) external // linguistic entry above - pMenu->InsertItem( MN_INSERT_START + i + 1, xDicTmp->getName() ); + USHORT nPos = MN_INSERT_START + i + 1; + pMenu->InsertItem( nPos, xDicTmp->getName() ); bEnable = sal_True; + + uno::Reference< lang::XServiceInfo > xSvcInfo( xDicTmp, uno::UNO_QUERY ); + if (xSvcInfo.is()) + { + OUString aDictionaryImageUrl( aCfg.GetSpellAndGrammarContextDictionaryImage( + xSvcInfo->getImplementationName(), bIsDark) ); + if (aDictionaryImageUrl.getLength() > 0) + { + Image aImage( lcl_GetImageFromPngUrl( aDictionaryImageUrl ) ); + pMenu->SetItemImage( nPos, aImage ); + } + } } } } @@ -475,6 +541,11 @@ bGrammarResults(false) nNumLanguageDocEntries = fillLangPopupMenu( pMenu, MN_LANGUAGE_ALL_TEXT_START, aSeq, pWrtSh, 2 ); EnableItem( MN_LANGUAGE_ALL_TEXT, true ); */ + uno::Reference< frame::XFrame > xFrame = pWrtSh->GetView().GetViewFrame()->GetFrame()->GetFrameInterface(); + Image rImg = ::GetImage( xFrame, + ::rtl::OUString::createFromAscii(".uno:SpellingAndGrammarDialog"), sal_False, + Application::GetSettings().GetStyleSettings().GetWindowColor().IsDark() ); + SetItemImage( MN_SPELLING, rImg ); ////////////////////////////////////////////////////////////////////////////////// RemoveDisabledEntries( TRUE, TRUE ); @@ -487,22 +558,25 @@ bGrammarResults(false) SwSpellPopup::SwSpellPopup( SwWrtShell *pWrtSh, - const linguistic2::GrammarCheckingResult &rResult, + const linguistic2::ProofreadingResult &rResult, sal_Int32 nErrorInResult, const uno::Sequence< rtl::OUString > &rSuggestions, const String &rParaText ) : PopupMenu( SW_RES(MN_SPELL_POPUP) ), pSh( pWrtSh ), aSuggestions( rSuggestions ), -bGrammarResults( true ) +bGrammarResults( true ), +aInfo16( SW_RES(IMG_INFO_16) ) { nCheckedLanguage = SvxLocaleToLanguage( rResult.aLocale ); sal_Int16 nItemId = 1; sal_Int16 nPos = 0; - OUString aMessageText( rResult.aGrammarErrors[ nErrorInResult ].aShortComment ); + OUString aMessageText( rResult.aErrors[ nErrorInResult ].aShortComment ); InsertSeparator( nPos++ ); - InsertItem( nItemId++, aMessageText, MIB_NOSELECT, nPos++ ); + InsertItem( nItemId, aMessageText, MIB_NOSELECT, nPos++ ); + SetItemImage( nItemId, aInfo16 ); + ++nItemId; CreateAutoMnemonics(); @@ -510,15 +584,43 @@ bGrammarResults( true ) sal_Int32 nStringCount = aSuggestions.getLength(); if ( nStringCount ) // suggestions available... { + Image aImage; + OUString aSuggestionImageUrl; + uno::Reference< lang::XServiceInfo > xInfo( rResult.xProofreader, uno::UNO_QUERY ); + if (xInfo.is()) + { + aSuggestionImageUrl = SvtLinguConfig().GetSpellAndGrammarContextSuggestionImage( xInfo->getImplementationName() ); + aImage = Image( lcl_GetImageFromPngUrl( aSuggestionImageUrl ) ); + } + for (sal_uInt16 i = 0; i < nStringCount; ++i) { const String aEntry = aSuggestions[ i ]; InsertItem( nItemId, aEntry, 0, nPos++ ); SetHelpId( nItemId, HID_LINGU_REPLACE ); + + if (aSuggestionImageUrl.getLength() > 0) + SetItemImage( nItemId, aImage ); + ++nItemId; } InsertSeparator( nPos++ ); } + + //!! hard wired translations to be removed or added to src file in OOo 3.1 (#i94216) !! + OUString aIgnoreSelection( C2U("Ignore") ); + OUString aSpellingAndGrammar( C2U("Spelling and Grammar...") ); + const lang::Locale aUILocale( Application::GetSettings().GetUILocale() ); + if (aUILocale.Language.equalsAscii("de")) + { + aIgnoreSelection = C2U("Ignorieren"); + aSpellingAndGrammar = C2U("Rechtschreibung und Grammatik..."); + } + SetItemText( MN_SPELLING, aSpellingAndGrammar ); + USHORT nItemPos = GetItemPos( MN_IGNORE ); + InsertItem( MN_IGNORE_SELECTION, aIgnoreSelection, 0, nItemPos ); + SetHelpId( MN_IGNORE_SELECTION, HID_LINGU_IGNORE_SELECTION); + EnableItem( MN_AUTOCORR, false ); uno::Reference< linguistic2::XLanguageGuessing > xLG = SW_MOD()->GetLanguageGuesser(); @@ -580,6 +682,12 @@ bGrammarResults( true ) nNumLanguageDocEntries = fillLangPopupMenu( pMenu, MN_LANGUAGE_ALL_TEXT_START, aSeq, pWrtSh, 2 ); EnableItem( MN_LANGUAGE_ALL_TEXT, true ); */ + uno::Reference< frame::XFrame > xFrame = pWrtSh->GetView().GetViewFrame()->GetFrame()->GetFrameInterface(); + Image rImg = ::GetImage( xFrame, + ::rtl::OUString::createFromAscii(".uno:SpellingAndGrammarDialog"), sal_False, + Application::GetSettings().GetStyleSettings().GetWindowColor().IsDark() ); + SetItemImage( MN_SPELLING, rImg ); + ////////////////////////////////////////////////////////////////////////////////// RemoveDisabledEntries( TRUE, TRUE ); @@ -691,7 +799,7 @@ void SwSpellPopup::Execute( USHORT nId ) { if (bGrammarResults) { - SwLinguConfig().SetProperty( A2OU( UPN_IS_GRAMMAR_INTERACTIVE ), uno::makeAny( sal_True )); + SvtLinguConfig().SetProperty( A2OU( UPN_IS_GRAMMAR_INTERACTIVE ), uno::makeAny( sal_True )); } pSh->Left(CRSR_SKIP_CHARS, FALSE, 1, FALSE ); { @@ -702,6 +810,13 @@ void SwSpellPopup::Execute( USHORT nId ) } } break; + case MN_IGNORE_SELECTION : + { + SwPaM *pPaM = pSh->GetCrsr(); + if (pPaM) + pSh->IgnoreGrammarErrorAt( *pPaM ); + } + break; case MN_IGNORE : { uno::Reference< linguistic2::XDictionary > xDictionary( SvxGetIgnoreAllList(), uno::UNO_QUERY ); diff --git a/sw/source/ui/lingu/olmenu.hrc b/sw/source/ui/lingu/olmenu.hrc index 38a462654c9c..521fe313a55b 100644 --- a/sw/source/ui/lingu/olmenu.hrc +++ b/sw/source/ui/lingu/olmenu.hrc @@ -41,13 +41,16 @@ #define STR_LANGSTATUS_NONE (RC_LINGU_BEGIN + 6) #define STR_LANGSTATUS_MORE (RC_LINGU_BEGIN + 7) -#define MN_SPELLING 100 -#define MN_IGNORE 102 -#define MN_INSERT 103 -#define MN_AUTOCORR 104 -#define MN_LANGUAGE_WORD 105 -#define MN_LANGUAGE_PARA 106 +#define IMG_INFO_16 (RC_LINGU_BEGIN + 8) +//! Don't change these values. You may break context menu modifying extensions! +#define MN_SPELLING 100 +#define MN_IGNORE_SELECTION 101 +#define MN_IGNORE 102 +#define MN_INSERT 103 +#define MN_AUTOCORR 104 +#define MN_LANGUAGE_WORD 105 +#define MN_LANGUAGE_PARA 106 #define MN_LANGUAGE_SELECTION 107 #define MN_LANGUAGE_PARAGRAPH 108 #define MN_LANGUAGE_ALL_TEXT 109 diff --git a/sw/source/ui/lingu/olmenu.src b/sw/source/ui/lingu/olmenu.src index e4d4e1de7492..de391f0bc68d 100644 --- a/sw/source/ui/lingu/olmenu.src +++ b/sw/source/ui/lingu/olmenu.src @@ -31,16 +31,19 @@ #include "olmenu.hrc" #include "helpid.h" -#define SEPARATOR MenuItem { Separator = TRUE; }; + +#define MASKCOLOR MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; }; +#define SEPARATOR MenuItem { Separator = TRUE; }; + Menu MN_SPELL_POPUP { ItemList = { MenuItem { - Identifier = MN_SPELLING ; - HelpID = HID_LINGU_SPELLING_DLG ; - Text [ en-US ] = "~Spellcheck..." ; + Identifier = MN_IGNORE ; + HelpID = HID_LINGU_IGNORE_WORD ; + Text [ en-US ] = "Ignore All" ; }; MenuItem { @@ -53,14 +56,6 @@ Menu MN_SPELL_POPUP }; MenuItem { - Identifier = MN_IGNORE ; - HelpID = HID_LINGU_IGNORE_WORD ; - /* ### ACHTUNG: Neuer Text in Resource? Alle i~gnorieren : ~Ignorieren */ - /* ### ACHTUNG: Neuer Text in Resource? Alle i~gnorieren : ~Ignorieren */ - Text [ en-US ] = "Ignore All" ; - }; - MenuItem - { Identifier = MN_AUTOCORR ; HelpID = HID_LINGU_AUTOCORR ; SubMenu = Menu @@ -68,6 +63,12 @@ Menu MN_SPELL_POPUP }; Text [ en-US ] = "AutoCorrect" ; }; + MenuItem + { + Identifier = MN_SPELLING ; + HelpID = HID_LINGU_SPELLING_DLG ; + Text [ en-US ] = "~Spellcheck..." ; + }; SEPARATOR MenuItem { @@ -122,3 +123,9 @@ String STR_LANGSTATUS_MORE Text [ en-US ] = "More..." ; }; +Image IMG_INFO_16 +{ + ImageBitmap = Bitmap { File = "info_16.png" ; }; + MASKCOLOR +}; + diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx index 5fd8453bebd0..3d40ce80c918 100644 --- a/sw/source/ui/misc/glossary.cxx +++ b/sw/source/ui/misc/glossary.cxx @@ -54,6 +54,7 @@ #endif #include <svtools/stritem.hxx> #include <svtools/pathoptions.hxx> +#include <svtools/lingucfg.hxx> #include <sfx2/request.hxx> #include <sfx2/fcontnr.hxx> @@ -113,9 +114,6 @@ #include <swmodule.hxx> #include <sfx2/filedlghelper.hxx> -// #107253# -#include <swlinguconfig.hxx> - #define LONG_LENGTH 60 #define SHORT_LENGTH 30 @@ -284,11 +282,7 @@ SwGlossaryDlg::SwGlossaryDlg(SfxViewFrame* pViewFrame, pSh (pWrtShell) { - // #107253# Hold one local SwLinguConfig here. This creates one incarnation - // of a SvtLinguConfig which is then used as long as this local incarnation - // exists. Other dialogs may be equipped with the same startup-mechanism - // when required. - SwLinguConfig aLocalLinguConfig; + SvtLinguConfig aLocalLinguConfig; // Static-Pointer initialisieren if( !::GetCurrGlosGroup() ) diff --git a/sw/source/ui/shells/annotsh.cxx b/sw/source/ui/shells/annotsh.cxx index 6c10952d0e2e..aa63e682c06d 100755 --- a/sw/source/ui/shells/annotsh.cxx +++ b/sw/source/ui/shells/annotsh.cxx @@ -410,7 +410,6 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) break; } - case SID_AUTOSPELL_MARKOFF: case SID_AUTOSPELL_CHECK: { rView.ExecuteSlot(rReq); @@ -601,7 +600,6 @@ void SwAnnotationShell::GetState(SfxItemSet& rSet) } break; } - case SID_AUTOSPELL_MARKOFF: case SID_AUTOSPELL_CHECK: { const SfxPoolItem* pState = rView.GetSlotState(nWhich); diff --git a/sw/source/ui/shells/drwtxtex.cxx b/sw/source/ui/shells/drwtxtex.cxx index 2fad7245106c..f09a3d6a7dad 100644 --- a/sw/source/ui/shells/drwtxtex.cxx +++ b/sw/source/ui/shells/drwtxtex.cxx @@ -347,7 +347,6 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) aNewAttr.Put(*pArgs); } break; - case SID_AUTOSPELL_MARKOFF: case SID_AUTOSPELL_CHECK: { //!! JP 16.03.2001: why?? pSdrView = rSh.GetDrawView(); @@ -357,20 +356,10 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) sal_Bool bSet = ((const SfxBoolItem&)rReq.GetArgs()->Get( nSlot)).GetValue(); - if(nSlot == SID_AUTOSPELL_MARKOFF) - { - if(bSet) - nCtrl |= EE_CNTRL_NOREDLINES; - else - nCtrl &= ~EE_CNTRL_NOREDLINES; - } + if(bSet) + nCtrl |= EE_CNTRL_ONLINESPELLING|EE_CNTRL_ALLOWBIGOBJS; else - { - if(bSet) - nCtrl |= EE_CNTRL_ONLINESPELLING|EE_CNTRL_ALLOWBIGOBJS; - else - nCtrl &= ~EE_CNTRL_ONLINESPELLING; - } + nCtrl &= ~EE_CNTRL_ONLINESPELLING; pOutliner->SetControlWord(nCtrl); rView.ExecuteSlot(rReq); @@ -728,7 +717,6 @@ void SwDrawTextShell::GetDrawTxtCtrlState(SfxItemSet& rSet) case SID_ATTR_CHAR_CONTOUR: nEEWhich = EE_CHAR_OUTLINE; break; case SID_ATTR_CHAR_SHADOWED: nEEWhich = EE_CHAR_SHADOW;break; case SID_ATTR_CHAR_STRIKEOUT: nEEWhich = EE_CHAR_STRIKEOUT;break; - case SID_AUTOSPELL_MARKOFF: case SID_AUTOSPELL_CHECK: { const SfxPoolItem* pState = rView.GetSlotState(nWhich); diff --git a/sw/source/ui/shells/drwtxtsh.cxx b/sw/source/ui/shells/drwtxtsh.cxx index 1a80c7fc2176..f2381dbc8ff3 100644 --- a/sw/source/ui/shells/drwtxtsh.cxx +++ b/sw/source/ui/shells/drwtxtsh.cxx @@ -151,11 +151,9 @@ void SwDrawTextShell::Init() if(pVOpt->IsOnlineSpell()) { nCtrl |= EE_CNTRL_ONLINESPELLING|EE_CNTRL_ALLOWBIGOBJS; - if(pVOpt->IsHideSpell()) - nCtrl |= EE_CNTRL_NOREDLINES; } else - nCtrl &= ~(EE_CNTRL_ONLINESPELLING|EE_CNTRL_NOREDLINES); + nCtrl &= ~(EE_CNTRL_ONLINESPELLING); pOutliner->SetControlWord(nCtrl); pOLV->ShowCursor(); diff --git a/sw/source/ui/uiview/pview.cxx b/sw/source/ui/uiview/pview.cxx index a855e3dbb121..7c12f537761e 100644 --- a/sw/source/ui/uiview/pview.cxx +++ b/sw/source/ui/uiview/pview.cxx @@ -1793,7 +1793,6 @@ void SwPagePreView::Init(const SwViewOption * pPrefs) aOpt.SetTable( TRUE ); aOpt.SetSnap( FALSE ); aOpt.SetGridVisible( FALSE ); - aOpt.SetHideSpell( TRUE ); GetViewShell()->ApplyViewOptions( aOpt ); GetViewShell()->ApplyAccessiblityOptions(SW_MOD()->GetAccessibilityOptions()); diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx index d2cb9c01956c..2b559a8f535b 100644 --- a/sw/source/ui/uiview/view.cxx +++ b/sw/source/ui/uiview/view.cxx @@ -158,8 +158,6 @@ #include <rtl/ustrbuf.hxx> #include <xmloff/xmluconv.hxx> -// #107253# -#include <swlinguconfig.hxx> #include "formatclipboard.hxx" #include <PostItMgr.hxx> #include <annotsh.hxx> @@ -880,11 +878,9 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) //! get lingu options without loading lingu DLL SvtLinguOptions aLinguOpt; - // #107253# Replaced SvtLinguConfig with SwLinguConfig wrapper with UsageCount - SwLinguConfig().GetOptions( aLinguOpt ); + SvtLinguConfig().GetOptions( aLinguOpt ); aUsrPref.SetOnlineSpell( aLinguOpt.bIsSpellAuto ); - aUsrPref.SetHideSpell( aLinguOpt.bIsSpellHideMarkings ); sal_Bool bOldShellWasSrcView = FALSE; diff --git a/sw/source/ui/uiview/view0.cxx b/sw/source/ui/uiview/view0.cxx index 3803c218b8e1..368cf4749897 100644 --- a/sw/source/ui/uiview/view0.cxx +++ b/sw/source/ui/uiview/view0.cxx @@ -40,6 +40,7 @@ #include <SwSpellDialogChildWindow.hxx> #include <svtools/eitem.hxx> #include <svtools/linguprops.hxx> +#include <svtools/lingucfg.hxx> #include <viewopt.hxx> #include <globals.h> #include <sfx2/app.hxx> @@ -51,7 +52,6 @@ #ifndef _AVMEDIA_MEDIAPPLAYER_HXX #include <avmedia/mediaplayer.hxx> #endif -#include <swlinguconfig.hxx> #include <swmodule.hxx> #include <sfx2/objface.hxx> @@ -312,9 +312,6 @@ void SwView::StateViewOptions(SfxItemSet &rSet) case SID_AUTOSPELL_CHECK: aBool.SetValue( pOpt->IsOnlineSpell() ); break; - case SID_AUTOSPELL_MARKOFF: - aBool.SetValue( pOpt->IsHideSpell() ); - break; case FN_SHADOWCURSOR: if (pIDSA == 0 || pIDSA->get( IDocumentSettingAccess::BROWSE_MODE )) { @@ -486,8 +483,8 @@ void SwView::ExecViewOptions(SfxRequest &rReq) uno::Any aVal( &bSet, ::getCppuBooleanType() ); String aPropName( C2S(UPN_IS_SPELL_AUTO) ); - // #107253# Replaced SvtLinguConfig with SwLinguConfig wrapper with UsageCount - SwLinguConfig().SetProperty( aPropName, aVal ); + SvtLinguConfig aCfg; + aCfg.SetProperty( aPropName, aVal ); if (xLngProp.is()) xLngProp->setPropertyValue( aPropName, aVal ); @@ -499,28 +496,16 @@ void SwView::ExecViewOptions(SfxRequest &rReq) SwDocShell *pDocSh = GetDocShell(); SwDoc *pDoc = pDocSh? pDocSh->GetDoc() : NULL; SwRootFrm *pRootFrm = pDoc ? pDoc->GetRootFrm() : NULL; - if (pDoc && pRootFrm) - StartGrammarChecking( *pDoc, *pRootFrm ); - } - } - if (!(STATE_TOGGLE == eState && bSet && ( pOpt->IsHideSpell() ))) - break; - case SID_AUTOSPELL_MARKOFF: - if( STATE_TOGGLE == eState ) - bFlag = bSet = !pOpt->IsHideSpell(); - pOpt->SetHideSpell(bSet); - { - uno::Any aVal( &bSet, ::getCppuBooleanType() ); - String aPropName( C2S(UPN_IS_SPELL_HIDE) ); + // right now we don't have view options for automatic grammar checking. Thus... + sal_Bool bIsAutoGrammar = sal_False; + aCfg.GetProperty( C2U( UPN_IS_GRAMMAR_AUTO ) ) >>= bIsAutoGrammar; - // #107253# Replaced SvtLinguConfig with SwLinguConfig wrapper with UsageCount - SwLinguConfig().SetProperty( aPropName, aVal ); - - if (xLngProp.is()) - xLngProp->setPropertyValue( aPropName, aVal ); + if (pDoc && pRootFrm && bIsAutoGrammar) + StartGrammarChecking( *pDoc, *pRootFrm ); + } } - break; + break; case FN_SHADOWCURSOR: if( STATE_TOGGLE == eState ) bFlag = bSet = !pOpt->IsShadowCursor(); @@ -555,7 +540,7 @@ void SwView::ExecViewOptions(SfxRequest &rReq) pModule->ApplyUsrPref( *pOpt, this, bWebView ? VIEWOPT_DEST_WEB : VIEWOPT_DEST_TEXT ); //mod #i6193# let postits know about new spellcheck setting - if ( (nSlot==SID_AUTOSPELL_CHECK) || nSlot==SID_AUTOSPELL_MARKOFF) + if ( nSlot == SID_AUTOSPELL_CHECK ) GetPostItMgr()->SetSpellChecking(); const BOOL bLockedView = rSh.IsViewLocked(); diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx index 5f14993f66e6..11d0ee0f0f36 100644 --- a/sw/source/ui/uiview/view2.cxx +++ b/sw/source/ui/uiview/view2.cxx @@ -1106,21 +1106,39 @@ void __EXPORT SwView::Execute(SfxRequest &rReq) GenerateFormLetter(bUseCurrentDocument); } break; + case SID_RECHECK_DOCUMENT: + { + SwDocShell* pDocShell = GetDocShell(); + SwDoc* pDoc = pDocShell->GetDoc(); + uno::Reference< linguistic2::XProofreadingIterator > xGCIterator( pDoc->GetGCIterator() ); + if( xGCIterator.is() ) + { + xGCIterator->resetIgnoreRules(); + } + // reset ignore lists + pDoc->SpellItAgainSam( sal_True, sal_False, sal_False ); + // clear ignore dictionary + uno::Reference< linguistic2::XDictionary > xDictionary( SvxGetIgnoreAllList(), uno::UNO_QUERY ); + if( xDictionary.is() ) + xDictionary->clear(); + // put cursor to the start of the document + pWrtShell->SttDoc(); + } + // no break; - but call spell/grammar dialog case FN_SPELL_GRAMMAR_DIALOG: { SfxViewFrame* pViewFrame = GetViewFrame(); if (rReq.GetArgs() != NULL) - pViewFrame->SetChildWindow (nSlot, + pViewFrame->SetChildWindow (FN_SPELL_GRAMMAR_DIALOG, ((const SfxBoolItem&) (rReq.GetArgs()-> - Get(nSlot))).GetValue()); + Get(FN_SPELL_GRAMMAR_DIALOG))).GetValue()); else - pViewFrame->ToggleChildWindow(nSlot); + pViewFrame->ToggleChildWindow(FN_SPELL_GRAMMAR_DIALOG); - pViewFrame->GetBindings().Invalidate(nSlot); + pViewFrame->GetBindings().Invalidate(FN_SPELL_GRAMMAR_DIALOG); rReq.Ignore (); } break; - case SID_ALIGN_ANY_LEFT : case SID_ALIGN_ANY_HCENTER : case SID_ALIGN_ANY_RIGHT : diff --git a/sw/source/ui/uiview/viewdraw.cxx b/sw/source/ui/uiview/viewdraw.cxx index 50c1c4d094e5..d366a5ddc16c 100644 --- a/sw/source/ui/uiview/viewdraw.cxx +++ b/sw/source/ui/uiview/viewdraw.cxx @@ -548,11 +548,6 @@ sal_Bool SwView::BeginTextEdit(SdrObject* pObj, SdrPageView* pPV, Window* pWin, else nCntrl &= ~EE_CNTRL_MARKFIELDS; - if (pOpt->IsHideSpell()) - nCntrl |= EE_CNTRL_NOREDLINES; - else - nCntrl &= ~EE_CNTRL_NOREDLINES; - if (pOpt->IsOnlineSpell()) nCntrl |= EE_CNTRL_ONLINESPELLING; else diff --git a/sw/source/ui/uiview/viewling.cxx b/sw/source/ui/uiview/viewling.cxx index 76e637f5a727..588c30a9844d 100644 --- a/sw/source/ui/uiview/viewling.cxx +++ b/sw/source/ui/uiview/viewling.cxx @@ -40,7 +40,7 @@ #endif #include <com/sun/star/lang/Locale.hpp> #include <com/sun/star/linguistic2/XThesaurus.hpp> -#include <com/sun/star/linguistic2/GrammarCheckingResult.hpp> +#include <com/sun/star/linguistic2/ProofreadingResult.hpp> #include <com/sun/star/i18n/TextConversionOption.hpp> #include <linguistic/lngprops.hxx> #include <comphelper/processfactory.hxx> @@ -97,6 +97,18 @@ #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/util/URL.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/util/XURLTransformer.hpp> + +#include <unotools/processfactory.hxx> + +#include <vcl/svapp.hxx> +#include <rtl/ustring.hxx> + #include <cppuhelper/bootstrap.hxx> #include "stmenu.hxx" // PopupMenu for smarttags #include <svx/dialogs.hrc> @@ -105,6 +117,7 @@ #include <memory> +using ::rtl::OUString; using namespace ::com::sun::star; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::uno; @@ -702,13 +715,45 @@ void SwView::StartThesaurus() Beschreibung: Online-Vorschlaege anbieten *--------------------------------------------------------------------*/ +//!! Start of extra code for context menu modifying extensions +struct ExecuteInfo +{ + uno::Reference< frame::XDispatch > xDispatch; + util::URL aTargetURL; + uno::Sequence< PropertyValue > aArgs; +}; + +class AsyncExecute +{ +public: + DECL_STATIC_LINK( AsyncExecute, ExecuteHdl_Impl, ExecuteInfo* ); +}; + +IMPL_STATIC_LINK_NOINSTANCE( AsyncExecute, ExecuteHdl_Impl, ExecuteInfo*, pExecuteInfo ) +{ + const sal_uInt32 nRef = Application::ReleaseSolarMutex(); + try + { + // Asynchronous execution as this can lead to our own destruction! + // Framework can recycle our current frame and the layout manager disposes all user interface + // elements if a component gets detached from its frame! + pExecuteInfo->xDispatch->dispatch( pExecuteInfo->aTargetURL, pExecuteInfo->aArgs ); + } + catch ( Exception& ) + { + } + + Application::AcquireSolarMutex( nRef ); + delete pExecuteInfo; + return 0; +} +//!! End of extra code for context menu modifying extensions sal_Bool SwView::ExecSpellPopup(const Point& rPt) { sal_Bool bRet = sal_False; const SwViewOption* pVOpt = pWrtShell->GetViewOptions(); if( pVOpt->IsOnlineSpell() && - !pVOpt->IsHideSpell() && !pWrtShell->IsSelection()) { if (pWrtShell->GetSelectionType() & nsSelectionType::SEL_DRW_TXT) @@ -725,7 +770,7 @@ sal_Bool SwView::ExecSpellPopup(const Point& rPt) // default context menu. bool bUseGrammarContext = false; Reference< XSpellAlternatives > xAlt( pWrtShell->GetCorrection(&rPt, aToFill) ); - /*linguistic2::*/GrammarCheckingResult aGrammarCheckRes; + /*linguistic2::*/ProofreadingResult aGrammarCheckRes; sal_Int32 nErrorPosInText = -1; sal_Int32 nErrorInResult = -1; uno::Sequence< rtl::OUString > aSuggestions; @@ -735,7 +780,7 @@ sal_Bool SwView::ExecSpellPopup(const Point& rPt) bCorrectionRes = pWrtShell->GetGrammarCorrection( aGrammarCheckRes, nErrorPosInText, nErrorInResult, aSuggestions, &rPt, aToFill ); ::rtl::OUString aMessageText; if (nErrorInResult >= 0) - aMessageText = aGrammarCheckRes.aGrammarErrors[ nErrorInResult ].aShortComment; + aMessageText = aGrammarCheckRes.aErrors[ nErrorInResult ].aShortComment; // we like to use the grammar checking context menu if we either get // some suggestions or at least a comment about the error found... bUseGrammarContext = bCorrectionRes && @@ -744,7 +789,7 @@ sal_Bool SwView::ExecSpellPopup(const Point& rPt) // open respective context menu for spell check or grammar errors with correction suggestions... if ((!bUseGrammarContext && xAlt.is()) || - (bUseGrammarContext && bCorrectionRes && aGrammarCheckRes.aGrammarErrors.getLength() > 0)) + (bUseGrammarContext && bCorrectionRes && aGrammarCheckRes.aErrors.getLength() > 0)) { // get paragraph text String aParaText; @@ -777,13 +822,64 @@ sal_Bool SwView::ExecSpellPopup(const Point& rPt) aEvent.ExecutePosition.Y = aPixPos.Y(); Menu* pMenu = 0; - if(TryContextMenuInterception( *pPopup, pMenu, aEvent )) + ::rtl::OUString sMenuName = ::rtl::OUString::createFromAscii( + bUseGrammarContext ? "private:resource/GrammarContextMenu" : "private:resource/SpellContextMenu"); + if(TryContextMenuInterception( *pPopup, sMenuName, pMenu, aEvent )) { + + //! happy hacking for context menu modifying extensions of this + //! 'custom made' menu... *sigh* (code copied from sfx2 and framework) if ( pMenu ) { + OUString aSlotURL( RTL_CONSTASCII_USTRINGPARAM( "slot:" )); USHORT nId = ((PopupMenu*)pMenu)->Execute(pEditWin, aPixPos); - if(!ExecuteMenuCommand( *dynamic_cast<PopupMenu*>(pMenu), *GetViewFrame(), nId )) - pPopup->Execute(nId); + OUString aCommand = ((PopupMenu*)pMenu)->GetItemCommand(nId); + if (aCommand.getLength() == 0 ) + { + if(!ExecuteMenuCommand( *dynamic_cast<PopupMenu*>(pMenu), *GetViewFrame(), nId )) + pPopup->Execute(nId); + } + else + { + SfxViewFrame *pSfxViewFrame = GetViewFrame(); + SfxFrame *pSfxFrame = pSfxViewFrame? pSfxViewFrame->GetFrame() : 0; + uno::Reference< frame::XFrame > xFrame; + if (pSfxFrame) + xFrame = pSfxFrame->GetFrameInterface(); + com::sun::star::util::URL aURL; + uno::Reference< frame::XDispatchProvider > xDispatchProvider( xFrame, UNO_QUERY ); + uno::Reference< lang::XMultiServiceFactory > xMgr( utl::getProcessServiceFactory(), uno::UNO_QUERY ); + + try + { + uno::Reference< frame::XDispatch > xDispatch; + uno::Reference< util::XURLTransformer > xURLTransformer; + if (xMgr.is()) + { + xURLTransformer = uno::Reference< util::XURLTransformer >( xMgr->createInstance( + C2U("com.sun.star.util.URLTransformer")), UNO_QUERY); + } + + aURL.Complete = aCommand; + xURLTransformer->parseStrict(aURL); + uno::Sequence< beans::PropertyValue > aArgs; + xDispatch = xDispatchProvider->queryDispatch( aURL, rtl::OUString(), 0 ); + + + if (xDispatch.is()) + { + // Execute dispatch asynchronously + ExecuteInfo* pExecuteInfo = new ExecuteInfo; + pExecuteInfo->xDispatch = xDispatch; + pExecuteInfo->aTargetURL = aURL; + pExecuteInfo->aArgs = aArgs; + Application::PostUserEvent( STATIC_LINK(0, AsyncExecute , ExecuteHdl_Impl), pExecuteInfo ); + } + } + catch (Exception &) + { + } + } } else { diff --git a/sw/source/ui/uno/dlelstnr.cxx b/sw/source/ui/uno/dlelstnr.cxx index 54e48ef4db79..3b066a66ce08 100644 --- a/sw/source/ui/uno/dlelstnr.cxx +++ b/sw/source/ui/uno/dlelstnr.cxx @@ -38,7 +38,7 @@ #include <com/sun/star/linguistic2/XDictionaryList.hpp> #include <com/sun/star/linguistic2/XLinguServiceManager.hpp> #include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp> -#include <com/sun/star/linguistic2/XGrammarCheckingIterator.hpp> +#include <com/sun/star/linguistic2/XProofreadingIterator.hpp> #include <com/sun/star/linguistic2/LinguServiceEventFlags.hpp> #include <svtools/lingucfg.hxx> @@ -87,8 +87,8 @@ SwLinguServiceEventListener::SwLinguServiceEventListener() if (SvtLinguConfig().HasGrammarChecker()) { - aSvcName = A2OU( "com.sun.star.lingu2.GrammarCheckingIterator" ); - xGCIterator = Reference< XGrammarCheckingIterator >( xMgr->createInstance( aSvcName ), UNO_QUERY ); + aSvcName = A2OU( "com.sun.star.linguistic2.ProofreadingIterator" ); + xGCIterator = Reference< XProofreadingIterator >( xMgr->createInstance( aSvcName ), UNO_QUERY ); Reference< XLinguServiceEventBroadcaster > xBC( xGCIterator, UNO_QUERY ); if (xBC.is()) xBC->addLinguServiceEventListener( (XLinguServiceEventListener *) this ); @@ -143,34 +143,26 @@ void SAL_CALL SwLinguServiceEventListener::processLinguServiceEvent( { vos::OGuard aGuard(Application::GetSolarMutex()); - if (rLngSvcEvent.nEvent == GRAMMAR_CHECK_AGAIN) + sal_Bool bIsSpellWrong = 0 != (rLngSvcEvent.nEvent & SPELL_WRONG_WORDS_AGAIN); + sal_Bool bIsSpellAll = 0 != (rLngSvcEvent.nEvent & SPELL_CORRECT_WORDS_AGAIN); + if (0 != (rLngSvcEvent.nEvent & PROOFREAD_AGAIN)) + bIsSpellWrong = bIsSpellAll = sal_True; // have all spelling and grammar checked... + if (bIsSpellWrong || bIsSpellAll) { - // have all text spell and grammar checked again - SW_MOD()->CheckSpellChanges( sal_False, sal_True, sal_True, sal_False ); + SW_MOD()->CheckSpellChanges( sal_False, bIsSpellWrong, bIsSpellAll, sal_False ); } - if (rLngSvcEvent.Source == xLngSvcMgr) + if (rLngSvcEvent.nEvent & HYPHENATE_AGAIN) { - sal_Bool bIsSpellWrong = - 0 != (rLngSvcEvent.nEvent & SPELL_WRONG_WORDS_AGAIN); - sal_Bool bIsSpellAll = - 0 != (rLngSvcEvent.nEvent & SPELL_CORRECT_WORDS_AGAIN); - if (bIsSpellWrong || bIsSpellAll) - { - SW_MOD()->CheckSpellChanges( sal_False, bIsSpellWrong, bIsSpellAll, sal_False ); - } - if (rLngSvcEvent.nEvent & HYPHENATE_AGAIN) - { - SwView *pSwView = SW_MOD()->GetFirstView(); + SwView *pSwView = SW_MOD()->GetFirstView(); - //!! since this function may be called within the ctor of - //!! SwView (during formatting) where the WrtShell is not yet - //!! created, we have to check for the WrtShellPtr to see - //!! if it is already availbale - while (pSwView && pSwView->GetWrtShellPtr()) - { - pSwView->GetWrtShell().ChgHyphenation(); - pSwView = SW_MOD()->GetNextView( pSwView ); - } + //!! since this function may be called within the ctor of + //!! SwView (during formatting) where the WrtShell is not yet + //!! created, we have to check for the WrtShellPtr to see + //!! if it is already availbale + while (pSwView && pSwView->GetWrtShellPtr()) + { + pSwView->GetWrtShell().ChgHyphenation(); + pSwView = SW_MOD()->GetNextView( pSwView ); } } } diff --git a/sw/source/ui/uno/unotxvw.cxx b/sw/source/ui/uno/unotxvw.cxx index ec6ba322548e..42b0d699689a 100644 --- a/sw/source/ui/uno/unotxvw.cxx +++ b/sw/source/ui/uno/unotxvw.cxx @@ -1032,8 +1032,10 @@ void SAL_CALL SwXTextView::setPropertyValue( { switch (pCur->nWID) { - case WID_IS_CONSTANT_SPELLCHECK : case WID_IS_HIDE_SPELL_MARKS : + // deprecated #i91949 + break; + case WID_IS_CONSTANT_SPELLCHECK : { sal_Bool bVal = sal_False; const SwViewOption *pOpt = pView->GetWrtShell().GetViewOptions(); @@ -1042,8 +1044,6 @@ void SAL_CALL SwXTextView::setPropertyValue( SwViewOption aNewOpt( *pOpt ); if (pCur->nWID == WID_IS_CONSTANT_SPELLCHECK) aNewOpt.SetOnlineSpell(bVal); - else - aNewOpt.SetHideSpell(bVal); pView->GetWrtShell().ApplyViewOptions( aNewOpt ); } break; @@ -1085,14 +1085,15 @@ uno::Any SAL_CALL SwXTextView::getPropertyValue( aRet <<= nCount; } break; - case WID_IS_CONSTANT_SPELLCHECK : case WID_IS_HIDE_SPELL_MARKS : + // deprecated #i91949 + break; + case WID_IS_CONSTANT_SPELLCHECK : { const SwViewOption *pOpt = pView->GetWrtShell().GetViewOptions(); if (!pOpt) throw RuntimeException(); - UINT32 nFlag = nWID == WID_IS_CONSTANT_SPELLCHECK ? - VIEWOPT_1_ONLINESPELL : VIEWOPT_1_HIDESPELL; + UINT32 nFlag = VIEWOPT_1_ONLINESPELL; sal_Bool bVal = 0 != (pOpt->GetCoreOptions() & nFlag); aRet <<= bVal; } diff --git a/sw/uiconfig/layout/delzip b/sw/uiconfig/layout/delzip deleted file mode 100644 index 7b4d68d70fca..000000000000 --- a/sw/uiconfig/layout/delzip +++ /dev/null @@ -1 +0,0 @@ -empty
\ No newline at end of file diff --git a/sw/uiconfig/layout/layout.mk b/sw/uiconfig/layout/layout.mk deleted file mode 100644 index f6bea876d898..000000000000 --- a/sw/uiconfig/layout/layout.mk +++ /dev/null @@ -1,33 +0,0 @@ -# TODO: move to solenv/inc -# copies: sw/uiconfig/layout svx/uiconfig/layout - -TRALAY=tralay -XML_DEST=$(DLLDEST) -XML_LANGS=$(alllangiso) - -ALL_XMLS=$(foreach,i,$(XML_FILES) $(XML_DEST)/$i) $(foreach,i,$(XML_LANGS) $(foreach,j,$(XML_FILES) $(XML_DEST)/$i/$j)) - -# Must remove the -j (no duplicate base file names) flag -ZIPUPDATE=-u -XML_ZIP = $(PRJNAME)-layout - -ALLTAR: $(XML_ZIP) - -$(XML_ZIP): $(ALL_XMLS) - -ZIP1DIR=$(XML_DEST) -ZIP1TARGET=$(XML_ZIP) -ZIP1LIST=$(ALL_XMLS:s@$(XML_DEST)/@@) - -$(foreach,i,$(XML_LANGS) $(XML_DEST)/$i/%.xml): %.xml - -$(MKDIR) $(@:d) - @echo $(foreach,i,$(XML_LANGS) $(XML_DEST)/$i/%.xml): %.xml - $(TRALAY) -m localize.sdf -o $(XML_DEST) -l $(XML_LANGS:f:t" -l ") $< - -$(XML_DEST)/%.xml: %.xml - -$(MKDIR) $(@:d) - $(COPY) $< $@ - -# Don't want to overwrite filled localize.sdf with empty template -template.sdf: - $(foreach,i,$(XML_FILES) $(TRALAY) -l en-US $i) > $@ diff --git a/sw/uiconfig/layout/makefile.mk b/sw/uiconfig/layout/makefile.mk deleted file mode 100644 index b577653b1f9f..000000000000 --- a/sw/uiconfig/layout/makefile.mk +++ /dev/null @@ -1,50 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2008 by Sun Microsystems, Inc. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.2 $ -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=../.. -PRJNAME=sw -TARGET=layout - -.INCLUDE : settings.mk - -.IF "$(ENABLE_LAYOUT)" == "TRUE" - -all: ALLTAR - -XML_FILES=wordcount.xml - -.INCLUDE : layout.mk - -.ELSE # ENABLE_LAYOUT != TRUE -all .PHONY: -.ENDIF # ENABLE_LAYOUT != TRUE - -.INCLUDE : target.mk diff --git a/sw/uiconfig/layout/wordcount.xml b/sw/uiconfig/layout/wordcount.xml deleted file mode 100644 index c8f8092e3698..000000000000 --- a/sw/uiconfig/layout/wordcount.xml +++ /dev/null @@ -1,50 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- This is a template. i18n translation is not performed in-place; - i18n translated xml files are generated from this template by - transex3/layout/tralay. !--> - -<modaldialog xmlns="http://openoffice.org/2007/layout" - xmlns:cnt="http://openoffice.org/2007/layout/container" - help-id="HID_DLG_WORDCOUNT" - id="DLG_WORDCOUNT" - sizeable="true" moveable="true" optimumsize="true" - has_border="true" sv-look="true" _title="Word Count"> - <vbox border="5" spacing="5"> - <fixedline id="FL_CURRENT" _text="Current selection"/> - <hbox> - <vbox cnt:padding="13" spacing="5"> - <hbox> - <fixedtext id="FT_CURRENTWORD" _label="Words:"/> - <flow cnt:padding="60"/> - <fixedtext id="FI_CURRENTWORD" right="true" _label="0"/> - </hbox> - <hbox> - <fixedtext id="FT_CURRENTCHARACTER" _label="Characters:"/> - <flow cnt:padding="60"/> - <fixedtext id="FI_CURRENTCHARACTER" right="true" _label="00"/> - </hbox> - </vbox> - </hbox> - <!-- if we could do cnt:cnt:padding="-13" here, we would not have to close - and reope the hbox/vbox thing !--> - <fixedline id="FL_DOC" _text="Whole document"/> - <hbox> - <vbox cnt:padding="13" spacing="5"> - <hbox> - <fixedtext id="FT_DOCWORD" _label="Words:"/> - <fixedtext id="FI_DOCWORD" right="true" _label="000"/> - </hbox> - <hbox> - <fixedtext id="FT_DOCCHARACTER" _label="Characters:"/> - <fixedtext id="FI_DOCCHARACTER" right="true" _label="0000"/> - </hbox> - </vbox> - </hbox> - <fixedline cnt:padding="1" id="FL_BOTTOM"/> - <dialogbuttonhbox spacing="5"> - <flow/> - <okbutton id="PB_OK"/> - <helpbutton id="PB_HELP"/> - </dialogbuttonhbox> - </vbox> -</modaldialog> |