diff options
author | Michael Stahl <mst@openoffice.org> | 2010-03-09 13:27:18 +0100 |
---|---|---|
committer | Michael Stahl <mst@openoffice.org> | 2010-03-09 13:27:18 +0100 |
commit | 472bb4e289943b9c83b52a82a99fcbe52c8a6963 (patch) | |
tree | 10613fedaeba016f2a18dcd69698f9727a7f673c | |
parent | 310be1160a7205e11967b8cc5a0ad1669343538d (diff) |
odfmetadata4: #i109601#: add cursor property "NestedTextContent":
cmdid.h: add FN_UNO_NESTED_TEXT_CONTENT.
SwUnoCursorHelper: add GetNestedTextContent().
enum SwPropNameIds: add UNO_NAME_NESTED_TEXT_CONTENT.
SwUnoCursorHelper::getCrsrPropertyValue(): handle "NestedTextContent".
-rw-r--r-- | sw/inc/cmdid.h | 1 | ||||
-rw-r--r-- | sw/inc/unocrsrhelper.hxx | 6 | ||||
-rw-r--r-- | sw/inc/unoprnms.hxx | 5 | ||||
-rw-r--r-- | sw/source/core/unocore/unocrsrhelper.cxx | 48 | ||||
-rw-r--r-- | sw/source/core/unocore/unomap.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/unocore/unoprnms.cxx | 1 |
6 files changed, 60 insertions, 4 deletions
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index c8defcc78a42..3adc03dc13a5 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -907,6 +907,7 @@ Achtung: Ab sofort sind in diesem File keine C++-Kommentare (//) mehr #define FN_UNO_PARA_NUM_STRING (FN_EXTRA2 + 110) #define FN_UNO_TABLE_NAME (FN_EXTRA2 + 111) #define FN_UNO_META (FN_EXTRA2 + 112) +#define FN_UNO_NESTED_TEXT_CONTENT (FN_EXTRA2 + 113) /*-------------------------------------------------------------------- Bereich: Hilfe diff --git a/sw/inc/unocrsrhelper.hxx b/sw/inc/unocrsrhelper.hxx index e3ced236d10c..ae3b278c77b9 100644 --- a/sw/inc/unocrsrhelper.hxx +++ b/sw/inc/unocrsrhelper.hxx @@ -55,6 +55,9 @@ namespace com{ namespace sun{ namespace star{ namespace beans{ struct PropertyValue; } + namespace text { + class XTextContent; + } }}} /* -----------------03.12.98 12:16------------------- @@ -84,6 +87,9 @@ namespace SwUnoCursorHelper bool FillValue( USHORT nWhichId, USHORT nMemberId, const com::sun::star::uno::Any*& pAny ); }; + ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > + GetNestedTextContent(SwTxtNode & rTextNode, xub_StrLen const nIndex); + sal_Bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry , SwPaM& rPam , com::sun::star::uno::Any *pAny diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx index 46087df2b62c..0ea5fa9db598 100644 --- a/sw/inc/unoprnms.hxx +++ b/sw/inc/unoprnms.hxx @@ -805,9 +805,8 @@ enum SwPropNameIds /* 0737 */ UNO_NAME_DESCRIPTION, // <-- /* 0738 */ UNO_NAME_META, // #i91565# -/* 0739 */ UNO_NAME_IS_TEMPLATE, -/* 0740 */ UNO_NAME_VBA_DOCOBJ, -/* 0741 */ SW_PROPNAME_END +/* 0739 */ UNO_NAME_NESTED_TEXT_CONTENT, // #i109601# +/* 0740 */ SW_PROPNAME_END }; diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index 1761c64b351d..41993df65b73 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -88,6 +88,8 @@ // --> OD 2008-11-26 #158694# #include <SwNodeNum.hxx> // <-- +#include <fmtmeta.hxx> + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -102,6 +104,34 @@ using ::rtl::OUString; namespace SwUnoCursorHelper { +uno::Reference<text::XTextContent> +GetNestedTextContent(SwTxtNode & rTextNode, xub_StrLen const nIndex) +{ + // these should be unambiguous because of the dummy character + SwTxtAttr *const pMetaTxtAttr = + rTextNode.GetTxtAttrAt(nIndex, RES_TXTATR_META, true); + SwTxtAttr *const pMetaFieldTxtAttr = + rTextNode.GetTxtAttrAt(nIndex, RES_TXTATR_METAFIELD, true); + // which is innermost? + SwTxtAttr *const pTxtAttr = (pMetaTxtAttr) + ? ((pMetaFieldTxtAttr) + ? ((*pMetaFieldTxtAttr->GetStart() > + *pMetaTxtAttr->GetStart()) + ? pMetaFieldTxtAttr : pMetaTxtAttr) + : pMetaTxtAttr) + : pMetaFieldTxtAttr; + uno::Reference<XTextContent> xRet; + if (pTxtAttr) + { + ::sw::Meta *const pMeta( + static_cast<SwFmtMeta &>(pTxtAttr->GetAttr()).GetMeta()); + OSL_ASSERT(pMeta); + xRet.set(pMeta->MakeUnoObject(), uno::UNO_QUERY); + } + return xRet; +} + + /* -----------------16.09.98 12:27------------------- * Lesen spezieller Properties am Cursor * --------------------------------------------------*/ @@ -478,6 +508,24 @@ sal_Bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry eNewState = PropertyState_DEFAULT_VALUE; } break; + case FN_UNO_NESTED_TEXT_CONTENT: + { + uno::Reference<XTextContent> const xRet( + GetNestedTextContent(*rPam.GetNode()->GetTxtNode(), + rPam.GetPoint()->nContent.GetIndex())); + if (xRet.is()) + { + if (pAny) + { + (*pAny) <<= xRet; + } + } + else + { + eNewState = PropertyState_DEFAULT_VALUE; + } + } + break; case FN_UNO_CHARFMT_SEQUENCE: { diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx index 94d1f47fff12..765b1ae37485 100644 --- a/sw/source/core/unocore/unomap.cxx +++ b/sw/source/core/unocore/unomap.cxx @@ -279,10 +279,11 @@ SwUnoPropertyMapProvider::~SwUnoPropertyMapProvider() COMMON_CRSR_PARA_PROPERTIES\ { SW_PROP_NMID(UNO_NAME_DOCUMENT_INDEX_MARK), FN_UNO_DOCUMENT_INDEX_MARK, CPPU_E2T(CPPUTYPE_REFDOCIDXMRK), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 },\ { SW_PROP_NMID(UNO_NAME_TEXT_FIELD), FN_UNO_TEXT_FIELD, CPPU_E2T(CPPUTYPE_REFTXTFIELD), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 },\ - { SW_PROP_NMID(UNO_NAME_REFERENCE_MARK), FN_UNO_REFERENCE_MARK, CPPU_E2T(CPPUTYPE_REFTEXTCNTNT), PropertyAttribute::MAYBEVOID ,0 },\ + { SW_PROP_NMID(UNO_NAME_REFERENCE_MARK), FN_UNO_REFERENCE_MARK, CPPU_E2T(CPPUTYPE_REFTEXTCNTNT), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0 },\ { SW_PROP_NMID(UNO_NAME_FOOTNOTE), FN_UNO_FOOTNOTE, CPPU_E2T(CPPUTYPE_REFFOOTNOTE), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 },\ { SW_PROP_NMID(UNO_NAME_ENDNOTE), FN_UNO_ENDNOTE, CPPU_E2T(CPPUTYPE_REFFOOTNOTE), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 },\ { SW_PROP_NMID(UNO_NAME_HYPER_LINK_EVENTS), RES_TXTATR_INETFMT, CPPU_E2T(CPPUTYPE_REFNMREPLACE), PropertyAttribute::MAYBEVOID, MID_URL_HYPERLINKEVENTS},\ + { SW_PROP_NMID(UNO_NAME_NESTED_TEXT_CONTENT), FN_UNO_NESTED_TEXT_CONTENT, CPPU_E2T(CPPUTYPE_REFTEXTCNTNT), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0 },\ TABSTOPS_MAP_ENTRY diff --git a/sw/source/core/unocore/unoprnms.cxx b/sw/source/core/unocore/unoprnms.cxx index f049764a2b23..049ccfe42ed7 100644 --- a/sw/source/core/unocore/unoprnms.cxx +++ b/sw/source/core/unocore/unoprnms.cxx @@ -778,6 +778,7 @@ const SwPropNameTab aPropNameTab = { /* 0736 UNO_NAME_OUTLINE_LEVEL */ {MAP_CHAR_LEN("OutlineLevel")},//#outline level,add<-zhaojianwei Outlinelevel /* 0737 UNO_NAME_DESCRIPTION */ {MAP_CHAR_LEN("Description")}, /* 0738 UNO_NAME_META */ {MAP_CHAR_LEN("InContentMetadata")}, +/* 0739 UNO_NAME_NESTED_TEXT_CONTENT */ {MAP_CHAR_LEN("NestedTextContent")}, }; const SwPropNameLen& SwGetPropName( USHORT nId ) |