Kaydet (Commit) bc3c10b5 authored tarafından Cédric Bosdonnat's avatar Cédric Bosdonnat

Grammar checking dialog: reworked how explanations are shown

üst 610b7bc5
...@@ -47,6 +47,7 @@ struct SpellErrorDescription ...@@ -47,6 +47,7 @@ struct SpellErrorDescription
::rtl::OUString sErrorText; ::rtl::OUString sErrorText;
::rtl::OUString sDialogTitle; ::rtl::OUString sDialogTitle;
::rtl::OUString sExplanation; ::rtl::OUString sExplanation;
::rtl::OUString sExplanationURL;
::com::sun::star::lang::Locale aLocale; ::com::sun::star::lang::Locale aLocale;
::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XProofreader > xGrammarChecker; ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XProofreader > xGrammarChecker;
::rtl::OUString sServiceName; //service name of GrammarChecker/SpellChecker ::rtl::OUString sServiceName; //service name of GrammarChecker/SpellChecker
...@@ -64,9 +65,13 @@ struct SpellErrorDescription ...@@ -64,9 +65,13 @@ struct SpellErrorDescription
const ::rtl::OUString& rServiceName, const ::rtl::OUString& rServiceName,
const ::rtl::OUString* pDialogTitle = 0, const ::rtl::OUString* pDialogTitle = 0,
const ::rtl::OUString* pExplanation = 0, const ::rtl::OUString* pExplanation = 0,
const ::rtl::OUString* pRuleId = 0 ) : const ::rtl::OUString* pRuleId = 0,
const ::rtl::OUString* pExplanationURL = 0 ) :
bIsGrammarError( bGrammar ), bIsGrammarError( bGrammar ),
sErrorText( rText ), sErrorText( rText ),
sDialogTitle( ),
sExplanation( ),
sExplanationURL( ),
aLocale( rLocale ), aLocale( rLocale ),
xGrammarChecker( rxGrammarChecker ), xGrammarChecker( rxGrammarChecker ),
sServiceName( rServiceName ), sServiceName( rServiceName ),
...@@ -76,6 +81,8 @@ struct SpellErrorDescription ...@@ -76,6 +81,8 @@ struct SpellErrorDescription
sDialogTitle = *pDialogTitle; sDialogTitle = *pDialogTitle;
if( pExplanation ) if( pExplanation )
sExplanation = *pExplanation; sExplanation = *pExplanation;
if( pExplanationURL )
sExplanationURL = *pExplanationURL;
if( pRuleId ) if( pRuleId )
sRuleId = *pRuleId; sRuleId = *pRuleId;
}; };
...@@ -91,6 +98,7 @@ struct SpellErrorDescription ...@@ -91,6 +98,7 @@ struct SpellErrorDescription
xGrammarChecker == rDesc.xGrammarChecker && xGrammarChecker == rDesc.xGrammarChecker &&
sDialogTitle.equals( rDesc.sDialogTitle ) && sDialogTitle.equals( rDesc.sDialogTitle ) &&
sExplanation.equals( rDesc.sExplanation ) && sExplanation.equals( rDesc.sExplanation ) &&
sExplanationURL.equals( rDesc.sExplanationURL ) &&
sRuleId == rDesc.sRuleId; sRuleId == rDesc.sRuleId;
} }
}; };
......
...@@ -48,7 +48,6 @@ ...@@ -48,7 +48,6 @@
#define ST_SPELLING_AND_GRAMMAR 52 #define ST_SPELLING_AND_GRAMMAR 52
#define ST_SPELLING_AND_GRAMMAR_VENDORNAME 53 #define ST_SPELLING_AND_GRAMMAR_VENDORNAME 53
#define CB_CHECK_GRAMMAR 54 #define CB_CHECK_GRAMMAR 54
#define PB_EXPLAIN 55 #define LINK_EXPLAIN 55
#define IMG_VENDOR 56 #define FT_EXPLAIN 56
#define IMG_DEFAULT_VENDOR 57
#define PB_IGNORERULE 59 #define PB_IGNORERULE 59
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
ModelessDialog RID_SVXDLG_SPELLCHECK ModelessDialog RID_SVXDLG_SPELLCHECK
{ {
HelpId = HID_SPELLCHECK ; HelpId = HID_SPELLCHECK ;
Size = MAP_APPFONT( 270, 188 ); Size = MAP_APPFONT( 270, 208 );
OutputSize = TRUE; OutputSize = TRUE;
Closeable = TRUE ; Closeable = TRUE ;
SVLook = TRUE; SVLook = TRUE;
...@@ -45,13 +45,6 @@ ModelessDialog RID_SVXDLG_SPELLCHECK ...@@ -45,13 +45,6 @@ ModelessDialog RID_SVXDLG_SPELLCHECK
Moveable = TRUE ; Moveable = TRUE ;
FixedImage IMG_VENDOR
{
Pos = MAP_APPFONT ( 0, 0 ) ;
Size = MAP_APPFONT ( 270, 21 ) ;
Hide = TRUE;
};
FixedText FT_LANGUAGE FixedText FT_LANGUAGE
{ {
Pos = MAP_APPFONT( 6, 8 ); Pos = MAP_APPFONT( 6, 8 );
...@@ -67,9 +60,23 @@ ModelessDialog RID_SVXDLG_SPELLCHECK ...@@ -67,9 +60,23 @@ ModelessDialog RID_SVXDLG_SPELLCHECK
Sort = TRUE; Sort = TRUE;
DropDown = TRUE; DropDown = TRUE;
}; };
FixedText FT_EXPLAIN
{
Pos = MAP_APPFONT( 1, 18 );
Size = MAP_APPFONT( 239, 20 );
VCenter = TRUE ;
};
FixedText LINK_EXPLAIN
{
Pos = MAP_APPFONT( 240, 18 );
Size = MAP_APPFONT( 29, 20 );
Text [ en-US ] = "More..." ;
Right = TRUE ;
VCenter = TRUE ;
};
FixedText FT_NOTINDICT FixedText FT_NOTINDICT
{ {
Pos = MAP_APPFONT( 6, 26 ); Pos = MAP_APPFONT( 6, 46 );
Size = MAP_APPFONT( 120, 8 ); Size = MAP_APPFONT( 120, 8 );
Text [ en-US ] = "~Not in dictionary" ; Text [ en-US ] = "~Not in dictionary" ;
}; };
...@@ -77,7 +84,7 @@ ModelessDialog RID_SVXDLG_SPELLCHECK ...@@ -77,7 +84,7 @@ ModelessDialog RID_SVXDLG_SPELLCHECK
MultiLineEdit ED_NEWWORD MultiLineEdit ED_NEWWORD
{ {
HelpID = "cui:MultiLineEdit:RID_SVXDLG_SPELLCHECK:ED_NEWWORD"; HelpID = "cui:MultiLineEdit:RID_SVXDLG_SPELLCHECK:ED_NEWWORD";
Pos = MAP_APPFONT( 6, 37 ); Pos = MAP_APPFONT( 6, 57 );
Size = MAP_APPFONT( 197, 48 ); Size = MAP_APPFONT( 197, 48 );
Border = TRUE; Border = TRUE;
VScroll = TRUE; VScroll = TRUE;
...@@ -86,14 +93,14 @@ ModelessDialog RID_SVXDLG_SPELLCHECK ...@@ -86,14 +93,14 @@ ModelessDialog RID_SVXDLG_SPELLCHECK
FixedText FT_SUGGESTION FixedText FT_SUGGESTION
{ {
Pos = MAP_APPFONT( 6, 88 ); Pos = MAP_APPFONT( 6, 108 );
Size = MAP_APPFONT( 120, 8 ); Size = MAP_APPFONT( 120, 8 );
Text [ en-US ] = "~Suggestions" ; Text [ en-US ] = "~Suggestions" ;
}; };
ListBox LB_SUGGESTION ListBox LB_SUGGESTION
{ {
HelpID = "cui:ListBox:RID_SVXDLG_SPELLCHECK:LB_SUGGESTION"; HelpID = "cui:ListBox:RID_SVXDLG_SPELLCHECK:LB_SUGGESTION";
Pos = MAP_APPFONT( 6, 99 ); Pos = MAP_APPFONT( 6, 119 );
Size = MAP_APPFONT( 197, 48 ); Size = MAP_APPFONT( 197, 48 );
Border = TRUE; Border = TRUE;
}; };
...@@ -101,7 +108,7 @@ ModelessDialog RID_SVXDLG_SPELLCHECK ...@@ -101,7 +108,7 @@ ModelessDialog RID_SVXDLG_SPELLCHECK
CheckBox CB_CHECK_GRAMMAR CheckBox CB_CHECK_GRAMMAR
{ {
HelpID = "cui:CheckBox:RID_SVXDLG_SPELLCHECK:CB_CHECK_GRAMMAR"; HelpID = "cui:CheckBox:RID_SVXDLG_SPELLCHECK:CB_CHECK_GRAMMAR";
Pos = MAP_APPFONT( 6, 153 ); Pos = MAP_APPFONT( 6, 173 );
Size = MAP_APPFONT( 100, 10 ); Size = MAP_APPFONT( 100, 10 );
Text [ en-US ] = "Check ~grammar" ; Text [ en-US ] = "Check ~grammar" ;
Hide = TRUE; Hide = TRUE;
...@@ -110,7 +117,7 @@ ModelessDialog RID_SVXDLG_SPELLCHECK ...@@ -110,7 +117,7 @@ ModelessDialog RID_SVXDLG_SPELLCHECK
PushButton PB_IGNORE PushButton PB_IGNORE
{ {
HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_IGNORE"; HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_IGNORE";
Pos = MAP_APPFONT( 209, 37 ); Pos = MAP_APPFONT( 209, 57 );
Size = MAP_APPFONT( 55, 14 ); Size = MAP_APPFONT( 55, 14 );
Text [ en-US ] = "~Ignore Once" ; Text [ en-US ] = "~Ignore Once" ;
}; };
...@@ -118,14 +125,14 @@ ModelessDialog RID_SVXDLG_SPELLCHECK ...@@ -118,14 +125,14 @@ ModelessDialog RID_SVXDLG_SPELLCHECK
PushButton PB_IGNOREALL PushButton PB_IGNOREALL
{ {
HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_IGNOREALL"; HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_IGNOREALL";
Pos = MAP_APPFONT( 209, 54 ); Pos = MAP_APPFONT( 209, 74 );
Size = MAP_APPFONT( 55, 14 ); Size = MAP_APPFONT( 55, 14 );
Text [ en-US ] = "I~gnore All" ; Text [ en-US ] = "I~gnore All" ;
}; };
PushButton PB_IGNORERULE PushButton PB_IGNORERULE
{ {
HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_IGNORERULE"; HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_IGNORERULE";
Pos = MAP_APPFONT( 209, 54 ); Pos = MAP_APPFONT( 209, 74 );
Size = MAP_APPFONT( 55, 14 ); Size = MAP_APPFONT( 55, 14 );
Text [ en-US ] = "I~gnore Rule" ; Text [ en-US ] = "I~gnore Rule" ;
Hide = TRUE; Hide = TRUE;
...@@ -133,7 +140,7 @@ ModelessDialog RID_SVXDLG_SPELLCHECK ...@@ -133,7 +140,7 @@ ModelessDialog RID_SVXDLG_SPELLCHECK
MenuButton MB_ADDTODICT MenuButton MB_ADDTODICT
{ {
HelpID = "cui:MenuButton:RID_SVXDLG_SPELLCHECK:MB_ADDTODICT"; HelpID = "cui:MenuButton:RID_SVXDLG_SPELLCHECK:MB_ADDTODICT";
Pos = MAP_APPFONT( 209, 71 ); Pos = MAP_APPFONT( 209, 91 );
Size = MAP_APPFONT( 55, 14 ); Size = MAP_APPFONT( 55, 14 );
Text [ en-US ] = "~Add" ; Text [ en-US ] = "~Add" ;
}; };
...@@ -141,7 +148,7 @@ ModelessDialog RID_SVXDLG_SPELLCHECK ...@@ -141,7 +148,7 @@ ModelessDialog RID_SVXDLG_SPELLCHECK
PushButton PB_CHANGE PushButton PB_CHANGE
{ {
HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_CHANGE"; HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_CHANGE";
Pos = MAP_APPFONT( 209, 99 ); Pos = MAP_APPFONT( 209, 119 );
Size = MAP_APPFONT( 55, 14 ); Size = MAP_APPFONT( 55, 14 );
Text [ en-US ] = "~Change" ; Text [ en-US ] = "~Change" ;
DefButton = TRUE ; DefButton = TRUE ;
...@@ -150,48 +157,40 @@ ModelessDialog RID_SVXDLG_SPELLCHECK ...@@ -150,48 +157,40 @@ ModelessDialog RID_SVXDLG_SPELLCHECK
PushButton PB_CHANGEALL PushButton PB_CHANGEALL
{ {
HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_CHANGEALL"; HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_CHANGEALL";
Pos = MAP_APPFONT( 209, 117 ); Pos = MAP_APPFONT( 209, 137 );
Size = MAP_APPFONT( 55, 14 ); Size = MAP_APPFONT( 55, 14 );
Text [ en-US ] = "Change A~ll" ; Text [ en-US ] = "Change A~ll" ;
}; };
PushButton PB_EXPLAIN
{
HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_EXPLAIN";
Pos = MAP_APPFONT( 209, 117 );
Size = MAP_APPFONT( 55, 14 );
Hide = TRUE;
Text [ en-US ] = "~Explain..." ;
};
PushButton PB_AUTOCORR PushButton PB_AUTOCORR
{ {
HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_AUTOCORR"; HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_AUTOCORR";
Pos = MAP_APPFONT( 209, 134 ); Pos = MAP_APPFONT( 209, 154 );
Size = MAP_APPFONT( 55, 14 ); Size = MAP_APPFONT( 55, 14 );
Text [ en-US ] = "AutoCor~rect" ; Text [ en-US ] = "AutoCor~rect" ;
}; };
GroupBox GB_BACKGROUND GroupBox GB_BACKGROUND
{ {
Pos = MAP_APPFONT( 1, 21 ); Pos = MAP_APPFONT( 1, 41 );
Size = MAP_APPFONT( 268, 146 ); Size = MAP_APPFONT( 268, 146 );
Hide=TRUE; Hide=TRUE;
}; };
HelpButton PB_HELP HelpButton PB_HELP
{ {
Pos = MAP_APPFONT( 6, 170 ); Pos = MAP_APPFONT( 6, 191 );
Size = MAP_APPFONT( 55, 14 ); Size = MAP_APPFONT( 55, 14 );
}; };
PushButton PB_OPTIONS PushButton PB_OPTIONS
{ {
HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_OPTIONS"; HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_OPTIONS";
Pos = MAP_APPFONT( 87, 170 ); Pos = MAP_APPFONT( 87, 191 );
Size = MAP_APPFONT( 55, 14 ); Size = MAP_APPFONT( 55, 14 );
Text [ en-US ] = "O~ptions..." ; Text [ en-US ] = "O~ptions..." ;
}; };
PushButton PB_UNDO PushButton PB_UNDO
{ {
HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_UNDO"; HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_UNDO";
Pos = MAP_APPFONT( 148, 170 ); Pos = MAP_APPFONT( 148, 191 );
Size = MAP_APPFONT( 55, 14 ); Size = MAP_APPFONT( 55, 14 );
Text [ en-US ] = "~Undo" ; Text [ en-US ] = "~Undo" ;
}; };
...@@ -199,7 +198,7 @@ ModelessDialog RID_SVXDLG_SPELLCHECK ...@@ -199,7 +198,7 @@ ModelessDialog RID_SVXDLG_SPELLCHECK
PushButton PB_CLOSE PushButton PB_CLOSE
{ {
HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_CLOSE"; HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_CLOSE";
Pos = MAP_APPFONT ( 209 , 170 ) ; Pos = MAP_APPFONT ( 209 , 191 ) ;
Size = MAP_APPFONT ( 55 , 14 ) ; Size = MAP_APPFONT ( 55 , 14 ) ;
TabStop = TRUE ; TabStop = TRUE ;
Text [ en-US ] = "Cl~ose" ; Text [ en-US ] = "Cl~ose" ;
...@@ -224,9 +223,5 @@ ModelessDialog RID_SVXDLG_SPELLCHECK ...@@ -224,9 +223,5 @@ ModelessDialog RID_SVXDLG_SPELLCHECK
{ {
Text[ en-US ] = "Spelling and Grammar: $LANGUAGE ($LOCATION) [$VendorName]"; Text[ en-US ] = "Spelling and Grammar: $LANGUAGE ($LOCATION) [$VendorName]";
}; };
Image IMG_DEFAULT_VENDOR
{
ImageBitmap = Bitmap { File = "vendor01.png"; };
};
}; };
// ********************************************************************** EOF // ********************************************************************** EOF
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
#include <memory> #include <memory>
#include <svtools/svmedit.hxx> #include <svtools/svmedit.hxx>
#include <svl/lstner.hxx> #include <svl/lstner.hxx>
#include <svtools/fixedhyper.hxx>
#include <svtools/xtextedt.hxx> #include <svtools/xtextedt.hxx>
#include <editeng/SpellPortions.hxx> #include <editeng/SpellPortions.hxx>
...@@ -129,23 +130,18 @@ public: ...@@ -129,23 +130,18 @@ public:
void ResetIgnoreErrorsAt() { m_aIgnoreErrorsAt.clear(); } void ResetIgnoreErrorsAt() { m_aIgnoreErrorsAt.clear(); }
}; };
class HelpFixedText : public FixedText
// class SvxSpellDialog ---------------------------------------------
class SpellDialogChildWindow;
class ExplainButton : public PushButton
{ {
String m_sExplanation; public:
HelpFixedText( Window* pParent, const ResId& rResId );
virtual void RequestHelp( const HelpEvent& rHEvt );
virtual void Click();
public:
ExplainButton( Window* pParent, const ResId& rResId ) : PushButton( pParent, rResId ){}
~ExplainButton();
void SetExplanation( const String& rText ) {m_sExplanation = rText;}
bool HasExplanation() { return m_sExplanation.Len() > 0;}
virtual void Paint( const Rectangle& rRect );
long GetActualHeight( );
}; };
// class SvxSpellDialog ---------------------------------------------
class SpellDialogChildWindow;
class SpellDialog : public SfxModelessDialog class SpellDialog : public SfxModelessDialog
{ {
using Window::Invalidate; using Window::Invalidate;
...@@ -153,11 +149,12 @@ class SpellDialog : public SfxModelessDialog ...@@ -153,11 +149,12 @@ class SpellDialog : public SfxModelessDialog
friend class SentenceEditWindow_Impl; friend class SentenceEditWindow_Impl;
private: private:
FixedImage aVendorImageFI;
FixedText aLanguageFT; FixedText aLanguageFT;
SvxLanguageBox aLanguageLB; SvxLanguageBox aLanguageLB;
HelpFixedText aExplainFT;
svt::FixedHyperlink aExplainLink;
FixedText aNotInDictFT; FixedText aNotInDictFT;
SentenceEditWindow_Impl aSentenceED; SentenceEditWindow_Impl aSentenceED;
...@@ -171,7 +168,6 @@ private: ...@@ -171,7 +168,6 @@ private:
PushButton aChangePB; PushButton aChangePB;
PushButton aChangeAllPB; PushButton aChangeAllPB;
ExplainButton aExplainPB;
PushButton aAutoCorrPB; PushButton aAutoCorrPB;
CheckBox aCheckGrammarCB; CheckBox aCheckGrammarCB;
...@@ -219,6 +215,7 @@ private: ...@@ -219,6 +215,7 @@ private:
DECL_LINK( AddToDictionaryHdl, MenuButton* ); DECL_LINK( AddToDictionaryHdl, MenuButton* );
DECL_LINK( LanguageSelectHdl, SvxLanguageBox* ); DECL_LINK( LanguageSelectHdl, SvxLanguageBox* );
DECL_LINK( DialogUndoHdl, SpellUndoAction_Impl* ); DECL_LINK( DialogUndoHdl, SpellUndoAction_Impl* );
DECL_LINK( HandleHyperlink, svt::FixedHyperlink * );
DECL_STATIC_LINK( SpellDialog, InitHdl, SpellDialog * ); DECL_STATIC_LINK( SpellDialog, InitHdl, SpellDialog * );
......
...@@ -66,6 +66,10 @@ struct SingleProofreadingError ...@@ -66,6 +66,10 @@ struct SingleProofreadingError
sequence< string > aSuggestions; sequence< string > aSuggestions;
// a list of properties // a list of properties
// <ul>
// <li>FullCommentURL: URL to a page providing more details on the
// error.</li>
// </ul>
sequence< com::sun::star::beans::PropertyValue > aProperties; sequence< com::sun::star::beans::PropertyValue > aProperties;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment