diff options
author | Oliver Specht <os@openoffice.org> | 2001-06-20 12:08:26 +0000 |
---|---|---|
committer | Oliver Specht <os@openoffice.org> | 2001-06-20 12:08:26 +0000 |
commit | 27105bb12a68d69426cec3a1638a9df6fcd49b7d (patch) | |
tree | 7b25469c78cf17c1804c7d716cdcc22290809852 /sw/source/core/unocore/unoport.cxx | |
parent | 942fcaff22e3bac85fd0ea9fc4b93a64734d87e0 (diff) |
#87306# ruby properties corrected
Diffstat (limited to 'sw/source/core/unocore/unoport.cxx')
-rw-r--r-- | sw/source/core/unocore/unoport.cxx | 135 |
1 files changed, 59 insertions, 76 deletions
diff --git a/sw/source/core/unocore/unoport.cxx b/sw/source/core/unocore/unoport.cxx index 19077d70b261..2aa828c8222b 100644 --- a/sw/source/core/unocore/unoport.cxx +++ b/sw/source/core/unocore/unoport.cxx @@ -2,9 +2,9 @@ * * $RCSfile: unoport.cxx,v $ * - * $Revision: 1.16 $ + * $Revision: 1.17 $ * - * last change: $Author: jp $ $Date: 2001-06-13 12:57:43 $ + * last change: $Author: os $ $Date: 2001-06-20 13:08:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -160,7 +160,11 @@ SwXTextPortion::SwXTextPortion(const SwUnoCrsr* pPortionCrsr, uno::Reference< XT pFrameFmt(0), aFrameDepend(this, 0), bIsCollapsed(FALSE), - nControlChar(0) + nControlChar(0), + pRubyText(0), + pRubyStyle(0), + pRubyAdjust(0), + pRubyIsAbove(0) { SwUnoCrsr* pUnoCrsr = pPortionCrsr->GetDoc()->CreateUnoCrsr(*pPortionCrsr->GetPoint()); if(pPortionCrsr->HasMark()) @@ -188,7 +192,11 @@ SwXTextPortion::SwXTextPortion(const SwUnoCrsr* pPortionCrsr, uno::Reference< XT pFmtFld(0), aFrameDepend(this, &rFmt), bIsCollapsed(FALSE), - nControlChar(0) + nControlChar(0), + pRubyText(0), + pRubyStyle(0), + pRubyAdjust(0), + pRubyIsAbove(0) { SwUnoCrsr* pUnoCrsr = pPortionCrsr->GetDoc()->CreateUnoCrsr(*pPortionCrsr->GetPoint()); if(pPortionCrsr->HasMark()) @@ -206,6 +214,10 @@ SwXTextPortion::~SwXTextPortion() { SwUnoCrsr* pUnoCrsr = GetCrsr(); delete pUnoCrsr; + delete pRubyText; + delete pRubyStyle; + delete pRubyAdjust; + delete pRubyIsAbove; } /*-- 11.12.98 09:56:56--------------------------------------------------- @@ -426,6 +438,20 @@ void SwXTextPortion::GetPropertyValues( const OUString *pPropertyNames, pValues[nProp].setValue(&bStart, ::getBooleanCppuType()); } break; + case RES_TXTATR_CJK_RUBY: + { + Any* pToSet = 0; + switch(pMap->nMemberId) + { + case MID_RUBY_TEXT : pToSet = pRubyText; break; + case MID_RUBY_ADJUST : pToSet = pRubyAdjust; break; + case MID_RUBY_CHARSTYLE:pToSet = pRubyStyle; break; + case MID_RUBY_ABOVE : pToSet = pRubyIsAbove; break; + } + if(pToSet) + pValues[nProp] = *pToSet; + } + break; default: PropertyState eTemp; BOOL bDone = SwUnoCursorHelper::getCrsrPropertyValue( @@ -585,7 +611,13 @@ beans::PropertyState SwXTextPortion::getPropertyState(const OUString& rPropertyN beans::PropertyState eRet = beans::PropertyState_DEFAULT_VALUE; SwUnoCrsr* pUnoCrsr = ((SwXTextPortion*)this)->GetCrsr(); if(pUnoCrsr) - eRet = SwXTextCursor::GetPropertyState(*pUnoCrsr, aPropSet, rPropertyName); + { + if(GetTextPortionType() == PORTION_RUBY_START && + !rPropertyName.compareToAscii( RTL_CONSTASCII_STRINGPARAM("Ruby") )) + eRet = beans::PropertyState_DIRECT_VALUE; + else + eRet = SwXTextCursor::GetPropertyState(*pUnoCrsr, aPropSet, rPropertyName); + } else throw RuntimeException(); return eRet; @@ -594,14 +626,26 @@ beans::PropertyState SwXTextPortion::getPropertyState(const OUString& rPropertyN -----------------------------------------------------------------------*/ uno::Sequence< beans::PropertyState > SwXTextPortion::getPropertyStates( - const uno::Sequence< OUString >& PropertyNames) + const uno::Sequence< OUString >& rPropertyNames) throw( beans::UnknownPropertyException, uno::RuntimeException ) { vos::OGuard aGuard(Application::GetSolarMutex()); SwUnoCrsr* pUnoCrsr = ((SwXTextPortion*)this)->GetCrsr(); if(!pUnoCrsr) throw RuntimeException(); - return SwXTextCursor::GetPropertyStates(*pUnoCrsr, aPropSet, PropertyNames); + Sequence< PropertyState > aRet = SwXTextCursor::GetPropertyStates(*pUnoCrsr, aPropSet, rPropertyNames); + + if(GetTextPortionType() == PORTION_RUBY_START) + { + const OUString* pNames = rPropertyNames.getConstArray(); + PropertyState* pStates = aRet.getArray(); + for(sal_Int32 nProp = 0; nProp < rPropertyNames.getLength();nProp++) + { + if(!pNames[nProp].compareToAscii( RTL_CONSTASCII_STRINGPARAM("Ruby") )) + pStates[nProp] = beans::PropertyState_DIRECT_VALUE; + } + } + return aRet; } /*-- 08.03.99 09:41:47--------------------------------------------------- @@ -858,9 +902,14 @@ SwXRubyPortion::SwXRubyPortion(const SwUnoCrsr* pPortionCrsr, if(!bEnd) { const SfxPoolItem& rItem = rAttr.GetAttr(); - rItem.QueryValue(aRubyText, MID_RUBY_TEXT); - rItem.QueryValue(aRubyStyle, MID_RUBY_CHARSTYLE); - rItem.QueryValue(aRubyAdjust, MID_RUBY_ADJUST); + pRubyText = new Any; + pRubyStyle = new Any; + pRubyAdjust = new Any; + pRubyIsAbove = new Any; + rItem.QueryValue(*pRubyText, MID_RUBY_TEXT); + rItem.QueryValue(*pRubyStyle, MID_RUBY_CHARSTYLE); + rItem.QueryValue(*pRubyAdjust, MID_RUBY_ADJUST); + rItem.QueryValue(*pRubyIsAbove, MID_RUBY_ABOVE); } } /* -----------------------------19.02.01 10:52-------------------------------- @@ -869,70 +918,4 @@ SwXRubyPortion::SwXRubyPortion(const SwUnoCrsr* pPortionCrsr, SwXRubyPortion::~SwXRubyPortion() { } -/* -----------------------------19.02.01 10:52-------------------------------- - - ---------------------------------------------------------------------------*/ -Any SwXRubyPortion::getPropertyValue( const OUString& rPropertyName ) - throw(UnknownPropertyException, WrappedTargetException, RuntimeException) -{ - Any aRet; - if( GetTextPortionType() == PORTION_RUBY_START && - rPropertyName.equalsAsciiL( MAP_CHAR_LEN("Ruby") )) - { - if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_RUBY_TEXT))) - aRet = aRubyText; - else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_RUBY_ADJUST))) - aRet = aRubyAdjust; - else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_RUBY_CHAR_STYLE_NAME))) - aRet = aRubyStyle; - } - else - aRet = SwXTextPortion::getPropertyValue(rPropertyName); - return aRet; -} -/* -----------------------------21.02.01 12:24:30,5--------------------------- - - ---------------------------------------------------------------------------*/ -beans::PropertyState SwXRubyPortion::getPropertyState(const OUString& rPropertyName) - throw( beans::UnknownPropertyException, uno::RuntimeException ) -{ - vos::OGuard aGuard(Application::GetSolarMutex()); - beans::PropertyState eRet = beans::PropertyState_DEFAULT_VALUE; - SwUnoCrsr* pUnoCrsr = GetCrsr(); - if(pUnoCrsr) - { - if(GetTextPortionType() == PORTION_RUBY_START && - !rPropertyName.compareToAscii( RTL_CONSTASCII_STRINGPARAM("Ruby") )) - eRet = beans::PropertyState_DIRECT_VALUE; - else - eRet = SwXTextCursor::GetPropertyState(*pUnoCrsr, GetPropSet(), rPropertyName); - } - else - throw RuntimeException(); - return eRet; -} -/* -----------------------------21.02.01 12:24:30,5--------------------------- - -----------------------------------------------------------------------*/ -uno::Sequence< beans::PropertyState > SwXRubyPortion::getPropertyStates( - const uno::Sequence< OUString >& PropertyNames) - throw( beans::UnknownPropertyException, uno::RuntimeException ) -{ - vos::OGuard aGuard(Application::GetSolarMutex()); - SwUnoCrsr* pUnoCrsr = GetCrsr(); - if(!pUnoCrsr) - throw RuntimeException(); - uno::Sequence< beans::PropertyState > aRetSequence; - aRetSequence = SwXTextCursor::GetPropertyStates(*pUnoCrsr, GetPropSet(), PropertyNames); - if(GetTextPortionType() == PORTION_RUBY_START) - { - const OUString* pNames = PropertyNames.getConstArray(); - beans::PropertyState* pStates = aRetSequence.getArray(); - for(sal_Int32 i = 0; i < aRetSequence.getLength(); i++) - { - if (0 == pNames[i].compareToAscii(RTL_CONSTASCII_STRINGPARAM("Ruby"))) - pStates[i] = beans::PropertyState_DIRECT_VALUE; - } - } - return aRetSequence; -} |