diff options
author | Rüdiger Timm <rt@openoffice.org> | 2008-09-04 09:22:46 +0000 |
---|---|---|
committer | Rüdiger Timm <rt@openoffice.org> | 2008-09-04 09:22:46 +0000 |
commit | fa21e6249822611f504e2539a283b39ce28ff4e1 (patch) | |
tree | 01e0bfd51d527670b3445aa4652a605840f17f3a | |
parent | 4126104867709da30b1a8391b4345688084eace7 (diff) |
INTEGRATION: CWS swenhancedfields2 (1.15.18); FILE MERGED
2008/08/12 12:09:46 b_michaelsen 1.15.18.5: explicit casts to prevent win32 warnings
2008/08/07 11:51:12 b_michaelsen 1.15.18.4: fixed formatting in trvlfrm.cxx portxt.cxx portxt.hxx swfont.cxx unobkm.cxx unocoll.cxx amd unoportenum.cxx
2008/08/04 14:18:01 b_michaelsen 1.15.18.3: RESYNC: (1.15-1.16); FILE MERGED
2008/04/24 12:15:33 ama 1.15.18.2: #33737#: Enhanced fields
2008/04/23 14:29:19 ama 1.15.18.1: #i33737#: Enhanced fields
-rw-r--r-- | sw/source/core/unocore/unobkm.cxx | 122 |
1 files changed, 115 insertions, 7 deletions
diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx index 906e54f2b8e0..62feb7f2d3d5 100644 --- a/sw/source/core/unocore/unobkm.cxx +++ b/sw/source/core/unocore/unobkm.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: unobkm.cxx,v $ - * $Revision: 1.16 $ + * $Revision: 1.17 $ * * This file is part of OpenOffice.org. * @@ -101,7 +101,7 @@ SwXBookmark::~SwXBookmark() /*-- 10.12.98 10:14:39--------------------------------------------------- -----------------------------------------------------------------------*/ -void SwXBookmark::attachToRange(const uno::Reference< text::XTextRange > & xTextRange) +void SwXBookmark::attachToRangeEx(const uno::Reference< text::XTextRange > & xTextRange, IDocumentBookmarkAccess::BookmarkType eMark) throw( lang::IllegalArgumentException, uno::RuntimeException ) { if(!bIsDescriptor) @@ -134,15 +134,14 @@ void SwXBookmark::attachToRange(const uno::Reference< text::XTextRange > & xText m_aName = C2S("Bookmark"); // --> OD 2007-10-23 #i81002# // determine bookmark type due to its proposed name - IDocumentBookmarkAccess::BookmarkType eBkmkType = - pDoc->isCrossRefBookmarkName( m_aName ) - ? IDocumentBookmarkAccess::CROSSREF_BOOKMARK - : IDocumentBookmarkAccess::BOOKMARK; + if( eMark == IDocumentBookmarkAccess::BOOKMARK && + pDoc->isCrossRefBookmarkName( m_aName ) ) + eMark = IDocumentBookmarkAccess::CROSSREF_BOOKMARK; // <-- if( USHRT_MAX != pDoc->findBookmark(m_aName) ) pDoc->makeUniqueBookmarkName( m_aName ); KeyCode aCode; - pBkm = pDoc->makeBookmark( aPam, aCode, m_aName, aEmptyStr, eBkmkType); + pBkm = pDoc->makeBookmark( aPam, aCode, m_aName, aEmptyStr, eMark); // --> OD 2007-10-23 #i81002# // Check, if bookmark has been created. // E.g., the creation of a cross-reference bookmark is suppress, @@ -163,6 +162,115 @@ void SwXBookmark::attachToRange(const uno::Reference< text::XTextRange > & xText else throw lang::IllegalArgumentException(); } + +void SwXBookmark::attachToRange(const uno::Reference< text::XTextRange > & xTextRange) + throw( lang::IllegalArgumentException, uno::RuntimeException ) +{ + attachToRangeEx(xTextRange, IDocumentBookmarkAccess::BOOKMARK); +} + +SwXFieldmark::SwXFieldmark(bool _isReplacementObject, SwBookmark* pBkm, SwDoc* pDc) + : SwXFieldmark_BASE(pBkm, pDc) + , isReplacementObject(_isReplacementObject) +{ } + + +void SwXFieldmark::attachToRange(const uno::Reference< text::XTextRange > & xTextRange) + throw( lang::IllegalArgumentException, uno::RuntimeException ) +{ + attachToRangeEx(xTextRange, (isReplacementObject?IDocumentBookmarkAccess::FORM_FIELDMARK_NO_TEXT:IDocumentBookmarkAccess::FORM_FIELDMARK_TEXT)); +} + +::rtl::OUString SwXFieldmark::getDescription(void) throw( ::com::sun::star::uno::RuntimeException ) +{ + vos::OGuard aGuard(Application::GetSolarMutex()); + SwFieldBookmark* pBkm = (SwFieldBookmark*)GetBookmark(); + OUString sRet; + if(pBkm) + sRet = pBkm->GetFFHelpText(); + /* //@TODO implement... + else if(bIsDescriptor) + sRet = m_aName; + */ + else + throw uno::RuntimeException(); + return sRet; +} + +::sal_Int16 SAL_CALL SwXFieldmark::getType( ) throw (::com::sun::star::uno::RuntimeException) +{ + vos::OGuard aGuard(Application::GetSolarMutex()); + SwFieldBookmark* pBkm = (SwFieldBookmark*)GetBookmark(); + ::sal_Int16 sRet; + if(pBkm) + sRet = static_cast<sal_Int16>(pBkm->GetFieldType()); + /* //@TODO implement... + else if(bIsDescriptor) + sRet = m_aName; + */ + else + throw uno::RuntimeException(); + return sRet; +} + +::sal_Int16 SAL_CALL SwXFieldmark::getRes( ) throw (::com::sun::star::uno::RuntimeException) +{ + vos::OGuard aGuard(Application::GetSolarMutex()); + SwFieldBookmark* pBkm = (SwFieldBookmark*)GetBookmark(); + ::sal_Int16 sRet; + if(pBkm) + sRet = static_cast<sal_Int16>(pBkm->GetFFRes()); + /* //@TODO implement... + else if(bIsDescriptor) + sRet = m_aName; + */ + else + throw uno::RuntimeException(); + return sRet; +} + + +void SAL_CALL SwXFieldmark::setType( ::sal_Int16 fieldType ) throw (::com::sun::star::uno::RuntimeException) +{ + vos::OGuard aGuard(Application::GetSolarMutex()); + SwFieldBookmark* pBkm = (SwFieldBookmark*)GetBookmark(); + if (pBkm) + pBkm->SetFieldType(fieldType); + else + throw uno::RuntimeException(); +} + +void SAL_CALL SwXFieldmark::setRes( ::sal_Int16 res ) throw (::com::sun::star::uno::RuntimeException) +{ + vos::OGuard aGuard(Application::GetSolarMutex()); + SwFieldBookmark* pBkm = (SwFieldBookmark*)GetBookmark(); + if (pBkm) + pBkm->SetFFRes(res); + else + throw uno::RuntimeException(); +} + +void SAL_CALL SwXFieldmark::setDescription( const ::rtl::OUString& description ) throw (::com::sun::star::uno::RuntimeException) +{ + vos::OGuard aGuard(Application::GetSolarMutex()); + SwFieldBookmark* pBkm = (SwFieldBookmark*)GetBookmark(); + if (pBkm) + pBkm->SetFFHelpText(description); + else + throw uno::RuntimeException(); +} + + + +/* + +::com::sun::star::uno::Any SAL_CALL SwXFieldmark::queryInterface( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException) +{ + return SwXBookmark::queryInterface(rType); +} +*/ + + /* -----------------18.02.99 13:31------------------- * * --------------------------------------------------*/ |