diff options
-rw-r--r-- | accessibility/source/extended/textwindowaccessibility.cxx | 12 | ||||
-rwxr-xr-x | cui/source/dialogs/thesdlg.cxx | 64 | ||||
-rwxr-xr-x | cui/source/dialogs/thesdlg.src | 6 | ||||
-rwxr-xr-x | cui/source/dialogs/thesdlg_impl.hxx | 27 | ||||
-rwxr-xr-x[-rw-r--r--] | cui/source/options/optdict.cxx | 1 |
5 files changed, 79 insertions, 31 deletions
diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx index 04b07215d372..8af1b240343e 100644 --- a/accessibility/source/extended/textwindowaccessibility.cxx +++ b/accessibility/source/extended/textwindowaccessibility.cxx @@ -1989,10 +1989,14 @@ void Document::handleParagraphNotifications() determineVisibleRange(); notifyVisibleRangeChanges(aOldVisibleBegin, aOldVisibleEnd, m_xParagraphs->end()); - Paragraphs::iterator aIt(m_xParagraphs->begin() + n); - ::rtl::Reference< ParagraphImpl > xParagraph(getParagraph(aIt)); - if (xParagraph.is()) - xParagraph->textChanged(); + + if (n < m_xParagraphs->size()) + { + Paragraphs::iterator aIt(m_xParagraphs->begin() + n); + ::rtl::Reference< ParagraphImpl > xParagraph(getParagraph(aIt)); + if (xParagraph.is()) + xParagraph->textChanged(); + } break; } default: diff --git a/cui/source/dialogs/thesdlg.cxx b/cui/source/dialogs/thesdlg.cxx index bf617b126747..ec04362b488d 100755 --- a/cui/source/dialogs/thesdlg.cxx +++ b/cui/source/dialogs/thesdlg.cxx @@ -172,12 +172,21 @@ void ReplaceEdit_Impl::SetText( const XubString& rStr, const Selection& rNewSele // class ThesaurusAlternativesCtrl_Impl ---------------------------------- +AlternativesString_Impl::AlternativesString_Impl( + ThesaurusAlternativesCtrl_Impl &rControl, + SvLBoxEntry* pEntry, USHORT nFlags, const String& rStr ) : + // + SvLBoxString( pEntry, nFlags, rStr ), + m_rControlImpl( rControl ) +{ +} + void AlternativesString_Impl::Paint( const Point& rPos, SvLBox& rDev, USHORT, SvLBoxEntry* pEntry ) { - AlternativesUserData_Impl* pData = (AlternativesUserData_Impl*)pEntry->GetUserData(); + AlternativesExtraData* pData = m_rControlImpl.GetExtraData( pEntry ); Point aPos( rPos ); Font aOldFont( rDev.GetFont()); if (pData && pData->IsHeader()) @@ -207,14 +216,40 @@ ThesaurusAlternativesCtrl_Impl::ThesaurusAlternativesCtrl_Impl( ThesaurusAlternativesCtrl_Impl::~ThesaurusAlternativesCtrl_Impl() { - ClearUserData(); + ClearExtraData(); +} + + +void ThesaurusAlternativesCtrl_Impl::ClearExtraData() +{ + UserDataMap_t aEmpty; + m_aUserData.swap( aEmpty ); +} + + +void ThesaurusAlternativesCtrl_Impl::SetExtraData( + const SvLBoxEntry *pEntry, + const AlternativesExtraData &rData ) +{ + if (!pEntry) + return; + + UserDataMap_t::iterator aIt( m_aUserData.find( pEntry ) ); + if (aIt != m_aUserData.end()) + aIt->second = rData; + else + m_aUserData[ pEntry ] = rData; } -void ThesaurusAlternativesCtrl_Impl::ClearUserData() +AlternativesExtraData * ThesaurusAlternativesCtrl_Impl::GetExtraData( + const SvLBoxEntry *pEntry ) { - for (USHORT i = 0; i < GetEntryCount(); ++i) - delete (AlternativesUserData_Impl*)GetEntry(i)->GetUserData(); + AlternativesExtraData *pRes = NULL; + UserDataMap_t::iterator aIt( m_aUserData.find( pEntry ) ); + if (aIt != m_aUserData.end()) + pRes = &aIt->second; + return pRes; } @@ -230,10 +265,9 @@ SvLBoxEntry * ThesaurusAlternativesCtrl_Impl::AddEntry( sal_Int32 nVal, const St pEntry->AddItem( new SvLBoxString( pEntry, 0, String() ) ); // add empty column aText += rText; pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), 0 ) ); // otherwise crash - pEntry->AddItem( new AlternativesString_Impl( pEntry, 0, aText ) ); + pEntry->AddItem( new AlternativesString_Impl( *this, pEntry, 0, aText ) ); - AlternativesUserData_Impl* pUserData = new AlternativesUserData_Impl( rText, bIsHeader ); - pEntry->SetUserData( pUserData ); + SetExtraData( pEntry, AlternativesExtraData( rText, bIsHeader ) ); GetModel()->Insert( pEntry ); if (bIsHeader) @@ -365,7 +399,7 @@ bool SvxThesaurusDialog_Impl::UpdateAlternativesBox_Impl() m_pAlternativesCT->SetUpdateMode( FALSE ); // clear old user data of control before creating new ones via AddEntry below - m_pAlternativesCT->ClearUserData(); + m_pAlternativesCT->ClearExtraData(); m_pAlternativesCT->Clear(); for (sal_Int32 i = 0; i < nMeanings; ++i) @@ -468,9 +502,9 @@ IMPL_LINK( SvxThesaurusDialog_Impl, AlternativesSelectHdl_Impl, SvxCheckListBox SvLBoxEntry *pEntry = pBox ? pBox->GetCurEntry() : NULL; if (pEntry) { - AlternativesUserData_Impl * pData = (AlternativesUserData_Impl *) pEntry->GetUserData(); + AlternativesExtraData * pData = m_pAlternativesCT->GetExtraData( pEntry ); String aStr; - if (!pData->IsHeader()) + if (pData && !pData->IsHeader()) { aStr = pData->GetText(); GetReplaceEditString( aStr ); @@ -486,9 +520,9 @@ IMPL_LINK( SvxThesaurusDialog_Impl, AlternativesDoubleClickHdl_Impl, SvxCheckLis SvLBoxEntry *pEntry = pBox ? pBox->GetCurEntry() : NULL; if (pEntry) { - AlternativesUserData_Impl * pData = (AlternativesUserData_Impl *) pEntry->GetUserData(); + AlternativesExtraData * pData = m_pAlternativesCT->GetExtraData( pEntry ); String aStr; - if (!pData->IsHeader()) + if (pData && !pData->IsHeader()) { aStr = pData->GetText(); GetReplaceEditString( aStr ); @@ -509,8 +543,8 @@ IMPL_LINK( SvxThesaurusDialog_Impl, AlternativesDoubleClickHdl_Impl, SvxCheckLis IMPL_STATIC_LINK( SvxThesaurusDialog_Impl, SelectFirstHdl_Impl, SvxCheckListBox *, pBox ) { (void) pThis; - if (pBox && pBox->GetEntryCount() > 0) - pBox->SelectEntryPos( 0 ); + if (pBox && pBox->GetEntryCount() >= 2) + pBox->SelectEntryPos( 1 ); // pos 0 is a 'header' that is not selectable return 0; } diff --git a/cui/source/dialogs/thesdlg.src b/cui/source/dialogs/thesdlg.src index 16d724473d20..6c6a6444b33d 100755 --- a/cui/source/dialogs/thesdlg.src +++ b/cui/source/dialogs/thesdlg.src @@ -59,7 +59,7 @@ ModalDialog RID_SVXDLG_THESAURUS { Pos = MAP_APPFONT ( 24 , 5 ) ; Size = MAP_APPFONT ( 143 , 8 ) ; - Text [ en-US ] = "Current ~word" ; + Text [ en-US ] = "~Current word" ; LEFT = TRUE ; }; ComboBox CB_WORD @@ -95,7 +95,7 @@ ModalDialog RID_SVXDLG_THESAURUS { Pos = MAP_APPFONT ( 5 , 173 ) ; Size = MAP_APPFONT ( 255 , 8 ) ; - Text [ en-US ] = "Replace ~with" ; + Text [ en-US ] = "~Replace with" ; LEFT = TRUE ; }; Edit ED_REPL @@ -120,7 +120,7 @@ ModalDialog RID_SVXDLG_THESAURUS { Pos = MAP_APPFONT ( 105 , 210 ) ; Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~Replace" ; + Text [ en-US ] = "Replace" ; DefButton = TRUE ; }; CancelButton BTN_THES_CANCEL diff --git a/cui/source/dialogs/thesdlg_impl.hxx b/cui/source/dialogs/thesdlg_impl.hxx index 70ce91391456..b682c8d0c129 100755 --- a/cui/source/dialogs/thesdlg_impl.hxx +++ b/cui/source/dialogs/thesdlg_impl.hxx @@ -51,11 +51,16 @@ #include <com/sun/star/linguistic2/XMeaning.hpp> #include <stack> +#include <map> #include <algorithm> using namespace ::com::sun::star; using ::rtl::OUString; +class SvLBoxEntry; +class ThesaurusAlternativesCtrl_Impl; + + // class LookUpComboBox_Impl -------------------------------------------------- class LookUpComboBox_Impl : public ComboBox @@ -105,17 +110,14 @@ public: // class ThesaurusAlternativesCtrl_Impl ---------------------------------- -class AlternativesUserData_Impl +class AlternativesExtraData { String sText; bool bHeader; - // disable copy c-tor and assignment operator - AlternativesUserData_Impl( const AlternativesUserData_Impl & ); - AlternativesUserData_Impl & operator = ( const AlternativesUserData_Impl & ); - public: - AlternativesUserData_Impl( const String &rText, bool bIsHeader ) : + AlternativesExtraData() : bHeader( false ) {} + AlternativesExtraData( const String &rText, bool bIsHeader ) : sText(rText), bHeader(bIsHeader) { @@ -128,10 +130,11 @@ public: class AlternativesString_Impl : public SvLBoxString { + ThesaurusAlternativesCtrl_Impl & m_rControlImpl; public: - AlternativesString_Impl( SvLBoxEntry* pEntry, USHORT nFlags, const String& rStr ) - : SvLBoxString( pEntry, nFlags, rStr ) {} + AlternativesString_Impl( ThesaurusAlternativesCtrl_Impl &rControl, + SvLBoxEntry* pEntry, USHORT nFlags, const String& rStr ); virtual void Paint( const Point& rPos, SvLBox& rDev, USHORT nFlags, SvLBoxEntry* pEntry); }; @@ -142,6 +145,9 @@ class ThesaurusAlternativesCtrl_Impl : { SvxThesaurusDialog_Impl & m_rDialogImpl; + typedef std::map< const SvLBoxEntry *, AlternativesExtraData > UserDataMap_t; + UserDataMap_t m_aUserData; + // disable copy c-tor and assignment operator ThesaurusAlternativesCtrl_Impl( const ThesaurusAlternativesCtrl_Impl & ); ThesaurusAlternativesCtrl_Impl & operator = ( const ThesaurusAlternativesCtrl_Impl & ); @@ -152,7 +158,10 @@ public: SvLBoxEntry * AddEntry( sal_Int32 nVal, const String &rText, bool bIsHeader ); - void ClearUserData(); + + void ClearExtraData(); + void SetExtraData( const SvLBoxEntry *pEntry, const AlternativesExtraData &rData ); + AlternativesExtraData * GetExtraData( const SvLBoxEntry *pEntry ); virtual void KeyInput( const KeyEvent& rKEvt ); virtual void Paint( const Rectangle& rRect ); diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx index 1c76da9212c1..c9ee53ca13fb 100644..100755 --- a/cui/source/options/optdict.cxx +++ b/cui/source/options/optdict.cxx @@ -168,6 +168,7 @@ IMPL_LINK( SvxNewDictionaryDialog, OKHdl_Impl, Button *, EMPTYARG ) String aURL( linguistic::GetWritableDictionaryURL( sDict ) ); xNewDic = Reference< XDictionary > ( xDicList->createDictionary( sDict, aLocale, eType, aURL ) , UNO_QUERY ); + xNewDic->setActive( sal_True ); } DBG_ASSERT(xNewDic.is(), "NULL pointer"); } |