[Libreoffice-commits] .: 2 commits - cui/source offapi/com sw/source

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Wed Nov 2 05:26:15 PDT 2011


 cui/source/dialogs/SpellAttrib.hxx                          |   10 
 cui/source/dialogs/SpellDialog.cxx                          |  149 ++++++++----
 cui/source/dialogs/SpellDialog.hrc                          |    5 
 cui/source/dialogs/SpellDialog.src                          |   69 ++---
 cui/source/inc/SpellDialog.hxx                              |   29 +-
 offapi/com/sun/star/linguistic2/SingleProofreadingError.idl |    4 
 sw/source/ui/docvw/FrameControlsManager.cxx                 |   15 +
 sw/source/ui/docvw/PageBreakWin.cxx                         |   43 ++-
 sw/source/ui/inc/FrameControlsManager.hxx                   |    1 
 sw/source/ui/inc/PageBreakWin.hxx                           |    1 
 10 files changed, 210 insertions(+), 116 deletions(-)

New commits:
commit bc3c10b5ce88869871761000e9724bcad9a0d556
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date:   Sun Oct 23 07:35:06 2011 -0700

    Grammar checking dialog: reworked how explanations are shown

diff --git a/cui/source/dialogs/SpellAttrib.hxx b/cui/source/dialogs/SpellAttrib.hxx
index 9ebc229..731c694 100644
--- a/cui/source/dialogs/SpellAttrib.hxx
+++ b/cui/source/dialogs/SpellAttrib.hxx
@@ -47,6 +47,7 @@ struct SpellErrorDescription
     ::rtl::OUString                                     sErrorText;
     ::rtl::OUString                                     sDialogTitle;
     ::rtl::OUString                                     sExplanation;
+    ::rtl::OUString                                     sExplanationURL;
     ::com::sun::star::lang::Locale                      aLocale;
     ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XProofreader > xGrammarChecker;
     ::rtl::OUString                                     sServiceName; //service name of GrammarChecker/SpellChecker
@@ -64,9 +65,13 @@ struct SpellErrorDescription
                       const ::rtl::OUString& rServiceName,
                       const ::rtl::OUString* pDialogTitle = 0,
                       const ::rtl::OUString* pExplanation = 0,
-                      const ::rtl::OUString* pRuleId = 0 ) :
+                      const ::rtl::OUString* pRuleId = 0,
+                      const ::rtl::OUString* pExplanationURL = 0 ) :
         bIsGrammarError( bGrammar ),
         sErrorText( rText ),
+        sDialogTitle( ),
+        sExplanation( ),
+        sExplanationURL( ),
         aLocale( rLocale ),
         xGrammarChecker( rxGrammarChecker ),
         sServiceName( rServiceName ),
@@ -76,6 +81,8 @@ struct SpellErrorDescription
                 sDialogTitle = *pDialogTitle;
             if( pExplanation )
                 sExplanation = *pExplanation;
+            if( pExplanationURL )
+                sExplanationURL = *pExplanationURL;
             if( pRuleId )
                 sRuleId = *pRuleId;
         };
@@ -91,6 +98,7 @@ struct SpellErrorDescription
                 xGrammarChecker == rDesc.xGrammarChecker &&
                 sDialogTitle.equals( rDesc.sDialogTitle ) &&
                 sExplanation.equals( rDesc.sExplanation ) &&
+                sExplanationURL.equals( rDesc.sExplanationURL ) &&
                 sRuleId == rDesc.sRuleId;
     }
 };
diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index 389cee6..9990e4c 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -51,6 +51,8 @@
 #include <com/sun/star/lang/XServiceDisplayName.hpp>
 #include <com/sun/star/linguistic2/SpellFailure.hpp>
 #include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
+#include <com/sun/star/system/XSystemShellExecute.hpp>
 #include <sfx2/app.hxx>
 #include <vcl/help.hxx>
 #include <vcl/graph.hxx>
@@ -68,6 +70,8 @@
 #include <svx/svxerr.hxx>
 #include "treeopt.hxx"
 #include <svtools/langtab.hxx>
+#include <comphelper/anytostring.hxx>
+#include <cppuhelper/exc_hlp.hxx>
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
@@ -189,6 +193,26 @@ sal_uInt16 SpellUndoAction_Impl::GetId()const
     return m_nId;
 }
 
+HelpFixedText::HelpFixedText( Window* pParent, const ResId& rResId ):
+            FixedText( pParent, rResId )
+{
+}
+
+void HelpFixedText::Paint( const Rectangle& rRect )
+{
+    Rectangle aTextRect( rRect.Left() + 6, rRect.Top(), rRect.Right() - 6, rRect.Bottom() );
+    DrawText( aTextRect, GetText(), TEXT_DRAW_WORDBREAK | TEXT_DRAW_MULTILINE );
+}
+
+long HelpFixedText::GetActualHeight( )
+{
+    Rectangle rRect( GetPosPixel( ), GetSizePixel() );
+    Rectangle aTextRect( rRect.Left() + 6, rRect.Top(), rRect.Right() - 6, rRect.Bottom() );
+    Rectangle aBounds = GetTextRect( aTextRect, GetText(), TEXT_DRAW_WORDBREAK | TEXT_DRAW_MULTILINE );
+
+    return aBounds.getHeight();
+}
+
 // class SvxSpellCheckDialog ---------------------------------------------
 
 SpellDialog::SpellDialog(
@@ -200,9 +224,10 @@ SpellDialog::SpellDialog(
                                     pParent,
                                     CUI_RES(RID_SVXDLG_SPELLCHECK)),
 
-    aVendorImageFI  ( this , CUI_RES( IMG_VENDOR ) ),
     aLanguageFT     ( this, CUI_RES( FT_LANGUAGE ) ),
     aLanguageLB     ( this, CUI_RES( LB_LANGUAGE ) ),
+    aExplainFT      ( this, CUI_RES( FT_EXPLAIN ) ),
+    aExplainLink    ( this, CUI_RES( LINK_EXPLAIN ) ),
     aNotInDictFT    ( this, CUI_RES( FT_NOTINDICT ) ),
     aSentenceED      ( this, CUI_RES( ED_NEWWORD ) ),
     aSuggestionFT   ( this, CUI_RES( FT_SUGGESTION ) ),
@@ -215,7 +240,6 @@ SpellDialog::SpellDialog(
 
     aChangePB       ( this, CUI_RES( PB_CHANGE ) ),
     aChangeAllPB    ( this, CUI_RES( PB_CHANGEALL ) ),
-    aExplainPB      ( this, CUI_RES( PB_EXPLAIN) ),
     aAutoCorrPB     ( this, CUI_RES( PB_AUTOCORR ) ),
 
     aCheckGrammarCB ( this, CUI_RES( CB_CHECK_GRAMMAR ) ),
@@ -226,8 +250,6 @@ SpellDialog::SpellDialog(
     aClosePB        ( this, CUI_RES( PB_CLOSE ) ),
     aBackgroundGB   ( this, CUI_RES( GB_BACKGROUND ) ),
 
-    aVendorImage    ( CUI_RES( IMG_DEFAULT_VENDOR ) ),
-
     aResumeST       ( CUI_RES(ST_RESUME )),
     aIgnoreOnceST   ( aIgnorePB.GetText()),
     aNoSuggestionsST( CUI_RES(ST_NOSUGGESTIONS)),
@@ -244,6 +266,12 @@ SpellDialog::SpellDialog(
     xSpell = LinguMgr::GetSpellChecker();
     pImpl = new SpellDialog_Impl;
 
+    const StyleSettings& rSettings = GetSettings().GetStyleSettings();
+    Color aCol = rSettings.GetHelpColor();
+    Wallpaper aWall( aCol );
+    aExplainLink.SetBackground( aWall );
+    aExplainFT.SetBackground( aWall );
+
     //HelpIds
     aClosePB.       SetHelpId(HID_SPLDLG_BUTTON_CLOSE    );
     aIgnorePB.      SetHelpId(HID_SPLDLG_BUTTON_IGNORE   );
@@ -251,7 +279,7 @@ SpellDialog::SpellDialog(
     aIgnoreRulePB.  SetHelpId(HID_SPLDLG_BUTTON_IGNORERULE);
     aChangePB.      SetHelpId(HID_SPLDLG_BUTTON_CHANGE   );
     aChangeAllPB.   SetHelpId(HID_SPLDLG_BUTTON_CHANGEALL);
-    aExplainPB.     SetHelpId(HID_SPLDLG_BUTTON_EXPLAIN );
+    aExplainLink.   SetHelpId(HID_SPLDLG_BUTTON_EXPLAIN );
     Init_Impl();
 
     // disable controls if service is missing
@@ -300,6 +328,8 @@ void SpellDialog::Init_Impl()
     aAddToDictMB.SetSelectHdl(LINK ( this, SpellDialog, AddToDictionaryHdl ) );
     aLanguageLB.SetSelectHdl(LINK( this, SpellDialog, LanguageSelectHdl ) );
 
+    aExplainLink.SetClickHdl( LINK( this, SpellDialog, HandleHyperlink ) );
+
     // initialize language ListBox
     aLanguageLB.SetLanguageList( LANG_LIST_SPELL_USED, sal_False, sal_False, sal_True );
 
@@ -324,7 +354,8 @@ void SpellDialog::UpdateBoxes_Impl()
         nAltLanguage    = SvxLocaleToLanguage( pSpellErrorDescription->aLocale );
         aNewWords       = pSpellErrorDescription->aSuggestions;
         bIsGrammarError = pSpellErrorDescription->bIsGrammarError;
-        aExplainPB.SetExplanation(pSpellErrorDescription->sExplanation );
+        aExplainLink.SetURL( pSpellErrorDescription->sExplanationURL );
+        aExplainFT.SetText( pSpellErrorDescription->sExplanation );
     }
     if( pSpellErrorDescription && pSpellErrorDescription->sDialogTitle.getLength() )
     {
@@ -363,13 +394,12 @@ void SpellDialog::UpdateBoxes_Impl()
     aChangeAllPB.Enable(nSize > 0);
     bool bShowChangeAll = !bIsGrammarError;
     aChangeAllPB.Show( bShowChangeAll );
-    aExplainPB.Show( !bShowChangeAll );
+    aExplainFT.Show( !bShowChangeAll );
     aLanguageLB.Enable( bShowChangeAll );
     aIgnoreAllPB.Show( bShowChangeAll );
     aAddToDictMB.Show( bShowChangeAll );
     aIgnoreRulePB.Show( !bShowChangeAll );
     aIgnoreRulePB.Enable(pSpellErrorDescription && pSpellErrorDescription->sRuleId.getLength());
-    aExplainPB.Enable( aExplainPB.HasExplanation() );
     aAutoCorrPB.Show( bShowChangeAll && rParent.HasAutoCorrection() );
 
 }
@@ -463,23 +493,37 @@ IMPL_STATIC_LINK( SpellDialog, InitHdl, SpellDialog *, EMPTYARG )
     }
     else
     {
-        if( SvtLinguConfig().HasVendorImages( "SpellAndGrammarDialogImage" ) )
+        if( pThis->aExplainLink.GetURL().Len() == 0 )
+        {
+            pThis->aExplainLink.Hide();
+            Size aExplainSize = pThis->aExplainFT.GetSizePixel();
+            aExplainSize.Width() += pThis->aExplainLink.GetSizePixel().Width();
+            pThis->aExplainFT.SetSizePixel( aExplainSize );
+        }
+
+        sal_Int32 nExplainHeight = pThis->aExplainFT.GetActualHeight();
+        sal_Int32 nCurrentHeight = pThis->aExplainFT.GetSizePixel().Height();
+        if( pThis->aExplainFT.GetText().Len() == 0 )
+        {
+            nExplainHeight = 0;
+            pThis->aExplainFT.Hide();
+            pThis->aExplainLink.Hide();
+        }
+        else
+        {
+            Size aSize = pThis->aExplainFT.GetSizePixel();
+            aSize.Height() = nExplainHeight;
+            pThis->aExplainFT.SetSizePixel( aSize );
+
+            aSize = pThis->aExplainLink.GetSizePixel();
+            aSize.Height() = nExplainHeight;
+            pThis->aExplainLink.SetSizePixel( aSize );
+        }
+
+        sal_Int32 nDiff = - ( nCurrentHeight - nExplainHeight );
+        if ( nDiff != 0 )
         {
-            pThis->aVendorImageFI.Show();
-            Size aVendorSize = pThis->aVendorImageFI.GetSizePixel();
-            Size aImageSize = pThis->aVendorImageFI.GetImage().GetSizePixel();
-            if( aImageSize.Height() )
-            {
-                aVendorSize.Height() = aImageSize.Height();
-                if(aVendorSize.Width() < aImageSize.Width())
-                    aVendorSize.Width() = aImageSize.Width();
-                pThis->aVendorImageFI.SetSizePixel( aVendorSize );
-            }
-            sal_Int32 nDiff = aVendorSize.Height();
-            pThis->aVendorImageFI.SetSizePixel(aVendorSize);
             Control* aControls[] = {
-                &pThis->aLanguageFT,
-                &pThis->aLanguageLB,
                 &pThis->aNotInDictFT,
                 &pThis->aSentenceED,
                 &pThis->aSuggestionFT,
@@ -490,7 +534,6 @@ IMPL_STATIC_LINK( SpellDialog, InitHdl, SpellDialog *, EMPTYARG )
                 &pThis->aAddToDictMB,
                 &pThis->aChangePB,
                 &pThis->aChangeAllPB,
-                &pThis->aExplainPB,
                 &pThis->aAutoCorrPB,
                 &pThis->aCheckGrammarCB,
                 &pThis->aHelpPB,
@@ -884,17 +927,10 @@ void SpellDialog::SetTitle_Impl(LanguageType nLang)
         const SpellErrorDescription* pSpellErrorDescription = aSentenceED.GetAlternatives();
         if( pSpellErrorDescription && pSpellErrorDescription->sServiceName.getLength() )
         {
-            ::rtl::OUString sSuggestionImageUrl =
-                SvtLinguConfig().GetSpellAndGrammarDialogImage( pSpellErrorDescription->sServiceName );
-            aVendorImageFI.SetImage( lcl_GetImageFromPngUrl( sSuggestionImageUrl ) );
             uno::Reference< lang::XServiceDisplayName > xDisplayName( pSpellErrorDescription->xGrammarChecker, uno::UNO_QUERY );
             if( xDisplayName.is() )
                 sVendor = xDisplayName->getServiceDisplayName( pSpellErrorDescription->aLocale );
         }
-        else
-        {
-            aVendorImageFI.SetImage( aVendorImage );
-        }
 
         if( sVendor.Len() )
         {
@@ -1193,6 +1229,19 @@ bool SpellDialog::GetNextSentence_Impl(bool bUseSavedSentence, bool bRecheck)
                 }
                 else if(aStart->bIsGrammarError )
                 {
+                    beans::PropertyValues  aProperties = aStart->aGrammarError.aProperties;
+                    rtl::OUString sFullCommentURL;
+                    sal_Int32 i = 0;
+                    while ( !sFullCommentURL.isEmpty() && i < aProperties.getLength() )
+                    {
+                        if ( aProperties[i].Name.equalsAscii( "FullCommentURL" ) )
+                        {
+                            uno::Any aValue = aProperties[i].Value;
+                            aValue >>= sFullCommentURL;
+                        }
+                        ++i;
+                    }
+
                     uno::Reference< lang::XServiceInfo > xInfo( aStart->xGrammarChecker, uno::UNO_QUERY );
                     SpellErrorDescription aDesc( true,
                         aStart->sText,
@@ -1202,7 +1251,8 @@ bool SpellDialog::GetNextSentence_Impl(bool bUseSavedSentence, bool bRecheck)
                         xInfo->getImplementationName(),
                         &aStart->sDialogTitle,
                         &aStart->aGrammarError.aFullComment,
-                        &aStart->aGrammarError.aRuleIdentifier );
+                        &aStart->aGrammarError.aRuleIdentifier,
+                        &sFullCommentURL );
                     aSentenceED.SetAttrib( SpellErrorAttrib(aDesc), 0, (sal_uInt16) nStartPosition, (sal_uInt16) nEndPosition );
                 }
                 if(aStart->bIsField)
@@ -2056,7 +2106,7 @@ void  SentenceEditWindow_Impl::SetUndoEditMode(bool bSet)
     Control* aControls[] =
     {
         &pSpellDialog->aChangeAllPB,
-        &pSpellDialog->aExplainPB,
+        &pSpellDialog->aExplainFT,
         &pSpellDialog->aIgnoreAllPB,
         &pSpellDialog->aIgnoreRulePB,
         &pSpellDialog->aIgnorePB,
@@ -2087,20 +2137,31 @@ void  SentenceEditWindow_Impl::SetUndoEditMode(bool bSet)
     pSpellDialog->aChangePB.Enable();
 }
 
-//-----------------------------------------------------------------------
-ExplainButton::~ExplainButton()
+IMPL_LINK( SpellDialog, HandleHyperlink, svt::FixedHyperlink*, pHyperlink )
 {
-}
+    rtl::OUString sURL=pHyperlink->GetURL();
+    rtl::OUString sTitle=GetText();
 
-//-----------------------------------------------------------------------
-void ExplainButton::RequestHelp( const HelpEvent& )
-{
-    Help::ShowBalloon( this, GetPosPixel(), m_sExplanation );
-}
+    if ( ! sURL.getLength() ) // Nothing to do, when the URL is empty
+        return 1;
+    try
+    {
+        uno::Reference< com::sun::star::system::XSystemShellExecute > xSystemShellExecute(
+            ::comphelper::getProcessServiceFactory()->createInstance(
+                DEFINE_CONST_UNICODE("com.sun.star.system.SystemShellExecute") ), uno::UNO_QUERY_THROW );
+        xSystemShellExecute->execute( sURL, rtl::OUString(),  com::sun::star::system::SystemShellExecuteFlags::DEFAULTS );
+    }
+    catch ( uno::Exception& )
+    {
+        uno::Any exc( ::cppu::getCaughtException() );
+        rtl::OUString msg( ::comphelper::anyToString( exc ) );
+        const SolarMutexGuard guard;
+        ErrorBox aErrorBox( NULL, WB_OK, msg );
+        aErrorBox.SetText( sTitle );
+        aErrorBox.Execute();
+    }
 
-void ExplainButton::Click()
-{
-    RequestHelp( HelpEvent() );
+    return 1;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/dialogs/SpellDialog.hrc b/cui/source/dialogs/SpellDialog.hrc
index d51ec1e..36b6c56 100644
--- a/cui/source/dialogs/SpellDialog.hrc
+++ b/cui/source/dialogs/SpellDialog.hrc
@@ -48,7 +48,6 @@
 #define ST_SPELLING_AND_GRAMMAR     52
 #define ST_SPELLING_AND_GRAMMAR_VENDORNAME  53
 #define CB_CHECK_GRAMMAR            54
-#define PB_EXPLAIN                  55
-#define IMG_VENDOR                  56
-#define IMG_DEFAULT_VENDOR          57
+#define LINK_EXPLAIN                  55
+#define FT_EXPLAIN                  56
 #define PB_IGNORERULE               59
diff --git a/cui/source/dialogs/SpellDialog.src b/cui/source/dialogs/SpellDialog.src
index 88da8b7..4a5b2c9 100644
--- a/cui/source/dialogs/SpellDialog.src
+++ b/cui/source/dialogs/SpellDialog.src
@@ -36,7 +36,7 @@
 ModelessDialog RID_SVXDLG_SPELLCHECK
 {
     HelpId = HID_SPELLCHECK ;
-    Size = MAP_APPFONT( 270, 188 );
+    Size = MAP_APPFONT( 270, 208 );
     OutputSize = TRUE;
     Closeable = TRUE ;
     SVLook = TRUE;
@@ -45,13 +45,6 @@ ModelessDialog RID_SVXDLG_SPELLCHECK
 
     Moveable = TRUE ;
 
-    FixedImage IMG_VENDOR
-    {
-        Pos = MAP_APPFONT ( 0, 0 ) ;
-        Size = MAP_APPFONT ( 270, 21  ) ;
-        Hide = TRUE;
-    };
-
     FixedText FT_LANGUAGE
     {
         Pos = MAP_APPFONT(  6, 8 );
@@ -67,9 +60,23 @@ ModelessDialog RID_SVXDLG_SPELLCHECK
         Sort = 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
     {
-        Pos = MAP_APPFONT(  6, 26 );
+        Pos = MAP_APPFONT(  6, 46 );
         Size = MAP_APPFONT( 120, 8 );
         Text [ en-US ] = "~Not in dictionary" ;
     };
@@ -77,7 +84,7 @@ ModelessDialog RID_SVXDLG_SPELLCHECK
     MultiLineEdit 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 );
         Border = TRUE;
         VScroll = TRUE;
@@ -86,14 +93,14 @@ ModelessDialog RID_SVXDLG_SPELLCHECK
 
     FixedText FT_SUGGESTION
     {
-        Pos = MAP_APPFONT( 6, 88 );
+        Pos = MAP_APPFONT( 6, 108 );
         Size = MAP_APPFONT( 120, 8 );
         Text [ en-US ] = "~Suggestions" ;
     };
     ListBox 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 );
         Border = TRUE;
     };
@@ -101,7 +108,7 @@ ModelessDialog RID_SVXDLG_SPELLCHECK
     CheckBox 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 );
         Text [ en-US ] = "Check ~grammar" ;
         Hide = TRUE;
@@ -110,7 +117,7 @@ ModelessDialog RID_SVXDLG_SPELLCHECK
     PushButton 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 );
         Text [ en-US ] = "~Ignore Once" ;
     };
@@ -118,14 +125,14 @@ ModelessDialog RID_SVXDLG_SPELLCHECK
     PushButton 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 );
         Text [ en-US ] = "I~gnore All" ;
     };
     PushButton 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 );
         Text [ en-US ] = "I~gnore Rule" ;
         Hide = TRUE;
@@ -133,7 +140,7 @@ ModelessDialog RID_SVXDLG_SPELLCHECK
     MenuButton 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 );
         Text [ en-US ] = "~Add" ;
     };
@@ -141,7 +148,7 @@ ModelessDialog RID_SVXDLG_SPELLCHECK
     PushButton 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 );
         Text [ en-US ] = "~Change" ;
         DefButton = TRUE ;
@@ -150,48 +157,40 @@ ModelessDialog RID_SVXDLG_SPELLCHECK
     PushButton 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 );
         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
     {
         HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_AUTOCORR";
-        Pos = MAP_APPFONT( 209, 134 );
+        Pos = MAP_APPFONT( 209, 154 );
         Size = MAP_APPFONT( 55, 14 );
         Text [ en-US ] = "AutoCor~rect" ;
     };
     GroupBox GB_BACKGROUND
     {
-        Pos = MAP_APPFONT( 1, 21 );
+        Pos = MAP_APPFONT( 1, 41 );
         Size = MAP_APPFONT( 268, 146 );
         Hide=TRUE;
     };
 
     HelpButton PB_HELP
     {
-        Pos = MAP_APPFONT( 6, 170 );
+        Pos = MAP_APPFONT( 6, 191 );
         Size = MAP_APPFONT( 55, 14 );
     };
     PushButton 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 );
         Text [ en-US ] = "O~ptions..." ;
     };
     PushButton 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 );
         Text [ en-US ] = "~Undo" ;
     };
@@ -199,7 +198,7 @@ ModelessDialog RID_SVXDLG_SPELLCHECK
     PushButton 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 ) ;
         TabStop = TRUE ;
         Text [ en-US ] = "Cl~ose" ;
@@ -224,9 +223,5 @@ ModelessDialog RID_SVXDLG_SPELLCHECK
     {
         Text[ en-US ] = "Spelling and Grammar: $LANGUAGE ($LOCATION) [$VendorName]";
     };
-    Image IMG_DEFAULT_VENDOR
-    {
-        ImageBitmap = Bitmap { File = "vendor01.png"; };
-    };
 };
  // ********************************************************************** EOF
diff --git a/cui/source/inc/SpellDialog.hxx b/cui/source/inc/SpellDialog.hxx
index 99d6af3..71d502c 100644
--- a/cui/source/inc/SpellDialog.hxx
+++ b/cui/source/inc/SpellDialog.hxx
@@ -48,6 +48,7 @@
 #include <memory>
 #include <svtools/svmedit.hxx>
 #include <svl/lstner.hxx>
+#include <svtools/fixedhyper.hxx>
 #include <svtools/xtextedt.hxx>
 #include <editeng/SpellPortions.hxx>
 
@@ -129,23 +130,18 @@ public:
     void            ResetIgnoreErrorsAt()   { m_aIgnoreErrorsAt.clear(); }
 };
 
-
-// class SvxSpellDialog ---------------------------------------------
-class SpellDialogChildWindow;
-class ExplainButton : public PushButton
+class HelpFixedText : public FixedText
 {
-    String              m_sExplanation;
-
-    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;}
+    public:
+        HelpFixedText( Window* pParent, const ResId& rResId );
 
+        virtual void Paint( const Rectangle& rRect );
+        long GetActualHeight( );
 };
 
+// class SvxSpellDialog ---------------------------------------------
+class SpellDialogChildWindow;
+
 class SpellDialog : public SfxModelessDialog
 {
     using Window::Invalidate;
@@ -153,11 +149,12 @@ class SpellDialog : public SfxModelessDialog
     friend class SentenceEditWindow_Impl;
 private:
 
-    FixedImage      aVendorImageFI;
-
     FixedText       aLanguageFT;
     SvxLanguageBox  aLanguageLB;
 
+    HelpFixedText       aExplainFT;
+    svt::FixedHyperlink aExplainLink;
+
     FixedText           aNotInDictFT;
     SentenceEditWindow_Impl  aSentenceED;
 
@@ -171,7 +168,6 @@ private:
 
     PushButton      aChangePB;
     PushButton      aChangeAllPB;
-    ExplainButton   aExplainPB;
     PushButton      aAutoCorrPB;
 
     CheckBox        aCheckGrammarCB;
@@ -219,6 +215,7 @@ private:
     DECL_LINK( AddToDictionaryHdl, MenuButton* );
     DECL_LINK( LanguageSelectHdl, SvxLanguageBox* );
     DECL_LINK( DialogUndoHdl, SpellUndoAction_Impl* );
+    DECL_LINK( HandleHyperlink, svt::FixedHyperlink * );
 
     DECL_STATIC_LINK( SpellDialog, InitHdl, SpellDialog * );
 
diff --git a/offapi/com/sun/star/linguistic2/SingleProofreadingError.idl b/offapi/com/sun/star/linguistic2/SingleProofreadingError.idl
index 385b13d..d4944e0 100644
--- a/offapi/com/sun/star/linguistic2/SingleProofreadingError.idl
+++ b/offapi/com/sun/star/linguistic2/SingleProofreadingError.idl
@@ -66,6 +66,10 @@ struct SingleProofreadingError
     sequence< string > aSuggestions;
 
     // 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;
 };
 
commit 610b7bc5943579d8cacb421c9a6b401b83bda149
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date:   Sat Oct 22 04:18:39 2011 -0700

    Page Break: fix crash when changing from break before to break after
    
    Keeping a temporary copy of the shared_ptr to avoid the object to be
    deleted during the Select method.

diff --git a/sw/source/ui/docvw/FrameControlsManager.cxx b/sw/source/ui/docvw/FrameControlsManager.cxx
index 62f9b32..6b00d56 100644
--- a/sw/source/ui/docvw/FrameControlsManager.cxx
+++ b/sw/source/ui/docvw/FrameControlsManager.cxx
@@ -83,6 +83,21 @@ const SwFrameControlsManager& SwFrameControlsManager::operator=( const SwFrameCo
     return *this;
 }
 
+SwFrameControlPtr SwFrameControlsManager::GetControl( FrameControlType eType, const SwFrm* pFrm )
+{
+    SwFrameControlPtr pControl;
+
+    vector< SwFrameControlPtr >& aControls = m_aControls[eType];
+
+    vector< SwFrameControlPtr >::iterator pIt = find_if(
+            aControls.begin(), aControls.end( ), FramePredicate( pFrm ) );
+
+    if ( pIt != aControls.end() )
+        pControl = *pIt;
+
+    return pControl;
+}
+
 std::vector< SwFrameControlPtr >& SwFrameControlsManager::GetControls( FrameControlType eType )
 {
     return m_aControls[eType];
diff --git a/sw/source/ui/docvw/PageBreakWin.cxx b/sw/source/ui/docvw/PageBreakWin.cxx
index b48e450..2194bd9 100644
--- a/sw/source/ui/docvw/PageBreakWin.cxx
+++ b/sw/source/ui/docvw/PageBreakWin.cxx
@@ -183,7 +183,8 @@ SwPageBreakWin::SwPageBreakWin( SwEditWin* pEditWin, const SwPageFrm* pPageFrm )
     m_pPopupMenu( NULL ),
     m_pLine( NULL ),
     m_bIsAppearing( false ),
-    m_nFadeRate( 100 )
+    m_nFadeRate( 100 ),
+    m_bDestroyed( false )
 {
     // Use pixels for the rest of the drawing
     SetMapMode( MapMode ( MAP_PIXEL ) );
@@ -202,6 +203,9 @@ SwPageBreakWin::SwPageBreakWin( SwEditWin* pEditWin, const SwPageFrm* pPageFrm )
 
 SwPageBreakWin::~SwPageBreakWin( )
 {
+    m_bDestroyed = true;
+    m_aFadeTimer.Stop();
+
     delete m_pPopupMenu;
     delete m_pLine;
 }
@@ -290,6 +294,8 @@ void SwPageBreakWin::Paint( const Rectangle& )
 
 void SwPageBreakWin::Select( )
 {
+    SwFrameControlPtr pThis = GetEditWin()->GetFrameControlsManager( ).GetControl( PageBreak, GetFrame() );
+
     switch( GetCurItemId( ) )
     {
         case FN_PAGEBREAK_EDIT:
@@ -298,25 +304,27 @@ void SwPageBreakWin::Select( )
                 while ( pBodyFrm && !pBodyFrm->IsBodyFrm() )
                     pBodyFrm = static_cast< const SwLayoutFrm* >( pBodyFrm->GetNext() );
 
+                SwEditWin* pEditWin = GetEditWin();
+
                 if ( pBodyFrm )
                 {
+                    SwWrtShell& rSh = pEditWin->GetView().GetWrtShell();
+                    sal_Bool bOldLock = rSh.IsViewLocked();
+                    rSh.LockView( sal_True );
+
                     if ( pBodyFrm->Lower()->IsTabFrm() )
                     {
-                        SwWrtShell& rSh = GetEditWin()->GetView().GetWrtShell();
                         rSh.Push( );
                         rSh.ClearMark();
-                        sal_Bool bOldLock = rSh.IsViewLocked();
-                        rSh.LockView( sal_True );
 
                         SwCntntFrm *pCnt = const_cast< SwCntntFrm* >( pBodyFrm->ContainsCntnt() );
                         SwCntntNode* pNd = pCnt->GetNode();
                         rSh.SetSelection( *pNd );
 
-                        SfxUInt16Item aItem( GetEditWin()->GetView().GetPool( ).GetWhich( FN_FORMAT_TABLE_DLG ), TP_TABLE_TEXTFLOW );
-                        GetEditWin()->GetView().GetViewFrame()->GetDispatcher()->Execute(
+                        SfxUInt16Item aItem( pEditWin->GetView().GetPool( ).GetWhich( FN_FORMAT_TABLE_DLG ), TP_TABLE_TEXTFLOW );
+                        pEditWin->GetView().GetViewFrame()->GetDispatcher()->Execute(
                                 FN_FORMAT_TABLE_DLG, SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD, &aItem, NULL );
 
-                        rSh.LockView( bOldLock );
                         rSh.Pop( sal_False );
                     }
                     else
@@ -325,12 +333,13 @@ void SwPageBreakWin::Select( )
                         SwCntntNode* pNd = pCnt->GetNode();
 
                         SwPaM aPaM( *pNd );
-                        SwPaMItem aPaMItem( GetEditWin()->GetView().GetPool( ).GetWhich( FN_PARAM_PAM ), &aPaM );
-                        SfxUInt16Item aItem( GetEditWin()->GetView().GetPool( ).GetWhich( SID_PARA_DLG ), TP_PARA_EXT );
-                        GetEditWin()->GetView().GetViewFrame()->GetDispatcher()->Execute(
+                        SwPaMItem aPaMItem( pEditWin->GetView().GetPool( ).GetWhich( FN_PARAM_PAM ), &aPaM );
+                        SfxUInt16Item aItem( pEditWin->GetView().GetPool( ).GetWhich( SID_PARA_DLG ), TP_PARA_EXT );
+                        pEditWin->GetView().GetViewFrame()->GetDispatcher()->Execute(
                                 SID_PARA_DLG, SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD, &aItem, &aPaMItem, NULL );
                     }
-                    GetEditWin()->GrabFocus( );
+                    rSh.LockView( bOldLock );
+                    pEditWin->GrabFocus( );
                 }
             }
             break;
@@ -343,7 +352,6 @@ void SwPageBreakWin::Select( )
                 if ( pBodyFrm )
                 {
                     SwCntntFrm *pCnt = const_cast< SwCntntFrm* >( pBodyFrm->ContainsCntnt() );
-                    //sal_uInt16 nWhich = pCnt->GetAttrSet()->GetPool()->GetWhich( SID_ATTR_PARA_PAGEBREAK );
                     SwCntntNode* pNd = pCnt->GetNode();
 
                     pNd->GetDoc()->GetIDocumentUndoRedo( ).StartUndo( UNDO_UI_DELETE_PAGE_BREAK, NULL );
@@ -363,7 +371,11 @@ void SwPageBreakWin::Select( )
             }
             break;
     }
-    Fade( false );
+
+    // Only fade if there is more than this temporary shared pointer:
+    // The main reference has been deleted due to a page break removal
+    if ( pThis.use_count() > 1 )
+        Fade( false );
 }
 
 void SwPageBreakWin::MouseMove( const MouseEvent& rMEvt )
@@ -480,9 +492,10 @@ void SwPageBreakWin::Fade( bool bFadeIn )
     if ( !PopupMenu::IsInExecute() )
     {
         m_bIsAppearing = bFadeIn;
-        if ( m_aFadeTimer.IsActive( ) )
+        if ( !m_bDestroyed && m_aFadeTimer.IsActive( ) )
             m_aFadeTimer.Stop();
-        m_aFadeTimer.Start( );
+        if ( !m_bDestroyed )
+            m_aFadeTimer.Start( );
     }
 }
 
diff --git a/sw/source/ui/inc/FrameControlsManager.hxx b/sw/source/ui/inc/FrameControlsManager.hxx
index 798c0b9..453466e 100644
--- a/sw/source/ui/inc/FrameControlsManager.hxx
+++ b/sw/source/ui/inc/FrameControlsManager.hxx
@@ -60,6 +60,7 @@ class SwFrameControlsManager
         SwFrameControlsManager( const SwFrameControlsManager& rCopy );
         const SwFrameControlsManager& operator=( const SwFrameControlsManager& rCopy );
 
+        SwFrameControlPtr GetControl( FrameControlType eType, const SwFrm* pFrm );
         std::vector< SwFrameControlPtr >& GetControls( FrameControlType eType );
         void AddControl( FrameControlType eType, SwFrameControlPtr pControl );
         void RemoveControls( const SwFrm* pFrm );
diff --git a/sw/source/ui/inc/PageBreakWin.hxx b/sw/source/ui/inc/PageBreakWin.hxx
index 263ec56..bac664c 100644
--- a/sw/source/ui/inc/PageBreakWin.hxx
+++ b/sw/source/ui/inc/PageBreakWin.hxx
@@ -46,6 +46,7 @@ class SwPageBreakWin : public MenuButton, public SwFrameControl
     bool                  m_bIsAppearing;
     int                   m_nFadeRate;
     Timer                 m_aFadeTimer;
+    bool                  m_bDestroyed;
 
 public:
     SwPageBreakWin( SwEditWin* pEditWin, const SwPageFrm* pPageFrm );


More information about the Libreoffice-commits mailing list