From 9a6cbed6c4de11b12ed3d7201d7774649ed28577 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Wed, 23 Jun 2010 09:57:22 +0200 Subject: [PATCH 1/5] cws tl81: #i112363# patch for accessibility crash --- .../source/extended/textwindowaccessibility.cxx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 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: From 6cd261bd26504c664ae82ba4b13eb9b767d3e62b Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Thu, 24 Jun 2010 09:08:52 +0200 Subject: [PATCH 2/5] cws tl81: #i112179# dictionary issue with context menus fixed --- cui/source/options/optdict.cxx | 1 + 1 file changed, 1 insertion(+) mode change 100644 => 100755 cui/source/options/optdict.cxx diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx old mode 100644 new mode 100755 index 1c76da9212c1..c9ee53ca13fb --- 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"); } From e56241c85b0afffb2ccdf64c29ef88d2df5f4909 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Thu, 24 Jun 2010 09:27:08 +0200 Subject: [PATCH 3/5] cws tl81: #i112310# fixed duplicate short-cut problem --- cui/source/dialogs/thesdlg.src | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 From ce9c31ba3fe2cdf3eadc2114ddd619af24a147be Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Mon, 28 Jun 2010 15:51:46 +0200 Subject: [PATCH 4/5] cws tl81: #i112695# change in user data implementation for thesaurus dialog --- cui/source/dialogs/thesdlg.cxx | 64 ++++++++++++++++++++++------- cui/source/dialogs/thesdlg_impl.hxx | 27 ++++++++---- 2 files changed, 67 insertions(+), 24 deletions(-) diff --git a/cui/source/dialogs/thesdlg.cxx b/cui/source/dialogs/thesdlg.cxx index bf617b126747..b2d0ed41474e 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::ClearUserData() +void ThesaurusAlternativesCtrl_Impl::ClearExtraData() { - for (USHORT i = 0; i < GetEntryCount(); ++i) - delete (AlternativesUserData_Impl*)GetEntry(i)->GetUserData(); + UserDataMap_t aEmpty; + m_aUserData.swap( aEmpty ); +} + + +void ThesaurusAlternativesCtrl_Impl::SetExtraData( + const SvLBoxEntry *pEntry, + 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; +} + + +AlternativesExtraData * ThesaurusAlternativesCtrl_Impl::GetExtraData( + const SvLBoxEntry *pEntry ) +{ + 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_impl.hxx b/cui/source/dialogs/thesdlg_impl.hxx index 70ce91391456..ca18325aab21 100755 --- a/cui/source/dialogs/thesdlg_impl.hxx +++ b/cui/source/dialogs/thesdlg_impl.hxx @@ -51,11 +51,16 @@ #include #include +#include #include 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, AlternativesExtraData &rData ); + AlternativesExtraData * GetExtraData( const SvLBoxEntry *pEntry ); virtual void KeyInput( const KeyEvent& rKEvt ); virtual void Paint( const Rectangle& rRect ); From 5914f1a08b1ca5d0b9fe59b8a12403d9a65d3430 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Mon, 5 Jul 2010 10:45:58 +0200 Subject: [PATCH 5/5] cws tl81: warning-free code --- cui/source/dialogs/thesdlg.cxx | 2 +- cui/source/dialogs/thesdlg_impl.hxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) mode change 100755 => 100644 cui/source/dialogs/thesdlg.cxx mode change 100755 => 100644 cui/source/dialogs/thesdlg_impl.hxx diff --git a/cui/source/dialogs/thesdlg.cxx b/cui/source/dialogs/thesdlg.cxx old mode 100755 new mode 100644 index b2d0ed41474e..ec04362b488d --- a/cui/source/dialogs/thesdlg.cxx +++ b/cui/source/dialogs/thesdlg.cxx @@ -229,7 +229,7 @@ void ThesaurusAlternativesCtrl_Impl::ClearExtraData() void ThesaurusAlternativesCtrl_Impl::SetExtraData( const SvLBoxEntry *pEntry, - AlternativesExtraData &rData ) + const AlternativesExtraData &rData ) { if (!pEntry) return; diff --git a/cui/source/dialogs/thesdlg_impl.hxx b/cui/source/dialogs/thesdlg_impl.hxx old mode 100755 new mode 100644 index ca18325aab21..b682c8d0c129 --- a/cui/source/dialogs/thesdlg_impl.hxx +++ b/cui/source/dialogs/thesdlg_impl.hxx @@ -160,7 +160,7 @@ public: SvLBoxEntry * AddEntry( sal_Int32 nVal, const String &rText, bool bIsHeader ); void ClearExtraData(); - void SetExtraData( const SvLBoxEntry *pEntry, AlternativesExtraData &rData ); + void SetExtraData( const SvLBoxEntry *pEntry, const AlternativesExtraData &rData ); AlternativesExtraData * GetExtraData( const SvLBoxEntry *pEntry ); virtual void KeyInput( const KeyEvent& rKEvt );