[Libreoffice-commits] .: 5 commits - editeng/inc editeng/source filter/source offapi/com sc/source sd/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Thu May 10 22:54:36 PDT 2012
editeng/inc/editeng/flditem.hxx | 8 -
editeng/source/items/flditem.cxx | 8 -
editeng/source/uno/unofield.cxx | 192 ++++++++++++++++------------
filter/source/svg/svgexport.cxx | 12 -
offapi/com/sun/star/text/textfield/Type.idl | 12 +
sc/source/ui/unoobj/fielduno.cxx | 18 +-
sd/source/ui/unoidl/unomodel.cxx | 6
7 files changed, 147 insertions(+), 109 deletions(-)
New commits:
commit eeb9212531d91e8727bc8cabf4117b36638667f9
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri May 11 01:53:46 2012 -0400
Better names for presentation specific field item types.
Change-Id: Ib9bea60e05f1dcdd9501a3320f3b1185d5890d17
diff --git a/editeng/inc/editeng/flditem.hxx b/editeng/inc/editeng/flditem.hxx
index 40ba0e2..b124762 100644
--- a/editeng/inc/editeng/flditem.hxx
+++ b/editeng/inc/editeng/flditem.hxx
@@ -387,7 +387,7 @@ public:
class EDITENG_DLLPUBLIC SvxHeaderField : public SvxFieldData
{
public:
- SV_DECL_PERSIST1( SvxHeaderField, SvxFieldData, com::sun::star::text::textfield::Type::HEADER )
+ SV_DECL_PERSIST1( SvxHeaderField, SvxFieldData, com::sun::star::text::textfield::Type::PRESENTATION_HEADER )
SvxHeaderField();
virtual SvxFieldData* Clone() const;
@@ -399,7 +399,7 @@ public:
class EDITENG_DLLPUBLIC SvxFooterField : public SvxFieldData
{
public:
- SV_DECL_PERSIST1( SvxFooterField, SvxFieldData, com::sun::star::text::textfield::Type::FOOTER )
+ SV_DECL_PERSIST1( SvxFooterField, SvxFieldData, com::sun::star::text::textfield::Type::PRESENTATION_FOOTER )
SvxFooterField();
virtual SvxFieldData* Clone() const;
virtual int operator==( const SvxFieldData& ) const;
@@ -410,7 +410,7 @@ public:
class EDITENG_DLLPUBLIC SvxDateTimeField : public SvxFieldData
{
public:
- SV_DECL_PERSIST1( SvxDateTimeField, SvxFieldData, com::sun::star::text::textfield::Type::DATE_TIME )
+ SV_DECL_PERSIST1( SvxDateTimeField, SvxFieldData, com::sun::star::text::textfield::Type::PRESENTATION_DATE_TIME )
SvxDateTimeField();
static rtl::OUString GetFormatted( Date& rDate, Time& rTime, int eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage );
diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx
index 36ba686..d5aec5b 100644
--- a/editeng/source/items/flditem.cxx
+++ b/editeng/source/items/flditem.cxx
@@ -208,11 +208,11 @@ SvxFieldData* SvxFieldData::Create(const uno::Reference<text::XTextContent>& xTe
return new SdrMeasureField(eKind);
}
- case text::textfield::Type::HEADER:
+ case text::textfield::Type::PRESENTATION_HEADER:
return new SvxHeaderField();
- case text::textfield::Type::FOOTER:
+ case text::textfield::Type::PRESENTATION_FOOTER:
return new SvxFooterField();
- case text::textfield::Type::DATE_TIME:
+ case text::textfield::Type::PRESENTATION_DATE_TIME:
return new SvxDateTimeField();
default:
;
diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx
index dd3f56a..83cad2d 100644
--- a/editeng/source/uno/unofield.cxx
+++ b/editeng/source/uno/unofield.cxx
@@ -160,7 +160,6 @@ const SfxItemPropertySet* ImplGetFieldItemPropertySet( sal_Int32 mnId )
return &aAuthorFieldPropertySet_Impl;
case text::textfield::Type::MEASURE:
return &aMeasureFieldPropertySet_Impl;
- case text::textfield::Type::DATE_TIME:
default:
return &aEmptyPropertySet_Impl;
}
@@ -515,13 +514,13 @@ SvxFieldData* SvxUnoTextField::CreateFieldData() const throw()
pData = new SdrMeasureField( eKind);
break;
}
- case text::textfield::Type::HEADER:
+ case text::textfield::Type::PRESENTATION_HEADER:
pData = new SvxHeaderField();
break;
- case text::textfield::Type::FOOTER:
+ case text::textfield::Type::PRESENTATION_FOOTER:
pData = new SvxFooterField();
break;
- case text::textfield::Type::DATE_TIME:
+ case text::textfield::Type::PRESENTATION_DATE_TIME:
pData = new SvxDateTimeField();
break;
};
@@ -625,11 +624,11 @@ OUString SAL_CALL SvxUnoTextField::getPresentation( sal_Bool bShowCommand )
return OUString("Author");
case text::textfield::Type::MEASURE:
return OUString("Measure");
- case text::textfield::Type::HEADER:
+ case text::textfield::Type::PRESENTATION_HEADER:
return OUString("Header");
- case text::textfield::Type::FOOTER:
+ case text::textfield::Type::PRESENTATION_FOOTER:
return OUString("Footer");
- case text::textfield::Type::DATE_TIME:
+ case text::textfield::Type::PRESENTATION_DATE_TIME:
return OUString("DateTime");
case text::textfield::Type::EXTENDED_DATE:
return OUString("ExtDate");
@@ -868,15 +867,15 @@ uno::Sequence< OUString > SAL_CALL SvxUnoTextField::getSupportedServiceNames()
pServices[2] = "com.sun.star.text.TextField.Measure";
pServices[3] = "com.sun.star.text.textfield.Measure";
break;
- case text::textfield::Type::HEADER:
+ case text::textfield::Type::PRESENTATION_HEADER:
pServices[2] = "com.sun.star.presentation.TextField.Header";
pServices[3] = "com.sun.star.presentation.textfield.Header";
break;
- case text::textfield::Type::FOOTER:
+ case text::textfield::Type::PRESENTATION_FOOTER:
pServices[2] = "com.sun.star.presentation.TextField.Footer";
pServices[3] = "com.sun.star.presentation.textfield.Footer";
break;
- case text::textfield::Type::DATE_TIME:
+ case text::textfield::Type::PRESENTATION_DATE_TIME:
pServices[2] = "com.sun.star.presentation.TextField.DateTime";
pServices[3] = "com.sun.star.presentation.textfield.DateTime";
break;
diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
index efab93d..e73074a 100644
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@ -1773,15 +1773,15 @@ IMPL_LINK( SVGFilter, CalcFieldHdl, EditFieldInfo*, pInfo )
pCharSetMap = &( mTextFieldCharSets[ mCreateOjectsCurrentMasterPage ] );
}
const SvxFieldData* pField = pInfo->GetField().GetField();
- if( bHasCharSetMap && ( pField->GetClassId() == text::textfield::Type::HEADER ) && ( pCharSetMap->find( aHeaderId ) != pCharSetMap->end() ) )
+ if( bHasCharSetMap && ( pField->GetClassId() == text::textfield::Type::PRESENTATION_HEADER ) && ( pCharSetMap->find( aHeaderId ) != pCharSetMap->end() ) )
{
pCharSet = &( (*pCharSetMap)[ aHeaderId ] );
}
- else if( bHasCharSetMap && ( pField->GetClassId() == text::textfield::Type::FOOTER ) && ( pCharSetMap->find( aFooterId ) != pCharSetMap->end() ) )
+ else if( bHasCharSetMap && ( pField->GetClassId() == text::textfield::Type::PRESENTATION_FOOTER ) && ( pCharSetMap->find( aFooterId ) != pCharSetMap->end() ) )
{
pCharSet = &( (*pCharSetMap)[ aFooterId ] );
}
- else if( pField->GetClassId() == text::textfield::Type::DATE_TIME )
+ else if( pField->GetClassId() == text::textfield::Type::PRESENTATION_DATE_TIME )
{
if( bHasCharSetMap && ( pCharSetMap->find( aDateTimeId ) != pCharSetMap->end() ) )
{
@@ -1913,15 +1913,15 @@ IMPL_LINK( SVGFilter, CalcFieldHdl, EditFieldInfo*, pInfo )
if( mVisiblePagePropSet.bAreBackgroundObjectsVisible )
{
const SvxFieldData* pField = pInfo->GetField().GetField();
- if( ( pField->GetClassId() == text::textfield::Type::HEADER ) && mVisiblePagePropSet.bIsHeaderFieldVisible )
+ if( ( pField->GetClassId() == text::textfield::Type::PRESENTATION_HEADER ) && mVisiblePagePropSet.bIsHeaderFieldVisible )
{
aRepresentation += mVisiblePagePropSet.sHeaderText;
}
- else if( ( pField->GetClassId() == text::textfield::Type::FOOTER ) && mVisiblePagePropSet.bIsFooterFieldVisible )
+ else if( ( pField->GetClassId() == text::textfield::Type::PRESENTATION_FOOTER ) && mVisiblePagePropSet.bIsFooterFieldVisible )
{
aRepresentation += mVisiblePagePropSet.sFooterText;
}
- else if( ( pField->GetClassId() == text::textfield::Type::DATE_TIME ) && mVisiblePagePropSet.bIsDateTimeFieldVisible )
+ else if( ( pField->GetClassId() == text::textfield::Type::PRESENTATION_DATE_TIME ) && mVisiblePagePropSet.bIsDateTimeFieldVisible )
{
// TODO: implement the variable case
aRepresentation += mVisiblePagePropSet.sDateTimeText;
diff --git a/offapi/com/sun/star/text/textfield/Type.idl b/offapi/com/sun/star/text/textfield/Type.idl
index 29f8c4d..a9a2653 100644
--- a/offapi/com/sun/star/text/textfield/Type.idl
+++ b/offapi/com/sun/star/text/textfield/Type.idl
@@ -56,9 +56,10 @@ constants Type
const long EXTENDED_FILE = 8;
const long AUTHOR = 9;
const long MEASURE = 10;
- const long HEADER = 11;
- const long FOOTER = 12;
- const long DATE_TIME = 13;
+
+ const long PRESENTATION_HEADER = 11;
+ const long PRESENTATION_FOOTER = 12;
+ const long PRESENTATION_DATE_TIME = 13;
const long EXTENDED_DATE = 14;
};
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 6796fe7..afdbbb0 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -913,19 +913,19 @@ uno::Reference< uno::XInterface > SAL_CALL SdXImpressDocument::createInstance( c
if( (0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.TextField.Header"))) ||
(0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.textfield.Header"))) )
{
- return (::cppu::OWeakObject * )new SvxUnoTextField( text::textfield::Type::HEADER );
+ return (::cppu::OWeakObject * )new SvxUnoTextField( text::textfield::Type::PRESENTATION_HEADER );
}
if( (0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.TextField.Footer"))) ||
(0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.textfield.Footer"))) )
{
- return (::cppu::OWeakObject * )new SvxUnoTextField( text::textfield::Type::FOOTER );
+ return (::cppu::OWeakObject * )new SvxUnoTextField( text::textfield::Type::PRESENTATION_FOOTER );
}
if( (0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.TextField.DateTime"))) ||
(0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.textfield.DateTime"))) )
{
- return (::cppu::OWeakObject * )new SvxUnoTextField( text::textfield::Type::DATE_TIME );
+ return (::cppu::OWeakObject * )new SvxUnoTextField( text::textfield::Type::PRESENTATION_DATE_TIME );
}
if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.xml.NamespaceMap") ) )
commit e3df55842c4f9e37492a7b653f42b8f2b68305ef
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri May 11 01:00:59 2012 -0400
Fixed a regression on impress/draw file save losing date field format info.
Change-Id: If9e01ab91d52d21cab175bfda925e690625fac3e
diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx
index f08a820..dd3f56a 100644
--- a/editeng/source/uno/unofield.cxx
+++ b/editeng/source/uno/unofield.cxx
@@ -148,12 +148,11 @@ const SfxItemPropertySet* ImplGetFieldItemPropertySet( sal_Int32 mnId )
{
case text::textfield::Type::EXTENDED_DATE:
case text::textfield::Type::EXTENDED_TIME:
+ case text::textfield::Type::DATE:
return &aExDateTimeFieldPropertySet_Impl;
case text::textfield::Type::URL:
return &aUrlFieldPropertySet_Impl;
- case text::textfield::Type::DATE:
case text::textfield::Type::TIME:
- case text::textfield::Type::DATE_TIME:
return &aDateTimeFieldPropertySet_Impl;
case text::textfield::Type::EXTENDED_FILE:
return &aExtFileFieldPropertySet_Impl;
@@ -161,6 +160,7 @@ const SfxItemPropertySet* ImplGetFieldItemPropertySet( sal_Int32 mnId )
return &aAuthorFieldPropertySet_Impl;
case text::textfield::Type::MEASURE:
return &aMeasureFieldPropertySet_Impl;
+ case text::textfield::Type::DATE_TIME:
default:
return &aEmptyPropertySet_Impl;
}
@@ -877,13 +877,13 @@ uno::Sequence< OUString > SAL_CALL SvxUnoTextField::getSupportedServiceNames()
pServices[3] = "com.sun.star.presentation.textfield.Footer";
break;
case text::textfield::Type::DATE_TIME:
- pServices[2] = "com.sun.star.text.TextField.DateTime";
- pServices[3] = "com.sun.star.text.textfield.DateTime";
- break;
- case text::textfield::Type::EXTENDED_DATE:
pServices[2] = "com.sun.star.presentation.TextField.DateTime";
pServices[3] = "com.sun.star.presentation.textfield.DateTime";
break;
+ case text::textfield::Type::EXTENDED_DATE:
+ pServices[2] = "com.sun.star.text.TextField.DateTime";
+ pServices[3] = "com.sun.star.text.textfield.DateTime";
+ break;
default:
aSeq.realloc(0);
}
commit 17b900c657cac6a510ed63e0ff8eb74a33dcc8db
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Thu May 10 20:31:36 2012 -0400
Added UNSPECIFIED to textfield::Type.
Change-Id: I28fbab54ba71f01b989a47ab357583113e85fccb
diff --git a/editeng/inc/editeng/flditem.hxx b/editeng/inc/editeng/flditem.hxx
index 03a2cac..40ba0e2 100644
--- a/editeng/inc/editeng/flditem.hxx
+++ b/editeng/inc/editeng/flditem.hxx
@@ -57,7 +57,7 @@ public:
static SvxFieldData* Create(const com::sun::star::uno::Reference<com::sun::star::text::XTextContent>& xContent);
- SV_DECL_PERSIST1( SvxFieldData, SvPersistBase, UNKNOWN_FIELD)
+ SV_DECL_PERSIST1( SvxFieldData, SvPersistBase, com::sun::star::text::textfield::Type::UNSPECIFIED)
SvxFieldData();
virtual ~SvxFieldData();
diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx
index 0290ad4..36ba686 100644
--- a/editeng/source/items/flditem.cxx
+++ b/editeng/source/items/flditem.cxx
@@ -49,8 +49,6 @@ 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 975ab15..f08a820 100644
--- a/editeng/source/uno/unofield.cxx
+++ b/editeng/source/uno/unofield.cxx
@@ -313,7 +313,7 @@ SvxUnoTextField::SvxUnoTextField( uno::Reference< text::XTextRange > xAnchor, co
: OComponentHelper( getMutex() )
, mxAnchor( xAnchor )
, mpPropSet(NULL)
-, mnServiceId(SvxFieldData::UNKNOWN_FIELD)
+, mnServiceId(text::textfield::Type::UNSPECIFIED)
, mpImpl( new SvxUnoFieldData_Impl )
{
DBG_ASSERT(pData, "pFieldData == NULL! [CL]" );
@@ -323,8 +323,8 @@ SvxUnoTextField::SvxUnoTextField( uno::Reference< text::XTextRange > xAnchor, co
if(pData)
{
mnServiceId = pData->GetClassId();
- DBG_ASSERT(mnServiceId != SvxFieldData::UNKNOWN_FIELD, "unknown SvxFieldData! [CL]");
- if (mnServiceId != SvxFieldData::UNKNOWN_FIELD)
+ DBG_ASSERT(mnServiceId != text::textfield::Type::UNSPECIFIED, "unknown SvxFieldData! [CL]");
+ if (mnServiceId != text::textfield::Type::UNSPECIFIED)
{
// extract field properties from data class
switch( mnServiceId )
@@ -911,7 +911,7 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoTextCreateTextField( const ::rt
{
OUString aFieldType( ServiceSpecifier.copy( aTextFieldPrexit.getLength() ) );
- sal_Int32 nId = SvxFieldData::UNKNOWN_FIELD;
+ sal_Int32 nId = text::textfield::Type::UNSPECIFIED;
if ( aFieldType == "DateTime" )
{
@@ -953,7 +953,7 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoTextCreateTextField( const ::rt
nId = text::textfield::Type::MEASURE;
}
- if (nId != SvxFieldData::UNKNOWN_FIELD)
+ if (nId != text::textfield::Type::UNSPECIFIED)
xRet = (::cppu::OWeakObject * )new SvxUnoTextField( nId );
}
diff --git a/offapi/com/sun/star/text/textfield/Type.idl b/offapi/com/sun/star/text/textfield/Type.idl
index fe99a91..29f8c4d 100644
--- a/offapi/com/sun/star/text/textfield/Type.idl
+++ b/offapi/com/sun/star/text/textfield/Type.idl
@@ -43,6 +43,8 @@ module com { module sun { module star { module text { module textfield {
*/
constants Type
{
+ const long UNSPECIFIED = -1;
+
const long DATE = 0;
const long URL = 1;
const long PAGE = 2;
@@ -54,10 +56,11 @@ constants Type
const long EXTENDED_FILE = 8;
const long AUTHOR = 9;
const long MEASURE = 10;
- const long EXTENDED_DATE = 11;
- const long HEADER = 12;
- const long FOOTER = 13;
- const long DATE_TIME = 14;
+ const long HEADER = 11;
+ const long FOOTER = 12;
+ const long DATE_TIME = 13;
+
+ const long EXTENDED_DATE = 14;
};
}; }; }; }; };
diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx
index 7bc82b7..7f36dfb 100644
--- a/sc/source/ui/unoobj/fielduno.cxx
+++ b/sc/source/ui/unoobj/fielduno.cxx
@@ -206,7 +206,7 @@ ScUnoEditEngine::ScUnoEditEngine(ScEditEngineDefaulter* pSource) :
ScEditEngineDefaulter( *pSource ),
eMode( SC_UNO_COLLECT_NONE ),
nFieldCount( 0 ),
- mnFieldType(SvxFieldData::UNKNOWN_FIELD),
+ mnFieldType(text::textfield::Type::UNSPECIFIED),
pFound( NULL )
{
if (pSource)
@@ -231,7 +231,7 @@ String ScUnoEditEngine::CalcFieldValue( const SvxFieldItem& rField,
const SvxFieldData* pFieldData = rField.GetField();
if ( pFieldData )
{
- if (mnFieldType == SvxFieldData::UNKNOWN_FIELD || pFieldData->GetClassId() == mnFieldType)
+ if (mnFieldType == text::textfield::Type::UNSPECIFIED || pFieldData->GetClassId() == mnFieldType)
{
if ( eMode == SC_UNO_COLLECT_FINDINDEX && !pFound && nFieldCount == nFieldIndex )
{
@@ -255,7 +255,7 @@ String ScUnoEditEngine::CalcFieldValue( const SvxFieldItem& rField,
sal_uInt16 ScUnoEditEngine::CountFields()
{
eMode = SC_UNO_COLLECT_COUNT;
- mnFieldType = SvxFieldData::UNKNOWN_FIELD;
+ mnFieldType = text::textfield::Type::UNSPECIFIED;
nFieldCount = 0;
UpdateFields();
eMode = SC_UNO_COLLECT_NONE;
@@ -267,7 +267,7 @@ SvxFieldData* ScUnoEditEngine::FindByIndex(sal_uInt16 nIndex)
{
eMode = SC_UNO_COLLECT_FINDINDEX;
nFieldIndex = nIndex;
- mnFieldType = SvxFieldData::UNKNOWN_FIELD;
+ mnFieldType = text::textfield::Type::UNSPECIFIED;
nFieldCount = 0;
UpdateFields();
eMode = SC_UNO_COLLECT_NONE;
@@ -283,7 +283,7 @@ SvxFieldData* ScUnoEditEngine::FindByPos(sal_uInt16 nPar, xub_StrLen nPos, sal_I
mnFieldType = nType;
nFieldCount = 0;
UpdateFields();
- mnFieldType = SvxFieldData::UNKNOWN_FIELD;
+ mnFieldType = text::textfield::Type::UNSPECIFIED;
eMode = SC_UNO_COLLECT_NONE;
return pFound;
@@ -718,7 +718,7 @@ void ScEditFieldObj::setPropertyValueURL(const rtl::OUString& rName, const com::
// Typ egal (in Zellen gibts nur URLs)
SvxFieldData* pField = aTempEngine.FindByPos(
- aSelection.nStartPara, aSelection.nStartPos, SvxFieldData::UNKNOWN_FIELD);
+ aSelection.nStartPara, aSelection.nStartPos, text::textfield::Type::UNSPECIFIED);
OSL_ENSURE(pField,"setPropertyValue: Feld nicht gefunden");
if (!pField)
return;
@@ -791,7 +791,7 @@ uno::Any ScEditFieldObj::getPropertyValueURL(const rtl::OUString& rName)
// Typ egal (in Zellen gibts nur URLs)
const SvxFieldData* pField = aTempEngine.FindByPos(
- aSelection.nStartPara, aSelection.nStartPos, SvxFieldData::UNKNOWN_FIELD);
+ aSelection.nStartPara, aSelection.nStartPos, text::textfield::Type::UNSPECIFIED);
OSL_ENSURE(pField,"getPropertyValue: Feld nicht gefunden");
if (!pField)
throw uno::RuntimeException();
@@ -1105,7 +1105,7 @@ void ScEditFieldObj::setPropertyValueSheet(const rtl::OUString& rName, const uno
// Typ egal (in Zellen gibts nur URLs)
SvxFieldData* pField = aTempEngine.FindByPos(
- aSelection.nStartPara, aSelection.nStartPos, SvxFieldData::UNKNOWN_FIELD);
+ aSelection.nStartPara, aSelection.nStartPos, text::textfield::Type::UNSPECIFIED);
OSL_ENSURE(pField,"setPropertyValue: Feld nicht gefunden");
if (!pField)
return;
@@ -1245,7 +1245,7 @@ rtl::OUString SAL_CALL ScEditFieldObj::getPresentation( sal_Bool bShowCommand )
// Typ egal (in Zellen gibts nur URLs)
const SvxFieldData* pField = aTempEngine.FindByPos(
- aSelection.nStartPara, aSelection.nStartPos, SvxFieldData::UNKNOWN_FIELD);
+ aSelection.nStartPara, aSelection.nStartPos, text::textfield::Type::UNSPECIFIED);
OSL_ENSURE(pField,"getPresentation: Feld nicht gefunden");
if (!pField)
return rtl::OUString();
commit 328be2536f5911dabb2ae504dc2f4fc348fc994e
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Thu May 10 19:49:05 2012 -0400
Return correct presentation strings for fields.
Change-Id: Icab3910f49639fff1551dfdb5be9341bd3ea70b1
diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx
index a530c6b..975ab15 100644
--- a/editeng/source/uno/unofield.cxx
+++ b/editeng/source/uno/unofield.cxx
@@ -166,25 +166,6 @@ const SfxItemPropertySet* ImplGetFieldItemPropertySet( sal_Int32 mnId )
}
}
-static sal_Char const* aFieldItemNameMap_Impl[] =
-{
- "Date",
- "URL",
- "Page",
- "Pages",
- "Time",
- "File",
- "Table",
- "ExtTime",
- "ExtFile",
- "Author",
- "Measure",
- "ExtDate",
- "Header",
- "Footer",
- "DateTime"
-};
-
/* conversion routines */
static sal_Int16 getFileNameDisplayFormat( SvxFileFormat nFormat )
@@ -618,14 +599,43 @@ OUString SAL_CALL SvxUnoTextField::getPresentation( sal_Bool bShowCommand )
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
-
- if(bShowCommand)
+ if (bShowCommand)
{
- DBG_ASSERT(mnServiceId >= 0, "Unknown field type");
- if (isValidFieldId(mnServiceId))
- return OUString::createFromAscii(aFieldItemNameMap_Impl[mnServiceId]);
- else
- return OUString("Unknown");
+ switch (mnServiceId)
+ {
+ case text::textfield::Type::DATE:
+ return OUString("Date");
+ case text::textfield::Type::URL:
+ return OUString("URL");
+ case text::textfield::Type::PAGE:
+ return OUString("Page");
+ case text::textfield::Type::PAGES:
+ return OUString("Pages");
+ case text::textfield::Type::TIME:
+ return OUString("Time");
+ case text::textfield::Type::FILE:
+ return OUString("File");
+ case text::textfield::Type::TABLE:
+ return OUString("Table");
+ case text::textfield::Type::EXTENDED_TIME:
+ return OUString("ExtTime");
+ case text::textfield::Type::EXTENDED_FILE:
+ return OUString("ExtFile");
+ case text::textfield::Type::AUTHOR:
+ return OUString("Author");
+ case text::textfield::Type::MEASURE:
+ return OUString("Measure");
+ case text::textfield::Type::HEADER:
+ return OUString("Header");
+ case text::textfield::Type::FOOTER:
+ return OUString("Footer");
+ case text::textfield::Type::DATE_TIME:
+ return OUString("DateTime");
+ case text::textfield::Type::EXTENDED_DATE:
+ return OUString("ExtDate");
+ default:
+ return OUString("Unknown");
+ }
}
else
{
commit 89d8f039af90b7f8f4d616abcfbcf4e3874d874d
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Thu May 10 19:34:00 2012 -0400
Return the correct service names for each field type.
Change-Id: I1b6261d09dfc42913070ffd2f797688587ab7a8b
diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx
index b0a51eb..a530c6b 100644
--- a/editeng/source/uno/unofield.cxx
+++ b/editeng/source/uno/unofield.cxx
@@ -153,6 +153,7 @@ const SfxItemPropertySet* ImplGetFieldItemPropertySet( sal_Int32 mnId )
return &aUrlFieldPropertySet_Impl;
case text::textfield::Type::DATE:
case text::textfield::Type::TIME:
+ case text::textfield::Type::DATE_TIME:
return &aDateTimeFieldPropertySet_Impl;
case text::textfield::Type::EXTENDED_FILE:
return &aExtFileFieldPropertySet_Impl;
@@ -803,53 +804,79 @@ OUString SAL_CALL SvxUnoTextField::getImplementationName() throw(uno::RuntimeExc
return OUString(RTL_CONSTASCII_USTRINGPARAM("SvxUnoTextField"));
}
-static const sal_Char* pOldServiceNames[] =
-{
- "com.sun.star.text.TextField.DateTime",
- "com.sun.star.text.TextField.URL",
- "com.sun.star.text.TextField.PageNumber",
- "com.sun.star.text.TextField.PageCount",
- "com.sun.star.text.TextField.DateTime",
- "com.sun.star.text.TextField.DocInfo.Title", // SvxFileField is used for title
- "com.sun.star.text.TextField.SheetName",
- "com.sun.star.text.TextField.DateTime",
- "com.sun.star.text.TextField.FileName",
- "com.sun.star.text.TextField.Author",
- "com.sun.star.text.TextField.Measure",
- "com.sun.star.text.TextField.DateTime",
- "com.sun.star.presentation.TextField.Header",
- "com.sun.star.presentation.TextField.Footer",
- "com.sun.star.presentation.TextField.DateTime"
-};
-
-static const sal_Char* pNewServiceNames[] =
-{
- "com.sun.star.text.textfield.DateTime",
- "com.sun.star.text.textfield.URL",
- "com.sun.star.text.textfield.PageNumber",
- "com.sun.star.text.textfield.PageCount",
- "com.sun.star.text.textfield.DateTime",
- "com.sun.star.text.textfield.docinfo.Title", // SvxFileField is used for title
- "com.sun.star.text.textfield.SheetName",
- "com.sun.star.text.textfield.DateTime",
- "com.sun.star.text.textfield.FileName",
- "com.sun.star.text.textfield.Author",
- "com.sun.star.text.textfield.Measure",
- "com.sun.star.text.textfield.DateTime",
- "com.sun.star.presentation.textfield.Header",
- "com.sun.star.presentation.textfield.Footer",
- "com.sun.star.presentation.textfield.DateTime"
-};
-
uno::Sequence< OUString > SAL_CALL SvxUnoTextField::getSupportedServiceNames()
throw(uno::RuntimeException)
{
- uno::Sequence< OUString > aSeq( 4 );
+ uno::Sequence<OUString> aSeq(4);
OUString* pServices = aSeq.getArray();
- pServices[0] = OUString::createFromAscii( pNewServiceNames[mnServiceId] );
- pServices[1] = OUString::createFromAscii( pOldServiceNames[mnServiceId] );
- pServices[2] = OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextContent" )),
- pServices[3] = OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextField" ));
+ pServices[0] = "com.sun.star.text.TextContent";
+ pServices[1] = "com.sun.star.text.TextField";
+
+ switch (mnServiceId)
+ {
+ case text::textfield::Type::DATE:
+ pServices[2] = "com.sun.star.text.TextField.DateTime";
+ pServices[3] = "com.sun.star.text.textfield.DateTime";
+ break;
+ case text::textfield::Type::URL:
+ pServices[2] = "com.sun.star.text.TextField.URL";
+ pServices[3] = "com.sun.star.text.textfield.URL";
+ break;
+ case text::textfield::Type::PAGE:
+ pServices[2] = "com.sun.star.text.TextField.PageNumber";
+ pServices[3] = "com.sun.star.text.textfield.PageNumber";
+ break;
+ case text::textfield::Type::PAGES:
+ pServices[2] = "com.sun.star.text.TextField.PageCount";
+ pServices[3] = "com.sun.star.text.textfield.PageCount";
+ break;
+ case text::textfield::Type::TIME:
+ pServices[2] = "com.sun.star.text.TextField.DateTime";
+ pServices[3] = "com.sun.star.text.textfield.DateTime";
+ break;
+ case text::textfield::Type::FILE:
+ pServices[2] = "com.sun.star.text.TextField.docinfo.Title";
+ pServices[3] = "com.sun.star.text.textfield.docinfo.Title";
+ break;
+ case text::textfield::Type::TABLE:
+ pServices[2] = "com.sun.star.text.TextField.SheetName";
+ pServices[3] = "com.sun.star.text.textfield.SheetName";
+ break;
+ case text::textfield::Type::EXTENDED_TIME:
+ pServices[2] = "com.sun.star.text.TextField.DateTime";
+ pServices[3] = "com.sun.star.text.textfield.DateTime";
+ break;
+ case text::textfield::Type::EXTENDED_FILE:
+ pServices[2] = "com.sun.star.text.TextField.FileName";
+ pServices[3] = "com.sun.star.text.textfield.FileName";
+ break;
+ case text::textfield::Type::AUTHOR:
+ pServices[2] = "com.sun.star.text.TextField.Author";
+ pServices[3] = "com.sun.star.text.textfield.Author";
+ break;
+ case text::textfield::Type::MEASURE:
+ pServices[2] = "com.sun.star.text.TextField.Measure";
+ pServices[3] = "com.sun.star.text.textfield.Measure";
+ break;
+ case text::textfield::Type::HEADER:
+ pServices[2] = "com.sun.star.presentation.TextField.Header";
+ pServices[3] = "com.sun.star.presentation.textfield.Header";
+ break;
+ case text::textfield::Type::FOOTER:
+ pServices[2] = "com.sun.star.presentation.TextField.Footer";
+ pServices[3] = "com.sun.star.presentation.textfield.Footer";
+ break;
+ case text::textfield::Type::DATE_TIME:
+ pServices[2] = "com.sun.star.text.TextField.DateTime";
+ pServices[3] = "com.sun.star.text.textfield.DateTime";
+ break;
+ case text::textfield::Type::EXTENDED_DATE:
+ pServices[2] = "com.sun.star.presentation.TextField.DateTime";
+ pServices[3] = "com.sun.star.presentation.textfield.DateTime";
+ break;
+ default:
+ aSeq.realloc(0);
+ }
return aSeq;
}
More information about the Libreoffice-commits
mailing list