Kaydet (Commit) 399727e9 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Have ScHeaderFooterTextObj store authoritative EditTextObject instance.

This removes lots of needless broadcasting, and makes the code a lot
simpler.  But it introduced a bug I need to look into...
üst 0809ccec
...@@ -44,6 +44,7 @@ class ScCellTextData; ...@@ -44,6 +44,7 @@ class ScCellTextData;
class ScHeaderFooterTextData; class ScHeaderFooterTextData;
class ScAccessibleTextData; class ScAccessibleTextData;
class SdrObject; class SdrObject;
class EditTextObject;
class ScHeaderFooterChangedHint : public SfxHint class ScHeaderFooterChangedHint : public SfxHint
...@@ -69,7 +70,7 @@ private: ...@@ -69,7 +70,7 @@ private:
public: public:
ScHeaderFooterEditSource(const ScHeaderFooterTextData& rData); ScHeaderFooterEditSource(const ScHeaderFooterTextData& rData);
ScHeaderFooterEditSource(ScHeaderFooterContentObj& rContent, sal_uInt16 nP); ScHeaderFooterEditSource(ScHeaderFooterContentObj& rContent, sal_uInt16 nP, const EditTextObject* pTextObj);
virtual ~ScHeaderFooterEditSource(); virtual ~ScHeaderFooterEditSource();
// GetEditEngine is needed because the forwarder doesn't have field functions // GetEditEngine is needed because the forwarder doesn't have field functions
......
...@@ -58,6 +58,7 @@ class ScEditFieldObj; ...@@ -58,6 +58,7 @@ class ScEditFieldObj;
class ScHeaderFieldObj; class ScHeaderFieldObj;
class ScHeaderFooterContentObj; class ScHeaderFooterContentObj;
class ScDocShell; class ScDocShell;
class EditTextObject;
class ScCellFieldsObj : public cppu::WeakImplHelper5< class ScCellFieldsObj : public cppu::WeakImplHelper5<
...@@ -283,8 +284,8 @@ private: ...@@ -283,8 +284,8 @@ private:
ScHeaderFieldObj* GetObjectByIndex_Impl(sal_Int32 Index) const; ScHeaderFieldObj* GetObjectByIndex_Impl(sal_Int32 Index) const;
public: public:
ScHeaderFieldsObj(ScHeaderFooterContentObj* pContent, ScHeaderFieldsObj(
sal_uInt16 nP, sal_uInt16 nT); ScHeaderFooterContentObj* pContent, sal_uInt16 nP, const EditTextObject* pTextObj, sal_uInt16 nT);
virtual ~ScHeaderFieldsObj(); virtual ~ScHeaderFieldsObj();
// XIndexAccess // XIndexAccess
...@@ -361,7 +362,7 @@ public: ...@@ -361,7 +362,7 @@ public:
SvxFieldItem CreateFieldItem(); SvxFieldItem CreateFieldItem();
void InitDoc( void InitDoc(
const com::sun::star::uno::Reference<com::sun::star::text::XTextRange>& rContent, const com::sun::star::uno::Reference<com::sun::star::text::XTextRange>& rContent,
ScHeaderFooterContentObj* pContent, sal_uInt16 nP, const ESelection& rSel); ScHeaderFooterContentObj* pContent, sal_uInt16 nP, const EditTextObject* pTextObj, const ESelection& rSel);
virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(
const ::com::sun::star::uno::Type & rType ) const ::com::sun::star::uno::Type & rType )
......
...@@ -40,6 +40,8 @@ ...@@ -40,6 +40,8 @@
#include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp>
#include <cppuhelper/implbase3.hxx> #include <cppuhelper/implbase3.hxx>
#include <cppuhelper/implbase5.hxx> #include <cppuhelper/implbase5.hxx>
#include "rtl/ref.hxx"
#include "scdllapi.h" #include "scdllapi.h"
class EditEngine; class EditEngine;
...@@ -52,6 +54,7 @@ class ScSimpleEditSource; ...@@ -52,6 +54,7 @@ class ScSimpleEditSource;
class ScCellEditSource; class ScCellEditSource;
class ScEditEngineDefaulter; class ScEditEngineDefaulter;
class ScFieldEditEngine; class ScFieldEditEngine;
class ScHeaderFooterTextObj;
struct ScHeaderFieldData; struct ScHeaderFieldData;
...@@ -70,28 +73,22 @@ class ScHeaderFooterContentObj : public cppu::WeakImplHelper3< ...@@ -70,28 +73,22 @@ class ScHeaderFooterContentObj : public cppu::WeakImplHelper3<
com::sun::star::lang::XServiceInfo > com::sun::star::lang::XServiceInfo >
{ {
private: private:
EditTextObject* pLeftText; rtl::Reference<ScHeaderFooterTextObj> mxLeftText;
EditTextObject* pCenterText; rtl::Reference<ScHeaderFooterTextObj> mxCenterText;
EditTextObject* pRightText; rtl::Reference<ScHeaderFooterTextObj> mxRightText;
SfxBroadcaster aBC;
ScHeaderFooterContentObj(); // disabled ScHeaderFooterContentObj(); // disabled
public: public:
ScHeaderFooterContentObj( const EditTextObject* pLeft, ScHeaderFooterContentObj( const EditTextObject* pLeft,
const EditTextObject* pCenter, const EditTextObject* pCenter,
const EditTextObject* pRight ); const EditTextObject* pRight );
virtual ~ScHeaderFooterContentObj(); virtual ~ScHeaderFooterContentObj();
// for ScPageHFItem (using getImplementation) // for ScPageHFItem (using getImplementation)
const EditTextObject* GetLeftEditObject() const { return pLeftText; } const EditTextObject* GetLeftEditObject() const;
const EditTextObject* GetCenterEditObject() const { return pCenterText; } const EditTextObject* GetCenterEditObject() const;
const EditTextObject* GetRightEditObject() const { return pRightText; } const EditTextObject* GetRightEditObject() const;
void AddListener( SfxListener& rListener );
void RemoveListener( SfxListener& rListener );
void UpdateText( sal_uInt16 nPart, EditEngine& rSource );
// XHeaderFooterContent // XHeaderFooterContent
virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL
...@@ -122,9 +119,10 @@ public: ...@@ -122,9 +119,10 @@ public:
// ScHeaderFooterTextData: shared data between sub objects of a ScHeaderFooterTextObj // ScHeaderFooterTextData: shared data between sub objects of a ScHeaderFooterTextObj
class ScHeaderFooterTextData : public SfxListener class ScHeaderFooterTextData
{ {
private: private:
EditTextObject* mpTextObj;
ScHeaderFooterContentObj& rContentObj; ScHeaderFooterContentObj& rContentObj;
sal_uInt16 nPart; sal_uInt16 nPart;
ScEditEngineDefaulter* pEditEngine; ScEditEngineDefaulter* pEditEngine;
...@@ -133,23 +131,28 @@ private: ...@@ -133,23 +131,28 @@ private:
sal_Bool bInUpdate; sal_Bool bInUpdate;
public: public:
ScHeaderFooterTextData( ScHeaderFooterContentObj& rContent, ScHeaderFooterTextData(
sal_uInt16 nP ); ScHeaderFooterContentObj& rContent, sal_uInt16 nP, const EditTextObject* pTextObj);
~ScHeaderFooterTextData(); ~ScHeaderFooterTextData();
virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
// helper functions // helper functions
SvxTextForwarder* GetTextForwarder(); SvxTextForwarder* GetTextForwarder();
void UpdateData(); void UpdateData();
void UpdateData(EditEngine& rEditEngine);
ScEditEngineDefaulter* GetEditEngine() { GetTextForwarder(); return pEditEngine; } ScEditEngineDefaulter* GetEditEngine() { GetTextForwarder(); return pEditEngine; }
sal_uInt16 GetPart() const { return nPart; } sal_uInt16 GetPart() const { return nPart; }
ScHeaderFooterContentObj& GetContentObj() const { return rContentObj; } ScHeaderFooterContentObj& GetContentObj() const { return rContentObj; }
};
// ScHeaderFooterTextObj changes the text in a ScHeaderFooterContentObj const EditTextObject* GetTextObject() const;
};
/**
* Each of these instances represent, the left, center or right part of the
* header of footer of a page.
*
* ScHeaderFooterTextObj changes the text in a ScHeaderFooterContentObj.
*/
class ScHeaderFooterTextObj : public cppu::WeakImplHelper5< class ScHeaderFooterTextObj : public cppu::WeakImplHelper5<
com::sun::star::text::XText, com::sun::star::text::XText,
com::sun::star::text::XTextRangeMover, com::sun::star::text::XTextRangeMover,
...@@ -164,10 +167,11 @@ private: ...@@ -164,10 +167,11 @@ private:
void CreateUnoText_Impl(); void CreateUnoText_Impl();
public: public:
ScHeaderFooterTextObj( ScHeaderFooterContentObj& rContent, ScHeaderFooterTextObj(
sal_uInt16 nP ); ScHeaderFooterContentObj& rContent, sal_uInt16 nP, const EditTextObject* pTextObj);
virtual ~ScHeaderFooterTextObj(); virtual ~ScHeaderFooterTextObj();
const EditTextObject* GetTextObject() const;
const SvxUnoText& GetUnoText(); const SvxUnoText& GetUnoText();
static void FillDummyFieldData( ScHeaderFieldData& rData ); static void FillDummyFieldData( ScHeaderFieldData& rData );
......
...@@ -68,11 +68,11 @@ ScHeaderFooterChangedHint::~ScHeaderFooterChangedHint() ...@@ -68,11 +68,11 @@ ScHeaderFooterChangedHint::~ScHeaderFooterChangedHint()
// each ScHeaderFooterEditSource object has its own ScHeaderFooterTextData // each ScHeaderFooterEditSource object has its own ScHeaderFooterTextData
ScHeaderFooterEditSource::ScHeaderFooterEditSource(const ScHeaderFooterTextData& rData) : ScHeaderFooterEditSource::ScHeaderFooterEditSource(const ScHeaderFooterTextData& rData) :
pTextData(new ScHeaderFooterTextData(rData.GetContentObj(), rData.GetPart())) {} pTextData(new ScHeaderFooterTextData(rData.GetContentObj(), rData.GetPart(), rData.GetTextObject())) {}
ScHeaderFooterEditSource::ScHeaderFooterEditSource( ScHeaderFooterEditSource::ScHeaderFooterEditSource(
ScHeaderFooterContentObj& rContent, sal_uInt16 nP) : ScHeaderFooterContentObj& rContent, sal_uInt16 nP, const EditTextObject* pTextObj) :
pTextData(new ScHeaderFooterTextData(rContent, nP)) {} pTextData(new ScHeaderFooterTextData(rContent, nP, pTextObj)) {}
ScHeaderFooterEditSource::~ScHeaderFooterEditSource() ScHeaderFooterEditSource::~ScHeaderFooterEditSource()
{ {
...@@ -87,7 +87,7 @@ ScEditEngineDefaulter* ScHeaderFooterEditSource::GetEditEngine() ...@@ -87,7 +87,7 @@ ScEditEngineDefaulter* ScHeaderFooterEditSource::GetEditEngine()
SvxEditSource* ScHeaderFooterEditSource::Clone() const SvxEditSource* ScHeaderFooterEditSource::Clone() const
{ {
return new ScHeaderFooterEditSource( return new ScHeaderFooterEditSource(
pTextData->GetContentObj(), pTextData->GetPart()); pTextData->GetContentObj(), pTextData->GetPart(), pTextData->GetTextObject());
} }
SvxTextForwarder* ScHeaderFooterEditSource::GetTextForwarder() SvxTextForwarder* ScHeaderFooterEditSource::GetTextForwarder()
......
...@@ -848,7 +848,8 @@ uno::Sequence<rtl::OUString> SAL_CALL ScCellFieldObj::getSupportedServiceNames() ...@@ -848,7 +848,8 @@ uno::Sequence<rtl::OUString> SAL_CALL ScCellFieldObj::getSupportedServiceNames()
//------------------------------------------------------------------------ //------------------------------------------------------------------------
ScHeaderFieldsObj::ScHeaderFieldsObj(ScHeaderFooterContentObj* pContent, sal_uInt16 nP, sal_uInt16 nT) : ScHeaderFieldsObj::ScHeaderFieldsObj(
ScHeaderFooterContentObj* pContent, sal_uInt16 nP, const EditTextObject* pTextObj, sal_uInt16 nT) :
pContentObj( pContent ), pContentObj( pContent ),
nPart( nP ), nPart( nP ),
nType( nT ), nType( nT ),
...@@ -859,7 +860,7 @@ ScHeaderFieldsObj::ScHeaderFieldsObj(ScHeaderFooterContentObj* pContent, sal_uIn ...@@ -859,7 +860,7 @@ ScHeaderFieldsObj::ScHeaderFieldsObj(ScHeaderFooterContentObj* pContent, sal_uIn
if (pContentObj) if (pContentObj)
{ {
pContentObj->acquire(); // darf nicht wegkommen pContentObj->acquire(); // darf nicht wegkommen
pEditSource = new ScHeaderFooterEditSource(*pContentObj, nPart); pEditSource = new ScHeaderFooterEditSource(*pContentObj, nPart, pTextObj);
} }
else else
pEditSource = NULL; pEditSource = NULL;
...@@ -1118,7 +1119,7 @@ ScHeaderFieldObj::ScHeaderFieldObj( ...@@ -1118,7 +1119,7 @@ ScHeaderFieldObj::ScHeaderFieldObj(
if (pContentObj) if (pContentObj)
{ {
pContentObj->acquire(); // darf nicht wegkommen pContentObj->acquire(); // darf nicht wegkommen
pEditSource = new ScHeaderFooterEditSource(*pContentObj, nPart); pEditSource = new ScHeaderFooterEditSource(*pContentObj, nPart, NULL);
} }
else else
pEditSource = NULL; pEditSource = NULL;
...@@ -1187,7 +1188,7 @@ void SAL_CALL ScHeaderFieldObj::release() throw() ...@@ -1187,7 +1188,7 @@ void SAL_CALL ScHeaderFieldObj::release() throw()
void ScHeaderFieldObj::InitDoc( void ScHeaderFieldObj::InitDoc(
const uno::Reference<text::XTextRange>& rContent, const uno::Reference<text::XTextRange>& rContent,
ScHeaderFooterContentObj* pContent, sal_uInt16 nP, const ESelection& rSel) ScHeaderFooterContentObj* pContent, sal_uInt16 nP, const EditTextObject* pTextObj, const ESelection& rSel)
{ {
if ( pContent && !pEditSource ) if ( pContent && !pEditSource )
{ {
...@@ -1199,7 +1200,7 @@ void ScHeaderFieldObj::InitDoc( ...@@ -1199,7 +1200,7 @@ void ScHeaderFieldObj::InitDoc(
mpContent = rContent; mpContent = rContent;
pContentObj->acquire(); // darf nicht wegkommen pContentObj->acquire(); // darf nicht wegkommen
pEditSource = new ScHeaderFooterEditSource(*pContentObj, nPart); pEditSource = new ScHeaderFooterEditSource(*pContentObj, nPart, pTextObj);
} }
} }
......
...@@ -109,55 +109,27 @@ SC_SIMPLE_SERVICE_INFO( ScHeaderFooterTextObj, "ScHeaderFooterTextObj", "stardiv ...@@ -109,55 +109,27 @@ SC_SIMPLE_SERVICE_INFO( ScHeaderFooterTextObj, "ScHeaderFooterTextObj", "stardiv
ScHeaderFooterContentObj::ScHeaderFooterContentObj( const EditTextObject* pLeft, ScHeaderFooterContentObj::ScHeaderFooterContentObj( const EditTextObject* pLeft,
const EditTextObject* pCenter, const EditTextObject* pCenter,
const EditTextObject* pRight ) : const EditTextObject* pRight ) :
pLeftText ( NULL ), mxLeftText(new ScHeaderFooterTextObj(*this, SC_HDFT_LEFT, pLeft)),
pCenterText ( NULL ), mxCenterText(new ScHeaderFooterTextObj(*this, SC_HDFT_CENTER, pCenter)),
pRightText ( NULL ) mxRightText(new ScHeaderFooterTextObj(*this, SC_HDFT_RIGHT, pRight))
{ {
if ( pLeft )
pLeftText = pLeft->Clone();
if ( pCenter )
pCenterText = pCenter->Clone();
if ( pRight )
pRightText = pRight->Clone();
} }
ScHeaderFooterContentObj::~ScHeaderFooterContentObj() ScHeaderFooterContentObj::~ScHeaderFooterContentObj() {}
{
delete pLeftText;
delete pCenterText;
delete pRightText;
}
void ScHeaderFooterContentObj::AddListener( SfxListener& rListener ) const EditTextObject* ScHeaderFooterContentObj::GetLeftEditObject() const
{ {
rListener.StartListening( aBC ); return mxLeftText->GetTextObject();
} }
void ScHeaderFooterContentObj::RemoveListener( SfxListener& rListener ) const EditTextObject* ScHeaderFooterContentObj::GetCenterEditObject() const
{ {
rListener.EndListening( aBC ); return mxCenterText->GetTextObject();
} }
void ScHeaderFooterContentObj::UpdateText( sal_uInt16 nPart, EditEngine& rSource ) const EditTextObject* ScHeaderFooterContentObj::GetRightEditObject() const
{ {
EditTextObject* pNew = rSource.CreateTextObject(); return mxRightText->GetTextObject();
switch (nPart)
{
case SC_HDFT_LEFT:
delete pLeftText;
pLeftText = pNew;
break;
case SC_HDFT_CENTER:
delete pCenterText;
pCenterText = pNew;
break;
default: // SC_HDFT_RIGHT
delete pRightText;
pRightText = pNew;
break;
}
aBC.Broadcast( ScHeaderFooterChangedHint( nPart ) );
} }
// XHeaderFooterContent // XHeaderFooterContent
...@@ -166,21 +138,24 @@ uno::Reference<text::XText> SAL_CALL ScHeaderFooterContentObj::getLeftText() ...@@ -166,21 +138,24 @@ uno::Reference<text::XText> SAL_CALL ScHeaderFooterContentObj::getLeftText()
throw(uno::RuntimeException) throw(uno::RuntimeException)
{ {
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
return new ScHeaderFooterTextObj( *this, SC_HDFT_LEFT ); uno::Reference<text::XText> xInt(*mxLeftText, uno::UNO_QUERY);
return xInt;
} }
uno::Reference<text::XText> SAL_CALL ScHeaderFooterContentObj::getCenterText() uno::Reference<text::XText> SAL_CALL ScHeaderFooterContentObj::getCenterText()
throw(uno::RuntimeException) throw(uno::RuntimeException)
{ {
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
return new ScHeaderFooterTextObj( *this, SC_HDFT_CENTER ); uno::Reference<text::XText> xInt(*mxCenterText, uno::UNO_QUERY);
return xInt;
} }
uno::Reference<text::XText> SAL_CALL ScHeaderFooterContentObj::getRightText() uno::Reference<text::XText> SAL_CALL ScHeaderFooterContentObj::getRightText()
throw(uno::RuntimeException) throw(uno::RuntimeException)
{ {
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
return new ScHeaderFooterTextObj( *this, SC_HDFT_RIGHT ); uno::Reference<text::XText> xInt(*mxRightText, uno::UNO_QUERY);
return xInt;
} }
// XUnoTunnel // XUnoTunnel
...@@ -220,8 +195,9 @@ ScHeaderFooterContentObj* ScHeaderFooterContentObj::getImplementation( ...@@ -220,8 +195,9 @@ ScHeaderFooterContentObj* ScHeaderFooterContentObj::getImplementation(
//------------------------------------------------------------------------ //------------------------------------------------------------------------
ScHeaderFooterTextData::ScHeaderFooterTextData( ScHeaderFooterContentObj& rContent, ScHeaderFooterTextData::ScHeaderFooterTextData(
sal_uInt16 nP ) : ScHeaderFooterContentObj& rContent, sal_uInt16 nP, const EditTextObject* pTextObj) :
mpTextObj(pTextObj ? pTextObj->Clone() : NULL),
rContentObj( rContent ), rContentObj( rContent ),
nPart( nP ), nPart( nP ),
pEditEngine( NULL ), pEditEngine( NULL ),
...@@ -229,34 +205,21 @@ ScHeaderFooterTextData::ScHeaderFooterTextData( ScHeaderFooterContentObj& rConte ...@@ -229,34 +205,21 @@ ScHeaderFooterTextData::ScHeaderFooterTextData( ScHeaderFooterContentObj& rConte
bDataValid( false ), bDataValid( false ),
bInUpdate( false ) bInUpdate( false )
{ {
if (!mpTextObj)
fprintf(stdout, "ScHeaderFooterTextData::ScHeaderFooterTextData: mpTextObj = %p\n", mpTextObj);
rContentObj.acquire(); // must not go away rContentObj.acquire(); // must not go away
rContentObj.AddListener( *this );
} }
ScHeaderFooterTextData::~ScHeaderFooterTextData() ScHeaderFooterTextData::~ScHeaderFooterTextData()
{ {
SolarMutexGuard aGuard; // needed for EditEngine dtor SolarMutexGuard aGuard; // needed for EditEngine dtor
rContentObj.RemoveListener( *this );
delete pForwarder; delete pForwarder;
delete pEditEngine; delete pEditEngine;
rContentObj.release(); rContentObj.release();
} }
void ScHeaderFooterTextData::Notify( SfxBroadcaster&, const SfxHint& rHint )
{
if ( rHint.ISA( ScHeaderFooterChangedHint ) )
{
if ( ((const ScHeaderFooterChangedHint&)rHint).GetPart() == nPart )
{
if (!bInUpdate) // not for own updates
bDataValid = false; // text has to be fetched again
}
}
}
SvxTextForwarder* ScHeaderFooterTextData::GetTextForwarder() SvxTextForwarder* ScHeaderFooterTextData::GetTextForwarder()
{ {
if (!pEditEngine) if (!pEditEngine)
...@@ -292,38 +255,42 @@ SvxTextForwarder* ScHeaderFooterTextData::GetTextForwarder() ...@@ -292,38 +255,42 @@ SvxTextForwarder* ScHeaderFooterTextData::GetTextForwarder()
if (bDataValid) if (bDataValid)
return pForwarder; return pForwarder;
const EditTextObject* pData; if (mpTextObj)
if (nPart == SC_HDFT_LEFT) pEditEngine->SetText(*mpTextObj);
pData = rContentObj.GetLeftEditObject();
else if (nPart == SC_HDFT_CENTER)
pData = rContentObj.GetCenterEditObject();
else
pData = rContentObj.GetRightEditObject();
if (pData)
pEditEngine->SetText(*pData);
bDataValid = sal_True; bDataValid = true;
return pForwarder; return pForwarder;
} }
void ScHeaderFooterTextData::UpdateData() void ScHeaderFooterTextData::UpdateData()
{ {
if ( pEditEngine ) fprintf(stdout, "ScHeaderFooterTextData::UpdateData: 1\n");
if (pEditEngine)
{ {
bInUpdate = sal_True; // don't reset bDataValid during UpdateText delete mpTextObj;
mpTextObj = pEditEngine->CreateTextObject();
bDataValid = false;
}
}
rContentObj.UpdateText( nPart, *pEditEngine ); void ScHeaderFooterTextData::UpdateData(EditEngine& rEditEngine)
{
fprintf(stdout, "ScHeaderFooterTextData::UpdateData: 2\n");
delete mpTextObj;
mpTextObj = rEditEngine.CreateTextObject();
bDataValid = false;
}
bInUpdate = false; const EditTextObject* ScHeaderFooterTextData::GetTextObject() const
} {
return mpTextObj;
} }
//------------------------------------------------------------------------ //------------------------------------------------------------------------
ScHeaderFooterTextObj::ScHeaderFooterTextObj( ScHeaderFooterContentObj& rContent, ScHeaderFooterTextObj::ScHeaderFooterTextObj(
sal_uInt16 nP ) : ScHeaderFooterContentObj& rContent, sal_uInt16 nP, const EditTextObject* pTextObj) :
aTextData( rContent, nP ), aTextData(rContent, nP, pTextObj),
pUnoText( NULL ) pUnoText( NULL )
{ {
// ScHeaderFooterTextData acquires rContent // ScHeaderFooterTextData acquires rContent
...@@ -347,6 +314,11 @@ ScHeaderFooterTextObj::~ScHeaderFooterTextObj() ...@@ -347,6 +314,11 @@ ScHeaderFooterTextObj::~ScHeaderFooterTextObj()
pUnoText->release(); pUnoText->release();
} }
const EditTextObject* ScHeaderFooterTextObj::GetTextObject() const
{
return aTextData.GetTextObject();
}
const SvxUnoText& ScHeaderFooterTextObj::GetUnoText() const SvxUnoText& ScHeaderFooterTextObj::GetUnoText()
{ {
if (!pUnoText) if (!pUnoText)
...@@ -421,10 +393,9 @@ void SAL_CALL ScHeaderFooterTextObj::setString( const rtl::OUString& aText ) thr ...@@ -421,10 +393,9 @@ void SAL_CALL ScHeaderFooterTextObj::setString( const rtl::OUString& aText ) thr
String aString(aText); String aString(aText);
// for pure text, no font info is needed in pool defaults // for pure text, no font info is needed in pool defaults
ScHeaderEditEngine aEditEngine( EditEngine::CreatePool(), sal_True ); ScHeaderEditEngine aEditEngine(EditEngine::CreatePool(), true);
aEditEngine.SetText( aString ); aEditEngine.SetText( aString );
aTextData.UpdateData(aEditEngine);
aTextData.GetContentObj().UpdateText( aTextData.GetPart(), aEditEngine );
} }
void SAL_CALL ScHeaderFooterTextObj::insertString( const uno::Reference<text::XTextRange>& xRange, void SAL_CALL ScHeaderFooterTextObj::insertString( const uno::Reference<text::XTextRange>& xRange,
...@@ -513,7 +484,7 @@ void SAL_CALL ScHeaderFooterTextObj::insertTextContent( ...@@ -513,7 +484,7 @@ void SAL_CALL ScHeaderFooterTextObj::insertTextContent(
} }
pHeaderField->InitDoc( pHeaderField->InitDoc(
xTextRange, &aTextData.GetContentObj(), aTextData.GetPart(), aSelection); xTextRange, &aTextData.GetContentObj(), aTextData.GetPart(), aTextData.GetTextObject(), aSelection);
// for bAbsorb=FALSE, the new selection must be behind the inserted content // for bAbsorb=FALSE, the new selection must be behind the inserted content
// (the xml filter relies on this) // (the xml filter relies on this)
...@@ -582,7 +553,8 @@ uno::Reference<container::XEnumerationAccess> SAL_CALL ScHeaderFooterTextObj::ge ...@@ -582,7 +553,8 @@ uno::Reference<container::XEnumerationAccess> SAL_CALL ScHeaderFooterTextObj::ge
{ {
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
// all fields // all fields
return new ScHeaderFieldsObj( &aTextData.GetContentObj(), aTextData.GetPart(), SC_SERVICE_INVALID ); return new ScHeaderFieldsObj(
&aTextData.GetContentObj(), aTextData.GetPart(), aTextData.GetTextObject(), SC_SERVICE_INVALID);
} }
uno::Reference<container::XNameAccess> SAL_CALL ScHeaderFooterTextObj::getTextFieldMasters() uno::Reference<container::XNameAccess> SAL_CALL ScHeaderFooterTextObj::getTextFieldMasters()
......
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