1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_sw.hxx" 26 27 #include <sfx2/docfile.hxx> 28 #include <sfx2/frame.hxx> 29 #include <sfx2/linkmgr.hxx> 30 #include <svx/svxids.hrc> 31 #include <editeng/memberids.hrc> 32 #include <swtypes.hxx> 33 #include <cmdid.h> 34 #include <hintids.hxx> 35 #include "poolfmt.hrc" 36 #include "poolfmt.hxx" 37 #include <fmtcol.hxx> 38 #include <unomap.hxx> 39 #include <unostyle.hxx> 40 #include <unosett.hxx> 41 #include <unoprnms.hxx> 42 #include <ftninfo.hxx> 43 #include <doc.hxx> 44 #include <pagedesc.hxx> 45 #include <charfmt.hxx> 46 #include <lineinfo.hxx> 47 #include <docsh.hxx> 48 #include <docary.hxx> 49 #include <docstyle.hxx> 50 #include <fmtclds.hxx> 51 #include <editeng/brshitem.hxx> 52 #include <com/sun/star/text/XFootnotesSettingsSupplier.hpp> 53 #include <com/sun/star/text/XFootnote.hpp> 54 #include <com/sun/star/text/XFootnotesSupplier.hpp> 55 #include <com/sun/star/text/XEndnotesSupplier.hpp> 56 #include <com/sun/star/text/XEndnotesSettingsSupplier.hpp> 57 #include <com/sun/star/text/FootnoteNumbering.hpp> 58 #include <com/sun/star/text/HoriOrientation.hpp> 59 #include <com/sun/star/style/LineNumberPosition.hpp> 60 #include <com/sun/star/awt/XBitmap.hpp> 61 #include <com/sun/star/beans/PropertyAttribute.hpp> 62 #include <com/sun/star/style/VerticalAlignment.hpp> 63 #include <vcl/font.hxx> 64 #include <editeng/flstitem.hxx> 65 #include <vcl/metric.hxx> 66 #include <svtools/ctrltool.hxx> 67 #include <vos/mutex.hxx> 68 #include <vcl/svapp.hxx> 69 #include <toolkit/helper/vclunohelper.hxx> 70 #include <editeng/unofdesc.hxx> 71 #include <fmtornt.hxx> 72 #include <SwStyleNameMapper.hxx> 73 // --> OD 2008-01-15 #newlistlevelattrs# 74 #include <com/sun/star/text/PositionAndSpaceMode.hpp> 75 #include <com/sun/star/text/LabelFollow.hpp> 76 // <-- 77 #include <numrule.hxx> 78 79 using ::rtl::OUString; 80 using namespace ::com::sun::star; 81 using namespace ::com::sun::star::uno; 82 using namespace ::com::sun::star::lang; 83 using namespace ::com::sun::star::beans; 84 using namespace ::com::sun::star::text; 85 using namespace ::com::sun::star::style; 86 87 struct PropValData 88 { 89 uno::Any aVal; 90 OUString sPropName; 91 PropValData(void* pVal, const char* cPropName, uno::Type aType ) : 92 aVal(pVal, aType), 93 sPropName(OUString::createFromAscii(cPropName)) 94 {} 95 PropValData(const uno::Any& rVal, const OUString& rPropName) : 96 aVal(rVal), 97 sPropName(rPropName) 98 {} 99 }; 100 101 typedef PropValData* PropValDataPtr; 102 SV_DECL_PTRARR(PropValDataArr, PropValDataPtr, 5, 5 ) 103 SV_IMPL_PTRARR(PropValDataArr, PropValDataPtr) 104 105 106 #define WID_PREFIX 0 107 #define WID_SUFFIX 1 108 #define WID_NUMBERING_TYPE 2 109 #define WID_START_AT 3 110 #define WID_FOOTNOTE_COUNTING 4 111 #define WID_PARAGRAPH_STYLE 5 112 #define WID_PAGE_STYLE 6 113 #define WID_CHARACTER_STYLE 7 114 #define WID_POSITION_END_OF_DOC 8 115 #define WID_END_NOTICE 9 116 #define WID_BEGIN_NOTICE 10 117 #define WID_ANCHOR_CHARACTER_STYLE 11 118 119 const SfxItemPropertySet* GetFootnoteSet() 120 { 121 static SfxItemPropertyMapEntry aFootnoteMap_Impl[] = 122 { 123 { SW_PROP_NAME(UNO_NAME_ANCHOR_CHAR_STYLE_NAME),WID_ANCHOR_CHARACTER_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0}, 124 { SW_PROP_NAME(UNO_NAME_BEGIN_NOTICE), WID_BEGIN_NOTICE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0}, 125 { SW_PROP_NAME(UNO_NAME_CHAR_STYLE_NAME), WID_CHARACTER_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0}, 126 { SW_PROP_NAME(UNO_NAME_END_NOTICE), WID_END_NOTICE , &::getCppuType((const OUString*)0), PROPERTY_NONE, 0}, 127 { SW_PROP_NAME(UNO_NAME_FOOTNOTE_COUNTING), WID_FOOTNOTE_COUNTING, &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, 0}, 128 { SW_PROP_NAME(UNO_NAME_NUMBERING_TYPE), WID_NUMBERING_TYPE, &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, 0}, 129 { SW_PROP_NAME(UNO_NAME_PAGE_STYLE_NAME), WID_PAGE_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0}, 130 { SW_PROP_NAME(UNO_NAME_PARA_STYLE_NAME), WID_PARAGRAPH_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0}, 131 { SW_PROP_NAME(UNO_NAME_POSITION_END_OF_DOC), WID_POSITION_END_OF_DOC,&::getBooleanCppuType(), PROPERTY_NONE, 0}, 132 { SW_PROP_NAME(UNO_NAME_PREFIX), WID_PREFIX, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0}, 133 { SW_PROP_NAME(UNO_NAME_START_AT), WID_START_AT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, 0}, 134 { SW_PROP_NAME(UNO_NAME_SUFFIX), WID_SUFFIX, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0}, 135 {0,0,0,0,0,0} 136 }; 137 static SfxItemPropertySet aFootnoteSet_Impl(aFootnoteMap_Impl); 138 return &aFootnoteSet_Impl; 139 } 140 const SfxItemPropertySet* GetEndnoteSet() 141 { 142 static SfxItemPropertyMapEntry aEndnoteMap_Impl[] = 143 { 144 { SW_PROP_NAME(UNO_NAME_ANCHOR_CHAR_STYLE_NAME),WID_ANCHOR_CHARACTER_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0}, 145 { SW_PROP_NAME(UNO_NAME_CHAR_STYLE_NAME), WID_CHARACTER_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0}, 146 { SW_PROP_NAME(UNO_NAME_NUMBERING_TYPE), WID_NUMBERING_TYPE, &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, 0}, 147 { SW_PROP_NAME(UNO_NAME_PAGE_STYLE_NAME), WID_PAGE_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0}, 148 { SW_PROP_NAME(UNO_NAME_PARA_STYLE_NAME), WID_PARAGRAPH_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0}, 149 { SW_PROP_NAME(UNO_NAME_PREFIX), WID_PREFIX, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0}, 150 { SW_PROP_NAME(UNO_NAME_START_AT), WID_START_AT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, 0}, 151 { SW_PROP_NAME(UNO_NAME_SUFFIX), WID_SUFFIX, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0}, 152 {0,0,0,0,0,0} 153 }; 154 static SfxItemPropertySet aEndnoteSet_Impl(aEndnoteMap_Impl); 155 return &aEndnoteSet_Impl; 156 } 157 const SfxItemPropertySet* GetNumberingRulesSet() 158 { 159 static SfxItemPropertyMapEntry aNumberingRulesMap_Impl[] = 160 { 161 { SW_PROP_NAME(UNO_NAME_IS_ABSOLUTE_MARGINS), WID_IS_ABS_MARGINS, &::getBooleanCppuType(), PROPERTY_NONE, 0}, 162 { SW_PROP_NAME(UNO_NAME_IS_AUTOMATIC), WID_IS_AUTOMATIC, &::getBooleanCppuType(), PROPERTY_NONE, 0}, 163 { SW_PROP_NAME(UNO_NAME_IS_CONTINUOUS_NUMBERING), WID_CONTINUOUS, &::getBooleanCppuType(), PROPERTY_NONE, 0}, 164 { SW_PROP_NAME(UNO_NAME_NAME), WID_RULE_NAME , &::getCppuType((const OUString*)0), PropertyAttribute::READONLY, 0}, 165 { SW_PROP_NAME(UNO_NAME_NUMBERING_IS_OUTLINE), WID_IS_OUTLINE, &::getBooleanCppuType(), PROPERTY_NONE, 0}, 166 { SW_PROP_NAME(UNO_NAME_DEFAULT_LIST_ID), WID_DEFAULT_LIST_ID, &::getCppuType((const OUString*)0), PropertyAttribute::READONLY, 0}, 167 {0,0,0,0,0,0} 168 }; 169 static SfxItemPropertySet aNumberingRulesSet_Impl( aNumberingRulesMap_Impl ); 170 return &aNumberingRulesSet_Impl; 171 } 172 #define WID_NUM_ON 0 173 #define WID_SEPARATOR_INTERVAL 1 174 #define WID_NUMBERING_TYPE 2 175 #define WID_NUMBER_POSITION 3 176 #define WID_DISTANCE 4 177 #define WID_INTERVAL 5 178 #define WID_SEPARATOR_TEXT 6 179 //#define WID_CHARACTER_STYLE 7 180 #define WID_COUNT_EMPTY_LINES 8 181 #define WID_COUNT_LINES_IN_FRAMES 9 182 #define WID_RESTART_AT_EACH_PAGE 10 183 184 const SfxItemPropertySet* GetLineNumberingSet() 185 { 186 static SfxItemPropertyMapEntry aLineNumberingMap_Impl[] = 187 { 188 { SW_PROP_NAME(UNO_NAME_CHAR_STYLE_NAME), WID_CHARACTER_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0}, 189 { SW_PROP_NAME(UNO_NAME_COUNT_EMPTY_LINES), WID_COUNT_EMPTY_LINES , &::getBooleanCppuType(),PROPERTY_NONE, 0}, 190 { SW_PROP_NAME(UNO_NAME_COUNT_LINES_IN_FRAMES), WID_COUNT_LINES_IN_FRAMES, &::getBooleanCppuType(),PROPERTY_NONE, 0}, 191 { SW_PROP_NAME(UNO_NAME_DISTANCE ), WID_DISTANCE , &::getCppuType((const sal_Int32*)0),PROPERTY_NONE, 0}, 192 { SW_PROP_NAME(UNO_NAME_IS_ON), WID_NUM_ON, &::getBooleanCppuType() , PROPERTY_NONE, 0}, 193 { SW_PROP_NAME(UNO_NAME_INTERVAL ), WID_INTERVAL , &::getCppuType((const sal_Int16*)0),PROPERTY_NONE, 0}, 194 { SW_PROP_NAME(UNO_NAME_SEPARATOR_TEXT ), WID_SEPARATOR_TEXT, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0}, 195 { SW_PROP_NAME(UNO_NAME_NUMBER_POSITION), WID_NUMBER_POSITION, &::getCppuType((const sal_Int16*)0),PROPERTY_NONE, 0}, 196 { SW_PROP_NAME(UNO_NAME_NUMBERING_TYPE), WID_NUMBERING_TYPE , &::getCppuType((const sal_Int16*)0),PROPERTY_NONE, 0}, 197 { SW_PROP_NAME(UNO_NAME_RESTART_AT_EACH_PAGE), WID_RESTART_AT_EACH_PAGE, &::getBooleanCppuType() , PROPERTY_NONE, 0}, 198 { SW_PROP_NAME(UNO_NAME_SEPARATOR_INTERVAL), WID_SEPARATOR_INTERVAL, &::getCppuType((const sal_Int16*)0),PROPERTY_NONE, 0}, 199 {0,0,0,0,0,0} 200 }; 201 static SfxItemPropertySet aLineNumberingSet_Impl(aLineNumberingMap_Impl); 202 return &aLineNumberingSet_Impl; 203 } 204 205 /* -----------------05.05.98 08:30------------------- 206 * 207 * --------------------------------------------------*/ 208 SwCharFmt* lcl_getCharFmt(SwDoc* pDoc, const uno::Any& aValue) 209 { 210 SwCharFmt* pRet = 0; 211 String sStandard(SW_RES(STR_POOLCOLL_STANDARD)); 212 OUString uTmp; 213 aValue >>= uTmp; 214 String sCharFmt; 215 SwStyleNameMapper::FillUIName(uTmp, sCharFmt, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, sal_True); 216 if(sStandard != sCharFmt) 217 { 218 pRet = pDoc->FindCharFmtByName( sCharFmt ); 219 } 220 if(!pRet) 221 { 222 sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(sCharFmt, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT); 223 if(USHRT_MAX != nId) 224 pRet = pDoc->GetCharFmtFromPool( nId ); 225 } 226 return pRet; 227 } 228 /* -----------------05.05.98 08:30------------------- 229 * 230 * --------------------------------------------------*/ 231 SwTxtFmtColl* lcl_GetParaStyle(SwDoc* pDoc, const uno::Any& aValue) 232 { 233 OUString uTmp; 234 aValue >>= uTmp; 235 String sParaStyle; 236 SwStyleNameMapper::FillUIName(uTmp, sParaStyle, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True ); 237 SwTxtFmtColl* pRet = pDoc->FindTxtFmtCollByName( sParaStyle ); 238 if( !pRet ) 239 { 240 sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName( sParaStyle, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL ); 241 if( USHRT_MAX != nId ) 242 pRet = pDoc->GetTxtCollFromPool( nId ); 243 } 244 return pRet; 245 } 246 /* -----------------05.05.98 08:30------------------- 247 * 248 * --------------------------------------------------*/ 249 SwPageDesc* lcl_GetPageDesc(SwDoc* pDoc, const uno::Any& aValue) 250 { 251 SwPageDesc* pRet = 0; 252 sal_uInt16 nCount = pDoc->GetPageDescCnt(); 253 OUString uTmp; 254 aValue >>= uTmp; 255 String sPageDesc; 256 SwStyleNameMapper::FillUIName(uTmp, sPageDesc, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC, sal_True ); 257 for( sal_uInt16 i = 0; i < nCount; i++) 258 { 259 const SwPageDesc& rDesc = const_cast<const SwDoc *>(pDoc) 260 ->GetPageDesc( i ); 261 if(rDesc.GetName() == sPageDesc) 262 { 263 pRet = (SwPageDesc*)&rDesc; 264 break; 265 } 266 } 267 if(!pRet) 268 { 269 sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(sPageDesc, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC); 270 if(USHRT_MAX != nId) 271 pRet = pDoc->GetPageDescFromPool( nId ); 272 } 273 return pRet; 274 } 275 /****************************************************************************** 276 * 277 ******************************************************************************/ 278 // Numerierung 279 const unsigned short aSvxToUnoAdjust[] = 280 { 281 text::HoriOrientation::LEFT, //3 282 text::HoriOrientation::RIGHT, //1 283 USHRT_MAX, 284 text::HoriOrientation::CENTER, //2 285 USHRT_MAX, 286 USHRT_MAX 287 }; 288 289 const unsigned short aUnoToSvxAdjust[] = 290 { 291 USHRT_MAX, 292 SVX_ADJUST_RIGHT, // 1 293 SVX_ADJUST_CENTER, // 3 294 SVX_ADJUST_LEFT, // 0 295 USHRT_MAX, 296 USHRT_MAX 297 }; 298 299 /****************************************************************** 300 * SwXFootnoteProperties 301 ******************************************************************/ 302 /* -----------------------------06.04.00 11:43-------------------------------- 303 304 ---------------------------------------------------------------------------*/ 305 OUString SwXFootnoteProperties::getImplementationName(void) throw( RuntimeException ) 306 { 307 return C2U("SwXFootnoteProperties"); 308 } 309 /* -----------------------------06.04.00 11:43-------------------------------- 310 311 ---------------------------------------------------------------------------*/ 312 sal_Bool SwXFootnoteProperties::supportsService(const OUString& rServiceName) throw( RuntimeException ) 313 { 314 return C2U("com.sun.star.text.FootnoteSettings") == rServiceName; 315 } 316 /* -----------------------------06.04.00 11:43-------------------------------- 317 318 ---------------------------------------------------------------------------*/ 319 Sequence< OUString > SwXFootnoteProperties::getSupportedServiceNames(void) throw( RuntimeException ) 320 { 321 Sequence< OUString > aRet(1); 322 OUString* pArray = aRet.getArray(); 323 pArray[0] = C2U("com.sun.star.text.FootnoteSettings"); 324 return aRet; 325 } 326 /*-- 14.12.98 14:03:20--------------------------------------------------- 327 328 -----------------------------------------------------------------------*/ 329 SwXFootnoteProperties::SwXFootnoteProperties(SwDoc* pDc) : 330 pDoc(pDc), 331 m_pPropertySet(GetFootnoteSet()) 332 { 333 } 334 /*-- 14.12.98 14:03:20--------------------------------------------------- 335 336 -----------------------------------------------------------------------*/ 337 SwXFootnoteProperties::~SwXFootnoteProperties() 338 { 339 340 } 341 /*-- 14.12.98 14:03:20--------------------------------------------------- 342 343 -----------------------------------------------------------------------*/ 344 uno::Reference< beans::XPropertySetInfo > SwXFootnoteProperties::getPropertySetInfo(void) 345 throw( uno::RuntimeException ) 346 { 347 static uno::Reference< beans::XPropertySetInfo > aRef = m_pPropertySet->getPropertySetInfo(); 348 return aRef; 349 } 350 /*-- 14.12.98 14:03:20--------------------------------------------------- 351 352 -----------------------------------------------------------------------*/ 353 void SwXFootnoteProperties::setPropertyValue(const OUString& rPropertyName, const uno::Any& aValue) 354 throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException ) 355 { 356 vos::OGuard aGuard(Application::GetSolarMutex()); 357 if(pDoc) 358 { 359 const SfxItemPropertySimpleEntry* pEntry = m_pPropertySet->getPropertyMap()->getByName( rPropertyName ); 360 if(pEntry) 361 { 362 if ( pEntry->nFlags & PropertyAttribute::READONLY) 363 throw PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); 364 SwFtnInfo aFtnInfo(pDoc->GetFtnInfo()); 365 switch(pEntry->nWID) 366 { 367 case WID_PREFIX: 368 { 369 OUString uTmp; 370 aValue >>= uTmp; 371 aFtnInfo.SetPrefix(uTmp); 372 } 373 break; 374 case WID_SUFFIX: 375 { 376 OUString uTmp; 377 aValue >>= uTmp; 378 aFtnInfo.SetSuffix(uTmp); 379 } 380 break; 381 case WID_NUMBERING_TYPE : 382 { 383 sal_Int16 nTmp = 0; 384 aValue >>= nTmp; 385 if(nTmp >= 0 && 386 (nTmp <= SVX_NUM_ARABIC || 387 nTmp > SVX_NUM_BITMAP)) 388 aFtnInfo.aFmt.SetNumberingType(nTmp); 389 else 390 throw lang::IllegalArgumentException(); 391 } 392 break; 393 case WID_START_AT: 394 { 395 sal_Int16 nTmp = 0; 396 aValue >>= nTmp; 397 aFtnInfo.nFtnOffset = nTmp; 398 } 399 break; 400 case WID_FOOTNOTE_COUNTING : 401 { 402 sal_Int16 nTmp = 0; 403 aValue >>= nTmp; 404 switch(nTmp) 405 { 406 case FootnoteNumbering::PER_PAGE: 407 aFtnInfo.eNum = FTNNUM_PAGE; 408 break; 409 case FootnoteNumbering::PER_CHAPTER: 410 aFtnInfo.eNum = FTNNUM_CHAPTER; 411 break; 412 case FootnoteNumbering::PER_DOCUMENT: 413 aFtnInfo.eNum = FTNNUM_DOC; 414 break; 415 } 416 } 417 break; 418 case WID_PARAGRAPH_STYLE : 419 { 420 SwTxtFmtColl* pColl = lcl_GetParaStyle(pDoc, aValue); 421 if(pColl) 422 aFtnInfo.SetFtnTxtColl(*pColl); 423 } 424 break; 425 case WID_PAGE_STYLE : 426 { 427 SwPageDesc* pDesc = lcl_GetPageDesc(pDoc, aValue); 428 if(pDesc) 429 aFtnInfo.ChgPageDesc( pDesc ); 430 } 431 break; 432 case WID_ANCHOR_CHARACTER_STYLE: 433 case WID_CHARACTER_STYLE : 434 { 435 SwCharFmt* pFmt = lcl_getCharFmt(pDoc, aValue); 436 if(pFmt) 437 { 438 if(pEntry->nWID == WID_ANCHOR_CHARACTER_STYLE) 439 aFtnInfo.SetAnchorCharFmt(pFmt); 440 else 441 aFtnInfo.SetCharFmt(pFmt); 442 } 443 } 444 break; 445 case WID_POSITION_END_OF_DOC: 446 { 447 sal_Bool bVal = *(sal_Bool*)aValue.getValue(); 448 aFtnInfo.ePos = bVal ? FTNPOS_CHAPTER : FTNPOS_PAGE; 449 } 450 break; 451 case WID_END_NOTICE : 452 { 453 OUString uTmp; 454 aValue >>= uTmp; 455 aFtnInfo.aQuoVadis = String(uTmp); 456 } 457 break; 458 case WID_BEGIN_NOTICE : 459 { 460 OUString uTmp; 461 aValue >>= uTmp; 462 aFtnInfo.aErgoSum = String(uTmp); 463 } 464 break; 465 } 466 pDoc->SetFtnInfo(aFtnInfo); 467 } 468 else 469 throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); 470 } 471 else 472 throw uno::RuntimeException(); 473 } 474 /*-- 14.12.98 14:03:21--------------------------------------------------- 475 476 -----------------------------------------------------------------------*/ 477 uno::Any SwXFootnoteProperties::getPropertyValue(const OUString& rPropertyName) 478 throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) 479 { 480 vos::OGuard aGuard(Application::GetSolarMutex()); 481 uno::Any aRet; 482 if(pDoc) 483 { 484 const SfxItemPropertySimpleEntry* pEntry = m_pPropertySet->getPropertyMap()->getByName( rPropertyName ); 485 if(pEntry) 486 { 487 const SwFtnInfo& rFtnInfo = pDoc->GetFtnInfo(); 488 switch(pEntry->nWID) 489 { 490 case WID_PREFIX: 491 { 492 aRet <<= OUString(rFtnInfo.GetPrefix()); 493 } 494 break; 495 case WID_SUFFIX: 496 { 497 aRet <<= OUString(rFtnInfo.GetSuffix()); 498 } 499 break; 500 case WID_NUMBERING_TYPE : 501 { 502 aRet <<= rFtnInfo.aFmt.GetNumberingType(); 503 } 504 break; 505 case WID_START_AT: 506 aRet <<= (sal_Int16)rFtnInfo.nFtnOffset; 507 break; 508 case WID_FOOTNOTE_COUNTING : 509 { 510 sal_Int16 nRet = 0; 511 switch(rFtnInfo.eNum) 512 { 513 case FTNNUM_PAGE: 514 nRet = FootnoteNumbering::PER_PAGE; 515 break; 516 case FTNNUM_CHAPTER: 517 nRet = FootnoteNumbering::PER_CHAPTER; 518 break; 519 case FTNNUM_DOC: 520 nRet = FootnoteNumbering::PER_DOCUMENT; 521 break; 522 } 523 aRet <<= nRet; 524 } 525 break; 526 case WID_PARAGRAPH_STYLE : 527 { 528 SwTxtFmtColl* pColl = rFtnInfo.GetFtnTxtColl(); 529 String aString; 530 if(pColl) 531 aString = String ( pColl->GetName() ); 532 SwStyleNameMapper::FillProgName(aString, aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True); 533 aRet <<= OUString ( aString ); 534 } 535 break; 536 case WID_PAGE_STYLE : 537 { 538 String aString; 539 if( rFtnInfo.KnowsPageDesc() ) 540 { 541 SwStyleNameMapper::FillProgName( 542 rFtnInfo.GetPageDesc( *pDoc )->GetName(), 543 aString, 544 nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC, 545 sal_True); 546 } 547 aRet <<= OUString ( aString ); 548 } 549 break; 550 case WID_ANCHOR_CHARACTER_STYLE: 551 case WID_CHARACTER_STYLE: 552 { 553 String aString; 554 const SwCharFmt* pCharFmt = 0; 555 if( pEntry->nWID == WID_ANCHOR_CHARACTER_STYLE ) 556 { 557 if( rFtnInfo.GetAnchorCharFmtDep()->GetRegisteredIn() ) 558 pCharFmt = rFtnInfo.GetAnchorCharFmt(*pDoc); 559 } 560 else 561 { 562 if( rFtnInfo.GetCharFmtDep()->GetRegisteredIn() ) 563 pCharFmt = rFtnInfo.GetCharFmt(*pDoc); 564 } 565 if( pCharFmt ) 566 { 567 SwStyleNameMapper::FillProgName( 568 pCharFmt->GetName(), 569 aString, 570 nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, 571 sal_True); 572 } 573 aRet <<= OUString ( aString ); 574 } 575 break; 576 case WID_POSITION_END_OF_DOC: 577 { 578 sal_Bool bTemp = FTNPOS_CHAPTER == rFtnInfo.ePos; 579 aRet.setValue(&bTemp, ::getCppuBooleanType()); 580 } 581 break; 582 case WID_END_NOTICE : 583 aRet <<= OUString(rFtnInfo.aQuoVadis); 584 break; 585 case WID_BEGIN_NOTICE : 586 aRet <<= OUString(rFtnInfo.aErgoSum); 587 break; 588 } 589 } 590 else 591 throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); 592 } 593 else 594 throw uno::RuntimeException(); 595 return aRet; 596 } 597 /*-- 14.12.98 14:03:21--------------------------------------------------- 598 599 -----------------------------------------------------------------------*/ 600 void SwXFootnoteProperties::addPropertyChangeListener( 601 const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/) 602 throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) 603 { 604 DBG_WARNING("not implemented"); 605 } 606 /*-- 14.12.98 14:03:21--------------------------------------------------- 607 608 -----------------------------------------------------------------------*/ 609 void SwXFootnoteProperties::removePropertyChangeListener( 610 const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/) 611 throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) 612 { 613 DBG_WARNING("not implemented"); 614 } 615 /*-- 14.12.98 14:03:21--------------------------------------------------- 616 617 -----------------------------------------------------------------------*/ 618 void SwXFootnoteProperties::addVetoableChangeListener( 619 const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/) 620 throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) 621 { 622 DBG_WARNING("not implemented"); 623 } 624 /*-- 14.12.98 14:03:22--------------------------------------------------- 625 626 -----------------------------------------------------------------------*/ 627 void SwXFootnoteProperties::removeVetoableChangeListener( 628 const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/) 629 throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) 630 { 631 DBG_WARNING("not implemented"); 632 } 633 634 /****************************************************************** 635 * SwXEndnoteProperties 636 ******************************************************************/ 637 /* -----------------------------06.04.00 11:45-------------------------------- 638 639 ---------------------------------------------------------------------------*/ 640 OUString SwXEndnoteProperties::getImplementationName(void) throw( RuntimeException ) 641 { 642 return C2U("SwXEndnoteProperties"); 643 } 644 /* -----------------------------06.04.00 11:45-------------------------------- 645 646 ---------------------------------------------------------------------------*/ 647 sal_Bool SwXEndnoteProperties::supportsService(const OUString& rServiceName) throw( RuntimeException ) 648 { 649 return C2U("com.sun.star.text.FootnoteSettings") == rServiceName; 650 } 651 /* -----------------------------06.04.00 11:45-------------------------------- 652 653 ---------------------------------------------------------------------------*/ 654 Sequence< OUString > SwXEndnoteProperties::getSupportedServiceNames(void) throw( RuntimeException ) 655 { 656 Sequence< OUString > aRet(1); 657 OUString* pArray = aRet.getArray(); 658 pArray[0] = C2U("com.sun.star.text.FootnoteSettings"); 659 return aRet; 660 } 661 /*-- 14.12.98 14:27:39--------------------------------------------------- 662 663 -----------------------------------------------------------------------*/ 664 SwXEndnoteProperties::SwXEndnoteProperties(SwDoc* pDc) : 665 pDoc(pDc), 666 m_pPropertySet(GetEndnoteSet()) 667 { 668 669 } 670 /*-- 14.12.98 14:27:39--------------------------------------------------- 671 672 -----------------------------------------------------------------------*/ 673 SwXEndnoteProperties::~SwXEndnoteProperties() 674 { 675 676 } 677 /*-- 14.12.98 14:27:40--------------------------------------------------- 678 679 -----------------------------------------------------------------------*/ 680 uno::Reference< beans::XPropertySetInfo > SwXEndnoteProperties::getPropertySetInfo(void) throw( uno::RuntimeException ) 681 { 682 static uno::Reference< beans::XPropertySetInfo > aRef = m_pPropertySet->getPropertySetInfo(); 683 return aRef; 684 } 685 /*-- 14.12.98 14:27:40--------------------------------------------------- 686 687 -----------------------------------------------------------------------*/ 688 void SwXEndnoteProperties::setPropertyValue(const OUString& rPropertyName, const uno::Any& aValue) 689 throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, 690 lang::WrappedTargetException, uno::RuntimeException ) 691 { 692 vos::OGuard aGuard(Application::GetSolarMutex()); 693 if(pDoc) 694 { 695 const SfxItemPropertySimpleEntry* pEntry = m_pPropertySet->getPropertyMap()->getByName( rPropertyName ); 696 if(pEntry) 697 { 698 if ( pEntry->nFlags & PropertyAttribute::READONLY) 699 throw PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); 700 SwEndNoteInfo aEndInfo(pDoc->GetEndNoteInfo()); 701 switch(pEntry->nWID) 702 { 703 case WID_PREFIX: 704 { 705 OUString uTmp; 706 aValue >>= uTmp; 707 aEndInfo.SetPrefix(uTmp); 708 } 709 break; 710 case WID_SUFFIX: 711 { 712 OUString uTmp; 713 aValue >>= uTmp; 714 aEndInfo.SetSuffix(uTmp); 715 } 716 break; 717 case WID_NUMBERING_TYPE : 718 { 719 sal_Int16 nTmp = 0; 720 aValue >>= nTmp; 721 aEndInfo.aFmt.SetNumberingType(nTmp); 722 } 723 break; 724 case WID_START_AT: 725 { 726 sal_Int16 nTmp = 0; 727 aValue >>= nTmp; 728 aEndInfo.nFtnOffset = nTmp; 729 } 730 break; 731 case WID_PARAGRAPH_STYLE : 732 { 733 SwTxtFmtColl* pColl = lcl_GetParaStyle(pDoc, aValue); 734 if(pColl) 735 aEndInfo.SetFtnTxtColl(*pColl); 736 } 737 break; 738 case WID_PAGE_STYLE : 739 { 740 SwPageDesc* pDesc = lcl_GetPageDesc(pDoc, aValue); 741 if(pDesc) 742 aEndInfo.ChgPageDesc( pDesc ); 743 } 744 break; 745 case WID_ANCHOR_CHARACTER_STYLE: 746 case WID_CHARACTER_STYLE : 747 { 748 SwCharFmt* pFmt = lcl_getCharFmt(pDoc, aValue); 749 if(pFmt) 750 { 751 if(pEntry->nWID == WID_ANCHOR_CHARACTER_STYLE) 752 aEndInfo.SetAnchorCharFmt(pFmt); 753 else 754 aEndInfo.SetCharFmt(pFmt); 755 } 756 } 757 break; 758 } 759 pDoc->SetEndNoteInfo(aEndInfo); 760 } 761 else 762 throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); 763 } 764 } 765 /*-- 14.12.98 14:27:41--------------------------------------------------- 766 767 -----------------------------------------------------------------------*/ 768 uno::Any SwXEndnoteProperties::getPropertyValue(const OUString& rPropertyName) 769 throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) 770 { 771 vos::OGuard aGuard(Application::GetSolarMutex()); 772 uno::Any aRet; 773 if(pDoc) 774 { 775 const SfxItemPropertySimpleEntry* pEntry = m_pPropertySet->getPropertyMap()->getByName( rPropertyName ); 776 if(pEntry) 777 { 778 const SwEndNoteInfo& rEndInfo = pDoc->GetEndNoteInfo(); 779 switch(pEntry->nWID) 780 { 781 case WID_PREFIX: 782 aRet <<= OUString(rEndInfo.GetPrefix()); 783 break; 784 case WID_SUFFIX: 785 aRet <<= OUString(rEndInfo.GetSuffix()); 786 break; 787 case WID_NUMBERING_TYPE : 788 aRet <<= rEndInfo.aFmt.GetNumberingType(); 789 break; 790 case WID_START_AT: 791 aRet <<= (sal_Int16)rEndInfo.nFtnOffset; 792 break; 793 case WID_PARAGRAPH_STYLE : 794 { 795 SwTxtFmtColl* pColl = rEndInfo.GetFtnTxtColl(); 796 String aString; 797 if(pColl) 798 aString = pColl->GetName(); 799 SwStyleNameMapper::FillProgName( 800 aString, 801 aString, 802 nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, 803 sal_True); 804 aRet <<= OUString ( aString ); 805 806 } 807 break; 808 case WID_PAGE_STYLE : 809 { 810 String aString; 811 if( rEndInfo.KnowsPageDesc() ) 812 { 813 SwStyleNameMapper::FillProgName( 814 rEndInfo.GetPageDesc( *pDoc )->GetName(), 815 aString, 816 nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC, 817 sal_True ); 818 } 819 aRet <<= OUString ( aString ); 820 } 821 break; 822 case WID_ANCHOR_CHARACTER_STYLE: 823 case WID_CHARACTER_STYLE: 824 { 825 String aString; 826 const SwCharFmt* pCharFmt = 0; 827 if( pEntry->nWID == WID_ANCHOR_CHARACTER_STYLE ) 828 { 829 if( rEndInfo.GetAnchorCharFmtDep()->GetRegisteredIn() ) 830 pCharFmt = rEndInfo.GetAnchorCharFmt(*pDoc); 831 } 832 else 833 { 834 if( rEndInfo.GetCharFmtDep()->GetRegisteredIn() ) 835 pCharFmt = rEndInfo.GetCharFmt(*pDoc); 836 } 837 if( pCharFmt ) 838 { 839 SwStyleNameMapper::FillProgName( 840 pCharFmt->GetName(), 841 aString, 842 nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, 843 sal_True ); 844 } 845 aRet <<= OUString ( aString ); 846 } 847 break; 848 } 849 } 850 else 851 throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); 852 } 853 return aRet; 854 } 855 /*-- 14.12.98 14:27:41--------------------------------------------------- 856 857 -----------------------------------------------------------------------*/ 858 void SwXEndnoteProperties::addPropertyChangeListener( 859 const OUString& /*PropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) 860 { 861 DBG_WARNING("not implemented"); 862 } 863 /*-- 14.12.98 14:27:41--------------------------------------------------- 864 865 -----------------------------------------------------------------------*/ 866 void SwXEndnoteProperties::removePropertyChangeListener(const OUString& /*PropertyName*/, 867 const uno:: Reference< beans::XPropertyChangeListener > & /*xListener*/) 868 throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) 869 { 870 DBG_WARNING("not implemented"); 871 } 872 /*-- 14.12.98 14:27:41--------------------------------------------------- 873 874 -----------------------------------------------------------------------*/ 875 void SwXEndnoteProperties::addVetoableChangeListener(const OUString& /*PropertyName*/, 876 const uno:: Reference< beans::XVetoableChangeListener > & /*xListener*/) 877 throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) 878 { 879 DBG_WARNING("not implemented"); 880 } 881 /*-- 14.12.98 14:27:42--------------------------------------------------- 882 883 -----------------------------------------------------------------------*/ 884 void SwXEndnoteProperties::removeVetoableChangeListener(const OUString& /*PropertyName*/, const uno:: Reference< beans::XVetoableChangeListener > & /*xListener*/) 885 throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) 886 { 887 DBG_WARNING("not implemented"); 888 } 889 /****************************************************************** 890 * SwXLineNumberingProperties 891 ******************************************************************/ 892 /* -----------------------------06.04.00 11:47-------------------------------- 893 894 ---------------------------------------------------------------------------*/ 895 OUString SwXLineNumberingProperties::getImplementationName(void) throw( RuntimeException ) 896 { 897 return C2U("SwXLineNumberingProperties"); 898 } 899 /* -----------------------------06.04.00 11:47-------------------------------- 900 901 ---------------------------------------------------------------------------*/ 902 sal_Bool SwXLineNumberingProperties::supportsService(const OUString& rServiceName) throw( RuntimeException ) 903 { 904 return C2U("com.sun.star.text.LineNumberingProperties") == rServiceName; 905 } 906 /* -----------------------------06.04.00 11:47-------------------------------- 907 908 ---------------------------------------------------------------------------*/ 909 Sequence< OUString > SwXLineNumberingProperties::getSupportedServiceNames(void) throw( RuntimeException ) 910 { 911 Sequence< OUString > aRet(1); 912 OUString* pArray = aRet.getArray(); 913 pArray[0] = C2U("com.sun.star.text.LineNumberingProperties"); 914 return aRet; 915 } 916 /*-- 14.12.98 14:33:36--------------------------------------------------- 917 918 -----------------------------------------------------------------------*/ 919 SwXLineNumberingProperties::SwXLineNumberingProperties(SwDoc* pDc) : 920 pDoc(pDc), 921 m_pPropertySet(GetLineNumberingSet()) 922 { 923 924 } 925 /*-- 14.12.98 14:33:37--------------------------------------------------- 926 927 -----------------------------------------------------------------------*/ 928 SwXLineNumberingProperties::~SwXLineNumberingProperties() 929 { 930 931 } 932 /*-- 14.12.98 14:33:37--------------------------------------------------- 933 934 -----------------------------------------------------------------------*/ 935 uno::Reference< beans::XPropertySetInfo > SwXLineNumberingProperties::getPropertySetInfo(void) throw( uno::RuntimeException ) 936 { 937 static uno::Reference< beans::XPropertySetInfo > aRef = m_pPropertySet->getPropertySetInfo(); 938 return aRef; 939 } 940 /*-- 14.12.98 14:33:37--------------------------------------------------- 941 942 -----------------------------------------------------------------------*/ 943 void SwXLineNumberingProperties::setPropertyValue( 944 const OUString& rPropertyName, const Any& aValue) 945 throw( UnknownPropertyException, PropertyVetoException, 946 IllegalArgumentException, WrappedTargetException, RuntimeException ) 947 { 948 vos::OGuard aGuard(Application::GetSolarMutex()); 949 if(pDoc) 950 { 951 const SfxItemPropertySimpleEntry* pEntry = m_pPropertySet->getPropertyMap()->getByName( rPropertyName ); 952 if(pEntry) 953 { 954 if ( pEntry->nFlags & PropertyAttribute::READONLY) 955 throw PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); 956 SwLineNumberInfo aInfo(pDoc->GetLineNumberInfo()); 957 switch(pEntry->nWID) 958 { 959 case WID_NUM_ON: 960 { 961 sal_Bool bVal = *(sal_Bool*)aValue.getValue(); 962 aInfo.SetPaintLineNumbers(bVal); 963 } 964 break; 965 case WID_CHARACTER_STYLE : 966 { 967 SwCharFmt* pFmt = lcl_getCharFmt(pDoc, aValue); 968 if(pFmt) 969 aInfo.SetCharFmt(pFmt); 970 } 971 break; 972 case WID_NUMBERING_TYPE : 973 { 974 SvxNumberType aNumType(aInfo.GetNumType()); 975 sal_Int16 nTmp = 0; 976 aValue >>= nTmp; 977 aNumType.SetNumberingType(nTmp); 978 aInfo.SetNumType(aNumType); 979 } 980 break; 981 case WID_NUMBER_POSITION : 982 { 983 sal_Int16 nTmp = 0; 984 aValue >>= nTmp; 985 switch(nTmp) 986 { 987 case style::LineNumberPosition::LEFT: 988 aInfo.SetPos(LINENUMBER_POS_LEFT); ; 989 break; 990 case style::LineNumberPosition::RIGHT : 991 aInfo.SetPos(LINENUMBER_POS_RIGHT); ; 992 break; 993 case style::LineNumberPosition::INSIDE: 994 aInfo.SetPos(LINENUMBER_POS_INSIDE); ; 995 break; 996 case style::LineNumberPosition::OUTSIDE: 997 aInfo.SetPos(LINENUMBER_POS_OUTSIDE); 998 break; 999 } 1000 } 1001 break; 1002 case WID_DISTANCE : 1003 { 1004 sal_Int32 nVal = 0; 1005 aValue >>= nVal; 1006 sal_Int32 nTmp = MM100_TO_TWIP(nVal); 1007 if (nTmp > USHRT_MAX) 1008 nTmp = USHRT_MAX; 1009 aInfo.SetPosFromLeft( static_cast< sal_uInt16 >(nTmp) ); 1010 } 1011 break; 1012 case WID_INTERVAL : 1013 { 1014 sal_Int16 nTmp = 0; 1015 aValue >>= nTmp; 1016 if( nTmp > 0) 1017 aInfo.SetCountBy(nTmp); 1018 } 1019 break; 1020 case WID_SEPARATOR_TEXT : 1021 { 1022 OUString uTmp; 1023 aValue >>= uTmp; 1024 aInfo.SetDivider(uTmp); 1025 } 1026 break; 1027 case WID_SEPARATOR_INTERVAL: 1028 { 1029 sal_Int16 nTmp = 0; 1030 aValue >>= nTmp; 1031 if( nTmp >= 0) 1032 aInfo.SetDividerCountBy(nTmp); 1033 } 1034 break; 1035 case WID_COUNT_EMPTY_LINES : 1036 { 1037 sal_Bool bVal = *(sal_Bool*)aValue.getValue(); 1038 aInfo.SetCountBlankLines(bVal); 1039 } 1040 break; 1041 case WID_COUNT_LINES_IN_FRAMES : 1042 { 1043 sal_Bool bVal = *(sal_Bool*)aValue.getValue(); 1044 aInfo.SetCountInFlys(bVal); 1045 } 1046 break; 1047 case WID_RESTART_AT_EACH_PAGE : 1048 { 1049 sal_Bool bVal = *(sal_Bool*)aValue.getValue(); 1050 aInfo.SetRestartEachPage(bVal); 1051 } 1052 break; 1053 } 1054 pDoc->SetLineNumberInfo(aInfo); 1055 } 1056 else 1057 throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); 1058 } 1059 else 1060 throw uno::RuntimeException(); 1061 } 1062 /*-- 14.12.98 14:33:38--------------------------------------------------- 1063 1064 -----------------------------------------------------------------------*/ 1065 Any SwXLineNumberingProperties::getPropertyValue(const OUString& rPropertyName) 1066 throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) 1067 { 1068 vos::OGuard aGuard(Application::GetSolarMutex()); 1069 Any aRet; 1070 if(pDoc) 1071 { 1072 const SfxItemPropertySimpleEntry* pEntry = m_pPropertySet->getPropertyMap()->getByName( rPropertyName ); 1073 if(pEntry) 1074 { 1075 const SwLineNumberInfo& rInfo = pDoc->GetLineNumberInfo(); 1076 switch(pEntry->nWID) 1077 { 1078 case WID_NUM_ON: 1079 { 1080 sal_Bool bTemp = rInfo.IsPaintLineNumbers(); 1081 aRet.setValue(&bTemp, ::getCppuBooleanType()); 1082 } 1083 break; 1084 case WID_CHARACTER_STYLE : 1085 { 1086 String aString; 1087 // return empty string if no char format is set 1088 // otherwise it would be created here 1089 if(rInfo.HasCharFormat()) 1090 { 1091 SwStyleNameMapper::FillProgName( 1092 rInfo.GetCharFmt(*pDoc)->GetName(), 1093 aString, 1094 nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, 1095 sal_True); 1096 } 1097 aRet <<= OUString ( aString ); 1098 } 1099 break; 1100 case WID_NUMBERING_TYPE : 1101 aRet <<= rInfo.GetNumType().GetNumberingType(); 1102 break; 1103 case WID_NUMBER_POSITION : 1104 { 1105 sal_Int16 nRet = 0; 1106 switch(rInfo.GetPos()) 1107 { 1108 case LINENUMBER_POS_LEFT: 1109 nRet = style::LineNumberPosition::LEFT; 1110 break; 1111 case LINENUMBER_POS_RIGHT : 1112 nRet = style::LineNumberPosition::RIGHT ; 1113 break; 1114 case LINENUMBER_POS_INSIDE: 1115 nRet = style::LineNumberPosition::INSIDE ; 1116 break; 1117 case LINENUMBER_POS_OUTSIDE : 1118 nRet = style::LineNumberPosition::OUTSIDE ; 1119 break; 1120 } 1121 aRet <<= nRet; 1122 } 1123 break; 1124 case WID_DISTANCE : 1125 { 1126 sal_uInt32 nPos = rInfo.GetPosFromLeft(); 1127 if(USHRT_MAX == nPos) 1128 nPos = 0; 1129 aRet <<= static_cast < sal_Int32 >(TWIP_TO_MM100_UNSIGNED(nPos)); 1130 } 1131 break; 1132 case WID_INTERVAL : 1133 aRet <<= (sal_Int16)rInfo.GetCountBy(); 1134 break; 1135 case WID_SEPARATOR_TEXT : 1136 aRet <<= OUString(rInfo.GetDivider()); 1137 break; 1138 case WID_SEPARATOR_INTERVAL: 1139 aRet <<= (sal_Int16)rInfo.GetDividerCountBy(); 1140 break; 1141 case WID_COUNT_EMPTY_LINES : 1142 { 1143 sal_Bool bTemp = rInfo.IsCountBlankLines(); 1144 aRet.setValue(&bTemp, ::getCppuBooleanType()); 1145 } 1146 break; 1147 case WID_COUNT_LINES_IN_FRAMES : 1148 { 1149 sal_Bool bTemp = rInfo.IsCountInFlys(); 1150 aRet.setValue(&bTemp, ::getCppuBooleanType()); 1151 } 1152 break; 1153 case WID_RESTART_AT_EACH_PAGE : 1154 { 1155 sal_Bool bTemp = rInfo.IsRestartEachPage(); 1156 aRet.setValue(&bTemp, ::getCppuBooleanType()); 1157 } 1158 break; 1159 } 1160 } 1161 else 1162 throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); 1163 } 1164 else 1165 throw uno::RuntimeException(); 1166 return aRet; 1167 } 1168 /*-- 14.12.98 14:33:38--------------------------------------------------- 1169 1170 -----------------------------------------------------------------------*/ 1171 void SwXLineNumberingProperties::addPropertyChangeListener(const OUString& /*rPropertyName*/, const uno:: Reference< beans::XPropertyChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) 1172 { 1173 DBG_WARNING("not implemented"); 1174 } 1175 /*-- 14.12.98 14:33:38--------------------------------------------------- 1176 1177 -----------------------------------------------------------------------*/ 1178 void SwXLineNumberingProperties::removePropertyChangeListener(const OUString& /*rPropertyName*/, const uno:: Reference< beans::XPropertyChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) 1179 { 1180 DBG_WARNING("not implemented"); 1181 } 1182 /*-- 14.12.98 14:33:39--------------------------------------------------- 1183 1184 -----------------------------------------------------------------------*/ 1185 void SwXLineNumberingProperties::addVetoableChangeListener(const OUString& /*rPropertyName*/, const uno:: Reference< beans::XVetoableChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) 1186 { 1187 DBG_WARNING("not implemented"); 1188 } 1189 /*-- 14.12.98 14:33:39--------------------------------------------------- 1190 1191 -----------------------------------------------------------------------*/ 1192 void SwXLineNumberingProperties::removeVetoableChangeListener(const OUString& /*rPropertyName*/, const uno:: Reference< beans::XVetoableChangeListener > & /*xListener*/) 1193 throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) 1194 { 1195 DBG_WARNING("not implemented"); 1196 } 1197 /****************************************************************** 1198 * SwXNumberingRules 1199 ******************************************************************/ 1200 String SwXNumberingRules::sInvalidStyle(String::CreateFromAscii("__XXX___invalid")); 1201 1202 const String& SwXNumberingRules::GetInvalidStyle() 1203 { 1204 return sInvalidStyle; 1205 } 1206 /* -----------------------------10.03.00 17:05-------------------------------- 1207 1208 ---------------------------------------------------------------------------*/ 1209 const uno::Sequence< sal_Int8 > & SwXNumberingRules::getUnoTunnelId() 1210 { 1211 static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId(); 1212 return aSeq; 1213 } 1214 /* -----------------------------10.03.00 17:05-------------------------------- 1215 1216 ---------------------------------------------------------------------------*/ 1217 // return implementation specific data 1218 sal_Int64 SwXNumberingRules::getSomething( const uno::Sequence< sal_Int8 > & rId ) throw(uno::RuntimeException) 1219 { 1220 if( rId.getLength() == 16 1221 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), 1222 rId.getConstArray(), 16 ) ) 1223 { 1224 return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); 1225 } 1226 return 0; 1227 } 1228 1229 /* -----------------------------06.04.00 11:47-------------------------------- 1230 1231 ---------------------------------------------------------------------------*/ 1232 OUString SwXNumberingRules::getImplementationName(void) throw( RuntimeException ) 1233 { 1234 return C2U("SwXNumberingRules"); 1235 } 1236 /* -----------------------------06.04.00 11:47-------------------------------- 1237 1238 ---------------------------------------------------------------------------*/ 1239 sal_Bool SwXNumberingRules::supportsService(const OUString& rServiceName) throw( RuntimeException ) 1240 { 1241 return C2U("com.sun.star.text.NumberingRules") == rServiceName; 1242 } 1243 /* -----------------------------06.04.00 11:47-------------------------------- 1244 1245 ---------------------------------------------------------------------------*/ 1246 Sequence< OUString > SwXNumberingRules::getSupportedServiceNames(void) throw( RuntimeException ) 1247 { 1248 Sequence< OUString > aRet(1); 1249 OUString* pArray = aRet.getArray(); 1250 pArray[0] = C2U("com.sun.star.text.NumberingRules"); 1251 return aRet; 1252 } 1253 1254 /*-- 14.12.98 14:57:57--------------------------------------------------- 1255 1256 -----------------------------------------------------------------------*/ 1257 SwXNumberingRules::SwXNumberingRules(const SwNumRule& rRule) : 1258 pDoc(0), 1259 pDocShell(0), 1260 pNumRule(new SwNumRule(rRule)), 1261 m_pPropertySet(GetNumberingRulesSet()), 1262 bOwnNumRuleCreated(sal_True) 1263 { 1264 sal_uInt16 i; 1265 1266 //erstmal das Doc organisieren; es haengt an den gesetzten Zeichenvorlagen - wenn 1267 // keine gesetzt sind, muss es auch ohne gehen 1268 for( i = 0; i < MAXLEVEL; i++) 1269 { 1270 SwNumFmt rFmt(pNumRule->Get(i)); 1271 SwCharFmt* pCharFmt = rFmt.GetCharFmt(); 1272 if(pCharFmt) 1273 { 1274 pDoc = pCharFmt->GetDoc(); 1275 break; 1276 } 1277 } 1278 if(pDoc) 1279 pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this); 1280 for(i = 0; i < MAXLEVEL; i++) 1281 { 1282 sNewCharStyleNames[i] = SwXNumberingRules::GetInvalidStyle(); 1283 sNewBulletFontNames[i] = SwXNumberingRules::GetInvalidStyle(); 1284 } 1285 } 1286 /* -----------------22.02.99 16:35------------------- 1287 * 1288 * --------------------------------------------------*/ 1289 SwXNumberingRules::SwXNumberingRules(SwDocShell& rDocSh) : 1290 pDoc(0), 1291 pDocShell(&rDocSh), 1292 pNumRule(0), 1293 m_pPropertySet(GetNumberingRulesSet()), 1294 bOwnNumRuleCreated(sal_False) 1295 { 1296 pDocShell->GetDoc()->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this); 1297 } 1298 /* -----------------------------24.08.00 11:36-------------------------------- 1299 1300 ---------------------------------------------------------------------------*/ 1301 SwXNumberingRules::SwXNumberingRules(SwDoc& rDoc) : 1302 pDoc(&rDoc), 1303 pDocShell(0), 1304 pNumRule(0), 1305 m_pPropertySet(GetNumberingRulesSet()), 1306 bOwnNumRuleCreated(sal_False) 1307 { 1308 rDoc.GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this); 1309 sCreatedNumRuleName = rDoc.GetUniqueNumRuleName(); 1310 #if OSL_DEBUG_LEVEL > 1 1311 sal_uInt16 nIndex = 1312 #endif 1313 // --> OD 2008-02-11 #newlistlevelattrs# 1314 rDoc.MakeNumRule( sCreatedNumRuleName, 0, sal_False, 1315 // --> OD 2008-06-06 #i89178# 1316 numfunc::GetDefaultPositionAndSpaceMode() ); 1317 // <-- 1318 // <-- 1319 #if OSL_DEBUG_LEVEL > 1 1320 (void)nIndex; 1321 #endif 1322 } 1323 /*-- 14.12.98 14:57:57--------------------------------------------------- 1324 1325 -----------------------------------------------------------------------*/ 1326 SwXNumberingRules::~SwXNumberingRules() 1327 { 1328 vos::OGuard aGuard(Application::GetSolarMutex()); 1329 if(pDoc && sCreatedNumRuleName.Len()) 1330 pDoc->DelNumRule( sCreatedNumRuleName ); 1331 if( pNumRule && bOwnNumRuleCreated ) 1332 delete pNumRule; 1333 } 1334 /*-- 14.12.98 14:57:58--------------------------------------------------- 1335 1336 -----------------------------------------------------------------------*/ 1337 void SwXNumberingRules::replaceByIndex(sal_Int32 nIndex, const uno::Any& rElement) 1338 throw( lang::IllegalArgumentException, lang::IndexOutOfBoundsException, 1339 lang::WrappedTargetException, uno::RuntimeException) 1340 { 1341 vos::OGuard aGuard(Application::GetSolarMutex()); 1342 if(nIndex < 0 || MAXLEVEL <= nIndex) 1343 throw lang::IndexOutOfBoundsException(); 1344 1345 if(rElement.getValueType().getTypeClass() != uno::TypeClass_SEQUENCE) 1346 throw lang::IllegalArgumentException(); 1347 const uno::Sequence<beans::PropertyValue>& rProperties = 1348 *(const uno::Sequence<beans::PropertyValue>*)rElement.getValue(); 1349 SwNumRule* pRule = 0; 1350 if(pNumRule) 1351 SwXNumberingRules::SetNumberingRuleByIndex( *pNumRule, 1352 rProperties, nIndex); 1353 else if(pDocShell) 1354 { 1355 // --> OD 2008-04-21 #i87650# - correction of cws swwarnings: 1356 // Do not set member <pNumRule> 1357 // pNumRule = pDocShell->GetDoc()->GetOutlineNumRule(); 1358 // SwNumRule aNumRule(*pNumRule); 1359 SwNumRule aNumRule( *(pDocShell->GetDoc()->GetOutlineNumRule()) ); 1360 // <-- 1361 SwXNumberingRules::SetNumberingRuleByIndex( aNumRule, 1362 rProperties, nIndex); 1363 //hier noch die Zeichenformate bei Bedarf setzen 1364 const SwCharFmts* pFmts = pDocShell->GetDoc()->GetCharFmts(); 1365 sal_uInt16 nChCount = pFmts->Count(); 1366 for(sal_uInt16 i = 0; i < MAXLEVEL;i++) 1367 { 1368 SwNumFmt aFmt(aNumRule.Get( i )); 1369 if(sNewCharStyleNames[i].Len() && 1370 !sNewCharStyleNames[i].EqualsAscii(SW_PROP_NAME_STR(UNO_NAME_CHARACTER_FORMAT_NONE)) && 1371 (!aFmt.GetCharFmt() || 1372 aFmt.GetCharFmt()->GetName()!= sNewCharStyleNames[i] )) 1373 { 1374 SwCharFmt* pCharFmt = 0; 1375 for(sal_uInt16 j = 0; j< nChCount; j++) 1376 { 1377 SwCharFmt* pTmp = (*pFmts)[j]; 1378 if(pTmp->GetName() == sNewCharStyleNames[i]) 1379 { 1380 pCharFmt = pTmp; 1381 break; 1382 } 1383 } 1384 if(!pCharFmt) 1385 { 1386 SfxStyleSheetBase* pBase; 1387 pBase = pDocShell->GetStyleSheetPool()->Find(sNewCharStyleNames[i], 1388 SFX_STYLE_FAMILY_CHAR); 1389 if(!pBase) 1390 pBase = &pDocShell->GetStyleSheetPool()->Make(sNewCharStyleNames[i], SFX_STYLE_FAMILY_CHAR); 1391 pCharFmt = ((SwDocStyleSheet*)pBase)->GetCharFmt(); 1392 1393 } 1394 aFmt.SetCharFmt( pCharFmt ); 1395 aNumRule.Set( i, aFmt ); 1396 } 1397 } 1398 pDocShell->GetDoc()->SetOutlineNumRule( aNumRule ); 1399 } 1400 else if(!pNumRule && pDoc && sCreatedNumRuleName.Len() && 1401 0 != (pRule = pDoc->FindNumRulePtr( sCreatedNumRuleName ))) 1402 { 1403 SwXNumberingRules::SetNumberingRuleByIndex( *pRule, 1404 rProperties, nIndex); 1405 1406 pRule->Validate(); 1407 } 1408 else 1409 throw uno::RuntimeException(); 1410 1411 } 1412 /*-- 14.12.98 14:57:58--------------------------------------------------- 1413 1414 -----------------------------------------------------------------------*/ 1415 sal_Int32 SwXNumberingRules::getCount(void) throw( uno::RuntimeException ) 1416 { 1417 return MAXLEVEL; 1418 } 1419 /*-- 14.12.98 14:57:58--------------------------------------------------- 1420 1421 -----------------------------------------------------------------------*/ 1422 uno::Any SwXNumberingRules::getByIndex(sal_Int32 nIndex) 1423 throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, 1424 uno::RuntimeException ) 1425 { 1426 vos::OGuard aGuard(Application::GetSolarMutex()); 1427 if(nIndex < 0 || MAXLEVEL <= nIndex) 1428 throw lang::IndexOutOfBoundsException(); 1429 1430 uno::Any aVal; 1431 const SwNumRule* pRule = pNumRule; 1432 if(!pRule && pDoc && sCreatedNumRuleName.Len()) 1433 pRule = pDoc->FindNumRulePtr( sCreatedNumRuleName ); 1434 if(pRule) 1435 { 1436 uno::Sequence<beans::PropertyValue> aRet = GetNumberingRuleByIndex( 1437 *pRule, nIndex); 1438 aVal.setValue(&aRet, ::getCppuType((uno::Sequence<beans::PropertyValue>*)0)); 1439 1440 } 1441 else if(pDocShell) 1442 { 1443 uno::Sequence<beans::PropertyValue> aRet = GetNumberingRuleByIndex( 1444 *pDocShell->GetDoc()->GetOutlineNumRule(), nIndex); 1445 aVal.setValue(&aRet, ::getCppuType((uno::Sequence<beans::PropertyValue>*)0)); 1446 } 1447 else 1448 throw uno::RuntimeException(); 1449 return aVal; 1450 } 1451 /*-- 14.12.98 14:57:59--------------------------------------------------- 1452 1453 -----------------------------------------------------------------------*/ 1454 uno::Type SwXNumberingRules::getElementType(void) 1455 throw( uno::RuntimeException ) 1456 { 1457 return ::getCppuType((uno::Sequence<beans::PropertyValue>*)0); 1458 } 1459 /*-- 14.12.98 14:57:59--------------------------------------------------- 1460 1461 -----------------------------------------------------------------------*/ 1462 sal_Bool SwXNumberingRules::hasElements(void) throw( uno::RuntimeException ) 1463 { 1464 return sal_True; 1465 } 1466 /*-- 14.12.98 14:57:59--------------------------------------------------- 1467 1468 -----------------------------------------------------------------------*/ 1469 uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetNumberingRuleByIndex( 1470 const SwNumRule& rNumRule, sal_Int32 nIndex) const 1471 { 1472 vos::OGuard aGuard(Application::GetSolarMutex()); 1473 DBG_ASSERT( 0 <= nIndex && nIndex < MAXLEVEL, "index out of range" ); 1474 1475 const SwNumFmt& rFmt = rNumRule.Get( (sal_uInt16)nIndex ); 1476 1477 sal_Bool bChapterNum = pDocShell != 0; 1478 1479 PropValDataArr aPropertyValues; 1480 //fill all properties into the array 1481 1482 //adjust 1483 SvxAdjust eAdj = rFmt.GetNumAdjust(); 1484 sal_Int16 nINT16 = aSvxToUnoAdjust[(sal_uInt16)eAdj]; 1485 PropValData* pData = new PropValData((void*)&nINT16, "Adjust", ::getCppuType((const sal_Int16*)0) ); 1486 aPropertyValues.Insert(pData, aPropertyValues.Count()); 1487 1488 //parentnumbering 1489 nINT16 = rFmt.GetIncludeUpperLevels(); 1490 pData = new PropValData((void*)&nINT16, "ParentNumbering", ::getCppuType((const sal_Int16*)0)); 1491 aPropertyValues.Insert(pData, aPropertyValues.Count()); 1492 1493 //prefix 1494 OUString aUString = rFmt.GetPrefix(); 1495 pData = new PropValData((void*)&aUString, "Prefix", ::getCppuType((const OUString*)0)); 1496 aPropertyValues.Insert(pData, aPropertyValues.Count()); 1497 1498 //suffix 1499 aUString = rFmt.GetSuffix(); 1500 pData = new PropValData((void*)&aUString, "Suffix", ::getCppuType((const OUString*)0)); 1501 aPropertyValues.Insert(pData, aPropertyValues.Count()); 1502 1503 //char style name 1504 SwCharFmt* pCharFmt = rFmt.GetCharFmt(); 1505 String CharStyleName; 1506 if(pCharFmt) 1507 CharStyleName = pCharFmt->GetName(); 1508 //egal ob ein Style vorhanden ist oder nicht ueberschreibt der Array-Eintrag diesen String 1509 if(sNewCharStyleNames[(sal_uInt16)nIndex].Len() && 1510 SwXNumberingRules::sInvalidStyle != sNewCharStyleNames[(sal_uInt16)nIndex]) 1511 CharStyleName = sNewCharStyleNames[(sal_uInt16)nIndex]; 1512 1513 String aString; 1514 SwStyleNameMapper::FillProgName( CharStyleName, aString, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, sal_True ); 1515 aUString = aString; 1516 pData = new PropValData((void*)&aUString, "CharStyleName", ::getCppuType((const OUString*)0)); 1517 aPropertyValues.Insert(pData, aPropertyValues.Count()); 1518 1519 //startvalue 1520 nINT16 = rFmt.GetStart(); 1521 pData = new PropValData((void*)&nINT16, "StartWith", ::getCppuType((const sal_Int16*)0)); 1522 aPropertyValues.Insert(pData, aPropertyValues.Count()); 1523 1524 // --> OD 2008-01-23 #newlistlevelattrs# 1525 if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) 1526 { 1527 //leftmargin 1528 sal_Int32 nINT32 = TWIP_TO_MM100(rFmt.GetAbsLSpace()); 1529 pData = new PropValData((void*)&nINT32, SW_PROP_NAME_STR(UNO_NAME_LEFT_MARGIN), ::getCppuType((const sal_Int32*)0)); 1530 aPropertyValues.Insert(pData, aPropertyValues.Count()); 1531 1532 //chartextoffset 1533 nINT32 = TWIP_TO_MM100(rFmt.GetCharTextDistance()); 1534 pData = new PropValData((void*)&nINT32, SW_PROP_NAME_STR(UNO_NAME_SYMBOL_TEXT_DISTANCE), ::getCppuType((const sal_Int32*)0)); 1535 aPropertyValues.Insert(pData, aPropertyValues.Count()); 1536 1537 //firstlineoffset 1538 nINT32 = TWIP_TO_MM100(rFmt.GetFirstLineOffset()); 1539 pData = new PropValData((void*)&nINT32, SW_PROP_NAME_STR(UNO_NAME_FIRST_LINE_OFFSET), ::getCppuType((const sal_Int32*)0)); 1540 aPropertyValues.Insert(pData, aPropertyValues.Count()); 1541 } 1542 // <-- 1543 1544 // --> OD 2008-01-15 #newlistlevelattrs# 1545 // PositionAndSpaceMode 1546 nINT16 = PositionAndSpaceMode::LABEL_WIDTH_AND_POSITION; 1547 if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) 1548 { 1549 nINT16 = PositionAndSpaceMode::LABEL_ALIGNMENT; 1550 } 1551 pData = new PropValData( (void*)&nINT16, 1552 SW_PROP_NAME_STR(UNO_NAME_POSITION_AND_SPACE_MODE), 1553 ::getCppuType((const sal_Int16*)0) ); 1554 aPropertyValues.Insert(pData, aPropertyValues.Count()); 1555 1556 if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) 1557 { 1558 // LabelFollowedBy 1559 nINT16 = LabelFollow::LISTTAB; 1560 if ( rFmt.GetLabelFollowedBy() == SvxNumberFormat::SPACE ) 1561 { 1562 nINT16 = LabelFollow::SPACE; 1563 } 1564 else if ( rFmt.GetLabelFollowedBy() == SvxNumberFormat::NOTHING ) 1565 { 1566 nINT16 = LabelFollow::NOTHING; 1567 } 1568 pData = new PropValData( (void*)&nINT16, 1569 SW_PROP_NAME_STR(UNO_NAME_LABEL_FOLLOWED_BY), 1570 ::getCppuType((const sal_Int16*)0) ); 1571 aPropertyValues.Insert(pData, aPropertyValues.Count()); 1572 1573 // ListtabStopPosition 1574 sal_Int32 nINT32 = TWIP_TO_MM100(rFmt.GetListtabPos()); 1575 pData = new PropValData( (void*)&nINT32, 1576 SW_PROP_NAME_STR(UNO_NAME_LISTTAB_STOP_POSITION), 1577 ::getCppuType((const sal_Int32*)0)); 1578 aPropertyValues.Insert(pData, aPropertyValues.Count()); 1579 1580 // FirstLineIndent 1581 nINT32 = TWIP_TO_MM100(rFmt.GetFirstLineIndent()); 1582 pData = new PropValData( (void*)&nINT32, 1583 SW_PROP_NAME_STR(UNO_NAME_FIRST_LINE_INDENT), 1584 ::getCppuType((const sal_Int32*)0)); 1585 aPropertyValues.Insert(pData, aPropertyValues.Count()); 1586 1587 // IndentAt 1588 nINT32 = TWIP_TO_MM100(rFmt.GetIndentAt()); 1589 pData = new PropValData( (void*)&nINT32, 1590 SW_PROP_NAME_STR(UNO_NAME_INDENT_AT), 1591 ::getCppuType((const sal_Int32*)0)); 1592 aPropertyValues.Insert(pData, aPropertyValues.Count()); 1593 } 1594 // <-- 1595 1596 //numberingtype 1597 nINT16 = rFmt.GetNumberingType(); 1598 pData = new PropValData((void*)&nINT16, "NumberingType", ::getCppuType((const sal_Int16*)0)); 1599 aPropertyValues.Insert(pData, aPropertyValues.Count()); 1600 1601 if(!bChapterNum) 1602 { 1603 if(SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType()) 1604 { 1605 //BulletId 1606 nINT16 = rFmt.GetBulletChar(); 1607 pData = new PropValData((void*)&nINT16, "BulletId", ::getCppuType((const sal_Int16*)0)); 1608 aPropertyValues.Insert(pData, aPropertyValues.Count()); 1609 1610 const Font* pFont = rFmt.GetBulletFont(); 1611 1612 //BulletChar 1613 aUString = OUString(rFmt.GetBulletChar()); 1614 pData = new PropValData((void*)&aUString, "BulletChar", ::getCppuType((const OUString*)0)); 1615 aPropertyValues.Insert(pData, aPropertyValues.Count()); 1616 1617 //BulletFontName 1618 String sBulletFontName; 1619 if(pFont) 1620 sBulletFontName = pFont->GetStyleName(); 1621 aUString = sBulletFontName; 1622 pData = new PropValData((void*)&aUString, "BulletFontName", ::getCppuType((const OUString*)0)); 1623 aPropertyValues.Insert(pData, aPropertyValues.Count()); 1624 1625 //BulletFont 1626 if(pFont) 1627 { 1628 awt::FontDescriptor aDesc; 1629 SvxUnoFontDescriptor::ConvertFromFont( *pFont, aDesc ); 1630 pData = new PropValData((void*)&aDesc, SW_PROP_NAME_STR(UNO_NAME_BULLET_FONT), ::getCppuType((const awt::FontDescriptor*)0)); 1631 aPropertyValues.Insert(pData, aPropertyValues.Count()); 1632 } 1633 } 1634 if(SVX_NUM_BITMAP == rFmt.GetNumberingType()) 1635 { 1636 //GraphicURL 1637 const SvxBrushItem* pBrush = rFmt.GetBrush(); 1638 if(pBrush) 1639 { 1640 Any aAny; 1641 pBrush->QueryValue( aAny, MID_GRAPHIC_URL ); 1642 aAny >>= aUString; 1643 } 1644 else 1645 aUString = aEmptyStr; 1646 pData = new PropValData((void*)&aUString, SW_PROP_NAME_STR(UNO_NAME_GRAPHIC_URL), ::getCppuType((const OUString*)0)); 1647 aPropertyValues.Insert(pData, aPropertyValues.Count()); 1648 1649 //graphicbitmap 1650 const Graphic* pGraphic = 0; 1651 if(pBrush ) 1652 pGraphic = pBrush->GetGraphic(); 1653 if(pGraphic) 1654 { 1655 uno::Reference<awt::XBitmap> xBmp = VCLUnoHelper::CreateBitmap( pGraphic->GetBitmapEx() ); 1656 pData = new PropValData((void*)&xBmp, SW_PROP_NAME_STR(UNO_NAME_GRAPHIC_BITMAP), 1657 ::getCppuType((const uno::Reference<awt::XBitmap>*)0)); 1658 aPropertyValues.Insert(pData, aPropertyValues.Count()); 1659 } 1660 Size aSize = rFmt.GetGraphicSize(); 1661 // --> OD 2010-05-04 #i101131# - applying patch from CMC 1662 // adjust conversion due to type mismatch between <Size> and <awt::Size> 1663 // aSize.Width() = TWIP_TO_MM100( aSize.Width() ); 1664 // aSize.Height() = TWIP_TO_MM100( aSize.Height() ); 1665 // pData = new PropValData((void*)&aSize, SW_PROP_NAME_STR(UNO_NAME_GRAPHIC_SIZE), ::getCppuType((const awt::Size*)0)); 1666 awt::Size aAwtSize(TWIP_TO_MM100(aSize.Width()), TWIP_TO_MM100(aSize.Height())); 1667 pData = new PropValData((void*)&aAwtSize, SW_PROP_NAME_STR(UNO_NAME_GRAPHIC_SIZE), ::getCppuType((const awt::Size*)0)); 1668 // <-- 1669 aPropertyValues.Insert(pData, aPropertyValues.Count()); 1670 1671 const SwFmtVertOrient* pOrient = rFmt.GetGraphicOrientation(); 1672 if(pOrient) 1673 { 1674 pData = new PropValData((void*)0, SW_PROP_NAME_STR(UNO_NAME_VERT_ORIENT), ::getCppuType((const sal_Int16*)0)); 1675 ((const SfxPoolItem*)pOrient)->QueryValue(pData->aVal, MID_VERTORIENT_ORIENT); 1676 aPropertyValues.Insert(pData, aPropertyValues.Count()); 1677 } 1678 } 1679 1680 } 1681 else 1682 { 1683 //Vorlagenname 1684 String sValue(SW_RES(STR_POOLCOLL_HEADLINE1 + nIndex)); 1685 const SwTxtFmtColls* pColls = pDocShell->GetDoc()->GetTxtFmtColls(); 1686 const sal_uInt16 nCount = pColls->Count(); 1687 for(sal_uInt16 i = 0; i < nCount;++i) 1688 { 1689 SwTxtFmtColl &rTxtColl = *pColls->operator[](i); 1690 if(rTxtColl.IsDefault()) 1691 continue; 1692 1693 //sal_Int8 nOutLevel = rTxtColl.GetOutlineLevel(); //#outline level,zhaojianwei 1694 const sal_Int16 nOutLevel = rTxtColl.IsAssignedToListLevelOfOutlineStyle() 1695 ? static_cast<sal_Int16>(rTxtColl.GetAssignedOutlineStyleLevel()) 1696 : MAXLEVEL; //<-end,zhaojianwei 1697 if ( nOutLevel == nIndex ) 1698 { 1699 sValue = rTxtColl.GetName(); 1700 break; // the style for the level in question has been found 1701 } 1702 else if( sValue==rTxtColl.GetName() ) 1703 { 1704 // if the default for the level is existing, but its 1705 // level is different, then it cannot be the default. 1706 sValue.Erase(); 1707 } 1708 } 1709 String aName; 1710 SwStyleNameMapper::FillProgName(sValue, aName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True); 1711 aUString = aName; 1712 1713 pData = new PropValData((void*)&aUString, SW_PROP_NAME_STR(UNO_NAME_HEADING_STYLE_NAME), ::getCppuType((const OUString*)0)); 1714 aPropertyValues.Insert(pData, aPropertyValues.Count()); 1715 } 1716 1717 uno::Sequence<beans::PropertyValue> aSeq(aPropertyValues.Count()); 1718 beans::PropertyValue* pArray = aSeq.getArray(); 1719 1720 for(sal_uInt16 i = 0; i < aPropertyValues.Count(); i++) 1721 { 1722 pData = aPropertyValues.GetObject(i); 1723 pArray[i].Value = pData->aVal; 1724 pArray[i].Name = pData->sPropName; 1725 pArray[i].Handle = -1; 1726 } 1727 aPropertyValues.DeleteAndDestroy(0, aPropertyValues.Count()); 1728 return aSeq; 1729 } 1730 /*-- 14.12.98 14:57:59--------------------------------------------------- 1731 1732 -----------------------------------------------------------------------*/ 1733 PropValData* lcl_FindProperty(const char* cName, PropValDataArr& rPropertyValues) 1734 { 1735 OUString sCmp = C2U(cName); 1736 for(sal_uInt16 i = 0; i < rPropertyValues.Count(); i++) 1737 { 1738 PropValData* pTemp = rPropertyValues.GetObject(i); 1739 if(sCmp == pTemp->sPropName) 1740 return pTemp; 1741 } 1742 return 0; 1743 } 1744 //----------------------------------------------------------------------- 1745 1746 void SwXNumberingRules::SetNumberingRuleByIndex( 1747 SwNumRule& rNumRule, 1748 const uno::Sequence<beans::PropertyValue>& rProperties, sal_Int32 nIndex) 1749 throw( uno::RuntimeException, lang::IllegalArgumentException ) 1750 { 1751 vos::OGuard aGuard(Application::GetSolarMutex()); 1752 DBG_ASSERT( 0 <= nIndex && nIndex < MAXLEVEL, "index out of range" ); 1753 1754 // the order of the names is important! 1755 static const char* aNumPropertyNames[] = 1756 { 1757 "Adjust", //0 1758 "ParentNumbering", //1 1759 "Prefix", //2 1760 "Suffix", //3 1761 "CharStyleName", //4 1762 "StartWith", //5 1763 SW_PROP_NAME_STR(UNO_NAME_LEFT_MARGIN), //6 1764 SW_PROP_NAME_STR(UNO_NAME_SYMBOL_TEXT_DISTANCE), //7 1765 SW_PROP_NAME_STR(UNO_NAME_FIRST_LINE_OFFSET), //8 1766 // --> OD 2008-01-15 #newlistlevelattrs# 1767 SW_PROP_NAME_STR(UNO_NAME_POSITION_AND_SPACE_MODE), //9 1768 SW_PROP_NAME_STR(UNO_NAME_LABEL_FOLLOWED_BY), //10 1769 SW_PROP_NAME_STR(UNO_NAME_LISTTAB_STOP_POSITION), //11 1770 SW_PROP_NAME_STR(UNO_NAME_FIRST_LINE_INDENT), //12 1771 SW_PROP_NAME_STR(UNO_NAME_INDENT_AT), //13 1772 // <-- 1773 "NumberingType", //14 1774 "BulletId", //15 1775 SW_PROP_NAME_STR(UNO_NAME_BULLET_FONT), //16 1776 "BulletFontName", //17 1777 "BulletChar", //18 1778 SW_PROP_NAME_STR(UNO_NAME_GRAPHIC_URL), //19 1779 SW_PROP_NAME_STR(UNO_NAME_GRAPHIC_BITMAP), //20 1780 SW_PROP_NAME_STR(UNO_NAME_GRAPHIC_SIZE), //21 1781 SW_PROP_NAME_STR(UNO_NAME_VERT_ORIENT), //22 1782 SW_PROP_NAME_STR(UNO_NAME_HEADING_STYLE_NAME) //23 1783 }; 1784 // --> OD 2008-01-15 #newlistlevelattrs# 1785 const sal_uInt16 nPropNameCount = 24; 1786 const sal_uInt16 nNotInChapter = 15; 1787 // <-- 1788 1789 const beans::PropertyValue* pPropArray = rProperties.getConstArray(); 1790 PropValDataArr aPropertyValues; 1791 sal_Bool bExcept = sal_False; 1792 for(int i = 0; i < rProperties.getLength() && !bExcept; i++) 1793 { 1794 const beans::PropertyValue& rProp = pPropArray[i]; 1795 bExcept = sal_True; 1796 for(sal_uInt16 j = 0; j < (pDocShell ? nPropNameCount : nPropNameCount - 1); j++) 1797 { 1798 //some values not in chapter numbering 1799 if(pDocShell && j == nNotInChapter) 1800 j = nPropNameCount - 1; 1801 if(COMPARE_EQUAL == rProp.Name.compareToAscii(aNumPropertyNames[j])) 1802 { 1803 bExcept = sal_False; 1804 break; 1805 } 1806 } 1807 if(bExcept && 1808 (rProp.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("BulletRelSize")) || 1809 rProp.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("BulletColor")) ) ) 1810 { 1811 bExcept = sal_False; 1812 } 1813 PropValData* pData = new PropValData(rProp.Value, rProp.Name ); 1814 aPropertyValues.Insert(pData, aPropertyValues.Count()); 1815 } 1816 1817 SwNumFmt aFmt(rNumRule.Get( (sal_uInt16)nIndex )); 1818 sal_Bool bWrongArg = sal_False; 1819 if(!bExcept) 1820 { 1821 SvxBrushItem* pSetBrush = 0; 1822 Size* pSetSize = 0; 1823 SwFmtVertOrient* pSetVOrient = 0; 1824 sal_Bool bCharStyleNameSet = sal_False; 1825 1826 for(sal_uInt16 i = 0; i < nPropNameCount && !bExcept && !bWrongArg; i++) 1827 { 1828 PropValData* pData = lcl_FindProperty(aNumPropertyNames[i], aPropertyValues); 1829 if(!pData) 1830 continue; 1831 switch(i) 1832 { 1833 case 0: //"Adjust" 1834 { 1835 sal_Int16 nValue = 0; 1836 pData->aVal >>= nValue; 1837 if(nValue > 0 && 1838 nValue <= text::HoriOrientation::LEFT && 1839 USHRT_MAX != aUnoToSvxAdjust[nValue]) 1840 { 1841 aFmt.SetNumAdjust((SvxAdjust)aUnoToSvxAdjust[nValue]); 1842 } 1843 else 1844 bWrongArg = sal_True; 1845 } 1846 break; 1847 case 1: //"ParentNumbering", 1848 { 1849 sal_Int16 nSet = 0; 1850 pData->aVal >>= nSet; 1851 if(nSet >= 0 && MAXLEVEL >= nSet) 1852 aFmt.SetIncludeUpperLevels( static_cast< sal_uInt8 >(nSet) ); 1853 } 1854 break; 1855 case 2: //"Prefix", 1856 { 1857 OUString uTmp; 1858 pData->aVal >>= uTmp; 1859 aFmt.SetPrefix(uTmp); 1860 } 1861 break; 1862 case 3: //"Suffix", 1863 { 1864 OUString uTmp; 1865 pData->aVal >>= uTmp; 1866 aFmt.SetSuffix(uTmp); 1867 } 1868 break; 1869 case 4: //"CharStyleName", 1870 { 1871 bCharStyleNameSet = sal_True; 1872 OUString uTmp; 1873 pData->aVal >>= uTmp; 1874 String sCharFmtName; 1875 SwStyleNameMapper::FillUIName( uTmp, sCharFmtName, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, sal_True ); 1876 if(sCharFmtName.EqualsAscii(SW_PROP_NAME_STR(UNO_NAME_CHARACTER_FORMAT_NONE))) 1877 { 1878 sNewCharStyleNames[(sal_uInt16)nIndex] = SwXNumberingRules::GetInvalidStyle(); 1879 aFmt.SetCharFmt(0); 1880 } 1881 else if(pDocShell || pDoc) 1882 { 1883 SwDoc* pLocalDoc = pDoc ? pDoc : pDocShell->GetDoc(); 1884 const SwCharFmts* pFmts = pLocalDoc->GetCharFmts(); 1885 sal_uInt16 nChCount = pFmts->Count(); 1886 1887 SwCharFmt* pCharFmt = 0; 1888 if(sCharFmtName.Len()) 1889 { 1890 for(sal_uInt16 j = 0; j< nChCount; j++) 1891 { 1892 SwCharFmt* pTmp = (*pFmts)[j]; 1893 if(pTmp->GetName() == sCharFmtName) 1894 { 1895 pCharFmt = pTmp; 1896 break; 1897 } 1898 } 1899 if(!pCharFmt) 1900 { 1901 1902 SfxStyleSheetBase* pBase; 1903 SfxStyleSheetBasePool* pPool = pLocalDoc->GetDocShell()->GetStyleSheetPool(); 1904 pBase = ((SfxStyleSheetBasePool*)pPool)->Find(sCharFmtName, SFX_STYLE_FAMILY_CHAR); 1905 if(!pBase) 1906 pBase = &pPool->Make(sCharFmtName, SFX_STYLE_FAMILY_CHAR); 1907 pCharFmt = ((SwDocStyleSheet*)pBase)->GetCharFmt(); 1908 } 1909 } 1910 aFmt.SetCharFmt( pCharFmt ); 1911 // os 2005-08-22 #i51842# 1912 // If the character format has been found it's name should not be in the 1913 // char style names array 1914 //sNewCharStyleNames[(sal_uInt16)nIndex] = sCharFmtName; 1915 sNewCharStyleNames[(sal_uInt16)nIndex].Erase(); 1916 } 1917 else 1918 sNewCharStyleNames[(sal_uInt16)nIndex] = sCharFmtName; 1919 } 1920 break; 1921 case 5: //"StartWith", 1922 { 1923 sal_Int16 nVal = 0; 1924 pData->aVal >>= nVal; 1925 aFmt.SetStart(nVal); 1926 } 1927 break; 1928 case 6: //UNO_NAME_LEFT_MARGIN, 1929 { 1930 sal_Int32 nValue = 0; 1931 pData->aVal >>= nValue; 1932 // #i23727# nValue can be negative 1933 aFmt.SetAbsLSpace((sal_uInt16) MM100_TO_TWIP(nValue)); 1934 } 1935 break; 1936 case 7: //UNO_NAME_SYMBOL_TEXT_DISTANCE, 1937 { 1938 sal_Int32 nValue = 0; 1939 pData->aVal >>= nValue; 1940 if(nValue >= 0) 1941 aFmt.SetCharTextDistance((sal_uInt16) MM100_TO_TWIP(nValue)); 1942 else 1943 bWrongArg = sal_True; 1944 } 1945 break; 1946 case 8: //UNO_NAME_FIRST_LINE_OFFSET, 1947 { 1948 sal_Int32 nValue = 0; 1949 pData->aVal >>= nValue; 1950 // #i23727# nValue can be positive 1951 nValue = MM100_TO_TWIP(nValue); 1952 aFmt.SetFirstLineOffset((short)nValue); 1953 } 1954 break; 1955 // --> OD 2008-01-15 #newlistlevelattrs# 1956 case 9: // UNO_NAME_POSITION_AND_SPACE_MODE 1957 { 1958 sal_Int16 nValue = 0; 1959 pData->aVal >>= nValue; 1960 if ( nValue == 0 ) 1961 { 1962 aFmt.SetPositionAndSpaceMode( SvxNumberFormat::LABEL_WIDTH_AND_POSITION ); 1963 } 1964 else if ( nValue == 1 ) 1965 { 1966 aFmt.SetPositionAndSpaceMode( SvxNumberFormat::LABEL_ALIGNMENT ); 1967 } 1968 else 1969 { 1970 bWrongArg = sal_True; 1971 } 1972 } 1973 break; 1974 case 10: // UNO_NAME_LABEL_FOLLOWED_BY 1975 { 1976 sal_Int16 nValue = 0; 1977 pData->aVal >>= nValue; 1978 if ( nValue == 0 ) 1979 { 1980 aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB ); 1981 } 1982 else if ( nValue == 1 ) 1983 { 1984 aFmt.SetLabelFollowedBy( SvxNumberFormat::SPACE ); 1985 } 1986 else if ( nValue == 2 ) 1987 { 1988 aFmt.SetLabelFollowedBy( SvxNumberFormat::NOTHING ); 1989 } 1990 else 1991 { 1992 bWrongArg = sal_True; 1993 } 1994 } 1995 break; 1996 case 11: // UNO_NAME_LISTTAB_STOP_POSITION 1997 { 1998 sal_Int32 nValue = 0; 1999 pData->aVal >>= nValue; 2000 nValue = MM100_TO_TWIP(nValue); 2001 if ( nValue >= 0 ) 2002 { 2003 aFmt.SetListtabPos( nValue ); 2004 } 2005 else 2006 { 2007 bWrongArg = sal_True; 2008 } 2009 } 2010 break; 2011 case 12: // UNO_NAME_FIRST_LINE_INDENT 2012 { 2013 sal_Int32 nValue = 0; 2014 pData->aVal >>= nValue; 2015 nValue = MM100_TO_TWIP(nValue); 2016 aFmt.SetFirstLineIndent( nValue ); 2017 } 2018 break; 2019 case 13: // UNO_NAME_INDENT_AT 2020 { 2021 sal_Int32 nValue = 0; 2022 pData->aVal >>= nValue; 2023 nValue = MM100_TO_TWIP(nValue); 2024 aFmt.SetIndentAt( nValue ); 2025 } 2026 break; 2027 // <-- 2028 case 14: //"NumberingType" 2029 { 2030 sal_Int16 nSet = 0; 2031 pData->aVal >>= nSet; 2032 if(nSet >= 0) 2033 aFmt.SetNumberingType(nSet); 2034 else 2035 bWrongArg = sal_True; 2036 } 2037 break; 2038 case 15: //"BulletId", 2039 { 2040 sal_Int16 nSet = 0; 2041 if( pData->aVal >>= nSet ) 2042 aFmt.SetBulletChar(nSet); 2043 else 2044 bWrongArg = sal_True; 2045 } 2046 break; 2047 case 16: //UNO_NAME_BULLET_FONT, 2048 { 2049 awt::FontDescriptor* pDesc = (awt::FontDescriptor*)pData->aVal.getValue(); 2050 if(pDesc) 2051 { 2052 // --> OD 2008-09-11 #i93725# 2053 // do not accept "empty" font 2054 if ( pDesc->Name.getLength() > 0 ) 2055 { 2056 Font aFont; 2057 SvxUnoFontDescriptor::ConvertToFont( *pDesc, aFont ); 2058 aFmt.SetBulletFont(&aFont); 2059 } 2060 // <-- 2061 } 2062 else 2063 bWrongArg = sal_True; 2064 } 2065 break; 2066 case 17: //"BulletFontName", 2067 { 2068 OUString uTmp; 2069 pData->aVal >>= uTmp; 2070 String sBulletFontName(uTmp); 2071 SwDocShell* pLclDocShell = pDocShell ? pDocShell : pDoc ? pDoc->GetDocShell() : 0; 2072 if( sBulletFontName.Len() && pLclDocShell ) 2073 { 2074 const SvxFontListItem* pFontListItem = 2075 (const SvxFontListItem* )pLclDocShell 2076 ->GetItem( SID_ATTR_CHAR_FONTLIST ); 2077 const FontList* pList = pFontListItem->GetFontList(); 2078 FontInfo aInfo = pList->Get( 2079 sBulletFontName, WEIGHT_NORMAL, ITALIC_NONE); 2080 Font aFont(aInfo); 2081 aFmt.SetBulletFont(&aFont); 2082 } 2083 else 2084 sNewBulletFontNames[(sal_uInt16)nIndex] = sBulletFontName; 2085 } 2086 break; 2087 case 18: //"BulletChar", 2088 { 2089 OUString aChar; 2090 pData->aVal >>= aChar; 2091 if(aChar.getLength() == 1) 2092 { 2093 aFmt.SetBulletChar(aChar.toChar()); 2094 } 2095 else 2096 bWrongArg = sal_True; 2097 } 2098 break; 2099 case 19: //UNO_NAME_GRAPHIC_URL, 2100 { 2101 OUString sBrushURL; 2102 pData->aVal >>= sBrushURL; 2103 // We could have pDoc, but not pDocShell, or vice-versa 2104 SwDoc* myDoc = pDoc; 2105 SwDocShell* myDocShell = pDocShell; 2106 if ( myDoc && ( myDocShell == NULL ) ) { 2107 myDocShell = myDoc->GetDocShell(); 2108 } else if ( ( myDoc == NULL ) && myDocShell ) { 2109 myDoc = myDocShell->GetDoc(); 2110 } 2111 if ( myDoc && myDocShell ) { 2112 // The following access to the window is copied from SwDoc::UpdateLinks() 2113 SfxMedium* pMedium = myDocShell->GetMedium(); 2114 SfxFrame* pFrm = pMedium ? pMedium->GetLoadTargetFrame() : 0; 2115 sfx2::LinkManager& pLinkMgr = myDoc->GetLinkManager(); 2116 if ( pLinkMgr.urlIsVendor( sBrushURL ) ) { 2117 break; // Stop here 2118 } 2119 if ( !pLinkMgr.urlIsSafe( sBrushURL ) ) { 2120 Window* pDlgParent = 0; 2121 if ( pFrm ) 2122 pDlgParent = &pFrm->GetWindow(); 2123 if ( !pDlgParent ) 2124 pDlgParent = myDocShell->GetDialogParent( pMedium ); 2125 if ( pDlgParent ) 2126 if ( !pLinkMgr.GetUserAllowsLinkUpdate( pDlgParent )) { 2127 break; // Stop here 2128 } 2129 } 2130 } 2131 if(!pSetBrush) 2132 { 2133 const SvxBrushItem* pOrigBrush = aFmt.GetBrush(); 2134 if(pOrigBrush) 2135 { 2136 pSetBrush = new SvxBrushItem(*pOrigBrush); 2137 } 2138 else 2139 pSetBrush = new SvxBrushItem(aEmptyStr, aEmptyStr, GPOS_AREA, RES_BACKGROUND); 2140 } 2141 pSetBrush->PutValue( pData->aVal, MID_GRAPHIC_URL ); 2142 } 2143 break; 2144 case 20: //UNO_NAME_GRAPHIC_BITMAP, 2145 { 2146 uno::Reference< awt::XBitmap >* pBitmap = (uno::Reference< awt::XBitmap > *)pData->aVal.getValue(); 2147 if(pBitmap) 2148 { 2149 if(!pSetBrush) 2150 { 2151 const SvxBrushItem* pOrigBrush = aFmt.GetBrush(); 2152 if(pOrigBrush) 2153 { 2154 pSetBrush = new SvxBrushItem(*pOrigBrush); 2155 } 2156 else 2157 pSetBrush = new SvxBrushItem(aEmptyStr, aEmptyStr, GPOS_AREA, RES_BACKGROUND); 2158 } 2159 2160 BitmapEx aBmp = VCLUnoHelper::GetBitmap( *pBitmap ); 2161 Graphic aNewGr(aBmp); 2162 pSetBrush->SetGraphic( aNewGr ); 2163 } 2164 else 2165 bWrongArg = sal_True; 2166 } 2167 break; 2168 case 21: //UNO_NAME_GRAPHIC_SIZE, 2169 { 2170 if(!pSetSize) 2171 pSetSize = new Size; 2172 if(pData->aVal.getValueType() == ::getCppuType((awt::Size*)0)) 2173 { 2174 awt::Size* pSize = (awt::Size*)pData->aVal.getValue(); 2175 pSize->Width = MM100_TO_TWIP(pSize->Width); 2176 pSize->Height = MM100_TO_TWIP(pSize->Height); 2177 pSetSize->Width() = pSize->Width; 2178 pSetSize->Height() = pSize->Height; 2179 } 2180 else 2181 bWrongArg = sal_True; 2182 } 2183 break; 2184 case 22: //VertOrient 2185 { 2186 if(!pSetVOrient) 2187 { 2188 if(aFmt.GetGraphicOrientation()) 2189 pSetVOrient = (SwFmtVertOrient*)aFmt.GetGraphicOrientation()->Clone(); 2190 else 2191 pSetVOrient = new SwFmtVertOrient; 2192 } 2193 ((SfxPoolItem*)pSetVOrient)->PutValue(pData->aVal, MID_VERTORIENT_ORIENT); 2194 } 2195 break; 2196 case 23: //"HeadingStyleName" 2197 { 2198 OUString uTmp; 2199 pData->aVal >>= uTmp; 2200 String sStyleName; 2201 SwStyleNameMapper::FillUIName( uTmp, sStyleName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True ); 2202 const SwTxtFmtColls* pColls = pDocShell->GetDoc()->GetTxtFmtColls(); 2203 const sal_uInt16 nCount = pColls->Count(); 2204 for ( sal_uInt16 k = 0; k < nCount; ++k ) 2205 { 2206 SwTxtFmtColl &rTxtColl = *( ( *pColls )[k] ); 2207 if ( rTxtColl.IsDefault() ) 2208 continue; 2209 if ( rTxtColl.IsAssignedToListLevelOfOutlineStyle() 2210 && rTxtColl.GetAssignedOutlineStyleLevel() == nIndex 2211 && rTxtColl.GetName() != sStyleName ) 2212 { 2213 rTxtColl.DeleteAssignmentToListLevelOfOutlineStyle(); 2214 } 2215 else if ( rTxtColl.GetName() == sStyleName ) 2216 { 2217 rTxtColl.AssignToListLevelOfOutlineStyle( nIndex ); 2218 } 2219 } 2220 } 2221 break; 2222 case 24: // BulletRelSize - unsupported - only available in Impress 2223 break; 2224 } 2225 } 2226 if(!bExcept && !bWrongArg && (pSetBrush || pSetSize || pSetVOrient)) 2227 { 2228 if(!pSetBrush && aFmt.GetBrush()) 2229 pSetBrush = new SvxBrushItem(*aFmt.GetBrush()); 2230 2231 if(pSetBrush) 2232 { 2233 if(!pSetVOrient && aFmt.GetGraphicOrientation()) 2234 pSetVOrient = new SwFmtVertOrient(*aFmt.GetGraphicOrientation()); 2235 2236 if(!pSetSize) 2237 { 2238 pSetSize = new Size(aFmt.GetGraphicSize()); 2239 if(!pSetSize->Width() || !pSetSize->Height()) 2240 { 2241 const Graphic* pGraphic = pSetBrush->GetGraphic(); 2242 if(pGraphic) 2243 *pSetSize = ::GetGraphicSizeTwip(*pGraphic, 0); 2244 } 2245 } 2246 sal_Int16 eOrient = pSetVOrient ? 2247 (sal_Int16)pSetVOrient->GetVertOrient() : text::VertOrientation::NONE; 2248 aFmt.SetGraphicBrush( pSetBrush, pSetSize, text::VertOrientation::NONE == eOrient ? 0 : &eOrient ); 2249 } 2250 } 2251 if((!bCharStyleNameSet || !sNewCharStyleNames[(sal_uInt16)nIndex].Len()) && 2252 aFmt.GetNumberingType() == NumberingType::BITMAP && !aFmt.GetCharFmt() 2253 && SwXNumberingRules::GetInvalidStyle() != sNewCharStyleNames[(sal_uInt16)nIndex]) 2254 { 2255 SwStyleNameMapper::FillProgName ( RES_POOLCHR_BUL_LEVEL, sNewCharStyleNames[(sal_uInt16)nIndex] ); 2256 } 2257 delete pSetBrush; 2258 delete pSetSize; 2259 delete pSetVOrient; 2260 } 2261 aPropertyValues.DeleteAndDestroy(0, aPropertyValues.Count()); 2262 2263 if(bWrongArg) 2264 throw lang::IllegalArgumentException(); 2265 else if(bExcept) 2266 throw uno::RuntimeException(); 2267 rNumRule.Set( (sal_uInt16)nIndex, aFmt ); 2268 2269 } 2270 /*-- 19.07.00 07:49:17--------------------------------------------------- 2271 2272 -----------------------------------------------------------------------*/ 2273 uno::Reference< XPropertySetInfo > SwXNumberingRules::getPropertySetInfo() 2274 throw(RuntimeException) 2275 { 2276 static uno::Reference< beans::XPropertySetInfo > aRef = m_pPropertySet->getPropertySetInfo(); 2277 return aRef; 2278 } 2279 /*-- 19.07.00 07:49:17--------------------------------------------------- 2280 2281 -----------------------------------------------------------------------*/ 2282 void SwXNumberingRules::setPropertyValue( const OUString& rPropertyName, const Any& rValue ) 2283 throw(UnknownPropertyException, PropertyVetoException, 2284 IllegalArgumentException, WrappedTargetException, RuntimeException) 2285 { 2286 Any aRet; 2287 SwNumRule* pDocRule = 0; 2288 SwNumRule* pCreatedRule = 0; 2289 if(!pNumRule) 2290 { 2291 if(!pNumRule && pDocShell) 2292 { 2293 pDocRule = new SwNumRule(*pDocShell->GetDoc()->GetOutlineNumRule()); 2294 } 2295 else if(pDoc && sCreatedNumRuleName.Len()) 2296 { 2297 pCreatedRule = pDoc->FindNumRulePtr( sCreatedNumRuleName); 2298 } 2299 2300 } 2301 if(!pNumRule && !pDocRule && !pCreatedRule) 2302 throw RuntimeException(); 2303 2304 2305 if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_AUTOMATIC))) 2306 { 2307 sal_Bool bVal = *(sal_Bool*)rValue.getValue(); 2308 if(!pCreatedRule) 2309 pDocRule ? pDocRule->SetAutoRule(bVal) : pNumRule->SetAutoRule(bVal); 2310 } 2311 else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_CONTINUOUS_NUMBERING))) 2312 { 2313 sal_Bool bVal = *(sal_Bool*)rValue.getValue(); 2314 pDocRule ? pDocRule->SetContinusNum(bVal) : 2315 pCreatedRule ? pCreatedRule->SetContinusNum(bVal) : pNumRule->SetContinusNum(bVal); 2316 } 2317 else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_NAME))) 2318 { 2319 delete pDocRule; 2320 throw IllegalArgumentException(); 2321 } 2322 else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_ABSOLUTE_MARGINS))) 2323 { 2324 sal_Bool bVal = *(sal_Bool*)rValue.getValue(); 2325 pDocRule ? pDocRule->SetAbsSpaces(bVal) : 2326 pCreatedRule ? pCreatedRule->SetAbsSpaces(bVal) : pNumRule->SetAbsSpaces(bVal); 2327 } 2328 else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_NUMBERING_IS_OUTLINE))) 2329 { 2330 sal_Bool bVal = *(sal_Bool*)rValue.getValue(); 2331 SwNumRuleType eNumRuleType = bVal ? OUTLINE_RULE : NUM_RULE; 2332 pDocRule ? pDocRule->SetRuleType(eNumRuleType) : 2333 pCreatedRule ? pCreatedRule->SetRuleType(eNumRuleType) : pNumRule->SetRuleType(eNumRuleType); 2334 } 2335 // --> OD 2008-04-23 #refactorlists# 2336 else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DEFAULT_LIST_ID))) 2337 { 2338 delete pDocRule; 2339 throw IllegalArgumentException(); 2340 } 2341 // <-- 2342 else 2343 throw UnknownPropertyException(); 2344 2345 if(pDocRule) 2346 { 2347 pDocShell->GetDoc()->SetOutlineNumRule(*pDocRule); 2348 delete pDocRule; 2349 } 2350 else if(pCreatedRule) 2351 { 2352 pCreatedRule->Validate(); 2353 } 2354 } 2355 /*-- 19.07.00 07:49:18--------------------------------------------------- 2356 2357 -----------------------------------------------------------------------*/ 2358 Any SwXNumberingRules::getPropertyValue( const OUString& rPropertyName ) 2359 throw(UnknownPropertyException, WrappedTargetException, RuntimeException) 2360 { 2361 Any aRet; 2362 const SwNumRule* pRule = pNumRule; 2363 if(!pRule && pDocShell) 2364 pRule = pDocShell->GetDoc()->GetOutlineNumRule(); 2365 else if(pDoc && sCreatedNumRuleName.Len()) 2366 pRule = pDoc->FindNumRulePtr( sCreatedNumRuleName ); 2367 if(!pRule) 2368 throw RuntimeException(); 2369 2370 if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_AUTOMATIC))) 2371 { 2372 sal_Bool bVal = pRule->IsAutoRule(); 2373 aRet.setValue(&bVal, ::getBooleanCppuType()); 2374 } 2375 else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_CONTINUOUS_NUMBERING))) 2376 { 2377 sal_Bool bVal = pRule->IsContinusNum(); 2378 aRet.setValue(&bVal, ::getBooleanCppuType()); 2379 } 2380 else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_NAME))) 2381 aRet <<= OUString(pRule->GetName()); 2382 else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_ABSOLUTE_MARGINS))) 2383 { 2384 sal_Bool bVal = pRule->IsAbsSpaces(); 2385 aRet.setValue(&bVal, ::getBooleanCppuType()); 2386 } 2387 else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_NUMBERING_IS_OUTLINE))) 2388 { 2389 sal_Bool bVal = pRule->IsOutlineRule(); 2390 aRet.setValue(&bVal, ::getBooleanCppuType()); 2391 } 2392 // --> OD 2008-04-23 #refactorlists# 2393 else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DEFAULT_LIST_ID))) 2394 { 2395 ASSERT( pRule->GetDefaultListId().Len() != 0, 2396 "<SwXNumberingRules::getPropertyValue(..)> - no default list id found. Serious defect -> please inform OD." ); 2397 aRet <<= OUString(pRule->GetDefaultListId()); 2398 } 2399 // <-- 2400 else 2401 throw UnknownPropertyException(); 2402 return aRet; 2403 } 2404 /*-- 19.07.00 07:49:18--------------------------------------------------- 2405 2406 -----------------------------------------------------------------------*/ 2407 void SwXNumberingRules::addPropertyChangeListener( 2408 const OUString& /*rPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*xListener*/ ) 2409 throw(UnknownPropertyException, WrappedTargetException, RuntimeException) 2410 { 2411 } 2412 /*-- 19.07.00 07:49:18--------------------------------------------------- 2413 2414 -----------------------------------------------------------------------*/ 2415 void SwXNumberingRules::removePropertyChangeListener( 2416 const OUString& /*rPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*xListener*/ ) 2417 throw(UnknownPropertyException, WrappedTargetException, RuntimeException) 2418 { 2419 } 2420 /*-- 19.07.00 07:49:18--------------------------------------------------- 2421 2422 -----------------------------------------------------------------------*/ 2423 void SwXNumberingRules::addVetoableChangeListener( 2424 const OUString& /*rPropertyName*/, const uno::Reference< XVetoableChangeListener >& /*xListener*/ ) 2425 throw(UnknownPropertyException, WrappedTargetException, RuntimeException) 2426 { 2427 } 2428 /*-- 19.07.00 07:49:18--------------------------------------------------- 2429 2430 -----------------------------------------------------------------------*/ 2431 void SwXNumberingRules::removeVetoableChangeListener( 2432 const OUString& /*rPropertyName*/, const uno::Reference< XVetoableChangeListener >& /*xListener*/ ) 2433 throw(UnknownPropertyException, WrappedTargetException, RuntimeException) 2434 { 2435 } 2436 /* -----------------------------17.10.00 14:23-------------------------------- 2437 2438 ---------------------------------------------------------------------------*/ 2439 OUString SwXNumberingRules::getName() throw( RuntimeException ) 2440 { 2441 String aString; 2442 if(pNumRule) 2443 { 2444 SwStyleNameMapper::FillProgName(pNumRule->GetName(), aString, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE, sal_True ); 2445 return OUString ( aString ); 2446 } 2447 // --> OD 2005-10-25 #126347# - consider chapter numbering <SwXNumberingRules> 2448 else if ( pDocShell ) 2449 { 2450 SwStyleNameMapper::FillProgName( pDocShell->GetDoc()->GetOutlineNumRule()->GetName(), 2451 aString, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE, sal_True ); 2452 return OUString ( aString ); 2453 } 2454 // <-- 2455 else 2456 return sCreatedNumRuleName; 2457 } 2458 /* -----------------------------17.10.00 14:23-------------------------------- 2459 2460 ---------------------------------------------------------------------------*/ 2461 void SwXNumberingRules::setName(const OUString& /*rName*/) throw( RuntimeException ) 2462 { 2463 RuntimeException aExcept; 2464 aExcept.Message = C2U("readonly"); 2465 throw aExcept; 2466 } 2467 /*-- 14.12.98 14:58:00--------------------------------------------------- 2468 2469 -----------------------------------------------------------------------*/ 2470 void SwXNumberingRules::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) 2471 { 2472 ClientModify(this, pOld, pNew); 2473 if(!GetRegisteredIn()) 2474 { 2475 if(bOwnNumRuleCreated) 2476 delete pNumRule; 2477 pNumRule = 0; 2478 pDoc = 0; 2479 } 2480 } 2481 /* -----------------------------06.04.00 11:47-------------------------------- 2482 2483 ---------------------------------------------------------------------------*/ 2484 OUString SwXChapterNumbering::getImplementationName(void) throw( RuntimeException ) 2485 { 2486 return C2U("SwXChapterNumbering"); 2487 } 2488 /* -----------------------------06.04.00 11:47-------------------------------- 2489 2490 ---------------------------------------------------------------------------*/ 2491 sal_Bool SwXChapterNumbering::supportsService(const OUString& rServiceName) throw( RuntimeException ) 2492 { 2493 String sServiceName(rServiceName); 2494 return sServiceName.EqualsAscii("com.sun.star.text.ChapterNumbering") || 2495 sServiceName.EqualsAscii("com.sun.star.text.NumberingRules"); 2496 } 2497 /* -----------------------------06.04.00 11:47-------------------------------- 2498 2499 ---------------------------------------------------------------------------*/ 2500 Sequence< OUString > SwXChapterNumbering::getSupportedServiceNames(void) throw( RuntimeException ) 2501 { 2502 Sequence< OUString > aRet(2); 2503 OUString* pArray = aRet.getArray(); 2504 pArray[0] = C2U("com.sun.star.text.ChapterNumbering"); 2505 pArray[1] = C2U("com.sun.star.text.NumberingRules"); 2506 return aRet; 2507 } 2508 /* -----------------22.02.99 16:33------------------- 2509 * 2510 * --------------------------------------------------*/ 2511 SwXChapterNumbering::SwXChapterNumbering(SwDocShell& rDocSh) : 2512 SwXNumberingRules(rDocSh) 2513 { 2514 } 2515 /* -----------------22.02.99 16:33------------------- 2516 * 2517 * --------------------------------------------------*/ 2518 SwXChapterNumbering::~SwXChapterNumbering() 2519 { 2520 } 2521 2522 /****************************************************************** 2523 * SwXTextColumns 2524 ******************************************************************/ 2525 /* -----------------------------06.04.00 11:47-------------------------------- 2526 2527 ---------------------------------------------------------------------------*/ 2528 OUString SwXTextColumns::getImplementationName(void) throw( RuntimeException ) 2529 { 2530 return C2U("SwXTextColumns"); 2531 } 2532 /* -----------------------------06.04.00 11:47-------------------------------- 2533 2534 ---------------------------------------------------------------------------*/ 2535 sal_Bool SwXTextColumns::supportsService(const OUString& rServiceName) throw( RuntimeException ) 2536 { 2537 return C2U("com.sun.star.text.TextColumns") == rServiceName; 2538 } 2539 /* -----------------------------06.04.00 11:47-------------------------------- 2540 2541 ---------------------------------------------------------------------------*/ 2542 Sequence< OUString > SwXTextColumns::getSupportedServiceNames(void) throw( RuntimeException ) 2543 { 2544 Sequence< OUString > aRet(1); 2545 OUString* pArray = aRet.getArray(); 2546 pArray[0] = C2U("com.sun.star.text.TextColumns"); 2547 return aRet; 2548 } 2549 /* -----------------------------24.10.00 16:45-------------------------------- 2550 2551 ---------------------------------------------------------------------------*/ 2552 SwXTextColumns::SwXTextColumns(sal_uInt16 nColCount) : 2553 nReference(0), 2554 bIsAutomaticWidth(sal_True), 2555 nAutoDistance(0), 2556 m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_COLUMS)), 2557 nSepLineWidth(0), 2558 nSepLineColor(0), //black 2559 nSepLineHeightRelative(100),//full height 2560 nSepLineVertAlign(style::VerticalAlignment_MIDDLE), 2561 bSepLineIsOn(sal_False) 2562 { 2563 if(nColCount) 2564 setColumnCount(nColCount); 2565 } 2566 /*-- 16.12.98 14:06:53--------------------------------------------------- 2567 2568 -----------------------------------------------------------------------*/ 2569 SwXTextColumns::SwXTextColumns(const SwFmtCol& rFmtCol) : 2570 nReference(0), 2571 aTextColumns(rFmtCol.GetNumCols()), 2572 bIsAutomaticWidth(rFmtCol.IsOrtho()), 2573 m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_COLUMS)) 2574 { 2575 sal_uInt16 nItemGutterWidth = rFmtCol.GetGutterWidth(); 2576 nAutoDistance = bIsAutomaticWidth ? 2577 USHRT_MAX == nItemGutterWidth ? DEF_GUTTER_WIDTH : (sal_Int32)nItemGutterWidth 2578 : 0; 2579 nAutoDistance = TWIP_TO_MM100(nAutoDistance); 2580 2581 TextColumn* pColumns = aTextColumns.getArray(); 2582 const SwColumns& rCols = rFmtCol.GetColumns(); 2583 for(sal_uInt16 i = 0; i < aTextColumns.getLength(); i++) 2584 { 2585 SwColumn* pCol = rCols[i]; 2586 2587 pColumns[i].Width = pCol->GetWishWidth(); 2588 nReference += pColumns[i].Width; 2589 pColumns[i].LeftMargin = TWIP_TO_MM100_UNSIGNED(pCol->GetLeft ()); 2590 pColumns[i].RightMargin = TWIP_TO_MM100_UNSIGNED(pCol->GetRight()); 2591 } 2592 if(!aTextColumns.getLength()) 2593 nReference = USHRT_MAX; 2594 2595 nSepLineWidth = rFmtCol.GetLineWidth(); 2596 nSepLineColor = rFmtCol.GetLineColor().GetColor(); 2597 nSepLineHeightRelative = rFmtCol.GetLineHeight(); 2598 bSepLineIsOn = rFmtCol.GetLineAdj() != COLADJ_NONE; 2599 switch(rFmtCol.GetLineAdj()) 2600 { 2601 case COLADJ_TOP: nSepLineVertAlign = style::VerticalAlignment_TOP; break; 2602 case COLADJ_BOTTOM: nSepLineVertAlign = style::VerticalAlignment_BOTTOM; break; 2603 case COLADJ_CENTER: 2604 case COLADJ_NONE: nSepLineVertAlign = style::VerticalAlignment_MIDDLE; 2605 } 2606 } 2607 /*-- 16.12.98 14:06:54--------------------------------------------------- 2608 2609 -----------------------------------------------------------------------*/ 2610 SwXTextColumns::~SwXTextColumns() 2611 { 2612 2613 } 2614 /*-- 16.12.98 14:06:54--------------------------------------------------- 2615 2616 -----------------------------------------------------------------------*/ 2617 sal_Int32 SwXTextColumns::getReferenceValue(void) throw( uno::RuntimeException ) 2618 { 2619 vos::OGuard aGuard(Application::GetSolarMutex()); 2620 return nReference; 2621 } 2622 /*-- 16.12.98 14:06:55--------------------------------------------------- 2623 2624 -----------------------------------------------------------------------*/ 2625 sal_Int16 SwXTextColumns::getColumnCount(void) throw( uno::RuntimeException ) 2626 { 2627 vos::OGuard aGuard(Application::GetSolarMutex()); 2628 return static_cast< sal_Int16>( aTextColumns.getLength() ); 2629 } 2630 /*-- 16.12.98 14:06:55--------------------------------------------------- 2631 2632 -----------------------------------------------------------------------*/ 2633 void SwXTextColumns::setColumnCount(sal_Int16 nColumns) throw( uno::RuntimeException ) 2634 { 2635 vos::OGuard aGuard(Application::GetSolarMutex()); 2636 if(nColumns <= 0) 2637 throw uno::RuntimeException(); 2638 bIsAutomaticWidth = sal_True; 2639 aTextColumns.realloc(nColumns); 2640 TextColumn* pCols = aTextColumns.getArray(); 2641 nReference = USHRT_MAX; 2642 sal_Int32 nWidth = nReference / nColumns; 2643 sal_Int32 nDiff = nReference - nWidth * nColumns; 2644 sal_Int32 nDist = nAutoDistance / 2; 2645 for(sal_Int16 i = 0; i < nColumns; i++) 2646 { 2647 pCols[i].Width = nWidth; 2648 pCols[i].LeftMargin = i == 0 ? 0 : nDist; 2649 pCols[i].RightMargin = i == nColumns - 1 ? 0 : nDist; 2650 } 2651 pCols[nColumns - 1].Width += nDiff; 2652 } 2653 /*-- 16.12.98 14:06:55--------------------------------------------------- 2654 2655 -----------------------------------------------------------------------*/ 2656 uno::Sequence< TextColumn > SwXTextColumns::getColumns(void) throw( uno::RuntimeException ) 2657 { 2658 vos::OGuard aGuard(Application::GetSolarMutex()); 2659 return aTextColumns; 2660 } 2661 /*-- 16.12.98 14:06:56--------------------------------------------------- 2662 2663 -----------------------------------------------------------------------*/ 2664 void SwXTextColumns::setColumns(const uno::Sequence< TextColumn >& rColumns) 2665 throw( uno::RuntimeException ) 2666 { 2667 vos::OGuard aGuard(Application::GetSolarMutex()); 2668 sal_Int32 nReferenceTemp = 0; 2669 const TextColumn* prCols = rColumns.getConstArray(); 2670 for(long i = 0; i < rColumns.getLength(); i++) 2671 { 2672 nReferenceTemp += prCols[i].Width; 2673 } 2674 bIsAutomaticWidth = sal_False; 2675 nReference = !nReferenceTemp ? USHRT_MAX : nReferenceTemp; 2676 aTextColumns = rColumns; 2677 } 2678 /*-- 25.10.00 10:15:39--------------------------------------------------- 2679 2680 -----------------------------------------------------------------------*/ 2681 uno::Reference< XPropertySetInfo > SwXTextColumns::getPropertySetInfo( ) throw(RuntimeException) 2682 { 2683 static uno::Reference< beans::XPropertySetInfo > aRef = m_pPropSet->getPropertySetInfo(); 2684 return aRef; 2685 } 2686 /*-- 25.10.00 10:15:39--------------------------------------------------- 2687 2688 -----------------------------------------------------------------------*/ 2689 void SwXTextColumns::setPropertyValue( const OUString& rPropertyName, const Any& aValue ) 2690 throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, 2691 WrappedTargetException, RuntimeException) 2692 { 2693 const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName( rPropertyName ); 2694 if (!pEntry) 2695 throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); 2696 if ( pEntry->nFlags & PropertyAttribute::READONLY) 2697 throw PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); 2698 2699 switch(pEntry->nWID) 2700 { 2701 case WID_TXTCOL_LINE_WIDTH: 2702 { 2703 sal_Int32 nTmp = 0; 2704 aValue >>= nTmp; 2705 if(nTmp < 0) 2706 throw IllegalArgumentException(); 2707 nSepLineWidth = MM100_TO_TWIP(nTmp); 2708 } 2709 break; 2710 case WID_TXTCOL_LINE_COLOR: 2711 aValue >>= nSepLineColor; 2712 break; 2713 case WID_TXTCOL_LINE_REL_HGT: 2714 { 2715 sal_Int8 nTmp = 0; 2716 aValue >>= nTmp; 2717 if(nTmp < 0) 2718 throw IllegalArgumentException(); 2719 nSepLineHeightRelative = nTmp; 2720 } 2721 break; 2722 case WID_TXTCOL_LINE_ALIGN: 2723 { 2724 style::VerticalAlignment eAlign; 2725 if(!(aValue >>= eAlign) ) 2726 { 2727 sal_Int8 nTmp = 0; 2728 if (! ( aValue >>= nTmp ) ) 2729 throw IllegalArgumentException(); 2730 else 2731 nSepLineVertAlign = nTmp; 2732 } 2733 else 2734 nSepLineVertAlign = static_cast< sal_Int8 >(eAlign); 2735 } 2736 break; 2737 case WID_TXTCOL_LINE_IS_ON: 2738 bSepLineIsOn = *(sal_Bool*)aValue.getValue(); 2739 break; 2740 case WID_TXTCOL_AUTO_DISTANCE: 2741 { 2742 sal_Int32 nTmp = 0; 2743 aValue >>= nTmp; 2744 if(nTmp < 0 || nTmp >= nReference) 2745 throw IllegalArgumentException(); 2746 nAutoDistance = nTmp; 2747 sal_Int32 nColumns = aTextColumns.getLength(); 2748 TextColumn* pCols = aTextColumns.getArray(); 2749 sal_Int32 nDist = nAutoDistance / 2; 2750 for(sal_Int32 i = 0; i < nColumns; i++) 2751 { 2752 pCols[i].LeftMargin = i == 0 ? 0 : nDist; 2753 pCols[i].RightMargin = i == nColumns - 1 ? 0 : nDist; 2754 } 2755 } 2756 break; 2757 } 2758 } 2759 /*-- 25.10.00 10:15:40--------------------------------------------------- 2760 2761 -----------------------------------------------------------------------*/ 2762 Any SwXTextColumns::getPropertyValue( const OUString& rPropertyName ) 2763 throw(UnknownPropertyException, WrappedTargetException, RuntimeException) 2764 { 2765 const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName( rPropertyName ); 2766 if (!pEntry) 2767 throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); 2768 2769 Any aRet; 2770 switch(pEntry->nWID) 2771 { 2772 case WID_TXTCOL_LINE_WIDTH: 2773 aRet <<= static_cast < sal_Int32 >(TWIP_TO_MM100(nSepLineWidth)); 2774 break; 2775 case WID_TXTCOL_LINE_COLOR: 2776 aRet <<= nSepLineColor; 2777 break; 2778 case WID_TXTCOL_LINE_REL_HGT: 2779 aRet <<= nSepLineHeightRelative; 2780 break; 2781 case WID_TXTCOL_LINE_ALIGN: 2782 aRet <<= (style::VerticalAlignment)nSepLineVertAlign; 2783 break; 2784 case WID_TXTCOL_LINE_IS_ON: 2785 aRet.setValue(&bSepLineIsOn, ::getBooleanCppuType()); 2786 break; 2787 case WID_TXTCOL_IS_AUTOMATIC : 2788 aRet.setValue(&bIsAutomaticWidth, ::getBooleanCppuType()); 2789 break; 2790 case WID_TXTCOL_AUTO_DISTANCE: 2791 aRet <<= nAutoDistance; 2792 break; 2793 } 2794 return aRet; 2795 } 2796 /*-- 25.10.00 10:15:40--------------------------------------------------- 2797 2798 -----------------------------------------------------------------------*/ 2799 void SwXTextColumns::addPropertyChangeListener( 2800 const OUString& /*rPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*xListener*/ ) 2801 throw(UnknownPropertyException, WrappedTargetException, RuntimeException) 2802 { 2803 } 2804 /*-- 25.10.00 10:15:40--------------------------------------------------- 2805 2806 -----------------------------------------------------------------------*/ 2807 void SwXTextColumns::removePropertyChangeListener( 2808 const OUString& /*rPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*xListener*/ ) 2809 throw(UnknownPropertyException, WrappedTargetException, RuntimeException) 2810 { 2811 } 2812 /*-- 25.10.00 10:15:40--------------------------------------------------- 2813 2814 -----------------------------------------------------------------------*/ 2815 void SwXTextColumns::addVetoableChangeListener( 2816 const OUString& /*rPropertyName*/, const uno::Reference< XVetoableChangeListener >& /*xListener*/ ) 2817 throw(UnknownPropertyException, WrappedTargetException, RuntimeException) 2818 { 2819 } 2820 /*-- 25.10.00 10:15:40--------------------------------------------------- 2821 2822 -----------------------------------------------------------------------*/ 2823 void SwXTextColumns::removeVetoableChangeListener( 2824 const OUString& /*rPropertyName*/, const uno::Reference< XVetoableChangeListener >& /*xListener*/ ) 2825 throw(UnknownPropertyException, WrappedTargetException, RuntimeException) 2826 { 2827 } 2828 /* -----------------------------25.10.00 11:04-------------------------------- 2829 2830 ---------------------------------------------------------------------------*/ 2831 const uno::Sequence< sal_Int8 > & SwXTextColumns::getUnoTunnelId() 2832 { 2833 static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId(); 2834 return aSeq; 2835 } 2836 /* -----------------------------10.03.00 18:04-------------------------------- 2837 2838 ---------------------------------------------------------------------------*/ 2839 sal_Int64 SAL_CALL SwXTextColumns::getSomething( const uno::Sequence< sal_Int8 >& rId ) 2840 throw(uno::RuntimeException) 2841 { 2842 if( rId.getLength() == 16 2843 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), 2844 rId.getConstArray(), 16 ) ) 2845 { 2846 return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); 2847 } 2848 return 0; 2849 } 2850 2851