summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-04-23 11:14:09 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-04-26 09:57:58 -0400
commit53bd9908899db4899363d3fa729b50e3ca1a42d0 (patch)
tree391a956e472c41be03b8402e22ee0936cb83e110
parent34fe1bed19e4cf66500d7e7817eb251c42f8f439 (diff)
Initial copy and paste skeleton for the new UNO field item implementation.
-rw-r--r--sc/inc/fielduno.hxx132
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx4
-rw-r--r--sc/source/ui/unoobj/fielduno.cxx417
-rw-r--r--sc/source/ui/unoobj/servuno.cxx4
-rw-r--r--sc/source/ui/unoobj/shapeuno.cxx2
5 files changed, 538 insertions, 21 deletions
diff --git a/sc/inc/fielduno.hxx b/sc/inc/fielduno.hxx
index 153416f52aac..c9d9315a19be 100644
--- a/sc/inc/fielduno.hxx
+++ b/sc/inc/fielduno.hxx
@@ -45,11 +45,14 @@
#include <com/sun/star/util/XRefreshable.hpp>
#include <cppuhelper/component.hxx>
#include <cppuhelper/implbase5.hxx>
+#include <cppuhelper/implbase4.hxx>
#include <osl/mutex.hxx>
+#include <boost/noncopyable.hpp>
+
class SvxEditSource;
class SvxFieldItem;
-class ScCellFieldObj;
+class ScEditFieldObj;
class ScHeaderFieldObj;
class ScHeaderFooterContentObj;
class ScDocShell;
@@ -72,7 +75,9 @@ private:
/// mutex to lock the InterfaceContainerHelper
osl::Mutex aMutex;
- ScCellFieldObj* GetObjectByIndex_Impl(sal_Int32 Index) const;
+ com::sun::star::uno::Reference<
+ com::sun::star::text::XTextField>
+ GetObjectByIndex_Impl(sal_Int32 Index) const;
public:
ScCellFieldsObj(ScDocShell* pDocSh, const ScAddress& rPos);
@@ -448,6 +453,129 @@ public:
throw(::com::sun::star::uno::RuntimeException);
};
+/**
+ * Generic UNO wrapper for edit engine's field item. This will eventually
+ * replace ScCellFieldObj and ScHeaderFieldObj.
+ */
+class ScEditFieldObj : public cppu::WeakImplHelper4<
+ com::sun::star::text::XTextField,
+ com::sun::star::beans::XPropertySet,
+ com::sun::star::lang::XUnoTunnel,
+ com::sun::star::lang::XServiceInfo>,
+ public ScMutexHelper,
+ public ::cppu::OComponentHelper,
+ public SfxListener,
+ private boost::noncopyable
+{
+private:
+ const SfxItemPropertySet* pPropSet;
+ ScDocShell* pDocShell;
+ ScAddress aCellPos;
+ SvxEditSource* pEditSource;
+ ESelection aSelection;
+
+ String aUrl; // content, only iff not already inserted
+ String aRepresentation;
+ String aTarget;
+
+ ScEditFieldObj(); // disabled
+public:
+
+ static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId();
+ static ScEditFieldObj* getImplementation(const com::sun::star::uno::Reference<com::sun::star::text::XTextContent>& xObj);
+
+ ScEditFieldObj(ScDocShell* pDocSh, const ScAddress& rPos, const ESelection& rSel);
+ virtual ~ScEditFieldObj();
+
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
+
+ void DeleteField();
+ bool IsInserted() const;
+ SvxFieldItem CreateFieldItem();
+ void InitDoc(ScDocShell* pDocSh, const ScAddress& rPos, const ESelection& rSel);
+
+ // XTextField
+ virtual ::rtl::OUString SAL_CALL getPresentation( sal_Bool bShowCommand )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // XTextContent
+ virtual void SAL_CALL attach( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange >& xTextRange )
+ throw(::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL
+ getAnchor() throw(::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& xListener )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& aListener )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
+ SAL_CALL getPropertySetInfo()
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName,
+ const ::com::sun::star::uno::Any& aValue )
+ throw(::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
+ const ::rtl::OUString& PropertyName )
+ throw(::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertyChangeListener >& xListener )
+ throw(::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertyChangeListener >& aListener )
+ throw(::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XVetoableChangeListener >& aListener )
+ throw(::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XVetoableChangeListener >& aListener )
+ throw(::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence<
+ sal_Int8 >& aIdentifier )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
+ throw(::com::sun::star::uno::RuntimeException);
+};
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 80c4f45354ab..d51b81a03b16 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -6422,7 +6422,7 @@ void SAL_CALL ScCellObj::insertTextContent( const uno::Reference<text::XTextRang
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh && xContent.is() )
{
- ScCellFieldObj* pCellField = ScCellFieldObj::getImplementation( xContent );
+ ScEditFieldObj* pCellField = ScEditFieldObj::getImplementation(xContent);
SvxUnoTextRangeBase* pTextRange = ScCellTextCursor::getImplementation( xRange );
if ( pCellField && !pCellField->IsInserted() && pTextRange )
@@ -6469,7 +6469,7 @@ void SAL_CALL ScCellObj::removeTextContent( const uno::Reference<text::XTextCont
SolarMutexGuard aGuard;
if ( xContent.is() )
{
- ScCellFieldObj* pCellField = ScCellFieldObj::getImplementation( xContent );
+ ScEditFieldObj* pCellField = ScEditFieldObj::getImplementation(xContent);
if ( pCellField && pCellField->IsInserted() )
{
//! Testen, ob das Feld in dieser Zelle ist
diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx
index e088aaff2a97..8aee10bae17e 100644
--- a/sc/source/ui/unoobj/fielduno.cxx
+++ b/sc/source/ui/unoobj/fielduno.cxx
@@ -26,6 +26,17 @@
*
************************************************************************/
+#include "fielduno.hxx"
+#include "textuno.hxx"
+#include "miscuno.hxx"
+#include "docsh.hxx"
+#include "hints.hxx"
+#include "editsrc.hxx"
+#include "cellsuno.hxx"
+#include "servuno.hxx" // fuer IDs
+#include "unonames.hxx"
+#include "editutil.hxx"
+
#include <svl/smplhint.hxx>
#include <vcl/svapp.hxx>
@@ -42,17 +53,6 @@
#include <com/sun/star/text/WrapTextMode.hpp>
#include <com/sun/star/text/FilenameDisplayFormat.hpp>
-#include "fielduno.hxx"
-#include "textuno.hxx"
-#include "miscuno.hxx"
-#include "docsh.hxx"
-#include "hints.hxx"
-#include "editsrc.hxx"
-#include "cellsuno.hxx"
-#include "servuno.hxx" // fuer IDs
-#include "unonames.hxx"
-#include "editutil.hxx"
-
using namespace com::sun::star;
//------------------------------------------------------------------------
@@ -288,7 +288,7 @@ void ScCellFieldsObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
// XIndexAccess (via XTextFields)
-ScCellFieldObj* ScCellFieldsObj::GetObjectByIndex_Impl(sal_Int32 Index) const
+uno::Reference<text::XTextField> ScCellFieldsObj::GetObjectByIndex_Impl(sal_Int32 Index) const
{
//! Feld-Funktionen muessen an den Forwarder !!!
ScEditEngineDefaulter* pEditEngine = ((ScCellEditSource*)pEditSource)->GetEditEngine();
@@ -299,9 +299,11 @@ ScCellFieldObj* ScCellFieldsObj::GetObjectByIndex_Impl(sal_Int32 Index) const
sal_uInt16 nPar = aTempEngine.GetFieldPar();
xub_StrLen nPos = aTempEngine.GetFieldPos();
ESelection aSelection( nPar, nPos, nPar, nPos+1 ); // Feld ist 1 Zeichen
- return new ScCellFieldObj( pDocShell, aCellPos, aSelection );
+ uno::Reference<text::XTextField> xRet(
+ new ScEditFieldObj(pDocShell, aCellPos, aSelection));
+ return xRet;
}
- return NULL;
+ return uno::Reference<text::XTextField>();
}
sal_Int32 SAL_CALL ScCellFieldsObj::getCount() throw(uno::RuntimeException)
@@ -1492,7 +1494,394 @@ uno::Sequence<rtl::OUString> SAL_CALL ScHeaderFieldObj::getSupportedServiceNames
//------------------------------------------------------------------------
+ScEditFieldObj::ScEditFieldObj(
+ ScDocShell* pDocSh, const ScAddress& rPos, const ESelection& rSel) :
+ OComponentHelper( getMutex() ),
+ pPropSet( lcl_GetURLPropertySet() ),
+ pDocShell( pDocSh ),
+ aCellPos( rPos ),
+ aSelection( rSel )
+{
+ // pDocShell ist Null, wenn per ServiceProvider erzeugt
+
+ if (pDocShell)
+ {
+ pDocShell->GetDocument()->AddUnoObject(*this);
+ pEditSource = new ScCellEditSource( pDocShell, aCellPos );
+ }
+ else
+ pEditSource = NULL;
+}
+
+void ScEditFieldObj::InitDoc( ScDocShell* pDocSh, const ScAddress& rPos,
+ const ESelection& rSel )
+{
+ if ( pDocSh && !pEditSource )
+ {
+ aCellPos = rPos;
+ aSelection = rSel;
+ pDocShell = pDocSh;
+
+ pDocShell->GetDocument()->AddUnoObject(*this);
+ pEditSource = new ScCellEditSource( pDocShell, aCellPos );
+ }
+}
+
+ScEditFieldObj::~ScEditFieldObj()
+{
+ if (pDocShell)
+ pDocShell->GetDocument()->RemoveUnoObject(*this);
+
+ delete pEditSource;
+}
+
+void ScEditFieldObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
+{
+ //! Updates fuer aSelection (muessen erst noch erzeugt werden) !!!!!!
+
+ if ( rHint.ISA( ScUpdateRefHint ) )
+ {
+ //! Ref-Update
+ }
+ else if ( rHint.ISA( SfxSimpleHint ) &&
+ ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING )
+ {
+ pDocShell = NULL; // ungueltig geworden
+ }
+
+ // EditSource hat sich selber als Listener angemeldet
+}
+
+// per getImplementation gerufen:
+
+SvxFieldItem ScEditFieldObj::CreateFieldItem()
+{
+ OSL_ENSURE( !pEditSource, "CreateFieldItem mit eingefuegtem Feld" );
+
+ SvxURLField aField;
+ aField.SetFormat(SVXURLFORMAT_APPDEFAULT);
+ aField.SetURL( aUrl );
+ aField.SetRepresentation( aRepresentation );
+ aField.SetTargetFrame( aTarget );
+ return SvxFieldItem( aField, EE_FEATURE_FIELD );
+}
+
+void ScEditFieldObj::DeleteField()
+{
+ if (pEditSource)
+ {
+ SvxTextForwarder* pForwarder = pEditSource->GetTextForwarder();
+ pForwarder->QuickInsertText( String(), aSelection );
+ pEditSource->UpdateData();
+
+ aSelection.nEndPara = aSelection.nStartPara;
+ aSelection.nEndPos = aSelection.nStartPos;
+
+ //! Broadcast, um Selektion in anderen Objekten anzupassen
+ //! (auch bei anderen Aktionen)
+ }
+}
+
+bool ScEditFieldObj::IsInserted() const
+{
+ return pEditSource != NULL;
+}
+
+// XTextField
+
+rtl::OUString SAL_CALL ScEditFieldObj::getPresentation( sal_Bool bShowCommand )
+ throw(uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ String aRet;
+
+ if (pEditSource)
+ {
+ //! Feld-Funktionen muessen an den Forwarder !!!
+ ScEditEngineDefaulter* pEditEngine = ((ScCellEditSource*)pEditSource)->GetEditEngine();
+ ScUnoEditEngine aTempEngine(pEditEngine);
+
+ // Typ egal (in Zellen gibts nur URLs)
+ SvxFieldData* pField = aTempEngine.FindByPos( aSelection.nStartPara, aSelection.nStartPos, 0 );
+ OSL_ENSURE(pField,"getPresentation: Feld nicht gefunden");
+ if (pField)
+ {
+ SvxURLField* pURL = (SvxURLField*)pField;
+ if (bShowCommand)
+ aRet = pURL->GetURL();
+ else
+ aRet = pURL->GetRepresentation();
+ }
+ }
+
+ return aRet;
+}
+
+// XTextContent
+
+void SAL_CALL ScEditFieldObj::attach( const uno::Reference<text::XTextRange>& xTextRange )
+ throw(lang::IllegalArgumentException, uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ if (xTextRange.is())
+ {
+ uno::Reference<text::XText> xText(xTextRange->getText());
+ if (xText.is())
+ {
+ xText->insertTextContent( xTextRange, this, sal_True );
+ }
+ }
+}
+
+uno::Reference<text::XTextRange> SAL_CALL ScEditFieldObj::getAnchor() throw(uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ if (pDocShell)
+ return new ScCellObj( pDocShell, aCellPos );
+ return NULL;
+}
+
+// XComponent
+
+void SAL_CALL ScEditFieldObj::dispose() throw(uno::RuntimeException)
+{
+ OComponentHelper::dispose();
+}
+
+void SAL_CALL ScEditFieldObj::addEventListener(
+ const uno::Reference<lang::XEventListener>& xListener )
+ throw(uno::RuntimeException)
+{
+ OComponentHelper::addEventListener( xListener );
+}
+
+void SAL_CALL ScEditFieldObj::removeEventListener(
+ const uno::Reference<lang::XEventListener>& xListener )
+ throw(uno::RuntimeException)
+{
+ OComponentHelper::removeEventListener( xListener );
+}
+
+// XPropertySet
+
+uno::Reference<beans::XPropertySetInfo> SAL_CALL ScEditFieldObj::getPropertySetInfo()
+ throw(uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ static uno::Reference<beans::XPropertySetInfo> aRef = pPropSet->getPropertySetInfo();
+ return aRef;
+}
+
+void SAL_CALL ScEditFieldObj::setPropertyValue(
+ const rtl::OUString& aPropertyName, const uno::Any& aValue )
+ throw(beans::UnknownPropertyException, beans::PropertyVetoException,
+ lang::IllegalArgumentException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ String aNameString(aPropertyName);
+ rtl::OUString aStrVal;
+ if (pEditSource)
+ {
+ //! Feld-Funktionen muessen an den Forwarder !!!
+ ScEditEngineDefaulter* pEditEngine = ((ScCellEditSource*)pEditSource)->GetEditEngine();
+ ScUnoEditEngine aTempEngine(pEditEngine);
+
+ // Typ egal (in Zellen gibts nur URLs)
+ SvxFieldData* pField = aTempEngine.FindByPos( aSelection.nStartPara, aSelection.nStartPos, 0 );
+ OSL_ENSURE(pField,"setPropertyValue: Feld nicht gefunden");
+ if (pField)
+ {
+ SvxURLField* pURL = (SvxURLField*)pField; // ist eine Kopie in der ScUnoEditEngine
+
+ sal_Bool bOk = sal_True;
+ if ( aNameString.EqualsAscii( SC_UNONAME_URL ) )
+ {
+ if (aValue >>= aStrVal)
+ pURL->SetURL( aStrVal );
+ }
+ else if ( aNameString.EqualsAscii( SC_UNONAME_REPR ) )
+ {
+ if (aValue >>= aStrVal)
+ pURL->SetRepresentation( aStrVal );
+ }
+ else if ( aNameString.EqualsAscii( SC_UNONAME_TARGET ) )
+ {
+ if (aValue >>= aStrVal)
+ pURL->SetTargetFrame( aStrVal );
+ }
+ else
+ bOk = false;
+
+ if (bOk)
+ {
+ pEditEngine->QuickInsertField( SvxFieldItem(*pField, EE_FEATURE_FIELD), aSelection );
+ pEditSource->UpdateData();
+ }
+ }
+ }
+ else // noch nicht eingefuegt
+ {
+ if ( aNameString.EqualsAscii( SC_UNONAME_URL ) )
+ {
+ if (aValue >>= aStrVal)
+ aUrl = String( aStrVal );
+ }
+ else if ( aNameString.EqualsAscii( SC_UNONAME_REPR ) )
+ {
+ if (aValue >>= aStrVal)
+ aRepresentation = String( aStrVal );
+ }
+ else if ( aNameString.EqualsAscii( SC_UNONAME_TARGET ) )
+ {
+ if (aValue >>= aStrVal)
+ aTarget = String( aStrVal );
+ }
+ }
+}
+
+uno::Any SAL_CALL ScEditFieldObj::getPropertyValue( const rtl::OUString& aPropertyName )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ uno::Any aRet;
+ String aNameString(aPropertyName);
+ // anchor type is always "as character", text wrap always "none"
+ if ( aNameString.EqualsAscii( SC_UNONAME_ANCTYPE ) )
+ aRet <<= text::TextContentAnchorType_AS_CHARACTER;
+ else if ( aNameString.EqualsAscii( SC_UNONAME_ANCTYPES ) )
+ {
+ uno::Sequence<text::TextContentAnchorType> aSeq(1);
+ aSeq[0] = text::TextContentAnchorType_AS_CHARACTER;
+ aRet <<= aSeq;
+ }
+ else if ( aNameString.EqualsAscii( SC_UNONAME_TEXTWRAP ) )
+ aRet <<= text::WrapTextMode_NONE;
+ else if (pEditSource)
+ {
+ //! Feld-Funktionen muessen an den Forwarder !!!
+ ScEditEngineDefaulter* pEditEngine = ((ScCellEditSource*)pEditSource)->GetEditEngine();
+ ScUnoEditEngine aTempEngine(pEditEngine);
+
+ // Typ egal (in Zellen gibts nur URLs)
+ SvxFieldData* pField = aTempEngine.FindByPos( aSelection.nStartPara, aSelection.nStartPos, 0 );
+ OSL_ENSURE(pField,"getPropertyValue: Feld nicht gefunden");
+ if (pField)
+ {
+ SvxURLField* pURL = (SvxURLField*)pField;
+
+ if ( aNameString.EqualsAscii( SC_UNONAME_URL ) )
+ aRet <<= rtl::OUString( pURL->GetURL() );
+ else if ( aNameString.EqualsAscii( SC_UNONAME_REPR ) )
+ aRet <<= rtl::OUString( pURL->GetRepresentation() );
+ else if ( aNameString.EqualsAscii( SC_UNONAME_TARGET ) )
+ aRet <<= rtl::OUString( pURL->GetTargetFrame() );
+ }
+ }
+ else // noch nicht eingefuegt
+ {
+ if ( aNameString.EqualsAscii( SC_UNONAME_URL ) )
+ aRet <<= rtl::OUString( aUrl );
+ else if ( aNameString.EqualsAscii( SC_UNONAME_REPR ) )
+ aRet <<= rtl::OUString( aRepresentation );
+ else if ( aNameString.EqualsAscii( SC_UNONAME_TARGET ) )
+ aRet <<= rtl::OUString( aTarget );
+ }
+ return aRet;
+}
+
+SC_IMPL_DUMMY_PROPERTY_LISTENER( ScEditFieldObj )
+
+// XUnoTunnel
+
+sal_Int64 SAL_CALL ScEditFieldObj::getSomething(
+ const uno::Sequence<sal_Int8 >& rId ) throw(uno::RuntimeException)
+{
+ if ( rId.getLength() == 16 &&
+ 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
+ }
+ return 0;
+}
+
+namespace
+{
+ class theScEditFieldObjUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScEditFieldObjUnoTunnelId> {};
+}
+
+const uno::Sequence<sal_Int8>& ScEditFieldObj::getUnoTunnelId()
+{
+ return theScCellFieldObjUnoTunnelId::get().getSeq();
+}
+
+ScEditFieldObj* ScEditFieldObj::getImplementation(const uno::Reference<text::XTextContent>& xObj)
+{
+ ScEditFieldObj* pRet = NULL;
+ uno::Reference<lang::XUnoTunnel> xUT( xObj, uno::UNO_QUERY );
+ if (xUT.is())
+ pRet = reinterpret_cast<ScEditFieldObj*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId())));
+ return pRet;
+}
+
+// XServiceInfo
+
+rtl::OUString SAL_CALL ScEditFieldObj::getImplementationName() throw(uno::RuntimeException)
+{
+ return rtl::OUString("ScEditFieldObj");
+}
+
+sal_Bool SAL_CALL ScEditFieldObj::supportsService( const rtl::OUString& rServiceName )
+ throw(uno::RuntimeException)
+{
+ return rServiceName == SCTEXTFIELD_SERVICE || rServiceName == SCTEXTCONTENT_SERVICE;
+}
+
+uno::Sequence<rtl::OUString> SAL_CALL ScEditFieldObj::getSupportedServiceNames()
+ throw(uno::RuntimeException)
+{
+ uno::Sequence<rtl::OUString> aRet(2);
+ rtl::OUString* pArray = aRet.getArray();
+ pArray[0] = SCTEXTFIELD_SERVICE;
+ pArray[1] = SCTEXTCONTENT_SERVICE;
+ return aRet;
+}
+
+uno::Sequence<uno::Type> SAL_CALL ScEditFieldObj::getTypes() throw(uno::RuntimeException)
+{
+ static uno::Sequence<uno::Type> aTypes;
+ if ( aTypes.getLength() == 0 )
+ {
+ uno::Sequence<uno::Type> aParentTypes(OComponentHelper::getTypes());
+ long nParentLen = aParentTypes.getLength();
+ const uno::Type* pParentPtr = aParentTypes.getConstArray();
+
+ aTypes.realloc( nParentLen + 4 );
+ uno::Type* pPtr = aTypes.getArray();
+ pPtr[nParentLen + 0] = getCppuType((const uno::Reference<text::XTextField>*)0);
+ pPtr[nParentLen + 1] = getCppuType((const uno::Reference<beans::XPropertySet>*)0);
+ pPtr[nParentLen + 2] = getCppuType((const uno::Reference<lang::XUnoTunnel>*)0);
+ pPtr[nParentLen + 3] = getCppuType((const uno::Reference<lang::XServiceInfo>*)0);
+
+ for (long i=0; i<nParentLen; i++)
+ pPtr[i] = pParentPtr[i]; // parent types first
+ }
+ return aTypes;
+}
+
+namespace
+{
+ class theScEditFieldObjImplementationId : public rtl::Static<UnoTunnelIdInit, theScEditFieldObjImplementationId> {};
+}
+
+uno::Sequence<sal_Int8> SAL_CALL ScEditFieldObj::getImplementationId()
+ throw(uno::RuntimeException)
+{
+ return theScEditFieldObjImplementationId::get().getSeq();
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/unoobj/servuno.cxx b/sc/source/ui/unoobj/servuno.cxx
index c9efac0da942..623df8de74f9 100644
--- a/sc/source/ui/unoobj/servuno.cxx
+++ b/sc/source/ui/unoobj/servuno.cxx
@@ -429,8 +429,8 @@ uno::Reference<uno::XInterface> ScServiceProvider::MakeInstance(
xRet.set((sheet::XSpreadsheet*)new ScTableSheetObj(NULL,0));
break;
case SC_SERVICE_URLFIELD:
- xRet.set((text::XTextField*)new ScCellFieldObj( NULL, ScAddress(), ESelection() ));
- break;
+ xRet.set(static_cast<text::XTextField*>(new ScEditFieldObj(NULL, ScAddress(), ESelection())));
+ break;
case SC_SERVICE_PAGEFIELD:
case SC_SERVICE_PAGESFIELD:
case SC_SERVICE_DATEFIELD:
diff --git a/sc/source/ui/unoobj/shapeuno.cxx b/sc/source/ui/unoobj/shapeuno.cxx
index 167449ffb6ea..f5e53ceeee1f 100644
--- a/sc/source/ui/unoobj/shapeuno.cxx
+++ b/sc/source/ui/unoobj/shapeuno.cxx
@@ -1124,7 +1124,7 @@ void SAL_CALL ScShapeObj::insertTextContent( const uno::Reference<text::XTextRan
uno::Reference<text::XTextContent> xEffContent;
- ScCellFieldObj* pCellField = ScCellFieldObj::getImplementation( xContent );
+ ScEditFieldObj* pCellField = ScEditFieldObj::getImplementation( xContent );
if ( pCellField )
{
// createInstance("TextField.URL") from the document creates a ScCellFieldObj.