CWS-TOOLING: integrate CWS tl81_OOO330

This commit is contained in:
Jens-Heiner Rechtien
2010-07-22 13:00:15 +02:00
5 changed files with 79 additions and 31 deletions

View File

@@ -1989,10 +1989,14 @@ void Document::handleParagraphNotifications()
determineVisibleRange(); determineVisibleRange();
notifyVisibleRangeChanges(aOldVisibleBegin, aOldVisibleEnd, notifyVisibleRangeChanges(aOldVisibleBegin, aOldVisibleEnd,
m_xParagraphs->end()); m_xParagraphs->end());
Paragraphs::iterator aIt(m_xParagraphs->begin() + n);
::rtl::Reference< ParagraphImpl > xParagraph(getParagraph(aIt)); if (n < m_xParagraphs->size())
if (xParagraph.is()) {
xParagraph->textChanged(); Paragraphs::iterator aIt(m_xParagraphs->begin() + n);
::rtl::Reference< ParagraphImpl > xParagraph(getParagraph(aIt));
if (xParagraph.is())
xParagraph->textChanged();
}
break; break;
} }
default: default:

View File

@@ -172,12 +172,21 @@ void ReplaceEdit_Impl::SetText( const XubString& rStr, const Selection& rNewSele
// class ThesaurusAlternativesCtrl_Impl ---------------------------------- // 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( void AlternativesString_Impl::Paint(
const Point& rPos, const Point& rPos,
SvLBox& rDev, USHORT, SvLBox& rDev, USHORT,
SvLBoxEntry* pEntry ) SvLBoxEntry* pEntry )
{ {
AlternativesUserData_Impl* pData = (AlternativesUserData_Impl*)pEntry->GetUserData(); AlternativesExtraData* pData = m_rControlImpl.GetExtraData( pEntry );
Point aPos( rPos ); Point aPos( rPos );
Font aOldFont( rDev.GetFont()); Font aOldFont( rDev.GetFont());
if (pData && pData->IsHeader()) if (pData && pData->IsHeader())
@@ -207,14 +216,40 @@ ThesaurusAlternativesCtrl_Impl::ThesaurusAlternativesCtrl_Impl(
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) UserDataMap_t aEmpty;
delete (AlternativesUserData_Impl*)GetEntry(i)->GetUserData(); 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;
}
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 pEntry->AddItem( new SvLBoxString( pEntry, 0, String() ) ); // add empty column
aText += rText; aText += rText;
pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), 0 ) ); // otherwise crash 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 ); SetExtraData( pEntry, AlternativesExtraData( rText, bIsHeader ) );
pEntry->SetUserData( pUserData );
GetModel()->Insert( pEntry ); GetModel()->Insert( pEntry );
if (bIsHeader) if (bIsHeader)
@@ -365,7 +399,7 @@ bool SvxThesaurusDialog_Impl::UpdateAlternativesBox_Impl()
m_pAlternativesCT->SetUpdateMode( FALSE ); m_pAlternativesCT->SetUpdateMode( FALSE );
// clear old user data of control before creating new ones via AddEntry below // clear old user data of control before creating new ones via AddEntry below
m_pAlternativesCT->ClearUserData(); m_pAlternativesCT->ClearExtraData();
m_pAlternativesCT->Clear(); m_pAlternativesCT->Clear();
for (sal_Int32 i = 0; i < nMeanings; ++i) 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; SvLBoxEntry *pEntry = pBox ? pBox->GetCurEntry() : NULL;
if (pEntry) if (pEntry)
{ {
AlternativesUserData_Impl * pData = (AlternativesUserData_Impl *) pEntry->GetUserData(); AlternativesExtraData * pData = m_pAlternativesCT->GetExtraData( pEntry );
String aStr; String aStr;
if (!pData->IsHeader()) if (pData && !pData->IsHeader())
{ {
aStr = pData->GetText(); aStr = pData->GetText();
GetReplaceEditString( aStr ); GetReplaceEditString( aStr );
@@ -486,9 +520,9 @@ IMPL_LINK( SvxThesaurusDialog_Impl, AlternativesDoubleClickHdl_Impl, SvxCheckLis
SvLBoxEntry *pEntry = pBox ? pBox->GetCurEntry() : NULL; SvLBoxEntry *pEntry = pBox ? pBox->GetCurEntry() : NULL;
if (pEntry) if (pEntry)
{ {
AlternativesUserData_Impl * pData = (AlternativesUserData_Impl *) pEntry->GetUserData(); AlternativesExtraData * pData = m_pAlternativesCT->GetExtraData( pEntry );
String aStr; String aStr;
if (!pData->IsHeader()) if (pData && !pData->IsHeader())
{ {
aStr = pData->GetText(); aStr = pData->GetText();
GetReplaceEditString( aStr ); GetReplaceEditString( aStr );
@@ -509,8 +543,8 @@ IMPL_LINK( SvxThesaurusDialog_Impl, AlternativesDoubleClickHdl_Impl, SvxCheckLis
IMPL_STATIC_LINK( SvxThesaurusDialog_Impl, SelectFirstHdl_Impl, SvxCheckListBox *, pBox ) IMPL_STATIC_LINK( SvxThesaurusDialog_Impl, SelectFirstHdl_Impl, SvxCheckListBox *, pBox )
{ {
(void) pThis; (void) pThis;
if (pBox && pBox->GetEntryCount() > 0) if (pBox && pBox->GetEntryCount() >= 2)
pBox->SelectEntryPos( 0 ); pBox->SelectEntryPos( 1 ); // pos 0 is a 'header' that is not selectable
return 0; return 0;
} }

View File

@@ -59,7 +59,7 @@ ModalDialog RID_SVXDLG_THESAURUS
{ {
Pos = MAP_APPFONT ( 24 , 5 ) ; Pos = MAP_APPFONT ( 24 , 5 ) ;
Size = MAP_APPFONT ( 143 , 8 ) ; Size = MAP_APPFONT ( 143 , 8 ) ;
Text [ en-US ] = "Current ~word" ; Text [ en-US ] = "~Current word" ;
LEFT = TRUE ; LEFT = TRUE ;
}; };
ComboBox CB_WORD ComboBox CB_WORD
@@ -95,7 +95,7 @@ ModalDialog RID_SVXDLG_THESAURUS
{ {
Pos = MAP_APPFONT ( 5 , 173 ) ; Pos = MAP_APPFONT ( 5 , 173 ) ;
Size = MAP_APPFONT ( 255 , 8 ) ; Size = MAP_APPFONT ( 255 , 8 ) ;
Text [ en-US ] = "Replace ~with" ; Text [ en-US ] = "~Replace with" ;
LEFT = TRUE ; LEFT = TRUE ;
}; };
Edit ED_REPL Edit ED_REPL
@@ -120,7 +120,7 @@ ModalDialog RID_SVXDLG_THESAURUS
{ {
Pos = MAP_APPFONT ( 105 , 210 ) ; Pos = MAP_APPFONT ( 105 , 210 ) ;
Size = MAP_APPFONT ( 60 , 14 ) ; Size = MAP_APPFONT ( 60 , 14 ) ;
Text [ en-US ] = "~Replace" ; Text [ en-US ] = "Replace" ;
DefButton = TRUE ; DefButton = TRUE ;
}; };
CancelButton BTN_THES_CANCEL CancelButton BTN_THES_CANCEL

View File

@@ -51,11 +51,16 @@
#include <com/sun/star/linguistic2/XMeaning.hpp> #include <com/sun/star/linguistic2/XMeaning.hpp>
#include <stack> #include <stack>
#include <map>
#include <algorithm> #include <algorithm>
using namespace ::com::sun::star; using namespace ::com::sun::star;
using ::rtl::OUString; using ::rtl::OUString;
class SvLBoxEntry;
class ThesaurusAlternativesCtrl_Impl;
// class LookUpComboBox_Impl -------------------------------------------------- // class LookUpComboBox_Impl --------------------------------------------------
class LookUpComboBox_Impl : public ComboBox class LookUpComboBox_Impl : public ComboBox
@@ -105,17 +110,14 @@ public:
// class ThesaurusAlternativesCtrl_Impl ---------------------------------- // class ThesaurusAlternativesCtrl_Impl ----------------------------------
class AlternativesUserData_Impl class AlternativesExtraData
{ {
String sText; String sText;
bool bHeader; bool bHeader;
// disable copy c-tor and assignment operator
AlternativesUserData_Impl( const AlternativesUserData_Impl & );
AlternativesUserData_Impl & operator = ( const AlternativesUserData_Impl & );
public: public:
AlternativesUserData_Impl( const String &rText, bool bIsHeader ) : AlternativesExtraData() : bHeader( false ) {}
AlternativesExtraData( const String &rText, bool bIsHeader ) :
sText(rText), sText(rText),
bHeader(bIsHeader) bHeader(bIsHeader)
{ {
@@ -128,10 +130,11 @@ public:
class AlternativesString_Impl : public SvLBoxString class AlternativesString_Impl : public SvLBoxString
{ {
ThesaurusAlternativesCtrl_Impl & m_rControlImpl;
public: public:
AlternativesString_Impl( SvLBoxEntry* pEntry, USHORT nFlags, const String& rStr ) AlternativesString_Impl( ThesaurusAlternativesCtrl_Impl &rControl,
: SvLBoxString( pEntry, nFlags, rStr ) {} SvLBoxEntry* pEntry, USHORT nFlags, const String& rStr );
virtual void Paint( const Point& rPos, SvLBox& rDev, USHORT nFlags, SvLBoxEntry* pEntry); virtual void Paint( const Point& rPos, SvLBox& rDev, USHORT nFlags, SvLBoxEntry* pEntry);
}; };
@@ -142,6 +145,9 @@ class ThesaurusAlternativesCtrl_Impl :
{ {
SvxThesaurusDialog_Impl & m_rDialogImpl; SvxThesaurusDialog_Impl & m_rDialogImpl;
typedef std::map< const SvLBoxEntry *, AlternativesExtraData > UserDataMap_t;
UserDataMap_t m_aUserData;
// disable copy c-tor and assignment operator // disable copy c-tor and assignment operator
ThesaurusAlternativesCtrl_Impl( const ThesaurusAlternativesCtrl_Impl & ); ThesaurusAlternativesCtrl_Impl( const ThesaurusAlternativesCtrl_Impl & );
ThesaurusAlternativesCtrl_Impl & operator = ( const ThesaurusAlternativesCtrl_Impl & ); ThesaurusAlternativesCtrl_Impl & operator = ( const ThesaurusAlternativesCtrl_Impl & );
@@ -152,7 +158,10 @@ public:
SvLBoxEntry * AddEntry( sal_Int32 nVal, const String &rText, bool bIsHeader ); 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 KeyInput( const KeyEvent& rKEvt );
virtual void Paint( const Rectangle& rRect ); virtual void Paint( const Rectangle& rRect );

1
cui/source/options/optdict.cxx Normal file → Executable file
View File

@@ -168,6 +168,7 @@ IMPL_LINK( SvxNewDictionaryDialog, OKHdl_Impl, Button *, EMPTYARG )
String aURL( linguistic::GetWritableDictionaryURL( sDict ) ); String aURL( linguistic::GetWritableDictionaryURL( sDict ) );
xNewDic = Reference< XDictionary > ( xNewDic = Reference< XDictionary > (
xDicList->createDictionary( sDict, aLocale, eType, aURL ) , UNO_QUERY ); xDicList->createDictionary( sDict, aLocale, eType, aURL ) , UNO_QUERY );
xNewDic->setActive( sal_True );
} }
DBG_ASSERT(xNewDic.is(), "NULL pointer"); DBG_ASSERT(xNewDic.is(), "NULL pointer");
} }