ScEditEngineTextObj
This commit is contained in:
parent
05a07b1f6b
commit
d44694c595
2 changed files with 89 additions and 5 deletions
|
@ -2,9 +2,9 @@
|
|||
*
|
||||
* $RCSfile: textuno.hxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
* $Revision: 1.3 $
|
||||
*
|
||||
* last change: $Author: nn $ $Date: 2000-12-18 19:29:18 $
|
||||
* last change: $Author: nn $ $Date: 2001-01-18 15:55:11 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@ -89,9 +89,12 @@
|
|||
|
||||
class EditEngine;
|
||||
class EditTextObject;
|
||||
class SvxEditEngineForwarder;
|
||||
class ScDocShell;
|
||||
class ScAddress;
|
||||
class ScCellObj;
|
||||
class ScSimpleEditSource;
|
||||
class ScEditEngineDefaulter;
|
||||
|
||||
struct ScHeaderFieldData;
|
||||
|
||||
|
@ -309,8 +312,36 @@ public:
|
|||
com::sun::star::uno::XInterface> xObj );
|
||||
};
|
||||
|
||||
// ScAnnotationTextCursor isn't needed anymore - SvxUnoTextCursor is used instead
|
||||
|
||||
// ScAnnotationTextCursor nicht mehr - stattdessen wird einfach SvxUnoTextCursor benutzt
|
||||
|
||||
// ScEditEngineTextObj for formatted cell content that is not inserted in a cell or header/footer
|
||||
// (used for XML export of change tracking contents)
|
||||
|
||||
class ScSimpleEditSourceHelper
|
||||
{
|
||||
ScEditEngineDefaulter* pEditEngine;
|
||||
SvxEditEngineForwarder* pForwarder;
|
||||
ScSimpleEditSource* pOriginalSource;
|
||||
|
||||
public:
|
||||
ScSimpleEditSourceHelper();
|
||||
~ScSimpleEditSourceHelper();
|
||||
|
||||
ScSimpleEditSource* GetOriginalSource() const { return pOriginalSource; }
|
||||
ScEditEngineDefaulter* GetEditEngine() const { return pEditEngine; }
|
||||
};
|
||||
|
||||
class ScEditEngineTextObj : public ScSimpleEditSourceHelper, public SvxUnoText
|
||||
{
|
||||
public:
|
||||
ScEditEngineTextObj();
|
||||
virtual ~ScEditEngineTextObj();
|
||||
|
||||
void SetText( const String& rStr );
|
||||
void SetText( const EditTextObject& rTextObject );
|
||||
EditTextObject* CreateTextObject();
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
*
|
||||
* $RCSfile: textuno.cxx,v $
|
||||
*
|
||||
* $Revision: 1.3 $
|
||||
* $Revision: 1.4 $
|
||||
*
|
||||
* last change: $Author: nn $ $Date: 2000-12-18 19:30:26 $
|
||||
* last change: $Author: nn $ $Date: 2001-01-18 15:58:42 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@ -74,6 +74,7 @@
|
|||
#include <svx/flditem.hxx>
|
||||
#include <svx/unomid.hxx>
|
||||
#include <svx/unoprnms.hxx>
|
||||
#include <svx/unofored.hxx>
|
||||
#include <rtl/uuid.h>
|
||||
|
||||
#ifndef _COM_SUN_STAR_AWT_FONTSLANT_HPP_
|
||||
|
@ -713,5 +714,57 @@ ScHeaderFooterTextCursor* ScHeaderFooterTextCursor::getImplementation(
|
|||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
ScSimpleEditSourceHelper::ScSimpleEditSourceHelper()
|
||||
{
|
||||
SfxItemPool* pEnginePool = EditEngine::CreatePool();
|
||||
pEnginePool->SetDefaultMetric( SFX_MAPUNIT_100TH_MM );
|
||||
pEnginePool->FreezeIdRanges();
|
||||
|
||||
pEditEngine = new ScFieldEditEngine( pEnginePool, NULL, TRUE ); // TRUE: become owner of pool
|
||||
pForwarder = new SvxEditEngineForwarder( *pEditEngine );
|
||||
pOriginalSource = new ScSimpleEditSource( pForwarder );
|
||||
}
|
||||
|
||||
ScSimpleEditSourceHelper::~ScSimpleEditSourceHelper()
|
||||
{
|
||||
ScUnoGuard aGuard; // needed for EditEngine dtor
|
||||
|
||||
delete pOriginalSource;
|
||||
delete pForwarder;
|
||||
delete pEditEngine;
|
||||
}
|
||||
|
||||
ScEditEngineTextObj::ScEditEngineTextObj() :
|
||||
SvxUnoText( GetOriginalSource(), ScCellObj::GetEditPropertyMap(), uno::Reference<text::XText>() )
|
||||
{
|
||||
}
|
||||
|
||||
ScEditEngineTextObj::~ScEditEngineTextObj()
|
||||
{
|
||||
}
|
||||
|
||||
void ScEditEngineTextObj::SetText( const String& rStr )
|
||||
{
|
||||
GetEditEngine()->SetText( rStr );
|
||||
|
||||
ESelection aSel;
|
||||
::GetSelection( aSel, GetEditSource()->GetTextForwarder() );
|
||||
SetSelection( aSel );
|
||||
}
|
||||
|
||||
void ScEditEngineTextObj::SetText( const EditTextObject& rTextObject )
|
||||
{
|
||||
GetEditEngine()->SetText( rTextObject );
|
||||
|
||||
ESelection aSel;
|
||||
::GetSelection( aSel, GetEditSource()->GetTextForwarder() );
|
||||
SetSelection( aSel );
|
||||
}
|
||||
|
||||
EditTextObject* ScEditEngineTextObj::CreateTextObject()
|
||||
{
|
||||
return GetEditEngine()->CreateTextObject();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
|
|
Loading…
Reference in a new issue