Kaydet (Commit) e179ae41 authored tarafından Joachim Lingner's avatar Joachim Lingner

jl154 merging with OOO330m2

......@@ -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:
......
......@@ -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;
}
......
......@@ -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
......
......@@ -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 );
......
......@@ -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");
}
......
......@@ -40,6 +40,7 @@
#include <com/sun/star/frame/XLoadable.hpp>
#include <tools/rcid.h>
#include <tools/shl.hxx>
#include <tools/urlobj.hxx>
#include <comphelper/processfactory.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
......
......@@ -190,6 +190,7 @@ void OImageControlModel::implConstruct()
{
m_pImageProducer = new ImageProducer;
m_xImageProducer = m_pImageProducer;
m_pImageProducer->SetDoneHdl( LINK( this, OImageControlModel, OnImageImportDone ) );
}
//------------------------------------------------------------------
......@@ -630,6 +631,16 @@ void SAL_CALL OImageControlModel::startProduction( ) throw (RuntimeException)
GetImageProducer()->startProduction();
}
//------------------------------------------------------------------------------
IMPL_LINK( OImageControlModel, OnImageImportDone, ::Graphic*, i_pGraphic )
{
ENSURE_OR_RETURN( i_pGraphic, "OImageControlModel::OnImageImportDone: illegal graphic!", 0L );
setPropertyValue(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Graphic" ) ),
makeAny( Image( i_pGraphic->GetBitmapEx() ).GetXGraphic() )
);
return 1L;
}
//==================================================================
// OImageControlControl
......
......@@ -140,6 +140,8 @@ protected:
bound field, or the control itself if there is no bound field
*/
sal_Bool impl_updateStreamForURL_lck( const ::rtl::OUString& _rURL, ValueChangeInstigator _eInstigator );
DECL_LINK( OnImageImportDone, ::Graphic* );
};
//==================================================================
......
......@@ -190,11 +190,7 @@ ErrCode ImgProdLockBytes::Stat( SvLockBytesStat* pStat, SvLockBytesStatFlag eFla
ImageProducer::ImageProducer() :
mpStm ( NULL ),
mpFilter ( NULL ),
mnStatus ( 0UL ),
mbConsInit ( sal_False ),
mnLastError ( 0UL ),
mbAsync ( sal_False )
mbConsInit ( sal_False )
{
mpGraphic = new Graphic;
DBG_ASSERT( Application::GetFilterHdl().IsSet(), "ImageProducer::ImageProducer(): No filter handler set" );
......@@ -207,9 +203,6 @@ ImageProducer::~ImageProducer()
delete mpGraphic;
mpGraphic = NULL;
delete mpFilter;
mpFilter = NULL;
delete mpStm;
mpStm = NULL;
......@@ -261,7 +254,6 @@ void ImageProducer::SetImage( const ::rtl::OUString& rPath )
maURL = rPath;
mpGraphic->Clear();
mbConsInit = sal_False;
mbAsync = sal_False;
delete mpStm;
if ( ::svt::GraphicAccess::isSupportedURL( maURL ) )
......@@ -284,7 +276,6 @@ void ImageProducer::SetImage( SvStream& rStm )
maURL = ::rtl::OUString();
mpGraphic->Clear();
mbConsInit = sal_False;
mbAsync = sal_False;
delete mpStm;
mpStm = new SvStream( new ImgProdLockBytes( &rStm, sal_False ) );
......@@ -297,7 +288,6 @@ void ImageProducer::setImage( ::com::sun::star::uno::Reference< ::com::sun::star
maURL = ::rtl::OUString();
mpGraphic->Clear();
mbConsInit = sal_False;
mbAsync = sal_False;
delete mpStm;
if( rInputStmRef.is() )
......@@ -318,9 +308,7 @@ void ImageProducer::NewDataAvailable()
void ImageProducer::startProduction() throw(::com::sun::star::uno::RuntimeException)
{
ResetLastError();
if( maConsList.Count() )
if( maConsList.Count() || maDoneHdl.IsSet() )
{
bool bNotifyEmptyGraphics = false;
......@@ -331,8 +319,8 @@ void ImageProducer::startProduction() throw(::com::sun::star::uno::RuntimeExcept
// graphic is cleared if a new Stream is set
if( ( mpGraphic->GetType() == GRAPHIC_NONE ) || mpGraphic->GetContext() )
{
if( !ImplImportGraphic( *mpGraphic ) && maErrorHdl.IsSet() )
maErrorHdl.Call( this );
if ( ImplImportGraphic( *mpGraphic ) && maDoneHdl.IsSet() )
maDoneHdl.Call( mpGraphic );
}
if( mpGraphic->GetType() != GRAPHIC_NONE )
......@@ -371,33 +359,16 @@ void ImageProducer::startProduction() throw(::com::sun::star::uno::RuntimeExcept
sal_Bool ImageProducer::ImplImportGraphic( Graphic& rGraphic )
{
USHORT nFilter = GRFILTER_FORMAT_DONTKNOW;
short nRet;
sal_Bool bRet = sal_False;
if( ERRCODE_IO_PENDING == mpStm->GetError() )
mpStm->ResetError();
mpStm->Seek( 0UL );
if( mpFilter )
nRet = mpFilter->ImportGraphic( rGraphic, String(), *mpStm, nFilter );
else
{
if( GraphicConverter::Import( *mpStm, rGraphic ) == ERRCODE_NONE )
nRet = GRFILTER_OK;
else
nRet = GRFILTER_FILTERERROR;
}
sal_Bool bRet = GraphicConverter::Import( *mpStm, rGraphic ) == ERRCODE_NONE;
if( ERRCODE_IO_PENDING == mpStm->GetError() )
mpStm->ResetError();
if( nRet == GRFILTER_OK )
bRet = sal_True;
else
mnLastError = nRet;
return bRet;
}
......@@ -405,10 +376,6 @@ sal_Bool ImageProducer::ImplImportGraphic( Graphic& rGraphic )
void ImageProducer::ImplUpdateData( const Graphic& rGraphic )
{
// asynchronous?
if( mpGraphic->GetContext() )
mbAsync = sal_True;
ImplInitConsumer( rGraphic );
if( mbConsInit && maConsList.Count() )
......@@ -425,7 +392,7 @@ void ImageProducer::ImplUpdateData( const Graphic& rGraphic )
// iterate through interfaces
for( pCons = aTmp.First(); pCons; pCons = aTmp.Next() )
( *(::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons )->complete( mnStatus = ::com::sun::star::awt::ImageStatus::IMAGESTATUS_STATICIMAGEDONE, this );
( *(::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons )->complete( ::com::sun::star::awt::ImageStatus::IMAGESTATUS_STATICIMAGEDONE, this );
// delete interfaces in temporary list
for( pCons = aTmp.First(); pCons; pCons = aTmp.Next() )
......
......@@ -64,20 +64,9 @@ private:
List maConsList;
Graphic* mpGraphic;
SvStream* mpStm;
GraphicFilter* mpFilter;
sal_uInt32 mnTransIndex;
sal_uInt32 mnStatus;
sal_Bool mbConsInit;
sal_Bool mbStmDel;
Link maErrorHdl;
sal_uInt32 mnLastError;
sal_uInt32 mnExtra2;
sal_Bool mbAsync;
sal_Bool mbExtra1;
sal_Bool mbExtra2;
sal_Bool mbExtra3;
Link maDoneHdl;
sal_Bool ImplImportGraphic( Graphic& rGraphic );
void ImplUpdateData( const Graphic& rGraphic );
......@@ -92,14 +81,11 @@ public:
void SetImage( const ::rtl::OUString& rPath );
void SetImage( SvStream& rStm );
void SetErrorHandler( const Link& rErrorHdl ) { maErrorHdl = rErrorHdl; }
const Link& GetErrorHandler() const { return maErrorHdl; }
sal_uInt32 GetLastError() const { return mnLastError; }
void ResetLastError() { mnLastError = 0; }
void NewDataAvailable();
void SetDoneHdl( const Link& i_rHdl ) { maDoneHdl = i_rHdl; }
const Link& GetDoneHdl() const { return maDoneHdl; }
// ::com::sun::star::uno::XInterface
::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
......
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