[Libreoffice-commits] .: 10 commits - editeng/inc editeng/source offapi/com offapi/UnoApi_offapi.mk sc/inc sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Tue May 8 11:23:03 PDT 2012


 editeng/inc/editeng/flditem.hxx                 |   22 +
 editeng/inc/editeng/unofield.hxx                |    1 
 editeng/inc/editeng/unonames.hxx                |   62 ++++
 editeng/source/items/flditem.cxx                |  183 ++++++++++++
 editeng/source/uno/unofield.cxx                 |  347 ++----------------------
 editeng/source/uno/unotext.cxx                  |   89 ++++--
 offapi/UnoApi_offapi.mk                         |    2 
 offapi/com/sun/star/text/TextPosition.idl       |   45 +++
 offapi/com/sun/star/text/TextRangeSelection.idl |   47 +++
 sc/inc/fielduno.hxx                             |    8 
 sc/inc/unonames.hxx                             |    4 
 sc/source/ui/unoobj/cellsuno.cxx                |    2 
 sc/source/ui/unoobj/fielduno.cxx                |   73 ++++-
 sc/source/ui/unoobj/notesuno.cxx                |   12 
 14 files changed, 527 insertions(+), 370 deletions(-)

New commits:
commit aceff35230dab8d22a5fdd4cd9a7a982b9754fa2
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Tue May 8 12:55:14 2012 -0400

    A little more cleanup; translation of field IDs are no longer needed.
    
    Change-Id: I85364368d2ffca717b38d17c3396f53699001a3f

diff --git a/editeng/inc/editeng/flditem.hxx b/editeng/inc/editeng/flditem.hxx
index 46ddc34..03a2cac 100644
--- a/editeng/inc/editeng/flditem.hxx
+++ b/editeng/inc/editeng/flditem.hxx
@@ -53,9 +53,11 @@ class MetaAction;
 class EDITENG_DLLPUBLIC SvxFieldData : public SvPersistBase
 {
 public:
+    static const sal_Int32 UNKNOWN_FIELD;
+
     static SvxFieldData* Create(const com::sun::star::uno::Reference<com::sun::star::text::XTextContent>& xContent);
 
-    SV_DECL_PERSIST1( SvxFieldData, SvPersistBase, -1 )
+    SV_DECL_PERSIST1( SvxFieldData, SvPersistBase, UNKNOWN_FIELD)
 
                             SvxFieldData();
     virtual                 ~SvxFieldData();
diff --git a/editeng/inc/editeng/unofield.hxx b/editeng/inc/editeng/unofield.hxx
index 0be97f8..39cf2e6 100644
--- a/editeng/inc/editeng/unofield.hxx
+++ b/editeng/inc/editeng/unofield.hxx
@@ -71,7 +71,6 @@ public:
     virtual ~SvxUnoTextField() throw();
 
     // Internal
-    virtual sal_Int32 GetFieldId( const SvxFieldData* pFieldData ) const throw();
     SvxFieldData* CreateFieldData() const throw();
     void SetAnchor( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xAnchor ) { mxAnchor = xAnchor; }
 
diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx
index 36ba686..0290ad4 100644
--- a/editeng/source/items/flditem.cxx
+++ b/editeng/source/items/flditem.cxx
@@ -49,6 +49,8 @@ using namespace com::sun::star;
 #define FRAME_MARKER    (sal_uInt32)0x21981357
 #define CHARSET_MARKER  (FRAME_MARKER+1)
 
+const sal_Int32 SvxFieldData::UNKNOWN_FIELD = -1;
+
 SvxFieldData* SvxFieldData::Create(const uno::Reference<text::XTextContent>& xTextContent)
 {
     uno::Reference<beans::XPropertySet> xPropSet(xTextContent, uno::UNO_QUERY);
diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx
index a74ffe9..4f4bb69 100644
--- a/editeng/source/uno/unofield.cxx
+++ b/editeng/source/uno/unofield.cxx
@@ -61,8 +61,6 @@ using namespace ::com::sun::star;
 #define WID_STRING2 6
 #define WID_STRING3 7
 
-const sal_Int32 UNKNOWN_FIELD = -1;
-
 inline bool isValidFieldId(sal_Int32 nId)
 {
     return nId >= 0;
@@ -315,7 +313,7 @@ SvxUnoTextField::SvxUnoTextField( uno::Reference< text::XTextRange > xAnchor, co
 :   OComponentHelper( getMutex() )
 ,   mxAnchor( xAnchor )
 ,   mpPropSet(NULL)
-,   mnServiceId(UNKNOWN_FIELD)
+,   mnServiceId(SvxFieldData::UNKNOWN_FIELD)
 ,   mpImpl( new SvxUnoFieldData_Impl )
 {
     DBG_ASSERT(pData, "pFieldData == NULL! [CL]" );
@@ -324,9 +322,9 @@ SvxUnoTextField::SvxUnoTextField( uno::Reference< text::XTextRange > xAnchor, co
 
     if(pData)
     {
-        mnServiceId = GetFieldId(pData);
-        DBG_ASSERT(mnServiceId != UNKNOWN_FIELD, "unknown SvxFieldData! [CL]");
-        if(mnServiceId != UNKNOWN_FIELD)
+        mnServiceId = pData->GetClassId();
+        DBG_ASSERT(mnServiceId != SvxFieldData::UNKNOWN_FIELD, "unknown SvxFieldData! [CL]");
+        if (mnServiceId != SvxFieldData::UNKNOWN_FIELD)
         {
             // extract field properties from data class
             switch( mnServiceId )
@@ -781,40 +779,6 @@ void SvxUnoTextField::disposing()
     // nothing to do
 }
 
-sal_Int32 SvxUnoTextField::GetFieldId( const SvxFieldData* pFieldData ) const throw()
-{
-    if( pFieldData->ISA( SvxURLField ) )
-        return text::textfield::Type::URL;
-    else if( pFieldData->ISA( SvxPageField ) )
-        return text::textfield::Type::PAGE;
-    else if( pFieldData->ISA( SvxPagesField ) )
-        return text::textfield::Type::PAGES;
-    else if( pFieldData->ISA( SvxTimeField )    )
-        return text::textfield::Type::TIME;
-    else if( pFieldData->ISA( SvxFileField )    )
-        return text::textfield::Type::FILE;
-    else if( pFieldData->ISA( SvxTableField ) )
-        return text::textfield::Type::TABLE;
-    else if( pFieldData->ISA( SvxExtTimeField ) )
-        return text::textfield::Type::EXTENDED_TIME;
-    else if( pFieldData->ISA( SvxExtFileField ) )
-        return text::textfield::Type::EXTENDED_FILE;
-    else if( pFieldData->ISA( SvxAuthorField ) )
-        return text::textfield::Type::AUTHOR;
-    else if( pFieldData->ISA( SvxDateField ) )
-        return text::textfield::Type::EXTENDED_DATE;
-    else if( pFieldData->ISA( SdrMeasureField ) )
-        return text::textfield::Type::MEASURE;
-    else if( pFieldData->ISA( SvxHeaderField ) )
-        return text::textfield::Type::HEADER;
-    else if( pFieldData->ISA( SvxFooterField ) )
-        return text::textfield::Type::FOOTER;
-    else if( pFieldData->ISA( SvxDateTimeField ) )
-        return text::textfield::Type::DATE_TIME;
-
-    return UNKNOWN_FIELD;
-}
-
 // lang::XServiceInfo
 OUString SAL_CALL SvxUnoTextField::getImplementationName() throw(uno::RuntimeException)
 {
@@ -892,7 +856,7 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoTextCreateTextField( const ::rt
     {
         OUString aFieldType( ServiceSpecifier.copy( aTextFieldPrexit.getLength() ) );
 
-        sal_Int32 nId = UNKNOWN_FIELD;
+        sal_Int32 nId = SvxFieldData::UNKNOWN_FIELD;
 
         if ( aFieldType == "DateTime" )
         {
@@ -934,7 +898,7 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoTextCreateTextField( const ::rt
             nId = text::textfield::Type::MEASURE;
         }
 
-        if (nId != UNKNOWN_FIELD)
+        if (nId != SvxFieldData::UNKNOWN_FIELD)
             xRet = (::cppu::OWeakObject * )new SvxUnoTextField( nId );
     }
 
commit c5af59331a7ce7beac38c7d95d03decd0eb75db0
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Tue May 8 12:19:43 2012 -0400

    Remove the evil hack.
    
    Change-Id: I4b560e276bd0026e90e8a27238fe3f588cf91e55

diff --git a/sc/source/ui/unoobj/notesuno.cxx b/sc/source/ui/unoobj/notesuno.cxx
index f94e812..924d9b0 100644
--- a/sc/source/ui/unoobj/notesuno.cxx
+++ b/sc/source/ui/unoobj/notesuno.cxx
@@ -391,20 +391,7 @@ void SAL_CALL ScAnnotationShapeObj::insertTextContent( const uno::Reference< tex
                                         uno::RuntimeException)
 {
     SolarMutexGuard aGuard;
-#if 1
     GetUnoText().insertTextContent(xRange, xContent, bAbsorb);
-#else
-    // Evil hack to convert a ScEditFieldObj based text field into a
-    // SvxUnoTextField based one.  See SvxUnoTextBase::insertTextContent() for
-    // the reason why.  We need a clean solution for this.
-
-    ScEditFieldObj* pField = ScEditFieldObj::getImplementation(xContent);
-    uno::Reference<text::XTextContent> xContent2 = xContent;
-    if (pField)
-        xContent2.set(new SvxUnoTextField(pField->GetFieldType()));
-
-    GetUnoText().insertTextContent(xRange, xContent2, bAbsorb);
-#endif
 }
 
 void SAL_CALL ScAnnotationShapeObj::removeTextContent( const uno::Reference< text::XTextContent >& xContent )
commit abc8bfb51ade3cf9e1506fe7386ae5afab5e92f1
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Tue May 8 12:09:02 2012 -0400

    Use defined UNO property names instead of hard-coded values.
    
    Change-Id: I56801d8ce1a9bb6f8f9faebdf15ce831b7e9ea3d

diff --git a/editeng/inc/editeng/unonames.hxx b/editeng/inc/editeng/unonames.hxx
index d8a6f32..9db7745 100644
--- a/editeng/inc/editeng/unonames.hxx
+++ b/editeng/inc/editeng/unonames.hxx
@@ -40,7 +40,7 @@
 // URL
 #define UNO_TC_PROP_URL_FORMAT         "Format"
 #define UNO_TC_PROP_URL_REPRESENTATION "Representation"
-#define UNO_TC_PROP_URL_TARGET         "Target"
+#define UNO_TC_PROP_URL_TARGET         "TargetFrame"
 #define UNO_TC_PROP_URL                "URL"
 
 // Table
diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx
index 0d1c139..a74ffe9 100644
--- a/editeng/source/uno/unofield.cxx
+++ b/editeng/source/uno/unofield.cxx
@@ -87,17 +87,17 @@ const SfxItemPropertySet* ImplGetFieldItemPropertySet( sal_Int32 mnId )
 {
     static SfxItemPropertyMapEntry aExDateTimeFieldPropertyMap_Impl[] =
     {
-        { MAP_CHAR_LEN("DateTime"),         WID_DATE,       &::getCppuType((const util::DateTime*)0),       0, 0 },
-        { MAP_CHAR_LEN("IsFixed"),          WID_BOOL1,      &::getBooleanCppuType(),                0, 0 },
-        { MAP_CHAR_LEN("IsDate"),           WID_BOOL2,      &::getBooleanCppuType(),                0, 0 },
-        { MAP_CHAR_LEN("NumberFormat"),     WID_INT32,      &::getCppuType((const sal_Int32*)0),    0, 0 },
+        { MAP_CHAR_LEN(UNO_TC_PROP_DATE_TIME), WID_DATE,  &::getCppuType((const util::DateTime*)0), 0, 0 },
+        { MAP_CHAR_LEN(UNO_TC_PROP_IS_FIXED),  WID_BOOL1, &::getBooleanCppuType(),                  0, 0 },
+        { MAP_CHAR_LEN(UNO_TC_PROP_IS_DATE),   WID_BOOL2, &::getBooleanCppuType(),                  0, 0 },
+        { MAP_CHAR_LEN(UNO_TC_PROP_NUMFORMAT), WID_INT32, &::getCppuType((const sal_Int32*)0),      0, 0 },
         {0,0,0,0,0,0}
     };
     static SfxItemPropertySet aExDateTimeFieldPropertySet_Impl(aExDateTimeFieldPropertyMap_Impl);
 
     static SfxItemPropertyMapEntry aDateTimeFieldPropertyMap_Impl[] =
     {
-        { MAP_CHAR_LEN("IsDate"),           WID_BOOL2,      &::getBooleanCppuType(),                0, 0 },
+        { MAP_CHAR_LEN(UNO_TC_PROP_IS_DATE), WID_BOOL2, &::getBooleanCppuType(), 0, 0 },
         {0,0,0,0,0,0}
     };
     static SfxItemPropertySet aDateTimeFieldPropertySet_Impl(aDateTimeFieldPropertyMap_Impl);
@@ -105,10 +105,10 @@ const SfxItemPropertySet* ImplGetFieldItemPropertySet( sal_Int32 mnId )
     static SfxItemPropertyMapEntry aUrlFieldPropertyMap_Impl[] =
     {
 
-        { MAP_CHAR_LEN("Format"),           WID_INT16,      &::getCppuType((const sal_Int16*)0),    0, 0 },
-        { MAP_CHAR_LEN("Representation"),   WID_STRING1,    &::getCppuType((const OUString*)0),     0, 0 },
-        { MAP_CHAR_LEN("TargetFrame"),      WID_STRING2,    &::getCppuType((const OUString*)0),     0, 0 },
-        { MAP_CHAR_LEN("URL"),              WID_STRING3,    &::getCppuType((const OUString*)0),     0, 0 },
+        { MAP_CHAR_LEN(UNO_TC_PROP_URL_FORMAT),         WID_INT16,   &::getCppuType((const sal_Int16*)0), 0, 0 },
+        { MAP_CHAR_LEN(UNO_TC_PROP_URL_REPRESENTATION), WID_STRING1, &::getCppuType((const OUString*)0),  0, 0 },
+        { MAP_CHAR_LEN(UNO_TC_PROP_URL_TARGET),         WID_STRING2, &::getCppuType((const OUString*)0),  0, 0 },
+        { MAP_CHAR_LEN(UNO_TC_PROP_URL),                WID_STRING3, &::getCppuType((const OUString*)0),  0, 0 },
         {0,0,0,0,0,0}
     };
     static SfxItemPropertySet aUrlFieldPropertySet_Impl(aUrlFieldPropertyMap_Impl);
@@ -121,27 +121,27 @@ const SfxItemPropertySet* ImplGetFieldItemPropertySet( sal_Int32 mnId )
 
     static SfxItemPropertyMapEntry aExtFileFieldPropertyMap_Impl[] =
     {
-        { MAP_CHAR_LEN("IsFixed"),              WID_BOOL1,  &::getBooleanCppuType(),                0, 0 },
-        { MAP_CHAR_LEN("FileFormat"),           WID_INT16,  &::getCppuType((const sal_Int16*)0),    0, 0 },
-        { MAP_CHAR_LEN("CurrentPresentation"),  WID_STRING1,&::getCppuType((const OUString*)0),     0, 0 },
+        { MAP_CHAR_LEN(UNO_TC_PROP_IS_FIXED),             WID_BOOL1,   &::getBooleanCppuType(),             0, 0 },
+        { MAP_CHAR_LEN(UNO_TC_PROP_FILE_FORMAT),          WID_INT16,   &::getCppuType((const sal_Int16*)0), 0, 0 },
+        { MAP_CHAR_LEN(UNO_TC_PROP_CURRENT_PRESENTATION), WID_STRING1, &::getCppuType((const OUString*)0),  0, 0 },
         {0,0,0,0,0,0}
     };
     static SfxItemPropertySet aExtFileFieldPropertySet_Impl(aExtFileFieldPropertyMap_Impl);
 
     static SfxItemPropertyMapEntry aAuthorFieldPropertyMap_Impl[] =
     {
-        { MAP_CHAR_LEN("IsFixed"),              WID_BOOL1,  &::getBooleanCppuType(),                0, 0 },
-        { MAP_CHAR_LEN("CurrentPresentation"),  WID_STRING1,&::getCppuType((const OUString*)0),     0, 0 },
-        { MAP_CHAR_LEN("Content"),              WID_STRING2,&::getCppuType((const OUString*)0),     0, 0 },
-        { MAP_CHAR_LEN("AuthorFormat"),         WID_INT16,  &::getCppuType((const sal_Int16*)0),    0, 0 },
-        { MAP_CHAR_LEN("FullName"),             WID_BOOL2,  &::getBooleanCppuType(),                0, 0 },
+        { MAP_CHAR_LEN(UNO_TC_PROP_IS_FIXED),             WID_BOOL1,  &::getBooleanCppuType(),             0, 0 },
+        { MAP_CHAR_LEN(UNO_TC_PROP_CURRENT_PRESENTATION), WID_STRING1,&::getCppuType((const OUString*)0),  0, 0 },
+        { MAP_CHAR_LEN(UNO_TC_PROP_AUTHOR_CONTENT),       WID_STRING2,&::getCppuType((const OUString*)0),  0, 0 },
+        { MAP_CHAR_LEN(UNO_TC_PROP_AUTHOR_FORMAT),        WID_INT16,  &::getCppuType((const sal_Int16*)0), 0, 0 },
+        { MAP_CHAR_LEN(UNO_TC_PROP_AUTHOR_FULLNAME),      WID_BOOL2,  &::getBooleanCppuType(),             0, 0 },
         {0,0,0,0,0,0}
     };
     static SfxItemPropertySet aAuthorFieldPropertySet_Impl(aAuthorFieldPropertyMap_Impl);
 
     static SfxItemPropertyMapEntry aMeasureFieldPropertyMap_Impl[] =
     {
-        { MAP_CHAR_LEN("Kind"),                 WID_INT16,  &::getCppuType((const sal_Int16*)0),    0, 0 },
+        { MAP_CHAR_LEN(UNO_TC_PROP_MEASURE_KIND), WID_INT16,  &::getCppuType((const sal_Int16*)0), 0, 0 },
         {0,0,0,0,0,0}
     };
     static SfxItemPropertySet aMeasureFieldPropertySet_Impl(aMeasureFieldPropertyMap_Impl);
commit ca98e2abb860d135517c44a2d2195a99290ff8e2
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Tue May 8 11:59:43 2012 -0400

    Removed commented out code blocks.
    
    Change-Id: I7e5d0abbf209fd975a1f886b2588b51e05cf35e7

diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx
index 5333ac3..0d1c139 100644
--- a/editeng/source/uno/unofield.cxx
+++ b/editeng/source/uno/unofield.cxx
@@ -720,125 +720,6 @@ void SAL_CALL SvxUnoTextField::setPropertyValue( const OUString& aPropertyName,
     }
 
     throw lang::IllegalArgumentException();
-
-/*
-    case WID_FORMAT:
-        {
-        sal_Int32 nFormat;
-
-        switch( mnId )
-        {
-        case text::textfield::Type::DATE:
-        {
-            SvxDateField* pDate = PTR_CAST( SvxDateField, aFieldItem.GetField() );
-            if(pDate)
-                pDate->SetFormat( (SvxDateFormat)nFormat );
-            break;
-        }
-        case text::textfield::Type::URL:
-        {
-            SvxURLField* pURL = PTR_CAST( SvxURLField, aFieldItem.GetField() );
-            if(pURL)
-                pURL->SetFormat( (SvxURLFormat)nFormat );
-            break;
-        }
-        case text::textfield::Type::EXTENDED_TIME:
-        {
-            SvxExtTimeField* pTime = PTR_CAST( SvxExtTimeField, aFieldItem.GetField() );
-            if(pTime)
-                pTime->SetFormat( (SvxTimeFormat)nFormat );
-            break;
-        }
-        case text::textfield::Type::EXTENDED_FILE:
-        {
-            SvxExtFileField* pFile = PTR_CAST( SvxExtFileField, aFieldItem.GetField() );
-            if(pFile)
-                pFile->SetFormat( (SvxFileFormat)nFormat );
-            break;
-        }
-        case text::textfield::Type::AUTHOR:
-        {
-            SvxAuthorField* pAuthor = PTR_CAST( SvxAuthorField, aFieldItem.GetField() );
-            if(pAuthor)
-                pAuthor->SetFormat( (SvxAuthorFormat)nFormat );
-            break;
-        }
-        default:
-            throw beans::UnknownPropertyException();
-        }
-        }
-        break;
-    case WID_FIX:
-        {
-        if( aValue.hasValue() || aValue.getValueType() != ::getCppuBooleanType() )
-            throw lang::IllegalArgumentException();
-        sal_Bool bFix( *(sal_Bool*)aValue.getValue() );
-        switch( mnId )
-        {
-        case text::textfield::Type::EXTENDED_TIME:
-        {
-            SvxExtTimeField* pTime = PTR_CAST( SvxExtTimeField, aFieldItem.GetField() );
-            if(pTime)
-                pTime->SetType( (SvxTimeType)bFix?SVXTIMETYPE_FIX:SVXTIMETYPE_VAR );
-            break;
-        }
-        case text::textfield::Type::DATE:
-        {
-            SvxDateField* pDate = PTR_CAST( SvxDateField, aFieldItem.GetField() );
-            if(pDate)
-                pDate->SetType( (SvxDateType)bFix?SVXDATETYPE_FIX:SVXDATETYPE_VAR );
-            break;
-        }
-        case text::textfield::Type::EXTENDED_FILE:
-        {
-            SvxExtFileField* pFile = PTR_CAST( SvxExtFileField, aFieldItem.GetField() );
-            if(pFile)
-                pFile->SetType( (SvxFileType)bFix?SVXFILETYPE_FIX:SVXFILETYPE_VAR );
-            break;
-        }
-        case text::textfield::Type::AUTHOR:
-        {
-            SvxAuthorField* pAuthor = PTR_CAST( SvxAuthorField, aFieldItem.GetField() );
-            if(pAuthor)
-                pAuthor->SetType( (SvxAuthorType)bFix?SVXAUTHORTYPE_FIX:SVXAUTHORTYPE_VAR );
-            break;
-        }
-        default:
-            throw beans::UnknownPropertyException();
-        }
-        }
-        break;
-    case WID_PRES:
-    case WID_URL:
-    case WID_TARGET:
-    {
-        SvxURLField* pURL = PTR_CAST( SvxURLField, aFieldItem.GetField() );
-        if(pURL)
-        {
-            OUString aUnoStr;
-            if(!(aValue >>= aUnoStr))
-                throw lang::IllegalArgumentException();
-
-            switch( pMap->nWID )
-            {
-            case WID_PRES:
-                pURL->SetRepresentation( aUnoStr );
-                break;
-            case WID_URL:
-                pURL->SetURL( aUnoStr );
-                break;
-            case WID_TARGET:
-                pURL->SetTargetFrame( aUnoStr );
-                break;
-            }
-        }
-        break;
-    }
-    }
-
-    SfxItemSet aSet = pForwarder->GetAttribs( GetSelection() );
-    aSet.Put( aFieldItem );
-*/
 }
 
 uno::Any SAL_CALL SvxUnoTextField::getPropertyValue( const OUString& PropertyName )
@@ -887,136 +768,6 @@ uno::Any SAL_CALL SvxUnoTextField::getPropertyValue( const OUString& PropertyNam
     }
 
     return aValue;
-
-/*
-    switch(pMap->nWID)
-    {
-    case WID_FORMAT:
-        switch( mnId )
-        {
-        case text::textfield::Type::DATE:
-        {
-            SvxDateField* pDate = PTR_CAST( SvxDateField, pFieldItem->GetField() );
-            if(pDate)
-                aValue <<= (sal_Int32)pDate->GetFormat();
-            break;
-        }
-        case text::textfield::Type::URL:
-        {
-            SvxURLField* pURL = PTR_CAST( SvxURLField, pFieldItem->GetField() );
-            if(pURL)
-                aValue <<= (sal_Int32)pURL->GetFormat();
-            break;
-        }
-        case text::textfield::Type::EXTENDED_TIME:
-        {
-            SvxExtTimeField* pTime = PTR_CAST( SvxExtTimeField, pFieldItem->GetField() );
-            if(pTime)
-                aValue <<= (sal_Int32)pTime->GetFormat();
-            break;
-        }
-        case text::textfield::Type::EXTENDED_FILE:
-        {
-            SvxExtFileField* pFile = PTR_CAST( SvxExtFileField, pFieldItem->GetField() );
-            if(pFile)
-                aValue <<= (sal_Int32)pFile->GetFormat();
-            break;
-        }
-        case text::textfield::Type::AUTHOR:
-        {
-            SvxAuthorField* pAuthor = PTR_CAST( SvxAuthorField, pFieldItem->GetField() );
-            if(pAuthor)
-                aValue <<= (sal_Int32)pAuthor->GetFormat();
-            break;
-        }
-        default:
-            throw beans::UnknownPropertyException();
-        }
-        break;
-    case WID_FIX:
-        {
-            sal_Bool bFix = sal_False;
-        switch( mnId )
-        {
-        case text::textfield::Type::EXTENDED_TIME:
-        {
-            SvxExtTimeField* pTime = PTR_CAST( SvxExtTimeField, pFieldItem->GetField() );
-            if(pTime)
-                bFix = pTime->GetType() == SVXTIMETYPE_FIX;
-            break;
-        }
-        case text::textfield::Type::DATE:
-        {
-            SvxDateField* pDate = PTR_CAST( SvxDateField, pFieldItem->GetField() );
-            if(pDate)
-                bFix = pDate->GetType() == SVXDATETYPE_FIX;
-            break;
-        }
-        case text::textfield::Type::EXTENDED_FILE:
-        {
-            SvxExtFileField* pFile = PTR_CAST( SvxExtFileField, pFieldItem->GetField() );
-            if(pFile)
-                bFix = pFile->GetType() == SVXFILETYPE_FIX;
-            break;
-        }
-        case text::textfield::Type::AUTHOR:
-        {
-            SvxAuthorField* pAuthor = PTR_CAST( SvxAuthorField, pFieldItem->GetField() );
-            if(pAuthor)
-                bFix = pAuthor->GetType() == SVXAUTHORTYPE_FIX;
-            break;
-        }
-        default:
-            throw beans::UnknownPropertyException();
-        }
-        aValue.setValue( &bFix, ::getCppuBooleanType() );
-        }
-        break;
-    case WID_PRES:
-    case WID_URL:
-    case WID_TARGET:
-    {
-        SvxURLField* pURL = PTR_CAST( SvxURLField, pFieldItem->GetField() );
-        if(pURL)
-        {
-            OUString aStr;
-            switch( pMap->nWID )
-            {
-            case WID_PRES:
-                aStr = pURL->GetRepresentation();
-                break;
-            case WID_URL:
-                aStr = pURL->GetURL();
-                break;
-            case WID_TARGET:
-                aStr = pURL->GetTargetFrame();
-                break;
-            }
-            aValue <<= aStr;
-        }
-        break;
-    }
-    case WID_FCOLOR:
-    case WID_TCOLOR:
-    {
-        Color* pFColor = NULL;
-        Color* pTColor = NULL;
-        const ESelection aSel = GetSelection();
-
-        pForwarder->CalcFieldValue( *pFieldItem, aSel.nStartPara, aSel.nStartPos, pTColor, pFColor );
-
-        if( pMap->nWID == WID_FCOLOR )
-            aValue <<= (sal_Int32)pFColor->GetColor();
-        else
-            aValue <<= (sal_Int32)pTColor->GetColor();
-        break;
-
-        delete pTColor;
-        delete pFColor;
-    }
-    }
-    return aValue;
-*/
 }
 
 void SAL_CALL SvxUnoTextField::addPropertyChangeListener( const OUString&, const uno::Reference< beans::XPropertyChangeListener >& ) throw(::com::sun::star::beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
commit f5122f93fe97aea479c9228173b16516d2c2f19d
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Tue May 8 11:58:50 2012 -0400

    Use scoped_ptr for this.
    
    Change-Id: I43aba3046fb0c7adcf5362ea26273189addc12fe

diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index 56a2635..d7be1db 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -57,6 +57,8 @@
 
 #include "editeng/unonames.hxx"
 
+#include <boost/scoped_ptr.hpp>
+
 using namespace ::rtl;
 using namespace ::cppu;
 using namespace ::com::sun::star;
@@ -1808,7 +1810,7 @@ void SAL_CALL SvxUnoTextBase::insertTextContent( const uno::Reference< text::XTe
     if (!bAbsorb)
         aSel.Start = aSel.End;
 
-    SvxFieldData* pFieldData = SvxFieldData::Create(xContent);
+    boost::scoped_ptr<SvxFieldData> pFieldData(SvxFieldData::Create(xContent));
     if (!pFieldData)
         throw lang::IllegalArgumentException();
 
@@ -1825,8 +1827,6 @@ void SAL_CALL SvxUnoTextBase::insertTextContent( const uno::Reference< text::XTe
     aSel.End.PositionInParagraph += 1;
     aSel.Start.PositionInParagraph = aSel.End.PositionInParagraph;
     xPropSet->setPropertyValue(UNO_TR_PROP_SELECTION, uno::makeAny(aSel));
-
-    delete pFieldData;
 }
 
 void SAL_CALL SvxUnoTextBase::removeTextContent( const uno::Reference< text::XTextContent >& ) throw(container::NoSuchElementException, uno::RuntimeException)
commit 1af56c22b4b17922f43b67aaf1ceb9562b98f941
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Tue May 8 11:48:30 2012 -0400

    Adjust ScEditFieldObj for the change done in SvxUnoTextRangeBase.
    
    Treat date and time field types together, and handle appropriate
    properties to have it not throw UnknownPropertyValue exception.
    
    Change-Id: I6a4c512fb3030bfc48ab7372cb1a217069dedfc4

diff --git a/sc/inc/fielduno.hxx b/sc/inc/fielduno.hxx
index c20949c..62ab90f 100644
--- a/sc/inc/fielduno.hxx
+++ b/sc/inc/fielduno.hxx
@@ -43,6 +43,7 @@
 #include <com/sun/star/container/XIndexAccess.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/util/XRefreshable.hpp>
+#include <com/sun/star/util/DateTime.hpp>
 #include <cppuhelper/component.hxx>
 #include <cppuhelper/implbase5.hxx>
 #include <cppuhelper/implbase4.hxx>
@@ -221,7 +222,10 @@ class ScEditFieldObj : public cppu::WeakImplHelper4<
     boost::scoped_ptr<SvxFieldData> mpData;
     com::sun::star::uno::Reference<com::sun::star::text::XTextRange> mpContent;
 
+    com::sun::star::util::DateTime maDateTime;
+    sal_Int32 mnNumFormat;
     bool mbIsDate:1;
+    bool mbIsFixed:1;
 
 private:
     ScEditFieldObj(); // disabled
@@ -234,7 +238,9 @@ private:
     void setPropertyValueFile(const rtl::OUString& rName, const com::sun::star::uno::Any& rVal);
     com::sun::star::uno::Any getPropertyValueFile(const rtl::OUString& rName);
 
-    void setPropertyValueExtTime(const rtl::OUString& rName, const com::sun::star::uno::Any& rVal);
+    void setPropertyValueDateTime(const rtl::OUString& rName, const com::sun::star::uno::Any& rVal);
+    com::sun::star::uno::Any getPropertyValueDateTime(const rtl::OUString& rName);
+
     void setPropertyValueSheet(const rtl::OUString& rName, const com::sun::star::uno::Any& rVal);
 
 public:
diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx
index 5ba1a3b..167c10c 100644
--- a/sc/inc/unonames.hxx
+++ b/sc/inc/unonames.hxx
@@ -323,6 +323,7 @@
 #define SC_UNONAME_ANCTYPES         "AnchorTypes"
 #define SC_UNONAME_TEXTWRAP         "TextWrap"
 #define SC_UNONAME_FILEFORM         "FileFormat"
+#define SC_UNONAME_TEXTFIELD_TYPE   "TextFieldType"
 
 //  url field
 #define SC_UNONAME_REPR             "Representation"
@@ -334,6 +335,9 @@
 #define SC_UNONAME_ISFIXED          "IsFixed"
 #define SC_UNONAME_DATETIME         "DateTime"
 
+// table field
+#define SC_UNONAME_TABLEPOS         "TablePosition"
+
 //  conditional format
 #define SC_UNONAME_OPERATOR         "Operator"
 #define SC_UNONAME_FORMULA1         "Formula1"
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 44fdff5..7fc9093 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -6436,7 +6436,7 @@ void SAL_CALL ScCellObj::insertTextContent( const uno::Reference<text::XTextRang
             }
 
             if (pCellField->GetFieldType() == text::textfield::Type::TABLE)
-                pCellField->setPropertyValue("SheetPosition", uno::makeAny<sal_Int32>(aCellPos.Tab()));
+                pCellField->setPropertyValue(SC_UNONAME_TABLEPOS, uno::makeAny<sal_Int32>(aCellPos.Tab()));
 
             SvxFieldItem aItem = pCellField->CreateFieldItem();
             SvxTextForwarder* pForwarder = pEditSource->GetTextForwarder();
diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx
index 93f3b18..1168b12 100644
--- a/sc/source/ui/unoobj/fielduno.cxx
+++ b/sc/source/ui/unoobj/fielduno.cxx
@@ -60,7 +60,7 @@ namespace {
 
 //  alles ohne Which-ID, Map nur fuer PropertySetInfo
 
-const SfxItemPropertySet* getExtTimePropertySet()
+const SfxItemPropertySet* getDateTimePropertySet()
 {
     static SfxItemPropertyMapEntry aMapContent[] =
     {
@@ -881,12 +881,35 @@ uno::Any ScEditFieldObj::getPropertyValueFile(const rtl::OUString& rName)
     return aRet;
 }
 
-void ScEditFieldObj::setPropertyValueExtTime(const rtl::OUString& rName, const uno::Any& rVal)
+void ScEditFieldObj::setPropertyValueDateTime(const rtl::OUString& rName, const uno::Any& rVal)
 {
-    if (rName == "IsDate")
-    {
+    if (rName == SC_UNONAME_ISDATE)
         mbIsDate = rVal.get<sal_Bool>();
-    }
+    else if (rName == SC_UNONAME_ISFIXED)
+        mbIsFixed = rVal.get<sal_Bool>();
+    else if (rName == SC_UNONAME_DATETIME)
+        maDateTime = rVal.get<util::DateTime>();
+    else if (rName == SC_UNONAME_NUMFMT)
+        mnNumFormat = rVal.get<sal_Int32>();
+    else
+        throw beans::UnknownPropertyException();
+}
+
+uno::Any ScEditFieldObj::getPropertyValueDateTime(const rtl::OUString& rName)
+{
+    if (rName == SC_UNONAME_ISDATE)
+        return uno::makeAny<sal_Bool>(mbIsDate);
+
+    if (rName == SC_UNONAME_ISFIXED)
+        return uno::makeAny<sal_Bool>(mbIsFixed);
+
+    if (rName == SC_UNONAME_DATETIME)
+        return uno::makeAny(maDateTime);
+
+    if (rName == SC_UNONAME_NUMFMT)
+        return uno::makeAny(mnNumFormat);
+
+    throw beans::UnknownPropertyException();
 }
 
 void ScEditFieldObj::setPropertyValueSheet(const rtl::OUString& rName, const uno::Any& rVal)
@@ -909,7 +932,7 @@ void ScEditFieldObj::setPropertyValueSheet(const rtl::OUString& rName, const uno
 
         SvxTableField* p = static_cast<SvxTableField*>(pField);
 
-        if (rName == "SheetPosition")
+        if (rName == SC_UNONAME_TABLEPOS)
         {
             sal_Int32 nTab = rVal.get<sal_Int32>();
             p->SetTab(nTab);
@@ -928,7 +951,7 @@ void ScEditFieldObj::setPropertyValueSheet(const rtl::OUString& rName, const uno
         throw uno::RuntimeException();
 
     SvxTableField* p = static_cast<SvxTableField*>(pData);
-    if (rName == "SheetPosition")
+    if (rName == SC_UNONAME_TABLEPOS)
     {
         sal_Int32 nTab = rVal.get<sal_Int32>();
         p->SetTab(nTab);
@@ -945,7 +968,7 @@ ScEditFieldObj::ScEditFieldObj(
     pPropSet(NULL),
     mpEditSource(pEditSrc),
     aSelection(rSel),
-    meType(eType), mpData(NULL), mpContent(rContent), mbIsDate(false)
+    meType(eType), mpData(NULL), mpContent(rContent), mnNumFormat(0), mbIsDate(false), mbIsFixed(false)
 {
     switch (meType)
     {
@@ -955,12 +978,18 @@ ScEditFieldObj::ScEditFieldObj(
         case text::textfield::Type::URL:
             pPropSet = lcl_GetURLPropertySet();
         break;
+        case text::textfield::Type::DATE:
+        case text::textfield::Type::EXTENDED_DATE:
+        case text::textfield::Type::TIME:
         case text::textfield::Type::EXTENDED_TIME:
-            pPropSet = getExtTimePropertySet();
+            pPropSet = getDateTimePropertySet();
         break;
         default:
             pPropSet = lcl_GetHeaderFieldPropertySet();
     }
+
+    if (meType == text::textfield::Type::DATE || meType == text::textfield::Type::EXTENDED_DATE)
+        mbIsDate = true;
 }
 
 void ScEditFieldObj::InitDoc(
@@ -1111,6 +1140,12 @@ void SAL_CALL ScEditFieldObj::setPropertyValue(
                         uno::RuntimeException)
 {
     SolarMutexGuard aGuard;
+    if (aPropertyName == SC_UNONAME_ANCHOR)
+    {
+        aValue >>= mpContent;
+        return;
+    }
+
     switch (meType)
     {
         case text::textfield::Type::URL:
@@ -1119,8 +1154,11 @@ void SAL_CALL ScEditFieldObj::setPropertyValue(
         case text::textfield::Type::EXTENDED_FILE:
             setPropertyValueFile(aPropertyName, aValue);
         break;
+        case text::textfield::Type::DATE:
+        case text::textfield::Type::EXTENDED_DATE:
+        case text::textfield::Type::TIME:
         case text::textfield::Type::EXTENDED_TIME:
-            setPropertyValueExtTime(aPropertyName, aValue);
+            setPropertyValueDateTime(aPropertyName, aValue);
         break;
         case text::textfield::Type::TABLE:
             setPropertyValueSheet(aPropertyName, aValue);
@@ -1135,13 +1173,19 @@ uno::Any SAL_CALL ScEditFieldObj::getPropertyValue( const rtl::OUString& aProper
                         uno::RuntimeException)
 {
     SolarMutexGuard aGuard;
+    if (aPropertyName.equals(SC_UNONAME_TEXTFIELD_TYPE))
+        return uno::makeAny(meType);
+
+    if (aPropertyName == SC_UNONAME_ANCHOR)
+        return uno::makeAny(mpContent);
+
     if (aPropertyName == SC_UNONAME_ANCTYPE)
     {
         uno::Any aRet;
         aRet <<= text::TextContentAnchorType_AS_CHARACTER;
         return aRet;
     }
-    else if (aPropertyName == SC_UNONAME_ANCTYPES)
+    if (aPropertyName == SC_UNONAME_ANCTYPES)
     {
         uno::Any aRet;
         uno::Sequence<text::TextContentAnchorType> aSeq(1);
@@ -1149,7 +1193,7 @@ uno::Any SAL_CALL ScEditFieldObj::getPropertyValue( const rtl::OUString& aProper
         aRet <<= aSeq;
         return aRet;
     }
-    else if (aPropertyName == SC_UNONAME_TEXTWRAP)
+    if (aPropertyName == SC_UNONAME_TEXTWRAP)
     {
         uno::Any aRet;
         aRet <<= text::WrapTextMode_NONE;
@@ -1162,6 +1206,11 @@ uno::Any SAL_CALL ScEditFieldObj::getPropertyValue( const rtl::OUString& aProper
             return getPropertyValueURL(aPropertyName);
         case text::textfield::Type::EXTENDED_FILE:
             return getPropertyValueFile(aPropertyName);
+        case text::textfield::Type::DATE:
+        case text::textfield::Type::TIME:
+        case text::textfield::Type::EXTENDED_DATE:
+        case text::textfield::Type::EXTENDED_TIME:
+            return getPropertyValueDateTime(aPropertyName);
         default:
             throw beans::UnknownPropertyException();
     }
diff --git a/sc/source/ui/unoobj/notesuno.cxx b/sc/source/ui/unoobj/notesuno.cxx
index 1ed78c9..f94e812 100644
--- a/sc/source/ui/unoobj/notesuno.cxx
+++ b/sc/source/ui/unoobj/notesuno.cxx
@@ -391,7 +391,9 @@ void SAL_CALL ScAnnotationShapeObj::insertTextContent( const uno::Reference< tex
                                         uno::RuntimeException)
 {
     SolarMutexGuard aGuard;
-
+#if 1
+    GetUnoText().insertTextContent(xRange, xContent, bAbsorb);
+#else
     // Evil hack to convert a ScEditFieldObj based text field into a
     // SvxUnoTextField based one.  See SvxUnoTextBase::insertTextContent() for
     // the reason why.  We need a clean solution for this.
@@ -402,6 +404,7 @@ void SAL_CALL ScAnnotationShapeObj::insertTextContent( const uno::Reference< tex
         xContent2.set(new SvxUnoTextField(pField->GetFieldType()));
 
     GetUnoText().insertTextContent(xRange, xContent2, bAbsorb);
+#endif
 }
 
 void SAL_CALL ScAnnotationShapeObj::removeTextContent( const uno::Reference< text::XTextContent >& xContent )
commit 63114e6d863de32e2d93f0da54caca928916d9c2
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Mon May 7 18:04:12 2012 -0400

    Create SvxFieldData instance directly from the UNO textfield object.
    
    Change-Id: Ifa8210ffdf29624689f547b436fd687a2de82eb1

diff --git a/editeng/inc/editeng/flditem.hxx b/editeng/inc/editeng/flditem.hxx
index 14a3980..46ddc34 100644
--- a/editeng/inc/editeng/flditem.hxx
+++ b/editeng/inc/editeng/flditem.hxx
@@ -37,6 +37,12 @@
 
 #include <com/sun/star/text/textfield/Type.hpp>
 
+namespace com { namespace sun { namespace star { namespace text {
+
+class XTextContent;
+
+}}}}
+
 class SvNumberFormatter;
 class MetaAction;
 
@@ -47,6 +53,8 @@ class MetaAction;
 class EDITENG_DLLPUBLIC SvxFieldData : public SvPersistBase
 {
 public:
+    static SvxFieldData* Create(const com::sun::star::uno::Reference<com::sun::star::text::XTextContent>& xContent);
+
     SV_DECL_PERSIST1( SvxFieldData, SvPersistBase, -1 )
 
                             SvxFieldData();
@@ -92,7 +100,7 @@ public:
 // =================================================================
 
 enum SvxDateType { SVXDATETYPE_FIX, SVXDATETYPE_VAR };
-enum SvxDateFormat {    SVXDATEFORMAT_APPDEFAULT,   // Set as in App
+enum SvxDateFormat {    SVXDATEFORMAT_APPDEFAULT = 0,   // Set as in App
                         SVXDATEFORMAT_SYSTEM,       // Set as in System
                         SVXDATEFORMAT_STDSMALL,
                         SVXDATEFORMAT_STDBIG,
@@ -139,7 +147,7 @@ public:
 };
 
 
-enum SvxURLFormat   {   SVXURLFORMAT_APPDEFAULT,    // Set as in App
+enum SvxURLFormat   {   SVXURLFORMAT_APPDEFAULT = 0,    // Set as in App
                         SVXURLFORMAT_URL,           // Represent URL
                         SVXURLFORMAT_REPR           // Constitute repraesentation
                     };
@@ -237,7 +245,7 @@ public:
 
 
 enum SvxTimeType { SVXTIMETYPE_FIX, SVXTIMETYPE_VAR };
-enum SvxTimeFormat {    SVXTIMEFORMAT_APPDEFAULT,   // Set as in App
+enum SvxTimeFormat {    SVXTIMEFORMAT_APPDEFAULT = 0,   // Set as in App
                         SVXTIMEFORMAT_SYSTEM,       // Set as in System
                         SVXTIMEFORMAT_STANDARD,
                         SVXTIMEFORMAT_24_HM,    // 13:49
@@ -287,7 +295,7 @@ public:
 
 
 enum SvxFileType { SVXFILETYPE_FIX, SVXFILETYPE_VAR };
-enum SvxFileFormat {    SVXFILEFORMAT_NAME_EXT, // File name with Extension
+enum SvxFileFormat {    SVXFILEFORMAT_NAME_EXT = 0, // File name with Extension
                         SVXFILEFORMAT_FULLPATH, // full path
                         SVXFILEFORMAT_PATH,     // only path
                         SVXFILEFORMAT_NAME      // only file name
@@ -326,7 +334,7 @@ public:
 
 
 enum SvxAuthorType { SVXAUTHORTYPE_FIX, SVXAUTHORTYPE_VAR };
-enum SvxAuthorFormat {  SVXAUTHORFORMAT_FULLNAME,   // full name
+enum SvxAuthorFormat {  SVXAUTHORFORMAT_FULLNAME = 0, // full name
                         SVXAUTHORFORMAT_NAME,       // Only Last name
                         SVXAUTHORFORMAT_FIRSTNAME,  // Only first name
                         SVXAUTHORFORMAT_SHORTNAME   // Initials
diff --git a/editeng/inc/editeng/unonames.hxx b/editeng/inc/editeng/unonames.hxx
index e724115..d8a6f32 100644
--- a/editeng/inc/editeng/unonames.hxx
+++ b/editeng/inc/editeng/unonames.hxx
@@ -26,7 +26,36 @@
  * instead of those above.
  */
 
-#define UNO_TC_PROP_ANCHOR "Anchor"
+// Common across fields
+#define UNO_TC_PROP_ANCHOR               "Anchor"
+#define UNO_TC_PROP_TEXTFIELD_TYPE       "TextFieldType"
+#define UNO_TC_PROP_IS_FIXED             "IsFixed"
+#define UNO_TC_PROP_CURRENT_PRESENTATION "CurrentPresentation"
+
+// Date & Time
+#define UNO_TC_PROP_IS_DATE   "IsDate"
+#define UNO_TC_PROP_DATE_TIME "DateTime"
+#define UNO_TC_PROP_NUMFORMAT "NumberFormat"
+
+// URL
+#define UNO_TC_PROP_URL_FORMAT         "Format"
+#define UNO_TC_PROP_URL_REPRESENTATION "Representation"
+#define UNO_TC_PROP_URL_TARGET         "Target"
+#define UNO_TC_PROP_URL                "URL"
+
+// Table
+#define UNO_TC_PROP_TABLE_POSITION "TablePosition"
+
+// File
+#define UNO_TC_PROP_FILE_FORMAT "FileFormat"
+
+// Author
+#define UNO_TC_PROP_AUTHOR_CONTENT  "Content"
+#define UNO_TC_PROP_AUTHOR_FORMAT   "AuthorFormat"
+#define UNO_TC_PROP_AUTHOR_FULLNAME "FullName"
+
+// Measure
+#define UNO_TC_PROP_MEASURE_KIND "Kind"
 
 #define UNO_TR_PROP_SELECTION "Selection"
 
diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx
index 5b5361d..36ba686 100644
--- a/editeng/source/items/flditem.cxx
+++ b/editeng/source/items/flditem.cxx
@@ -34,15 +34,192 @@
 #include <unotools/localfilehelper.hxx>
 
 #include <editeng/flditem.hxx>
-
 #include <editeng/measfld.hxx>
+#include "editeng/unonames.hxx"
 
 #include <tools/tenccvt.hxx>
 
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/text/XTextContent.hpp>
+#include <com/sun/star/text/FilenameDisplayFormat.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+
+using namespace com::sun::star;
+
 #define FRAME_MARKER    (sal_uInt32)0x21981357
 #define CHARSET_MARKER  (FRAME_MARKER+1)
 
-// -----------------------------------------------------------------------
+SvxFieldData* SvxFieldData::Create(const uno::Reference<text::XTextContent>& xTextContent)
+{
+    uno::Reference<beans::XPropertySet> xPropSet(xTextContent, uno::UNO_QUERY);
+    if (!xPropSet.is())
+        return NULL;
+
+    uno::Any aAny = xPropSet->getPropertyValue(UNO_TC_PROP_TEXTFIELD_TYPE);
+    sal_Int32 nFieldType = aAny.get<sal_Int32>();
+
+    switch (nFieldType)
+    {
+        case text::textfield::Type::TIME:
+        case text::textfield::Type::EXTENDED_TIME:
+        case text::textfield::Type::DATE:
+        case text::textfield::Type::EXTENDED_DATE:
+        {
+            sal_Bool bIsDate = false;
+            xPropSet->getPropertyValue(UNO_TC_PROP_IS_DATE) >>= bIsDate;
+
+            if (bIsDate)
+            {
+                util::DateTime aDateTime = xPropSet->getPropertyValue(UNO_TC_PROP_DATE_TIME).get<util::DateTime>();
+                Date aDate(aDateTime.Day, aDateTime.Month, aDateTime.Year);
+                sal_Bool bIsFixed = false;
+                xPropSet->getPropertyValue(UNO_TC_PROP_IS_FIXED) >>= bIsFixed;
+
+                SvxDateField* pData = new SvxDateField(aDate, bIsFixed ? SVXDATETYPE_FIX : SVXDATETYPE_VAR);
+                sal_Int32 nNumFmt = -1;
+                xPropSet->getPropertyValue(UNO_TC_PROP_NUMFORMAT) >>= nNumFmt;
+                if (nNumFmt >= SVXDATEFORMAT_APPDEFAULT && nNumFmt <= SVXDATEFORMAT_F)
+                    pData->SetFormat(static_cast<SvxDateFormat>(nNumFmt));
+
+                return pData;
+            }
+
+            if (nFieldType != text::textfield::Type::TIME && nFieldType != text::textfield::Type::DATE)
+            {
+                util::DateTime aDateTime = xPropSet->getPropertyValue(UNO_TC_PROP_DATE_TIME).get<util::DateTime>();
+                Time aTime(aDateTime.Hours, aDateTime.Minutes, aDateTime.Seconds, aDateTime.HundredthSeconds);
+
+                sal_Bool bIsFixed = false;
+                xPropSet->getPropertyValue(UNO_TC_PROP_IS_FIXED) >>= bIsFixed;
+
+                SvxExtTimeField* pData = new SvxExtTimeField(aTime, bIsFixed ? SVXTIMETYPE_FIX : SVXTIMETYPE_VAR);
+
+                sal_Int32 nNumFmt = -1;
+                xPropSet->getPropertyValue(UNO_TC_PROP_NUMFORMAT) >>= nNumFmt;
+                if (nNumFmt >= SVXTIMEFORMAT_APPDEFAULT && nNumFmt <= SVXTIMEFORMAT_AM_HMSH)
+                    pData->SetFormat(static_cast<SvxTimeFormat>(nNumFmt));
+
+                return pData;
+            }
+
+            return new SvxTimeField();
+        }
+        case text::textfield::Type::URL:
+        {
+            rtl::OUString aRep, aTarget, aURL;
+            sal_Int16 nFmt = -1;
+            xPropSet->getPropertyValue(UNO_TC_PROP_URL_REPRESENTATION) >>= aRep;
+            xPropSet->getPropertyValue(UNO_TC_PROP_URL_TARGET) >>= aTarget;
+            xPropSet->getPropertyValue(UNO_TC_PROP_URL) >>= aURL;
+            xPropSet->getPropertyValue(UNO_TC_PROP_URL_FORMAT) >>= nFmt;
+            SvxURLField* pData = new SvxURLField(aURL, aRep, aRep.isEmpty() ? SVXURLFORMAT_URL : SVXURLFORMAT_REPR);
+            pData->SetTargetFrame(aTarget);
+            if (nFmt >= SVXURLFORMAT_APPDEFAULT && nFmt <= SVXURLFORMAT_REPR)
+                pData->SetFormat(static_cast<SvxURLFormat>(nFmt));
+
+            return pData;
+        }
+        case text::textfield::Type::PAGE:
+            return new SvxPageField();
+        case text::textfield::Type::PAGES:
+            return new SvxPagesField();
+        case text::textfield::Type::FILE:
+            return new SvxFileField();
+        case text::textfield::Type::TABLE:
+        {
+            sal_Int32 nTab = 0;
+            xPropSet->getPropertyValue(UNO_TC_PROP_TABLE_POSITION) >>= nTab;
+            return new SvxTableField(nTab);
+        }
+        case text::textfield::Type::EXTENDED_FILE:
+        {
+            rtl::OUString aPresentation;
+            sal_Bool bIsFixed = false;
+            sal_Int16 nFmt = text::FilenameDisplayFormat::FULL;
+            xPropSet->getPropertyValue(UNO_TC_PROP_IS_FIXED) >>= bIsFixed;
+            xPropSet->getPropertyValue(UNO_TC_PROP_CURRENT_PRESENTATION) >>= aPresentation;
+            xPropSet->getPropertyValue(UNO_TC_PROP_FILE_FORMAT) >>= nFmt;
+
+            SvxFileFormat eFmt = SVXFILEFORMAT_NAME_EXT;
+            switch (nFmt)
+            {
+                case text::FilenameDisplayFormat::FULL: eFmt = SVXFILEFORMAT_FULLPATH; break;
+                case text::FilenameDisplayFormat::PATH: eFmt = SVXFILEFORMAT_PATH;     break;
+                case text::FilenameDisplayFormat::NAME: eFmt = SVXFILEFORMAT_NAME;     break;
+                default:;
+            }
+
+            // pass fixed attribute to constructor
+            return new SvxExtFileField(
+                aPresentation, bIsFixed ? SVXFILETYPE_FIX : SVXFILETYPE_VAR, eFmt);
+        }
+        case text::textfield::Type::AUTHOR:
+        {
+            sal_Bool bIsFixed = false;
+            sal_Bool bFullName = false;
+            sal_Int16 nFmt = -1;
+            rtl::OUString aPresentation, aContent, aFirstName, aLastName;
+            xPropSet->getPropertyValue(UNO_TC_PROP_IS_FIXED) >>= bIsFixed;
+            xPropSet->getPropertyValue(UNO_TC_PROP_AUTHOR_FULLNAME) >>= bFullName;
+            xPropSet->getPropertyValue(UNO_TC_PROP_CURRENT_PRESENTATION) >>= aPresentation;
+            xPropSet->getPropertyValue(UNO_TC_PROP_AUTHOR_CONTENT) >>= aContent;
+            xPropSet->getPropertyValue(UNO_TC_PROP_AUTHOR_FORMAT) >>= nFmt;
+
+            // do we have CurrentPresentation given?  Mimic behaviour of
+            // writer, which means: prefer CurrentPresentation over Content
+            // if both are given.
+            if (!aPresentation.isEmpty())
+                aContent = aPresentation;
+
+            sal_Int32 nPos = aContent.lastIndexOf(sal_Unicode(' '), 0);
+            if (nPos > 0)
+            {
+                aFirstName = aContent.copy(0, nPos);
+                aLastName = aContent.copy(nPos + 1);
+            }
+            else
+            {
+                aLastName = aContent;
+            }
+
+            // #92009# pass fixed attribute to constructor
+            SvxAuthorField* pData = new SvxAuthorField(
+                aFirstName, aLastName, rtl::OUString(), bIsFixed ? SVXAUTHORTYPE_FIX : SVXAUTHORTYPE_VAR);
+
+            if (!bFullName)
+            {
+                pData->SetFormat(SVXAUTHORFORMAT_SHORTNAME);
+            }
+            else if (nFmt >= SVXAUTHORFORMAT_FULLNAME || nFmt <= SVXAUTHORFORMAT_SHORTNAME)
+            {
+                pData->SetFormat(static_cast<SvxAuthorFormat>(nFmt));
+            }
+
+            return pData;
+        }
+        case text::textfield::Type::MEASURE:
+        {
+            SdrMeasureFieldKind eKind = SDRMEASUREFIELD_VALUE;
+            sal_Int16 nTmp = -1;
+            xPropSet->getPropertyValue(UNO_TC_PROP_MEASURE_KIND) >>= nTmp;
+            if (nTmp == static_cast<sal_Int16>(SDRMEASUREFIELD_UNIT) ||
+                nTmp == static_cast<sal_Int16>(SDRMEASUREFIELD_ROTA90BLANCS))
+                eKind = static_cast<SdrMeasureFieldKind>(nTmp);
+
+            return new SdrMeasureField(eKind);
+        }
+        case text::textfield::Type::HEADER:
+            return new SvxHeaderField();
+        case text::textfield::Type::FOOTER:
+            return new SvxFooterField();
+        case text::textfield::Type::DATE_TIME:
+            return new SvxDateTimeField();
+        default:
+            ;
+    };
+
+    return NULL;
+}
 
 TYPEINIT1( SvxFieldItem, SfxPoolItem );
 
diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx
index 50c578f..5333ac3 100644
--- a/editeng/source/uno/unofield.cxx
+++ b/editeng/source/uno/unofield.cxx
@@ -90,7 +90,7 @@ const SfxItemPropertySet* ImplGetFieldItemPropertySet( sal_Int32 mnId )
         { MAP_CHAR_LEN("DateTime"),         WID_DATE,       &::getCppuType((const util::DateTime*)0),       0, 0 },
         { MAP_CHAR_LEN("IsFixed"),          WID_BOOL1,      &::getBooleanCppuType(),                0, 0 },
         { MAP_CHAR_LEN("IsDate"),           WID_BOOL2,      &::getBooleanCppuType(),                0, 0 },
-        { MAP_CHAR_LEN("NumberFormat"),     WID_INT32,      &::getCppuType((const sal_Int16*)0),    0, 0 },
+        { MAP_CHAR_LEN("NumberFormat"),     WID_INT32,      &::getCppuType((const sal_Int32*)0),    0, 0 },
         {0,0,0,0,0,0}
     };
     static SfxItemPropertySet aExDateTimeFieldPropertySet_Impl(aExDateTimeFieldPropertyMap_Impl);
@@ -849,6 +849,9 @@ uno::Any SAL_CALL SvxUnoTextField::getPropertyValue( const OUString& PropertyNam
     if (PropertyName == UNO_TC_PROP_ANCHOR)
         return uno::makeAny(mxAnchor);
 
+    if (PropertyName == UNO_TC_PROP_TEXTFIELD_TYPE)
+        return uno::makeAny(mnServiceId);
+
     uno::Any aValue;
 
     const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMap().getByName( PropertyName );
diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index 52d31bb..56a2635 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -1799,11 +1799,6 @@ void SAL_CALL SvxUnoTextBase::insertTextContent( const uno::Reference< text::XTe
     if (!pForwarder)
         return;
 
-    SvxUnoTextField* pField = SvxUnoTextField::getImplementation( xContent );
-
-    if (pField == NULL)
-        throw lang::IllegalArgumentException();
-
     uno::Reference<beans::XPropertySet> xPropSet(xRange, uno::UNO_QUERY);
     if (!xPropSet.is())
         throw lang::IllegalArgumentException();
@@ -1813,8 +1808,8 @@ void SAL_CALL SvxUnoTextBase::insertTextContent( const uno::Reference< text::XTe
     if (!bAbsorb)
         aSel.Start = aSel.End;
 
-    SvxFieldData* pFieldData = pField->CreateFieldData();
-    if( pFieldData == NULL )
+    SvxFieldData* pFieldData = SvxFieldData::Create(xContent);
+    if (!pFieldData)
         throw lang::IllegalArgumentException();
 
     SvxFieldItem aField( *pFieldData, EE_FEATURE_FIELD );
commit aac15b638410f181133dc15343136b4e9a1675ba
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Mon May 7 15:22:54 2012 -0400

    Set anchor to XTextContent using UNO API.
    
    Change-Id: Id1ccae62037369917a46d620c0c46ac2447a0910

diff --git a/editeng/inc/editeng/unonames.hxx b/editeng/inc/editeng/unonames.hxx
new file mode 100644
index 0000000..e724115
--- /dev/null
+++ b/editeng/inc/editeng/unonames.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ *   Copyright (C) 2012 Kohei Yoshida <kohei.yoshida at suse.com>
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#define UNO_TC_PROP_ANCHOR "Anchor"
+
+#define UNO_TR_PROP_SELECTION "Selection"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx
index 7b97684..50c578f 100644
--- a/editeng/source/uno/unofield.cxx
+++ b/editeng/source/uno/unofield.cxx
@@ -41,6 +41,8 @@
 #include <comphelper/serviceinfohelper.hxx>
 #include <comphelper/servicehelper.hxx>
 
+#include "editeng/unonames.hxx"
+
 using namespace ::rtl;
 using namespace ::cppu;
 using namespace ::com::sun::star;
@@ -671,6 +673,12 @@ void SAL_CALL SvxUnoTextField::setPropertyValue( const OUString& aPropertyName,
     if( mpImpl == NULL )
         throw uno::RuntimeException();
 
+    if (aPropertyName == UNO_TC_PROP_ANCHOR)
+    {
+        aValue >>= mxAnchor;
+        return;
+    }
+
     const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMap().getByName( aPropertyName );
     if ( !pMap )
         throw beans::UnknownPropertyException();
@@ -838,6 +846,9 @@ uno::Any SAL_CALL SvxUnoTextField::getPropertyValue( const OUString& PropertyNam
 {
     SolarMutexGuard aGuard;
 
+    if (PropertyName == UNO_TC_PROP_ANCHOR)
+        return uno::makeAny(mxAnchor);
+
     uno::Any aValue;
 
     const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMap().getByName( PropertyName );
diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index a13bb0c..52d31bb 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -55,7 +55,7 @@
 #include <comphelper/serviceinfohelper.hxx>
 #include <comphelper/servicehelper.hxx>
 
-#define UNO_TR_PROP_SELECTION "Selection"
+#include "editeng/unonames.hxx"
 
 using namespace ::rtl;
 using namespace ::cppu;
@@ -1821,7 +1821,11 @@ void SAL_CALL SvxUnoTextBase::insertTextContent( const uno::Reference< text::XTe
     pForwarder->QuickInsertField(aField, toESelection(aSel));
     GetEditSource()->UpdateData();
 
-    pField->SetAnchor( uno::Reference< text::XTextRange >::query( (cppu::OWeakObject*)this ) );
+    uno::Reference<beans::XPropertySet> xPropSetContent(xContent, uno::UNO_QUERY);
+    if (!xContent.is())
+        throw lang::IllegalArgumentException();
+
+    xPropSetContent->setPropertyValue(UNO_TC_PROP_ANCHOR, uno::makeAny(xRange));
 
     aSel.End.PositionInParagraph += 1;
     aSel.Start.PositionInParagraph = aSel.End.PositionInParagraph;
commit c601d86ce154e43266e0185b2fba2c1b4f196d1d
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Mon May 7 14:55:31 2012 -0400

    Avoid calling getImplementation() on the text range object.
    
    Change-Id: I3d1d4c1e9adebda16c62f4e14bd5aca14e058605

diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index 7e9b1d6..a13bb0c 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -29,7 +29,9 @@
 #include <vcl/svapp.hxx>
 #include <com/sun/star/style/LineSpacing.hpp>
 #include <com/sun/star/text/ControlCharacter.hpp>
-#include <com/sun/star/text/XTextField.hdl>
+#include <com/sun/star/text/XTextField.hpp>
+#include <com/sun/star/text/TextRangeSelection.hpp>
+
 #include <osl/mutex.hxx>
 #include <svl/itemset.hxx>
 #include <svl/itempool.hxx>
@@ -53,10 +55,26 @@
 #include <comphelper/serviceinfohelper.hxx>
 #include <comphelper/servicehelper.hxx>
 
+#define UNO_TR_PROP_SELECTION "Selection"
+
 using namespace ::rtl;
 using namespace ::cppu;
 using namespace ::com::sun::star;
 
+namespace {
+
+ESelection toESelection(const text::TextRangeSelection& rSel)
+{
+    ESelection aESel;
+    aESel.nStartPara = rSel.Start.Paragraph;
+    aESel.nStartPos = rSel.Start.PositionInParagraph;
+    aESel.nEndPara = rSel.End.Paragraph;
+    aESel.nEndPos = rSel.End.PositionInParagraph;
+    return aESel;
+}
+
+}
+
 const SvxItemPropertySet* ImplGetSvxUnoOutlinerTextCursorSvxPropertySet()
 {
     static SvxItemPropertySet aTextCursorSvxPropertySet( ImplGetSvxUnoOutlinerTextCursorPropertyMap(), EditEngine::GetGlobalItemPool() );
@@ -396,6 +414,14 @@ uno::Reference< beans::XPropertySetInfo > SAL_CALL SvxUnoTextRangeBase::getPrope
 void SAL_CALL SvxUnoTextRangeBase::setPropertyValue(const OUString& PropertyName, const uno::Any& aValue)
     throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException )
 {
+    if (PropertyName == UNO_TR_PROP_SELECTION)
+    {
+        text::TextRangeSelection aSel = aValue.get<text::TextRangeSelection>();
+        SetSelection(toESelection(aSel));
+
+        return;
+    }
+
     _setPropertyValue( PropertyName, aValue, -1 );
 }
 
@@ -561,6 +587,17 @@ sal_Bool SvxUnoTextRangeBase::SetPropertyValueHelper( const SfxItemSet&, const S
 uno::Any SAL_CALL SvxUnoTextRangeBase::getPropertyValue(const OUString& PropertyName)
     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
 {
+    if (PropertyName == UNO_TR_PROP_SELECTION)
+    {
+        const ESelection& rSel = GetSelection();
+        text::TextRangeSelection aSel;
+        aSel.Start.Paragraph = static_cast<sal_Int32>(rSel.nStartPara);
+        aSel.Start.PositionInParagraph = static_cast<sal_Int32>(rSel.nStartPos);
+        aSel.End.Paragraph = static_cast<sal_Int32>(rSel.nEndPara);
+        aSel.End.PositionInParagraph = static_cast<sal_Int32>(rSel.nEndPos);
+        return uno::makeAny(aSel);
+    }
+
     return _getPropertyValue( PropertyName, -1 );
 }
 
@@ -1759,39 +1796,38 @@ void SAL_CALL SvxUnoTextBase::insertTextContent( const uno::Reference< text::XTe
     SolarMutexGuard aGuard;
 
     SvxTextForwarder* pForwarder = GetEditSource() ? GetEditSource()->GetTextForwarder() : NULL;
-    if( pForwarder )
-    {
+    if (!pForwarder)
+        return;
 
-        SvxUnoTextRangeBase* pRange = SvxUnoTextRange::getImplementation( xRange );
-        SvxUnoTextField* pField = SvxUnoTextField::getImplementation( xContent );
+    SvxUnoTextField* pField = SvxUnoTextField::getImplementation( xContent );
 
-        if( pRange == NULL || pField == NULL )
-            throw lang::IllegalArgumentException();
+    if (pField == NULL)
+        throw lang::IllegalArgumentException();
 
-        ESelection aSelection = pRange->GetSelection();
-        if( !bAbsorb )
-        {
-            aSelection.nStartPara = aSelection.nEndPara;
-            aSelection.nStartPos  = aSelection.nEndPos;
-        }
+    uno::Reference<beans::XPropertySet> xPropSet(xRange, uno::UNO_QUERY);
+    if (!xPropSet.is())
+        throw lang::IllegalArgumentException();
 
-        SvxFieldData* pFieldData = pField->CreateFieldData();
-        if( pFieldData == NULL )
-            throw lang::IllegalArgumentException();
+    uno::Any aAny = xPropSet->getPropertyValue(UNO_TR_PROP_SELECTION);
+    text::TextRangeSelection aSel = aAny.get<text::TextRangeSelection>();
+    if (!bAbsorb)
+        aSel.Start = aSel.End;
 
-        SvxFieldItem aField( *pFieldData, EE_FEATURE_FIELD );
-        pForwarder->QuickInsertField( aField, aSelection );
-        GetEditSource()->UpdateData();
+    SvxFieldData* pFieldData = pField->CreateFieldData();
+    if( pFieldData == NULL )
+        throw lang::IllegalArgumentException();
 
-        pField->SetAnchor( uno::Reference< text::XTextRange >::query( (cppu::OWeakObject*)this ) );
+    SvxFieldItem aField( *pFieldData, EE_FEATURE_FIELD );
+    pForwarder->QuickInsertField(aField, toESelection(aSel));
+    GetEditSource()->UpdateData();
 
-        aSelection.nEndPos += 1;
-        aSelection.nStartPos = aSelection.nEndPos;
-        //maSelection = aSelection; //???
-        pRange->SetSelection( aSelection );
+    pField->SetAnchor( uno::Reference< text::XTextRange >::query( (cppu::OWeakObject*)this ) );
 
-        delete pFieldData;
-    }
+    aSel.End.PositionInParagraph += 1;
+    aSel.Start.PositionInParagraph = aSel.End.PositionInParagraph;
+    xPropSet->setPropertyValue(UNO_TR_PROP_SELECTION, uno::makeAny(aSel));
+
+    delete pFieldData;
 }
 
 void SAL_CALL SvxUnoTextBase::removeTextContent( const uno::Reference< text::XTextContent >& ) throw(container::NoSuchElementException, uno::RuntimeException)
commit c0b6e3e93c72e9e08a7af34353b8da3ce99a1ac0
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Mon May 7 12:07:58 2012 -0400

    New UNO API to deal with text range selections.
    
    Change-Id: I Ie868d9d2d8d56459f2013d91f836736cd3fd4d72

diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index ca50d1b..98cca5f 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -3660,6 +3660,8 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/text,\
 	TextGridMode \
 	TextMarkupDescriptor \
 	TextMarkupType \
+	TextPosition \
+	TextRangeSelection \
 	TimeDisplayFormat \
 	UserDataPart \
 	UserFieldFormat \
diff --git a/offapi/com/sun/star/text/TextPosition.idl b/offapi/com/sun/star/text/TextPosition.idl
new file mode 100644
index 0000000..7790218
--- /dev/null
+++ b/offapi/com/sun/star/text/TextPosition.idl
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ *   Copyright (C) 2012 Kohei Yoshida <kohei.yoshida at suse.com>
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#ifndef __com_sun_star_text_TextPosition_idl__
+#define __com_sun_star_text_TextPosition_idl__
+
+module com {  module sun {  module star { module text {
+
+struct TextPosition
+{
+    long Paragraph;
+
+    long PositionInParagraph;
+};
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/text/TextRangeSelection.idl b/offapi/com/sun/star/text/TextRangeSelection.idl
new file mode 100644
index 0000000..a383600
--- /dev/null
+++ b/offapi/com/sun/star/text/TextRangeSelection.idl
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ *   Copyright (C) 2012 Kohei Yoshida <kohei.yoshida at suse.com>
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#ifndef __com_sun_star_text_TextRangeSelection_idl__
+#define __com_sun_star_text_TextRangeSelection_idl__
+
+#include <com/sun/star/text/TextPosition.idl>
+
+module com {  module sun {  module star { module text {
+
+struct TextRangeSelection
+{
+    TextPosition Start;
+
+    TextPosition End;
+};
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list