2010-10-14 08:30:41 +02:00
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2011-03-31 10:05:04 +02:00
/*
* This file is part of the LibreOffice project .
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License , v . 2.0 . If a copy of the MPL was not distributed with this
* file , You can obtain one at http : //mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice :
*
* Licensed to the Apache Software Foundation ( ASF ) under one or more
* contributor license agreements . See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership . The ASF licenses this file to you under the Apache
* License , Version 2.0 ( the " License " ) ; you may not use this file
* except in compliance with the License . You may obtain a copy of
* the License at http : //www.apache.org/licenses/LICENSE-2.0 .
*/
2000-09-18 23:08:29 +00:00
2006-09-16 21:01:21 +00:00
2010-01-08 18:32:51 +01:00
# include <svx/svxids.hrc>
2000-10-31 19:33:20 +00:00
# include <hintids.hxx>
2010-10-16 03:22:02 -05:00
# include <osl/mutex.hxx>
2000-10-31 19:33:20 +00:00
# include <vcl/svapp.hxx>
2009-10-16 00:05:16 +02:00
# include <svl/smplhint.hxx>
2000-10-31 19:33:20 +00:00
# include <svtools/ctrltool.hxx>
2009-10-16 00:05:16 +02:00
# include <svl/style.hxx>
# include <svl/itemiter.hxx>
2000-10-31 19:33:20 +00:00
# include <svx/pageitem.hxx>
2010-01-08 18:32:51 +01:00
# include <editeng/sizeitem.hxx>
# include <editeng/ulspitem.hxx>
# include <editeng/lrspitem.hxx>
# include <editeng/boxitem.hxx>
# include <editeng/shaditem.hxx>
2013-02-12 13:41:53 -05:00
# include <editeng/brushitem.hxx>
2010-01-08 18:32:51 +01:00
# include <editeng/flstitem.hxx>
# include <editeng/paperinf.hxx>
2000-09-18 23:08:29 +00:00
# include <pagedesc.hxx>
# include <doc.hxx>
2010-11-25 14:31:08 +01:00
# include <IDocumentUndoRedo.hxx>
2000-09-18 23:08:29 +00:00
# include <docary.hxx>
# include <charfmt.hxx>
# include <cmdid.h>
# include <unostyle.hxx>
# include <unosett.hxx>
# include <docsh.hxx>
# include <swstyle.h>
# include <paratr.hxx>
# include <unoprnms.hxx>
# include <shellio.hxx>
# include <docstyle.hxx>
2010-01-05 16:37:47 +01:00
# include <unotextbodyhf.hxx>
2000-09-18 23:08:29 +00:00
# include <fmthdft.hxx>
# include <fmtpdsc.hxx>
# include <poolfmt.hrc>
# include <poolfmt.hxx>
2000-12-19 16:28:58 +00:00
# include "unoevent.hxx"
2001-02-19 07:04:57 +00:00
# include <fmtruby.hxx>
2001-07-19 15:35:09 +00:00
# include <SwStyleNameMapper.hxx>
2001-09-03 13:58:49 +00:00
# include <sfx2/printer.hxx>
2005-11-11 12:16:07 +00:00
# include <com/sun/star/style/ParagraphStyleCategory.hpp>
2001-10-17 11:27:45 +00:00
# include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
2001-10-16 11:16:17 +00:00
# include <com/sun/star/beans/PropertyAttribute.hpp>
2005-11-11 12:16:07 +00:00
# include <com/sun/star/beans/NamedValue.hpp>
2006-12-01 14:52:41 +00:00
# include <istyleaccess.hxx>
2001-10-24 14:51:20 +00:00
# include <GetMetricVal.hxx>
# include <fmtfsize.hxx>
2008-03-05 16:13:59 +00:00
# include <numrule.hxx>
2005-11-11 12:16:07 +00:00
2011-06-01 22:40:08 +01:00
# include <comphelper/servicehelper.hxx>
2013-01-16 16:04:48 +01:00
# include <cppuhelper/supportsservice.hxx>
2011-06-01 22:40:08 +01:00
2006-12-01 14:52:41 +00:00
# include <boost/shared_ptr.hpp>
2005-11-11 12:16:07 +00:00
# include "ccoll.hxx"
2009-01-06 17:37:13 +00:00
# include "unocore.hrc"
2005-11-11 12:16:07 +00:00
2008-06-13 09:32:46 +00:00
# include <set>
2001-10-29 14:16:14 +00:00
# define STYLE_FAMILY_COUNT 5 // we have 5 style families
2000-09-18 23:08:29 +00:00
# define TYPE_BOOL 0
# define TYPE_SIZE 1
# define TYPE_BRUSH 2
# define TYPE_ULSPACE 3
# define TYPE_SHADOW 4
# define TYPE_LRSPACE 5
# define TYPE_BOX 6
2001-07-19 15:35:09 +00:00
const unsigned short aStyleByIndex [ ] =
{
SFX_STYLE_FAMILY_CHAR ,
SFX_STYLE_FAMILY_PARA ,
SFX_STYLE_FAMILY_PAGE ,
SFX_STYLE_FAMILY_FRAME ,
SFX_STYLE_FAMILY_PSEUDO
} ;
2006-12-01 14:52:41 +00:00
// Already implemented autostyle families: 3
# define AUTOSTYLE_FAMILY_COUNT 3
const IStyleAccess : : SwAutoStyleFamily aAutoStyleByIndex [ ] =
{
IStyleAccess : : AUTO_STYLE_CHAR ,
IStyleAccess : : AUTO_STYLE_RUBY ,
IStyleAccess : : AUTO_STYLE_PARA
} ;
2000-09-18 23:08:29 +00:00
using namespace : : com : : sun : : star ;
2005-11-11 12:16:07 +00:00
2000-10-25 11:06:06 +00:00
//convert FN_... to RES_ in header and footer itemset
2012-10-12 16:49:40 +02:00
static sal_uInt16 lcl_ConvertFNToRES ( sal_uInt16 nFNId )
2000-10-25 11:06:06 +00:00
{
2001-10-29 14:16:14 +00:00
sal_uInt16 nRes = USHRT_MAX ;
2000-10-25 11:06:06 +00:00
switch ( nFNId )
{
case FN_UNO_FOOTER_ON :
case FN_UNO_HEADER_ON :
break ;
case FN_UNO_FOOTER_BACKGROUND :
case FN_UNO_HEADER_BACKGROUND : nRes = RES_BACKGROUND ;
break ;
case FN_UNO_FOOTER_BOX :
case FN_UNO_HEADER_BOX : nRes = RES_BOX ;
break ;
case FN_UNO_FOOTER_LR_SPACE :
case FN_UNO_HEADER_LR_SPACE : nRes = RES_LR_SPACE ;
break ;
case FN_UNO_FOOTER_SHADOW :
case FN_UNO_HEADER_SHADOW : nRes = RES_SHADOW ;
break ;
case FN_UNO_FOOTER_BODY_DISTANCE :
case FN_UNO_HEADER_BODY_DISTANCE : nRes = RES_UL_SPACE ;
break ;
case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE :
case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE : nRes = SID_ATTR_PAGE_DYNAMIC ;
break ;
case FN_UNO_FOOTER_SHARE_CONTENT :
case FN_UNO_HEADER_SHARE_CONTENT : nRes = SID_ATTR_PAGE_SHARED ;
break ;
2012-07-09 09:45:04 +02:00
case FN_UNO_FIRST_SHARE_CONTENT : nRes = SID_ATTR_PAGE_SHARED_FIRST ;
2012-06-29 11:26:13 +02:00
break ;
2000-10-25 11:06:06 +00:00
case FN_UNO_FOOTER_HEIGHT :
case FN_UNO_HEADER_HEIGHT : nRes = SID_ATTR_PAGE_SIZE ;
break ;
2002-08-30 16:23:03 +00:00
case FN_UNO_FOOTER_EAT_SPACING :
case FN_UNO_HEADER_EAT_SPACING : nRes = RES_HEADER_FOOTER_EAT_SPACING ;
break ;
2000-10-25 11:06:06 +00:00
}
return nRes ;
2000-09-18 23:08:29 +00:00
2000-10-25 11:06:06 +00:00
}
2012-10-12 16:49:40 +02:00
static SwGetPoolIdFromName lcl_GetSwEnumFromSfxEnum ( SfxStyleFamily eFamily )
2000-09-18 23:08:29 +00:00
{
2001-07-19 15:35:09 +00:00
switch ( eFamily )
2000-09-18 23:08:29 +00:00
{
case SFX_STYLE_FAMILY_CHAR :
2007-09-27 08:40:48 +00:00
return nsSwGetPoolIdFromName : : GET_POOLID_CHRFMT ;
2000-09-18 23:08:29 +00:00
case SFX_STYLE_FAMILY_PARA :
2007-09-27 08:40:48 +00:00
return nsSwGetPoolIdFromName : : GET_POOLID_TXTCOLL ;
2000-09-18 23:08:29 +00:00
case SFX_STYLE_FAMILY_FRAME :
2007-09-27 08:40:48 +00:00
return nsSwGetPoolIdFromName : : GET_POOLID_FRMFMT ;
2000-09-18 23:08:29 +00:00
case SFX_STYLE_FAMILY_PAGE :
2007-09-27 08:40:48 +00:00
return nsSwGetPoolIdFromName : : GET_POOLID_PAGEDESC ;
2000-09-18 23:08:29 +00:00
case SFX_STYLE_FAMILY_PSEUDO :
2007-09-27 08:40:48 +00:00
return nsSwGetPoolIdFromName : : GET_POOLID_NUMRULE ;
2001-10-11 17:50:13 +00:00
default :
2011-05-08 22:14:45 +02:00
OSL_ENSURE ( sal_False , " someone asking for all styles in unostyle.cxx! " ) ;
2007-09-27 08:40:48 +00:00
return nsSwGetPoolIdFromName : : GET_POOLID_CHRFMT ;
2000-09-18 23:08:29 +00:00
}
}
2006-12-01 14:52:41 +00:00
class SwAutoStylesEnumImpl
{
std : : vector < SfxItemSet_Pointer_t > mAutoStyles ;
std : : vector < SfxItemSet_Pointer_t > : : iterator aIter ;
SwDoc * pDoc ;
IStyleAccess : : SwAutoStyleFamily eFamily ;
public :
SwAutoStylesEnumImpl ( SwDoc * pInitDoc , IStyleAccess : : SwAutoStyleFamily eFam ) ;
: : sal_Bool hasMoreElements ( ) { return aIter ! = mAutoStyles . end ( ) ; }
SfxItemSet_Pointer_t nextElement ( ) { return * ( aIter + + ) ; }
IStyleAccess : : SwAutoStyleFamily getFamily ( ) const { return eFamily ; }
SwDoc * getDoc ( ) const { return pDoc ; }
} ;
2000-09-18 23:08:29 +00:00
/******************************************************************
* SwXStyleFamilies
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2007-06-05 16:36:55 +00:00
OUString SwXStyleFamilies : : getImplementationName ( void ) throw ( uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2012-12-26 22:49:14 +01:00
return OUString ( " SwXStyleFamilies " ) ;
2000-09-18 23:08:29 +00:00
}
2011-01-03 20:35:28 +00:00
sal_Bool SwXStyleFamilies : : supportsService ( const OUString & rServiceName ) throw ( uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2013-01-16 16:04:48 +01:00
return cppu : : supportsService ( this , rServiceName ) ;
2000-09-18 23:08:29 +00:00
}
2007-06-05 16:36:55 +00:00
uno : : Sequence < OUString > SwXStyleFamilies : : getSupportedServiceNames ( void ) throw ( uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2007-06-05 16:36:55 +00:00
uno : : Sequence < OUString > aRet ( 1 ) ;
2000-09-18 23:08:29 +00:00
OUString * pArray = aRet . getArray ( ) ;
2012-12-26 22:49:14 +01:00
pArray [ 0 ] = " com.sun.star.style.StyleFamilies " ;
2000-09-18 23:08:29 +00:00
return aRet ;
}
SwXStyleFamilies : : SwXStyleFamilies ( SwDocShell & rDocShell ) :
SwUnoCollection ( rDocShell . GetDoc ( ) ) ,
2007-09-27 08:40:48 +00:00
pDocShell ( & rDocShell ) ,
2000-09-18 23:08:29 +00:00
pxCharStyles ( 0 ) ,
pxParaStyles ( 0 ) ,
pxFrameStyles ( 0 ) ,
pxPageStyles ( 0 ) ,
2007-09-27 08:40:48 +00:00
pxNumberingStyles ( 0 )
2000-09-18 23:08:29 +00:00
{
}
SwXStyleFamilies : : ~ SwXStyleFamilies ( )
{
delete pxCharStyles ;
delete pxParaStyles ;
delete pxFrameStyles ;
delete pxPageStyles ;
delete pxNumberingStyles ;
}
2007-06-05 16:36:55 +00:00
uno : : Any SAL_CALL SwXStyleFamilies : : getByName ( const OUString & Name )
2000-09-18 23:08:29 +00:00
throw (
container : : NoSuchElementException ,
lang : : WrappedTargetException ,
2007-06-05 16:36:55 +00:00
uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2000-09-18 23:08:29 +00:00
// der Index kommt aus const unsigned short aStyleByIndex[] =
2007-06-05 16:36:55 +00:00
uno : : Any aRet ;
2000-09-18 23:08:29 +00:00
if ( ! IsValid ( ) )
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2000-09-18 23:08:29 +00:00
if ( Name . compareToAscii ( " CharacterStyles " ) = = 0 )
aRet = getByIndex ( 0 ) ;
else if ( Name . compareToAscii ( " ParagraphStyles " ) = = 0 )
aRet = getByIndex ( 1 ) ;
else if ( Name . compareToAscii ( " FrameStyles " ) = = 0 )
aRet = getByIndex ( 3 ) ;
else if ( Name . compareToAscii ( " PageStyles " ) = = 0 )
aRet = getByIndex ( 2 ) ;
else if ( Name . compareToAscii ( " NumberingStyles " ) = = 0 )
aRet = getByIndex ( 4 ) ;
else
throw container : : NoSuchElementException ( ) ;
return aRet ;
}
2007-06-05 16:36:55 +00:00
uno : : Sequence < OUString > SwXStyleFamilies : : getElementNames ( void ) throw ( uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2007-06-05 16:36:55 +00:00
uno : : Sequence < OUString > aNames ( STYLE_FAMILY_COUNT ) ;
2000-09-18 23:08:29 +00:00
OUString * pNames = aNames . getArray ( ) ;
2012-12-26 22:49:14 +01:00
pNames [ 0 ] = " CharacterStyles " ;
pNames [ 1 ] = " ParagraphStyles " ;
pNames [ 2 ] = " FrameStyles " ;
pNames [ 3 ] = " PageStyles " ;
pNames [ 4 ] = " NumberingStyles " ;
2000-09-18 23:08:29 +00:00
return aNames ;
}
2007-06-05 16:36:55 +00:00
sal_Bool SwXStyleFamilies : : hasByName ( const OUString & Name ) throw ( uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
if ( Name . compareToAscii ( " CharacterStyles " ) = = 0 | |
Name . compareToAscii ( " ParagraphStyles " ) = = 0 | |
Name . compareToAscii ( " FrameStyles " ) = = 0 | |
Name . compareToAscii ( " PageStyles " ) = = 0 | |
Name . compareToAscii ( " NumberingStyles " ) = = 0 )
return sal_True ;
else
return sal_False ;
}
2007-06-05 16:36:55 +00:00
sal_Int32 SwXStyleFamilies : : getCount ( void ) throw ( uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
return STYLE_FAMILY_COUNT ;
}
2007-06-05 16:36:55 +00:00
uno : : Any SwXStyleFamilies : : getByIndex ( sal_Int32 nIndex )
throw ( lang : : IndexOutOfBoundsException , lang : : WrappedTargetException , uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2007-06-05 16:36:55 +00:00
uno : : Any aRet ;
2004-08-11 14:43:55 +00:00
if ( nIndex < 0 | | nIndex > = STYLE_FAMILY_COUNT )
2000-09-18 23:08:29 +00:00
throw lang : : IndexOutOfBoundsException ( ) ;
if ( IsValid ( ) )
{
2007-06-05 16:36:55 +00:00
uno : : Reference < container : : XNameContainer > aRef ;
2000-09-18 23:08:29 +00:00
sal_uInt16 nType = aStyleByIndex [ nIndex ] ;
switch ( nType )
{
case SFX_STYLE_FAMILY_CHAR :
{
if ( ! pxCharStyles )
{
2007-06-05 16:36:55 +00:00
( ( SwXStyleFamilies * ) this ) - > pxCharStyles = new uno : : Reference < container : : XNameContainer > ( ) ;
2000-09-18 23:08:29 +00:00
* pxCharStyles = new SwXStyleFamily ( pDocShell , nType ) ;
}
aRef = * pxCharStyles ;
}
break ;
case SFX_STYLE_FAMILY_PARA :
{
if ( ! pxParaStyles )
{
2007-06-05 16:36:55 +00:00
( ( SwXStyleFamilies * ) this ) - > pxParaStyles = new uno : : Reference < container : : XNameContainer > ( ) ;
2000-09-18 23:08:29 +00:00
* pxParaStyles = new SwXStyleFamily ( pDocShell , nType ) ;
}
aRef = * pxParaStyles ;
}
break ;
case SFX_STYLE_FAMILY_PAGE :
{
if ( ! pxPageStyles )
{
2007-06-05 16:36:55 +00:00
( ( SwXStyleFamilies * ) this ) - > pxPageStyles = new uno : : Reference < container : : XNameContainer > ( ) ;
2000-09-18 23:08:29 +00:00
* pxPageStyles = new SwXStyleFamily ( pDocShell , nType ) ;
}
aRef = * pxPageStyles ;
}
break ;
case SFX_STYLE_FAMILY_FRAME :
{
if ( ! pxFrameStyles )
{
2007-06-05 16:36:55 +00:00
( ( SwXStyleFamilies * ) this ) - > pxFrameStyles = new uno : : Reference < container : : XNameContainer > ( ) ;
2000-09-18 23:08:29 +00:00
* pxFrameStyles = new SwXStyleFamily ( pDocShell , nType ) ;
}
aRef = * pxFrameStyles ;
}
break ;
case SFX_STYLE_FAMILY_PSEUDO :
{
if ( ! pxNumberingStyles )
{
2007-06-05 16:36:55 +00:00
( ( SwXStyleFamilies * ) this ) - > pxNumberingStyles = new uno : : Reference < container : : XNameContainer > ( ) ;
2000-09-18 23:08:29 +00:00
* pxNumberingStyles = new SwXStyleFamily ( pDocShell , nType ) ;
}
aRef = * pxNumberingStyles ;
}
break ;
}
2007-06-05 16:36:55 +00:00
aRet . setValue ( & aRef , : : getCppuType ( ( const uno : : Reference < container : : XNameContainer > * ) 0 ) ) ;
2000-09-18 23:08:29 +00:00
}
else
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2000-09-18 23:08:29 +00:00
return aRet ;
}
2007-06-05 16:36:55 +00:00
uno : : Type SwXStyleFamilies : : getElementType ( void )
throw ( uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2007-06-05 16:36:55 +00:00
return : : getCppuType ( ( const uno : : Reference < container : : XNameContainer > * ) 0 ) ;
2000-09-18 23:08:29 +00:00
}
2007-06-05 16:36:55 +00:00
sal_Bool SwXStyleFamilies : : hasElements ( void ) throw ( uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
return sal_True ;
}
void SwXStyleFamilies : : loadStylesFromURL ( const OUString & rURL ,
2007-06-05 16:36:55 +00:00
const uno : : Sequence < beans : : PropertyValue > & aOptions )
throw ( io : : IOException , uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2001-02-23 11:32:44 +00:00
sal_Bool bLoadStyleText = sal_True ;
sal_Bool bLoadStylePage = sal_True ;
sal_Bool bLoadStyleOverwrite = sal_True ;
sal_Bool bLoadStyleNumbering = sal_True ;
sal_Bool bLoadStyleFrame = sal_True ;
2012-01-17 17:47:34 -02:00
if ( IsValid ( ) & & ! rURL . isEmpty ( ) )
2000-09-18 23:08:29 +00:00
{
2007-06-05 16:36:55 +00:00
const uno : : Any * pVal ;
2000-09-18 23:08:29 +00:00
int nCount = aOptions . getLength ( ) ;
2007-06-05 16:36:55 +00:00
const beans : : PropertyValue * pArray = aOptions . getConstArray ( ) ;
2000-09-18 23:08:29 +00:00
for ( int i = 0 ; i < nCount ; i + + )
2000-11-01 09:14:33 +00:00
if ( ( pVal = & pArray [ i ] . Value ) - > getValueType ( ) = =
: : getBooleanCppuType ( ) )
{
String sName = pArray [ i ] . Name ;
sal_Bool bVal = * ( sal_Bool * ) pVal - > getValue ( ) ;
2001-06-13 10:48:25 +00:00
if ( sName . EqualsAscii ( SW_PROP_NAME_STR ( UNO_NAME_OVERWRITE_STYLES ) ) )
2000-11-01 09:14:33 +00:00
bLoadStyleOverwrite = bVal ;
2001-06-13 10:48:25 +00:00
else if ( sName . EqualsAscii ( SW_PROP_NAME_STR ( UNO_NAME_LOAD_NUMBERING_STYLES ) ) )
2000-11-01 09:14:33 +00:00
bLoadStyleNumbering = bVal ;
2001-06-13 10:48:25 +00:00
else if ( sName . EqualsAscii ( SW_PROP_NAME_STR ( UNO_NAME_LOAD_PAGE_STYLES ) ) )
2000-11-01 09:14:33 +00:00
bLoadStylePage = bVal ;
2001-06-13 10:48:25 +00:00
else if ( sName . EqualsAscii ( SW_PROP_NAME_STR ( UNO_NAME_LOAD_FRAME_STYLES ) ) )
2000-11-01 09:14:33 +00:00
bLoadStyleFrame = bVal ;
2001-06-13 10:48:25 +00:00
else if ( sName . EqualsAscii ( SW_PROP_NAME_STR ( UNO_NAME_LOAD_TEXT_STYLES ) ) )
2000-11-01 09:14:33 +00:00
bLoadStyleText = bVal ;
}
2000-09-18 23:08:29 +00:00
2000-11-01 09:14:33 +00:00
SwgReaderOption aOpt ;
aOpt . SetFrmFmts ( bLoadStyleFrame ) ;
aOpt . SetTxtFmts ( bLoadStyleText ) ;
aOpt . SetPageDescs ( bLoadStylePage ) ;
aOpt . SetNumRules ( bLoadStyleNumbering ) ;
aOpt . SetMerge ( ! bLoadStyleOverwrite ) ;
2011-01-17 15:06:54 +01:00
sal_uLong nErr = pDocShell - > LoadStylesFromFile ( rURL , aOpt , sal_True ) ;
2000-11-01 09:14:33 +00:00
if ( nErr )
throw io : : IOException ( ) ;
2000-09-18 23:08:29 +00:00
}
else
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2000-09-18 23:08:29 +00:00
}
2007-06-05 16:36:55 +00:00
uno : : Sequence < beans : : PropertyValue > SwXStyleFamilies : : getStyleLoaderOptions ( void )
throw ( uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2007-06-05 16:36:55 +00:00
uno : : Sequence < beans : : PropertyValue > aSeq ( 5 ) ;
beans : : PropertyValue * pArray = aSeq . getArray ( ) ;
uno : : Any aVal ;
2001-02-23 11:32:44 +00:00
sal_Bool bTemp = sal_True ;
2000-09-18 23:08:29 +00:00
aVal . setValue ( & bTemp , : : getCppuBooleanType ( ) ) ;
2010-12-27 09:53:49 +01:00
pArray [ 0 ] = beans : : PropertyValue ( rtl : : OUString : : createFromAscii ( SW_PROP_NAME_STR ( UNO_NAME_LOAD_TEXT_STYLES ) ) , - 1 , aVal , beans : : PropertyState_DIRECT_VALUE ) ;
2000-09-18 23:08:29 +00:00
aVal . setValue ( & bTemp , : : getCppuBooleanType ( ) ) ;
2010-12-27 09:53:49 +01:00
pArray [ 1 ] = beans : : PropertyValue ( rtl : : OUString : : createFromAscii ( SW_PROP_NAME_STR ( UNO_NAME_LOAD_FRAME_STYLES ) ) , - 1 , aVal , beans : : PropertyState_DIRECT_VALUE ) ;
2000-09-18 23:08:29 +00:00
aVal . setValue ( & bTemp , : : getCppuBooleanType ( ) ) ;
2010-12-27 09:53:49 +01:00
pArray [ 2 ] = beans : : PropertyValue ( rtl : : OUString : : createFromAscii ( SW_PROP_NAME_STR ( UNO_NAME_LOAD_PAGE_STYLES ) ) , - 1 , aVal , beans : : PropertyState_DIRECT_VALUE ) ;
2000-09-18 23:08:29 +00:00
aVal . setValue ( & bTemp , : : getCppuBooleanType ( ) ) ;
2010-12-27 09:53:49 +01:00
pArray [ 3 ] = beans : : PropertyValue ( rtl : : OUString : : createFromAscii ( SW_PROP_NAME_STR ( UNO_NAME_LOAD_NUMBERING_STYLES ) ) , - 1 , aVal , beans : : PropertyState_DIRECT_VALUE ) ;
2000-09-18 23:08:29 +00:00
aVal . setValue ( & bTemp , : : getCppuBooleanType ( ) ) ;
2010-12-27 09:53:49 +01:00
pArray [ 4 ] = beans : : PropertyValue ( rtl : : OUString : : createFromAscii ( SW_PROP_NAME_STR ( UNO_NAME_OVERWRITE_STYLES ) ) , - 1 , aVal , beans : : PropertyState_DIRECT_VALUE ) ;
2000-09-18 23:08:29 +00:00
return aSeq ;
}
/******************************************************************
* SwXStyleFamily
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2007-06-05 16:36:55 +00:00
OUString SwXStyleFamily : : getImplementationName ( void ) throw ( uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2012-12-26 22:49:14 +01:00
return OUString ( " SwXStyleFamily " ) ;
2000-09-18 23:08:29 +00:00
}
2011-01-03 20:35:28 +00:00
sal_Bool SwXStyleFamily : : supportsService ( const OUString & rServiceName ) throw ( uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2013-01-16 16:04:48 +01:00
return cppu : : supportsService ( this , rServiceName ) ;
2000-09-18 23:08:29 +00:00
}
2007-06-05 16:36:55 +00:00
uno : : Sequence < OUString > SwXStyleFamily : : getSupportedServiceNames ( void ) throw ( uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2007-06-05 16:36:55 +00:00
uno : : Sequence < OUString > aRet ( 1 ) ;
2000-09-18 23:08:29 +00:00
OUString * pArray = aRet . getArray ( ) ;
2012-12-26 22:49:14 +01:00
pArray [ 0 ] = " com.sun.star.style.StyleFamily " ;
2000-09-18 23:08:29 +00:00
return aRet ;
}
SwXStyleFamily : : SwXStyleFamily ( SwDocShell * pDocSh , sal_uInt16 nFamily ) :
2007-09-27 08:40:48 +00:00
eFamily ( ( SfxStyleFamily ) nFamily ) ,
2000-09-18 23:08:29 +00:00
pBasePool ( pDocSh - > GetStyleSheetPool ( ) ) ,
2007-09-27 08:40:48 +00:00
pDocShell ( pDocSh )
2000-09-18 23:08:29 +00:00
{
StartListening ( * pBasePool ) ;
}
SwXStyleFamily : : ~ SwXStyleFamily ( )
{
2001-10-29 14:16:14 +00:00
}
2010-10-13 16:04:59 +05:30
2012-10-12 16:49:40 +02:00
static sal_Int32 lcl_GetCountOrName ( const SwDoc & rDoc , SfxStyleFamily eFamily , String * pString , sal_uInt16 nIndex = USHRT_MAX )
2001-10-29 14:16:14 +00:00
{
sal_Int32 nCount = 0 ;
switch ( eFamily )
{
case SFX_STYLE_FAMILY_CHAR :
{
sal_uInt16 nBaseCount = RES_POOLCHR_HTML_END - RES_POOLCHR_HTML_BEGIN +
RES_POOLCHR_NORMAL_END - RES_POOLCHR_NORMAL_BEGIN ;
2007-09-27 08:40:48 +00:00
nIndex = nIndex - nBaseCount ;
2012-06-20 16:36:51 +02:00
const sal_uInt16 nArrLen = rDoc . GetCharFmts ( ) - > size ( ) ;
2001-10-29 14:16:14 +00:00
for ( sal_uInt16 i = 0 ; i < nArrLen ; i + + )
{
SwCharFmt * pFmt = ( * rDoc . GetCharFmts ( ) ) [ i ] ;
if ( pFmt - > IsDefault ( ) & & pFmt ! = rDoc . GetDfltCharFmt ( ) )
continue ;
if ( IsPoolUserFmt ( pFmt - > GetPoolFmtId ( ) ) )
{
2001-11-01 14:10:56 +00:00
if ( nIndex = = nCount )
2001-10-29 14:16:14 +00:00
{
2003-04-04 17:13:27 +00:00
// the default character format needs to be set to "Default!"
if ( rDoc . GetDfltCharFmt ( ) = = pFmt )
SwStyleNameMapper : : FillUIName (
RES_POOLCOLL_STANDARD , * pString ) ;
else
* pString = pFmt - > GetName ( ) ;
2001-10-29 14:16:14 +00:00
break ;
}
2001-11-01 14:10:56 +00:00
nCount + + ;
2001-10-29 14:16:14 +00:00
}
}
nCount + = nBaseCount ;
}
break ;
case SFX_STYLE_FAMILY_PARA :
{
sal_uInt16 nBaseCount = RES_POOLCOLL_HTML_END - RES_POOLCOLL_HTML_BEGIN +
RES_POOLCOLL_DOC_END - RES_POOLCOLL_DOC_BEGIN +
RES_POOLCOLL_REGISTER_END - RES_POOLCOLL_REGISTER_BEGIN +
RES_POOLCOLL_EXTRA_END - RES_POOLCOLL_EXTRA_BEGIN +
RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN +
RES_POOLCOLL_TEXT_END - RES_POOLCOLL_TEXT_BEGIN ;
2007-09-27 08:40:48 +00:00
nIndex = nIndex - nBaseCount ;
2012-06-20 16:36:51 +02:00
const sal_uInt16 nArrLen = rDoc . GetTxtFmtColls ( ) - > size ( ) ;
2001-10-29 14:16:14 +00:00
for ( sal_uInt16 i = 0 ; i < nArrLen ; i + + )
{
SwTxtFmtColl * pColl = ( * rDoc . GetTxtFmtColls ( ) ) [ i ] ;
if ( pColl - > IsDefault ( ) )
continue ;
if ( IsPoolUserFmt ( pColl - > GetPoolFmtId ( ) ) )
{
2001-11-01 14:10:56 +00:00
if ( nIndex = = nCount )
2001-10-29 14:16:14 +00:00
{
* pString = pColl - > GetName ( ) ;
break ;
}
2001-11-01 14:10:56 +00:00
nCount + + ;
2001-10-29 14:16:14 +00:00
}
}
nCount + = nBaseCount ;
}
break ;
case SFX_STYLE_FAMILY_FRAME :
{
sal_uInt16 nBaseCount = RES_POOLFRM_END - RES_POOLFRM_BEGIN ;
2007-09-27 08:40:48 +00:00
nIndex = nIndex - nBaseCount ;
2012-06-20 16:36:51 +02:00
const sal_uInt16 nArrLen = rDoc . GetFrmFmts ( ) - > size ( ) ;
2001-10-29 14:16:14 +00:00
for ( sal_uInt16 i = 0 ; i < nArrLen ; i + + )
{
SwFrmFmt * pFmt = ( * rDoc . GetFrmFmts ( ) ) [ i ] ;
if ( pFmt - > IsDefault ( ) | | pFmt - > IsAuto ( ) )
continue ;
if ( IsPoolUserFmt ( pFmt - > GetPoolFmtId ( ) ) )
{
2001-11-01 14:10:56 +00:00
if ( nIndex = = nCount )
2001-10-29 14:16:14 +00:00
{
* pString = pFmt - > GetName ( ) ;
break ;
}
2001-11-01 14:10:56 +00:00
nCount + + ;
2001-10-29 14:16:14 +00:00
}
}
nCount + = nBaseCount ;
}
break ;
case SFX_STYLE_FAMILY_PAGE :
{
sal_uInt16 nBaseCount = RES_POOLPAGE_END - RES_POOLPAGE_BEGIN ;
2007-09-27 08:40:48 +00:00
nIndex = nIndex - nBaseCount ;
2001-10-29 14:16:14 +00:00
const sal_uInt16 nArrLen = rDoc . GetPageDescCnt ( ) ;
for ( sal_uInt16 i = 0 ; i < nArrLen ; + + i )
{
const SwPageDesc & rDesc = rDoc . GetPageDesc ( i ) ;
if ( IsPoolUserFmt ( rDesc . GetPoolFmtId ( ) ) )
{
2001-11-01 14:10:56 +00:00
if ( nIndex = = nCount )
2001-10-29 14:16:14 +00:00
{
* pString = rDesc . GetName ( ) ;
break ;
}
2001-11-01 14:10:56 +00:00
nCount + + ;
2001-10-29 14:16:14 +00:00
}
}
nCount + = nBaseCount ;
}
break ;
case SFX_STYLE_FAMILY_PSEUDO :
{
sal_uInt16 nBaseCount = RES_POOLNUMRULE_END - RES_POOLNUMRULE_BEGIN ;
2007-09-27 08:40:48 +00:00
nIndex = nIndex - nBaseCount ;
2001-10-29 14:16:14 +00:00
const SwNumRuleTbl & rNumTbl = rDoc . GetNumRuleTbl ( ) ;
2012-05-16 15:23:09 +02:00
for ( sal_uInt16 i = 0 ; i < rNumTbl . size ( ) ; + + i )
2001-10-29 14:16:14 +00:00
{
const SwNumRule & rRule = * rNumTbl [ i ] ;
if ( rRule . IsAutoRule ( ) )
continue ;
if ( IsPoolUserFmt ( rRule . GetPoolFmtId ( ) ) )
{
2001-11-01 14:10:56 +00:00
if ( nIndex = = nCount )
2001-10-29 14:16:14 +00:00
{
* pString = rRule . GetName ( ) ;
break ;
}
2001-11-01 14:10:56 +00:00
nCount + + ;
2001-10-29 14:16:14 +00:00
}
}
nCount + = nBaseCount ;
}
break ;
2007-09-27 08:40:48 +00:00
default :
;
2001-10-29 14:16:14 +00:00
}
return nCount ;
2000-09-18 23:08:29 +00:00
}
2007-06-05 16:36:55 +00:00
sal_Int32 SwXStyleFamily : : getCount ( void ) throw ( uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2001-10-29 14:16:14 +00:00
return lcl_GetCountOrName ( * pDocShell - > GetDoc ( ) , eFamily , NULL ) ;
2000-09-18 23:08:29 +00:00
}
2007-06-05 16:36:55 +00:00
uno : : Any SwXStyleFamily : : getByIndex ( sal_Int32 nTempIndex )
throw ( lang : : IndexOutOfBoundsException , lang : : WrappedTargetException , uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2007-06-05 16:36:55 +00:00
uno : : Any aRet ;
2001-10-29 14:16:14 +00:00
if ( nTempIndex > = 0 & & nTempIndex < USHRT_MAX )
2000-09-18 23:08:29 +00:00
{
2001-10-29 14:16:14 +00:00
sal_uInt16 nIndex = static_cast < sal_uInt16 > ( nTempIndex ) ;
if ( pBasePool )
2000-09-18 23:08:29 +00:00
{
2001-10-29 14:16:14 +00:00
String sStyleName ;
switch ( eFamily )
2000-09-18 23:08:29 +00:00
{
2001-10-29 14:16:14 +00:00
case SFX_STYLE_FAMILY_CHAR :
{
if ( nIndex < ( RES_POOLCHR_NORMAL_END - RES_POOLCHR_NORMAL_BEGIN ) )
2007-09-27 08:40:48 +00:00
SwStyleNameMapper : : FillUIName ( static_cast < sal_uInt16 > ( RES_POOLCHR_NORMAL_BEGIN + nIndex ) , sStyleName ) ;
2001-10-29 14:16:14 +00:00
else if ( nIndex < ( RES_POOLCHR_HTML_END - RES_POOLCHR_HTML_BEGIN +
RES_POOLCHR_NORMAL_END - RES_POOLCHR_NORMAL_BEGIN ) )
SwStyleNameMapper : : FillUIName ( RES_POOLCHR_HTML_BEGIN
- RES_POOLCHR_NORMAL_END + RES_POOLCHR_NORMAL_BEGIN
+ nIndex , sStyleName ) ;
}
break ;
case SFX_STYLE_FAMILY_PARA :
{
if ( nIndex < ( RES_POOLCOLL_TEXT_END - RES_POOLCOLL_TEXT_BEGIN ) )
2007-09-27 08:40:48 +00:00
SwStyleNameMapper : : FillUIName ( static_cast < sal_uInt16 > ( RES_POOLCOLL_TEXT_BEGIN + nIndex ) , sStyleName ) ;
2001-10-29 14:16:14 +00:00
else if ( nIndex < ( RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN +
RES_POOLCOLL_TEXT_END - RES_POOLCOLL_TEXT_BEGIN ) )
SwStyleNameMapper : : FillUIName ( RES_POOLCOLL_LISTS_BEGIN
- RES_POOLCOLL_TEXT_END + RES_POOLCOLL_TEXT_BEGIN
+ nIndex , sStyleName ) ;
else if ( nIndex < ( RES_POOLCOLL_EXTRA_END - RES_POOLCOLL_EXTRA_BEGIN +
RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN +
RES_POOLCOLL_TEXT_END - RES_POOLCOLL_TEXT_BEGIN ) )
2007-09-27 08:40:48 +00:00
SwStyleNameMapper : : FillUIName ( static_cast < sal_uInt16 > ( RES_POOLCOLL_EXTRA_BEGIN
2001-10-29 14:16:14 +00:00
- RES_POOLCOLL_LISTS_END + RES_POOLCOLL_LISTS_BEGIN
- RES_POOLCOLL_TEXT_END + RES_POOLCOLL_TEXT_BEGIN
2007-09-27 08:40:48 +00:00
+ nIndex ) , sStyleName ) ;
2001-10-29 14:16:14 +00:00
else if ( nIndex < ( RES_POOLCOLL_REGISTER_END - RES_POOLCOLL_REGISTER_BEGIN +
RES_POOLCOLL_EXTRA_END - RES_POOLCOLL_EXTRA_BEGIN +
RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN +
RES_POOLCOLL_TEXT_END - RES_POOLCOLL_TEXT_BEGIN ) )
2007-09-27 08:40:48 +00:00
SwStyleNameMapper : : FillUIName ( static_cast < sal_uInt16 > ( RES_POOLCOLL_REGISTER_BEGIN
2001-10-29 14:16:14 +00:00
- RES_POOLCOLL_EXTRA_END + RES_POOLCOLL_EXTRA_BEGIN
- RES_POOLCOLL_LISTS_END + RES_POOLCOLL_LISTS_BEGIN
- RES_POOLCOLL_TEXT_END + RES_POOLCOLL_TEXT_BEGIN
2007-09-27 08:40:48 +00:00
+ nIndex ) , sStyleName ) ;
2001-10-29 14:16:14 +00:00
else if ( nIndex < ( RES_POOLCOLL_DOC_END - RES_POOLCOLL_DOC_BEGIN +
RES_POOLCOLL_REGISTER_END - RES_POOLCOLL_REGISTER_BEGIN +
RES_POOLCOLL_EXTRA_END - RES_POOLCOLL_EXTRA_BEGIN +
RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN +
RES_POOLCOLL_TEXT_END - RES_POOLCOLL_TEXT_BEGIN ) )
2007-09-27 08:40:48 +00:00
SwStyleNameMapper : : FillUIName ( static_cast < sal_uInt16 > ( RES_POOLCOLL_DOC_BEGIN
2001-10-29 14:16:14 +00:00
- RES_POOLCOLL_REGISTER_END + RES_POOLCOLL_REGISTER_BEGIN
- RES_POOLCOLL_EXTRA_END + RES_POOLCOLL_EXTRA_BEGIN
- RES_POOLCOLL_LISTS_END + RES_POOLCOLL_LISTS_BEGIN
- RES_POOLCOLL_TEXT_END + RES_POOLCOLL_TEXT_BEGIN
2007-09-27 08:40:48 +00:00
+ nIndex ) , sStyleName ) ;
2001-10-29 14:16:14 +00:00
else if ( nIndex < ( RES_POOLCOLL_HTML_END - RES_POOLCOLL_HTML_BEGIN +
RES_POOLCOLL_DOC_END - RES_POOLCOLL_DOC_BEGIN +
RES_POOLCOLL_REGISTER_END - RES_POOLCOLL_REGISTER_BEGIN +
RES_POOLCOLL_EXTRA_END - RES_POOLCOLL_EXTRA_BEGIN +
RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN +
RES_POOLCOLL_TEXT_END - RES_POOLCOLL_TEXT_BEGIN ) )
2007-09-27 08:40:48 +00:00
SwStyleNameMapper : : FillUIName ( static_cast < sal_uInt16 > ( RES_POOLCOLL_HTML_BEGIN
2001-10-29 14:16:14 +00:00
- RES_POOLCOLL_DOC_END + RES_POOLCOLL_DOC_BEGIN
- RES_POOLCOLL_REGISTER_END + RES_POOLCOLL_REGISTER_BEGIN
- RES_POOLCOLL_EXTRA_END + RES_POOLCOLL_EXTRA_BEGIN
- RES_POOLCOLL_LISTS_END + RES_POOLCOLL_LISTS_BEGIN
- RES_POOLCOLL_TEXT_END + RES_POOLCOLL_TEXT_BEGIN
2007-09-27 08:40:48 +00:00
+ nIndex ) , sStyleName ) ;
2001-10-29 14:16:14 +00:00
}
break ;
case SFX_STYLE_FAMILY_FRAME :
{
if ( nIndex < ( RES_POOLFRM_END - RES_POOLFRM_BEGIN ) )
{
2007-09-27 08:40:48 +00:00
SwStyleNameMapper : : FillUIName ( static_cast < sal_uInt16 > ( RES_POOLFRM_BEGIN + nIndex ) , sStyleName ) ;
2001-10-29 14:16:14 +00:00
}
}
break ;
case SFX_STYLE_FAMILY_PAGE :
{
if ( nIndex < ( RES_POOLPAGE_END - RES_POOLPAGE_BEGIN ) )
{
2007-09-27 08:40:48 +00:00
SwStyleNameMapper : : FillUIName ( static_cast < sal_uInt16 > ( RES_POOLPAGE_BEGIN + nIndex ) , sStyleName ) ;
2001-10-29 14:16:14 +00:00
}
}
break ;
case SFX_STYLE_FAMILY_PSEUDO :
{
if ( nIndex < ( RES_POOLNUMRULE_END - RES_POOLNUMRULE_BEGIN ) )
{
2007-09-27 08:40:48 +00:00
SwStyleNameMapper : : FillUIName ( static_cast < sal_uInt16 > ( RES_POOLNUMRULE_BEGIN + nIndex ) , sStyleName ) ;
2001-10-29 14:16:14 +00:00
}
}
break ;
2007-09-27 08:40:48 +00:00
default :
;
2000-09-18 23:08:29 +00:00
}
2001-10-29 14:16:14 +00:00
if ( ! sStyleName . Len ( ) )
lcl_GetCountOrName ( * pDocShell - > GetDoc ( ) , eFamily , & sStyleName , nIndex ) ;
if ( sStyleName . Len ( ) )
{
SfxStyleSheetBase * pBase = pBasePool - > Find ( sStyleName , eFamily ) ;
if ( pBase )
{
2007-06-05 16:36:55 +00:00
uno : : Reference < style : : XStyle > xStyle = _FindStyle ( sStyleName ) ;
2001-10-29 14:16:14 +00:00
if ( ! xStyle . is ( ) )
{
xStyle = eFamily = = SFX_STYLE_FAMILY_PAGE ?
new SwXPageStyle ( * pBasePool , pDocShell , eFamily , sStyleName ) :
eFamily = = SFX_STYLE_FAMILY_FRAME ?
new SwXFrameStyle ( * pBasePool , pDocShell - > GetDoc ( ) , pBase - > GetName ( ) ) :
new SwXStyle ( * pBasePool , eFamily , pDocShell - > GetDoc ( ) , sStyleName ) ;
}
2007-06-05 16:36:55 +00:00
aRet . setValue ( & xStyle , : : getCppuType ( ( uno : : Reference < style : : XStyle > * ) 0 ) ) ;
2001-10-29 14:16:14 +00:00
}
else
throw container : : NoSuchElementException ( ) ;
}
else
throw lang : : IndexOutOfBoundsException ( ) ;
2000-09-18 23:08:29 +00:00
}
else
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2000-09-18 23:08:29 +00:00
}
else
2001-10-29 14:16:14 +00:00
throw lang : : IndexOutOfBoundsException ( ) ;
2000-09-18 23:08:29 +00:00
2001-10-29 14:16:14 +00:00
return aRet ;
2000-09-18 23:08:29 +00:00
}
2007-06-05 16:36:55 +00:00
uno : : Any SwXStyleFamily : : getByName ( const OUString & rName )
throw ( container : : NoSuchElementException , lang : : WrappedTargetException , uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2007-06-05 16:36:55 +00:00
uno : : Any aRet ;
2001-08-16 11:33:56 +00:00
String sStyleName ;
2012-10-10 07:34:19 +09:00
SwStyleNameMapper : : FillUIName ( rName , sStyleName , lcl_GetSwEnumFromSfxEnum ( eFamily ) , true ) ;
2000-09-18 23:08:29 +00:00
if ( pBasePool )
{
pBasePool - > SetSearchMask ( eFamily , SFXSTYLEBIT_ALL ) ;
SfxStyleSheetBase * pBase = pBasePool - > Find ( sStyleName ) ;
if ( pBase )
{
2007-06-05 16:36:55 +00:00
uno : : Reference < style : : XStyle > xStyle = _FindStyle ( sStyleName ) ;
2000-09-18 23:08:29 +00:00
if ( ! xStyle . is ( ) )
{
xStyle = eFamily = = SFX_STYLE_FAMILY_PAGE ?
2000-12-19 16:28:58 +00:00
new SwXPageStyle ( * pBasePool , pDocShell , eFamily , sStyleName ) :
eFamily = = SFX_STYLE_FAMILY_FRAME ?
new SwXFrameStyle ( * pBasePool , pDocShell - > GetDoc ( ) , pBase - > GetName ( ) ) :
new SwXStyle ( * pBasePool , eFamily , pDocShell - > GetDoc ( ) , sStyleName ) ;
2000-09-18 23:08:29 +00:00
}
2007-06-05 16:36:55 +00:00
aRet . setValue ( & xStyle , : : getCppuType ( ( uno : : Reference < style : : XStyle > * ) 0 ) ) ;
2000-09-18 23:08:29 +00:00
}
else
throw container : : NoSuchElementException ( ) ;
}
else
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2000-09-18 23:08:29 +00:00
return aRet ;
}
2007-06-05 16:36:55 +00:00
uno : : Sequence < OUString > SwXStyleFamily : : getElementNames ( void ) throw ( uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2007-06-05 16:36:55 +00:00
uno : : Sequence < OUString > aRet ;
2000-09-18 23:08:29 +00:00
if ( pBasePool )
{
2012-11-25 15:24:42 +01:00
SfxStyleSheetIterator * pIterator = pBasePool - > CreateIterator ( eFamily , SFXSTYLEBIT_ALL ) ;
2000-09-18 23:08:29 +00:00
sal_uInt16 nCount = pIterator - > Count ( ) ;
aRet . realloc ( nCount ) ;
OUString * pArray = aRet . getArray ( ) ;
2001-08-16 11:33:56 +00:00
String aString ;
2000-09-18 23:08:29 +00:00
for ( sal_uInt16 i = 0 ; i < nCount ; i + + )
2001-08-16 11:33:56 +00:00
{
2012-10-10 07:34:19 +09:00
SwStyleNameMapper : : FillProgName ( ( * pIterator ) [ i ] - > GetName ( ) , aString , lcl_GetSwEnumFromSfxEnum ( eFamily ) , true ) ;
2001-08-16 11:33:56 +00:00
pArray [ i ] = OUString ( aString ) ;
}
2000-09-18 23:08:29 +00:00
delete pIterator ;
}
else
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2000-09-18 23:08:29 +00:00
return aRet ;
}
2007-06-05 16:36:55 +00:00
sal_Bool SwXStyleFamily : : hasByName ( const OUString & rName ) throw ( uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2000-09-18 23:08:29 +00:00
sal_Bool bRet = sal_False ;
if ( pBasePool )
{
2001-08-16 11:33:56 +00:00
String sStyleName ;
2012-10-10 07:34:19 +09:00
SwStyleNameMapper : : FillUIName ( rName , sStyleName , lcl_GetSwEnumFromSfxEnum ( eFamily ) , true ) ;
2000-09-18 23:08:29 +00:00
pBasePool - > SetSearchMask ( eFamily , SFXSTYLEBIT_ALL ) ;
SfxStyleSheetBase * pBase = pBasePool - > Find ( sStyleName ) ;
bRet = 0 ! = pBase ;
}
else
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2000-09-18 23:08:29 +00:00
return bRet ;
}
2007-06-05 16:36:55 +00:00
uno : : Type SwXStyleFamily : : getElementType ( void ) throw ( uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2007-06-05 16:36:55 +00:00
return : : getCppuType ( ( const uno : : Reference < style : : XStyle > * ) 0 ) ;
2000-09-18 23:08:29 +00:00
}
2007-06-05 16:36:55 +00:00
sal_Bool SwXStyleFamily : : hasElements ( void ) throw ( uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
if ( ! pBasePool )
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2000-09-18 23:08:29 +00:00
return sal_True ;
}
2007-06-05 16:36:55 +00:00
void SwXStyleFamily : : insertByName ( const OUString & rName , const uno : : Any & rElement )
throw ( lang : : IllegalArgumentException , container : : ElementExistException , lang : : WrappedTargetException , uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2000-09-18 23:08:29 +00:00
if ( pBasePool )
{
2001-08-16 11:33:56 +00:00
String sStyleName ;
2012-10-10 07:34:19 +09:00
SwStyleNameMapper : : FillUIName ( rName , sStyleName , lcl_GetSwEnumFromSfxEnum ( eFamily ) , true ) ;
2000-09-18 23:08:29 +00:00
pBasePool - > SetSearchMask ( eFamily , SFXSTYLEBIT_ALL ) ;
SfxStyleSheetBase * pBase = pBasePool - > Find ( sStyleName ) ;
2001-08-16 11:33:56 +00:00
SfxStyleSheetBase * pUINameBase = pBasePool - > Find ( sStyleName ) ;
2000-09-18 23:08:29 +00:00
if ( pBase | | pUINameBase )
throw container : : ElementExistException ( ) ;
else
{
if ( rElement . getValueType ( ) . getTypeClass ( ) = =
2007-06-05 16:36:55 +00:00
uno : : TypeClass_INTERFACE )
2000-09-18 23:08:29 +00:00
{
2007-06-05 16:36:55 +00:00
uno : : Reference < uno : : XInterface > * pxRef =
( uno : : Reference < uno : : XInterface > * ) rElement . getValue ( ) ;
2000-09-18 23:08:29 +00:00
2007-06-05 16:36:55 +00:00
uno : : Reference < lang : : XUnoTunnel > xStyleTunnel ( * pxRef , uno : : UNO_QUERY ) ;
2000-09-18 23:08:29 +00:00
SwXStyle * pNewStyle = 0 ;
if ( xStyleTunnel . is ( ) )
{
2007-09-27 08:40:48 +00:00
pNewStyle = reinterpret_cast < SwXStyle * > (
sal : : static_int_cast < sal_IntPtr > ( xStyleTunnel - > getSomething ( SwXStyle : : getUnoTunnelId ( ) ) ) ) ;
2000-09-18 23:08:29 +00:00
}
if ( ! pNewStyle | | ! pNewStyle - > IsDescriptor ( ) | |
pNewStyle - > GetFamily ( ) ! = eFamily )
throw lang : : IllegalArgumentException ( ) ;
if ( pNewStyle )
{
2012-11-25 15:24:42 +01:00
sal_uInt16 nMask = SFXSTYLEBIT_ALL ;
2000-09-18 23:08:29 +00:00
if ( eFamily = = SFX_STYLE_FAMILY_PARA & & ! pNewStyle - > IsConditional ( ) )
nMask & = ~ SWSTYLEBIT_CONDCOLL ;
2007-09-27 08:40:48 +00:00
# if OSL_DEBUG_LEVEL > 1
SfxStyleSheetBase & rNewBase =
# endif
2013-01-02 19:55:34 +01:00
pBasePool - > Make ( sStyleName , eFamily , nMask ) ;
2000-09-18 23:08:29 +00:00
pNewStyle - > SetDoc ( pDocShell - > GetDoc ( ) , pBasePool ) ;
pNewStyle - > SetStyleName ( sStyleName ) ;
String sParentStyleName ( pNewStyle - > GetParentStyleName ( ) ) ;
if ( sParentStyleName . Len ( ) )
{
pBasePool - > SetSearchMask ( eFamily , SFXSTYLEBIT_ALL ) ;
SfxStyleSheetBase * pParentBase = pBasePool - > Find ( sParentStyleName ) ;
if ( pParentBase & & pParentBase - > GetFamily ( ) = = eFamily & &
& pParentBase - > GetPool ( ) = = pBasePool )
pBasePool - > SetParent ( eFamily , sStyleName , sParentStyleName ) ;
}
2007-09-27 08:40:48 +00:00
# if OSL_DEBUG_LEVEL > 1
( void ) rNewBase ;
# endif
2000-09-18 23:08:29 +00:00
//so, jetzt sollten noch die Properties des Descriptors angewandt werden
pNewStyle - > ApplyDescriptorProperties ( ) ;
}
else
throw lang : : IllegalArgumentException ( ) ;
}
else
throw lang : : IllegalArgumentException ( ) ;
}
}
else
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2000-09-18 23:08:29 +00:00
}
2007-06-05 16:36:55 +00:00
void SwXStyleFamily : : replaceByName ( const OUString & rName , const uno : : Any & rElement )
throw ( lang : : IllegalArgumentException , container : : NoSuchElementException , lang : : WrappedTargetException , uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2000-09-18 23:08:29 +00:00
if ( pBasePool )
{
pBasePool - > SetSearchMask ( eFamily ) ;
SfxStyleSheetBase * pBase = pBasePool - > Find ( rName ) ;
//Ersetzung geht nur fuer benutzerdefinierte Styles
if ( ! pBase )
throw container : : NoSuchElementException ( ) ;
if ( ! pBase - > IsUserDefined ( ) )
throw lang : : IllegalArgumentException ( ) ;
//if theres an object available to this style then it must be invalidated
2007-06-05 16:36:55 +00:00
uno : : Reference < style : : XStyle > xStyle = _FindStyle ( pBase - > GetName ( ) ) ;
2000-09-18 23:08:29 +00:00
if ( xStyle . is ( ) )
{
2007-06-05 16:36:55 +00:00
uno : : Reference < lang : : XUnoTunnel > xTunnel ( xStyle , uno : : UNO_QUERY ) ;
2000-09-18 23:08:29 +00:00
if ( xTunnel . is ( ) )
{
2007-09-27 08:40:48 +00:00
SwXStyle * pStyle = reinterpret_cast < SwXStyle * > (
sal : : static_int_cast < sal_IntPtr > ( xTunnel - > getSomething ( SwXStyle : : getUnoTunnelId ( ) ) ) ) ;
2000-09-18 23:08:29 +00:00
pStyle - > Invalidate ( ) ;
}
}
2008-03-12 11:35:18 +00:00
pBasePool - > Remove ( pBase ) ;
2000-09-18 23:08:29 +00:00
insertByName ( rName , rElement ) ;
}
else
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2000-09-18 23:08:29 +00:00
}
2007-06-05 16:36:55 +00:00
void SwXStyleFamily : : removeByName ( const OUString & rName ) throw ( container : : NoSuchElementException , lang : : WrappedTargetException , uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2000-09-18 23:08:29 +00:00
if ( pBasePool )
{
pBasePool - > SetSearchMask ( eFamily , SFXSTYLEBIT_ALL ) ;
2001-08-16 11:33:56 +00:00
String aString ;
2012-10-10 07:34:19 +09:00
SwStyleNameMapper : : FillUIName ( rName , aString , lcl_GetSwEnumFromSfxEnum ( eFamily ) , true ) ;
2001-08-16 11:33:56 +00:00
SfxStyleSheetBase * pBase = pBasePool - > Find ( aString ) ;
2000-09-18 23:08:29 +00:00
if ( pBase )
2008-03-12 11:35:18 +00:00
pBasePool - > Remove ( pBase ) ;
2000-09-18 23:08:29 +00:00
else
throw container : : NoSuchElementException ( ) ;
}
else
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2000-09-18 23:08:29 +00:00
}
2009-01-06 17:37:13 +00:00
uno : : Reference < beans : : XPropertySetInfo > SAL_CALL SwXStyleFamily : : getPropertySetInfo ( ) throw ( uno : : RuntimeException )
{
return uno : : Reference < beans : : XPropertySetInfo > ( ) ;
}
void SAL_CALL SwXStyleFamily : : setPropertyValue ( const : : rtl : : OUString & , const uno : : Any & ) throw ( beans : : UnknownPropertyException , beans : : PropertyVetoException , lang : : IllegalArgumentException , lang : : WrappedTargetException , uno : : RuntimeException )
{
2011-03-12 12:11:06 +01:00
OSL_FAIL ( " ###unexpected! " ) ;
2009-01-06 17:37:13 +00:00
}
uno : : Any SAL_CALL SwXStyleFamily : : getPropertyValue ( const : : rtl : : OUString & sPropertyName ) throw ( beans : : UnknownPropertyException , lang : : WrappedTargetException , uno : : RuntimeException )
{
uno : : Any aRet ;
2012-04-06 15:05:52 +02:00
if ( sPropertyName = = " DisplayName " )
2009-01-06 17:37:13 +00:00
{
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2009-01-06 17:37:13 +00:00
sal_uInt32 nResId = 0 ;
switch ( eFamily )
{
case SFX_STYLE_FAMILY_CHAR :
nResId = STR_STYLE_FAMILY_CHARACTER ; break ;
case SFX_STYLE_FAMILY_PARA :
nResId = STR_STYLE_FAMILY_PARAGRAPH ; break ;
case SFX_STYLE_FAMILY_FRAME :
nResId = STR_STYLE_FAMILY_FRAME ; break ;
case SFX_STYLE_FAMILY_PAGE :
nResId = STR_STYLE_FAMILY_PAGE ; break ;
case SFX_STYLE_FAMILY_PSEUDO :
nResId = STR_STYLE_FAMILY_NUMBERING ; break ;
default :
2011-03-12 12:11:06 +01:00
OSL_FAIL ( " SwXStyleFamily::getPropertyValue(): invalid family " ) ;
2009-01-06 17:37:13 +00:00
}
if ( nResId > 0 )
{
OUString sDisplayName ( String ( SW_RES ( nResId ) ) ) ;
aRet = uno : : makeAny ( sDisplayName ) ;
}
}
else
{
throw beans : : UnknownPropertyException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " unknown property: " ) ) + sPropertyName , static_cast < OWeakObject * > ( this ) ) ;
}
return aRet ;
}
void SAL_CALL SwXStyleFamily : : addPropertyChangeListener ( const : : rtl : : OUString & , const uno : : Reference < beans : : XPropertyChangeListener > & ) throw ( beans : : UnknownPropertyException , lang : : WrappedTargetException , uno : : RuntimeException )
{
2011-03-12 12:11:06 +01:00
OSL_FAIL ( " ###unexpected! " ) ;
2009-01-06 17:37:13 +00:00
}
void SAL_CALL SwXStyleFamily : : removePropertyChangeListener ( const : : rtl : : OUString & , const uno : : Reference < beans : : XPropertyChangeListener > & ) throw ( beans : : UnknownPropertyException , lang : : WrappedTargetException , uno : : RuntimeException )
{
2011-03-12 12:11:06 +01:00
OSL_FAIL ( " ###unexpected! " ) ;
2009-01-06 17:37:13 +00:00
}
void SAL_CALL SwXStyleFamily : : addVetoableChangeListener ( const : : rtl : : OUString & , const uno : : Reference < beans : : XVetoableChangeListener > & ) throw ( beans : : UnknownPropertyException , lang : : WrappedTargetException , uno : : RuntimeException )
{
2011-03-12 12:11:06 +01:00
OSL_FAIL ( " ###unexpected! " ) ;
2009-01-06 17:37:13 +00:00
}
void SAL_CALL SwXStyleFamily : : removeVetoableChangeListener ( const : : rtl : : OUString & , const uno : : Reference < beans : : XVetoableChangeListener > & ) throw ( beans : : UnknownPropertyException , lang : : WrappedTargetException , uno : : RuntimeException )
{
2011-03-12 12:11:06 +01:00
OSL_FAIL ( " ###unexpected! " ) ;
2009-01-06 17:37:13 +00:00
}
2000-09-18 23:08:29 +00:00
void SwXStyleFamily : : Notify ( SfxBroadcaster & rBC , const SfxHint & rHint )
{
SfxSimpleHint * pHint = PTR_CAST ( SfxSimpleHint , & rHint ) ;
if ( pHint & & ( pHint - > GetId ( ) & SFX_HINT_DYING ) )
{
pBasePool = 0 ;
pDocShell = 0 ;
EndListening ( rBC ) ;
}
}
SwXStyle * SwXStyleFamily : : _FindStyle ( const String & rStyleName ) const
{
sal_uInt16 nLCount = pBasePool - > GetListenerCount ( ) ;
SfxListener * pListener = 0 ;
for ( sal_uInt16 i = 0 ; i < nLCount ; i + + )
{
pListener = pBasePool - > GetListener ( i ) ;
2009-06-03 11:26:39 +00:00
SwXStyle * pTempStyle = dynamic_cast < SwXStyle * > ( pListener ) ;
if ( pTempStyle & & pTempStyle - > GetFamily ( ) = = eFamily & & pTempStyle - > GetStyleName ( ) = = rStyleName )
2000-09-18 23:08:29 +00:00
{
2009-06-03 11:26:39 +00:00
return pTempStyle ;
2000-09-18 23:08:29 +00:00
}
}
return 0 ;
}
2010-10-13 16:04:59 +05:30
2000-09-18 23:08:29 +00:00
class SwStyleProperties_Impl
{
2009-06-03 11:26:39 +00:00
const PropertyEntryVector_t aPropertyEntries ;
2007-06-05 16:36:55 +00:00
uno : : Any * * pAnyArr ;
2009-06-03 11:26:39 +00:00
sal_uInt32 nArrLen ;
2000-09-18 23:08:29 +00:00
public :
2012-01-05 21:30:06 +00:00
SwStyleProperties_Impl ( const SfxItemPropertyMap & rMap ) ;
2000-09-18 23:08:29 +00:00
~ SwStyleProperties_Impl ( ) ;
2009-06-03 11:26:39 +00:00
sal_Bool SetProperty ( const : : rtl : : OUString & rName , uno : : Any aVal ) ;
sal_Bool GetProperty ( const : : rtl : : OUString & rName , uno : : Any * & rpAny ) ;
sal_Bool ClearProperty ( const : : rtl : : OUString & rPropertyName ) ;
2001-11-06 17:52:15 +00:00
void ClearAllProperties ( ) ;
2009-06-03 11:26:39 +00:00
void GetProperty ( const : : rtl : : OUString & rPropertyName , const uno : : Reference < beans : : XPropertySet > & rxPropertySet , uno : : Any & rAny ) ;
2001-10-17 11:27:45 +00:00
2009-06-03 11:26:39 +00:00
const PropertyEntryVector_t & GetPropertyVector ( ) const { return aPropertyEntries ; }
2000-09-18 23:08:29 +00:00
} ;
2010-10-13 16:04:59 +05:30
2012-01-05 21:30:06 +00:00
SwStyleProperties_Impl : : SwStyleProperties_Impl ( const SfxItemPropertyMap & rMap ) :
aPropertyEntries ( rMap . getPropertyEntries ( ) ) ,
2000-09-18 23:08:29 +00:00
nArrLen ( 0 )
{
2009-06-03 11:26:39 +00:00
nArrLen = aPropertyEntries . size ( ) ;
2007-06-05 16:36:55 +00:00
pAnyArr = new uno : : Any * [ nArrLen ] ;
2009-06-03 11:26:39 +00:00
for ( sal_uInt32 i = 0 ; i < nArrLen ; i + + )
2000-09-18 23:08:29 +00:00
pAnyArr [ i ] = 0 ;
}
2010-10-13 16:04:59 +05:30
2000-09-18 23:08:29 +00:00
SwStyleProperties_Impl : : ~ SwStyleProperties_Impl ( )
{
2001-10-11 17:50:13 +00:00
for ( sal_uInt16 i = 0 ; i < nArrLen ; i + + )
2000-09-18 23:08:29 +00:00
delete pAnyArr [ i ] ;
2002-05-13 11:14:05 +00:00
delete [ ] pAnyArr ;
2000-09-18 23:08:29 +00:00
}
2009-06-03 11:26:39 +00:00
sal_Bool SwStyleProperties_Impl : : SetProperty ( const : : rtl : : OUString & rName , uno : : Any aVal )
2000-09-18 23:08:29 +00:00
{
sal_uInt16 nPos = 0 ;
2009-06-03 11:26:39 +00:00
sal_Bool bRet = sal_False ;
PropertyEntryVector_t : : const_iterator aIt = aPropertyEntries . begin ( ) ;
while ( aIt ! = aPropertyEntries . end ( ) )
2000-09-18 23:08:29 +00:00
{
2009-06-03 11:26:39 +00:00
if ( rName = = aIt - > sName )
{
delete pAnyArr [ nPos ] ;
pAnyArr [ nPos ] = new uno : : Any ( aVal ) ;
bRet = sal_True ;
2000-09-18 23:08:29 +00:00
break ;
2009-06-03 11:26:39 +00:00
}
2000-09-18 23:08:29 +00:00
+ + nPos ;
2009-06-03 11:26:39 +00:00
+ + aIt ;
2000-09-18 23:08:29 +00:00
}
2009-06-03 11:26:39 +00:00
return bRet ;
2000-09-18 23:08:29 +00:00
}
2001-11-06 17:52:15 +00:00
sal_Bool SwStyleProperties_Impl : : ClearProperty ( const OUString & rName )
{
2009-06-03 11:26:39 +00:00
sal_Bool bRet = sal_False ;
2001-11-06 17:52:15 +00:00
sal_uInt16 nPos = 0 ;
2009-06-03 11:26:39 +00:00
PropertyEntryVector_t : : const_iterator aIt = aPropertyEntries . begin ( ) ;
while ( aIt ! = aPropertyEntries . end ( ) )
2001-11-06 17:52:15 +00:00
{
2009-06-03 11:26:39 +00:00
if ( rName = = aIt - > sName )
{
delete pAnyArr [ nPos ] ;
pAnyArr [ nPos ] = 0 ;
bRet = sal_True ;
2001-11-06 17:52:15 +00:00
break ;
2009-06-03 11:26:39 +00:00
}
2001-11-06 17:52:15 +00:00
+ + nPos ;
2009-06-03 11:26:39 +00:00
+ + aIt ;
2001-11-06 17:52:15 +00:00
}
2009-06-03 11:26:39 +00:00
return bRet ;
2001-11-06 17:52:15 +00:00
}
2010-10-13 16:04:59 +05:30
2001-11-06 17:52:15 +00:00
void SwStyleProperties_Impl : : ClearAllProperties ( )
{
for ( sal_uInt16 i = 0 ; i < nArrLen ; i + + )
{
delete pAnyArr [ i ] ;
pAnyArr [ i ] = 0 ;
}
}
2010-10-13 16:04:59 +05:30
2009-06-03 11:26:39 +00:00
sal_Bool SwStyleProperties_Impl : : GetProperty ( const : : rtl : : OUString & rName , uno : : Any * & rpAny )
2000-09-18 23:08:29 +00:00
{
2009-06-03 11:26:39 +00:00
sal_Bool bRet = sal_False ;
2000-09-18 23:08:29 +00:00
sal_uInt16 nPos = 0 ;
2009-06-03 11:26:39 +00:00
PropertyEntryVector_t : : const_iterator aIt = aPropertyEntries . begin ( ) ;
while ( aIt ! = aPropertyEntries . end ( ) )
2000-09-18 23:08:29 +00:00
{
2009-06-03 11:26:39 +00:00
if ( rName = = aIt - > sName )
{
rpAny = pAnyArr [ nPos ] ;
bRet = sal_True ;
2000-09-18 23:08:29 +00:00
break ;
2009-06-03 11:26:39 +00:00
}
2010-01-29 15:14:32 +00:00
+ + nPos ;
2009-06-03 11:26:39 +00:00
+ + aIt ;
2000-09-18 23:08:29 +00:00
}
2009-06-03 11:26:39 +00:00
return bRet ;
2000-09-18 23:08:29 +00:00
}
2007-06-05 16:36:55 +00:00
void SwStyleProperties_Impl : : GetProperty ( const OUString & rPropertyName , const uno : : Reference < beans : : XPropertySet > & rxPropertySet , uno : : Any & rAny )
2001-10-17 11:27:45 +00:00
{
rAny = rxPropertySet - > getPropertyValue ( rPropertyName ) ;
}
2011-06-01 22:40:08 +01:00
namespace
{
class theSwXStyleUnoTunnelId : public rtl : : Static < UnoTunnelIdInit , theSwXStyleUnoTunnelId > { } ;
}
2007-06-05 16:36:55 +00:00
const uno : : Sequence < sal_Int8 > & SwXStyle : : getUnoTunnelId ( )
2000-09-18 23:08:29 +00:00
{
2011-06-01 22:40:08 +01:00
return theSwXStyleUnoTunnelId : : get ( ) . getSeq ( ) ;
2000-09-18 23:08:29 +00:00
}
2007-06-05 16:36:55 +00:00
sal_Int64 SAL_CALL SwXStyle : : getSomething ( const uno : : Sequence < sal_Int8 > & rId )
throw ( uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
if ( rId . getLength ( ) = = 16
2012-07-28 17:56:59 +02:00
& & 0 = = memcmp ( getUnoTunnelId ( ) . getConstArray ( ) ,
2000-09-18 23:08:29 +00:00
rId . getConstArray ( ) , 16 ) )
{
2007-09-27 08:40:48 +00:00
return sal : : static_int_cast < sal_Int64 > ( reinterpret_cast < sal_IntPtr > ( this ) ) ;
2000-09-18 23:08:29 +00:00
}
return 0 ;
}
TYPEINIT1 ( SwXStyle , SfxListener ) ;
2007-06-05 16:36:55 +00:00
OUString SwXStyle : : getImplementationName ( void ) throw ( uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2012-12-26 22:49:14 +01:00
return OUString ( " SwXStyle " ) ;
2000-09-18 23:08:29 +00:00
}
2011-01-03 20:35:28 +00:00
sal_Bool SwXStyle : : supportsService ( const OUString & rServiceName ) throw ( uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2013-01-16 16:04:48 +01:00
return cppu : : supportsService ( this , rServiceName ) ;
2000-09-18 23:08:29 +00:00
}
2007-06-05 16:36:55 +00:00
uno : : Sequence < OUString > SwXStyle : : getSupportedServiceNames ( void ) throw ( uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
long nCount = 1 ;
if ( SFX_STYLE_FAMILY_PARA = = eFamily )
{
2002-09-26 06:18:30 +00:00
nCount = 5 ;
2000-09-18 23:08:29 +00:00
if ( bIsConditional )
nCount + + ;
}
else if ( SFX_STYLE_FAMILY_CHAR = = eFamily )
2003-11-07 14:13:39 +00:00
nCount = 5 ;
2001-10-04 11:35:13 +00:00
else if ( SFX_STYLE_FAMILY_PAGE = = eFamily )
2003-11-07 14:13:39 +00:00
nCount = 3 ;
2007-06-05 16:36:55 +00:00
uno : : Sequence < OUString > aRet ( nCount ) ;
2000-09-18 23:08:29 +00:00
OUString * pArray = aRet . getArray ( ) ;
2012-12-26 22:49:14 +01:00
pArray [ 0 ] = " com.sun.star.style.Style " ;
2000-09-18 23:08:29 +00:00
switch ( eFamily )
{
2001-04-23 09:01:41 +00:00
case SFX_STYLE_FAMILY_CHAR :
2012-12-26 22:49:14 +01:00
pArray [ 1 ] = " com.sun.star.style.CharacterStyle " ;
pArray [ 2 ] = " com.sun.star.style.CharacterProperties " ;
pArray [ 3 ] = " com.sun.star.style.CharacterPropertiesAsian " ;
pArray [ 4 ] = " com.sun.star.style.CharacterPropertiesComplex " ;
2001-04-23 09:01:41 +00:00
break ;
2001-10-04 11:35:13 +00:00
case SFX_STYLE_FAMILY_PAGE :
2012-12-26 22:49:14 +01:00
pArray [ 1 ] = " com.sun.star.style.PageStyle " ;
pArray [ 2 ] = " com.sun.star.style.PageProperties " ;
2001-10-04 11:35:13 +00:00
break ;
2000-09-18 23:08:29 +00:00
case SFX_STYLE_FAMILY_PARA :
2012-12-26 22:49:14 +01:00
pArray [ 1 ] = " com.sun.star.style.ParagraphStyle " ;
pArray [ 2 ] = " com.sun.star.style.ParagraphProperties " ;
pArray [ 3 ] = " com.sun.star.style.ParagraphPropertiesAsian " ;
pArray [ 4 ] = " com.sun.star.style.ParagraphPropertiesComplex " ;
2000-09-18 23:08:29 +00:00
if ( bIsConditional )
2012-12-26 22:49:14 +01:00
pArray [ 5 ] = " com.sun.star.style.ConditionalParagraphStyle " ;
2000-09-18 23:08:29 +00:00
break ;
2007-09-27 08:40:48 +00:00
default :
;
2000-09-18 23:08:29 +00:00
}
return aRet ;
}
2011-01-17 15:06:54 +01:00
SwXStyle : : SwXStyle ( SwDoc * pDoc , SfxStyleFamily eFam , sal_Bool bConditional ) :
2001-10-17 11:27:45 +00:00
m_pDoc ( pDoc ) ,
2007-09-27 08:40:48 +00:00
pBasePool ( 0 ) ,
2000-09-18 23:08:29 +00:00
eFamily ( eFam ) ,
2007-09-27 08:40:48 +00:00
bIsDescriptor ( sal_True ) ,
bIsConditional ( bConditional )
2000-09-18 23:08:29 +00:00
{
2001-10-17 11:27:45 +00:00
// Register ourselves as a listener to the document (via the page descriptor)
pDoc - > GetPageDescFromPool ( RES_POOLPAGE_STANDARD ) - > Add ( this ) ;
// get the property set for the default style data
// First get the model
2007-06-05 16:36:55 +00:00
uno : : Reference < frame : : XModel > xModel = pDoc - > GetDocShell ( ) - > GetBaseModel ( ) ;
2001-10-17 11:27:45 +00:00
// Ask the model for it's family supplier interface
2007-06-05 16:36:55 +00:00
uno : : Reference < style : : XStyleFamiliesSupplier > xFamilySupplier ( xModel , uno : : UNO_QUERY ) ;
2001-10-17 11:27:45 +00:00
// Get the style families
2007-06-05 16:36:55 +00:00
uno : : Reference < container : : XNameAccess > xFamilies = xFamilySupplier - > getStyleFamilies ( ) ;
2001-10-17 11:27:45 +00:00
2007-06-05 16:36:55 +00:00
uno : : Any aAny ;
2007-09-27 08:40:48 +00:00
sal_uInt16 nMapId = PROPERTY_MAP_NUM_STYLE ;
2000-09-18 23:08:29 +00:00
switch ( eFamily )
{
2001-10-17 11:27:45 +00:00
case SFX_STYLE_FAMILY_CHAR :
{
nMapId = PROPERTY_MAP_CHAR_STYLE ;
2005-01-18 13:28:18 +00:00
aAny = xFamilies - > getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " CharacterStyles " ) ) ) ;
// Get the Frame family (and keep it for later)
aAny > > = mxStyleFamily ;
2001-10-17 11:27:45 +00:00
}
break ;
case SFX_STYLE_FAMILY_PARA :
{
2005-11-11 12:16:07 +00:00
nMapId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE ;
2001-10-17 11:27:45 +00:00
aAny = xFamilies - > getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " ParagraphStyles " ) ) ) ;
// Get the Frame family (and keep it for later)
aAny > > = mxStyleFamily ;
aAny = mxStyleFamily - > getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " Standard " ) ) ) ;
aAny > > = mxStyleData ;
}
break ;
case SFX_STYLE_FAMILY_PAGE :
{
nMapId = PROPERTY_MAP_PAGE_STYLE ;
aAny = xFamilies - > getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " PageStyles " ) ) ) ;
// Get the Frame family (and keep it for later)
aAny > > = mxStyleFamily ;
aAny = mxStyleFamily - > getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " Standard " ) ) ) ;
aAny > > = mxStyleData ;
}
break ;
case SFX_STYLE_FAMILY_FRAME :
{
nMapId = PROPERTY_MAP_FRAME_STYLE ;
}
break ;
case SFX_STYLE_FAMILY_PSEUDO :
{
nMapId = PROPERTY_MAP_NUM_STYLE ;
}
break ;
2007-09-27 08:40:48 +00:00
default :
;
2000-09-18 23:08:29 +00:00
}
2009-06-03 11:26:39 +00:00
pPropImpl = new SwStyleProperties_Impl ( aSwMapProvider . GetPropertySet ( nMapId ) - > getPropertyMap ( ) ) ;
2000-09-18 23:08:29 +00:00
}
SwXStyle : : SwXStyle ( SfxStyleSheetBasePool & rPool , SfxStyleFamily eFam ,
SwDoc * pDoc , const String & rStyleName ) :
2007-09-27 08:40:48 +00:00
m_pDoc ( pDoc ) ,
2000-09-18 23:08:29 +00:00
sStyleName ( rStyleName ) ,
pBasePool ( & rPool ) ,
eFamily ( eFam ) ,
bIsDescriptor ( sal_False ) ,
bIsConditional ( sal_False ) ,
pPropImpl ( 0 )
{
StartListening ( rPool ) ;
if ( eFam = = SFX_STYLE_FAMILY_PARA )
{
pBasePool - > SetSearchMask ( eFamily , SFXSTYLEBIT_ALL ) ;
SfxStyleSheetBase * pBase = pBasePool - > Find ( sStyleName ) ;
2011-05-08 22:14:45 +02:00
OSL_ENSURE ( pBase , " where is the style? " ) ;
2000-09-18 23:08:29 +00:00
if ( pBase )
{
2007-09-27 08:40:48 +00:00
const sal_uInt16 nId = SwStyleNameMapper : : GetPoolIdFromUIName ( sStyleName , nsSwGetPoolIdFromName : : GET_POOLID_TXTCOLL ) ;
2000-09-18 23:08:29 +00:00
if ( nId ! = USHRT_MAX )
2005-11-11 12:16:07 +00:00
bIsConditional = : : IsConditionalByPoolId ( nId ) ;
2000-09-18 23:08:29 +00:00
else
bIsConditional = RES_CONDTXTFMTCOLL = = ( ( SwDocStyleSheet * ) pBase ) - > GetCollection ( ) - > Which ( ) ;
}
}
}
SwXStyle : : ~ SwXStyle ( )
{
if ( pBasePool )
EndListening ( * pBasePool ) ;
delete pPropImpl ;
}
2010-12-17 09:02:23 +01:00
void SwXStyle : : Modify ( const SfxPoolItem * pOld , const SfxPoolItem * pNew )
2001-10-17 11:27:45 +00:00
{
ClientModify ( this , pOld , pNew ) ;
if ( ! GetRegisteredIn ( ) )
{
m_pDoc = 0 ;
mxStyleData . clear ( ) ;
mxStyleFamily . clear ( ) ;
}
}
2010-10-13 16:04:59 +05:30
2007-06-05 16:36:55 +00:00
OUString SwXStyle : : getName ( void ) throw ( uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2001-08-16 11:33:56 +00:00
String aString ;
2000-09-18 23:08:29 +00:00
if ( pBasePool )
{
pBasePool - > SetSearchMask ( eFamily , SFXSTYLEBIT_ALL ) ;
SfxStyleSheetBase * pBase = pBasePool - > Find ( sStyleName ) ;
2011-05-08 22:14:45 +02:00
OSL_ENSURE ( pBase , " where is the style? " ) ;
2000-09-18 23:08:29 +00:00
if ( ! pBase )
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2012-10-10 07:34:19 +09:00
SwStyleNameMapper : : FillProgName ( pBase - > GetName ( ) , aString , lcl_GetSwEnumFromSfxEnum ( eFamily ) , true ) ;
2000-09-18 23:08:29 +00:00
}
else
2001-08-16 11:33:56 +00:00
aString = sStyleName ;
return OUString ( aString ) ;
2000-09-18 23:08:29 +00:00
}
2007-06-05 16:36:55 +00:00
void SwXStyle : : setName ( const OUString & rName ) throw ( uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2000-09-18 23:08:29 +00:00
if ( pBasePool )
{
pBasePool - > SetSearchMask ( eFamily , SFXSTYLEBIT_ALL ) ;
SfxStyleSheetBase * pBase = pBasePool - > Find ( sStyleName ) ;
2011-05-08 22:14:45 +02:00
OSL_ENSURE ( pBase , " where is the style? " ) ;
2012-12-17 18:12:09 +09:00
bool bExcept = true ;
2000-09-18 23:08:29 +00:00
if ( pBase & & pBase - > IsUserDefined ( ) )
{
2008-03-12 11:35:18 +00:00
rtl : : Reference < SwDocStyleSheet > xTmp ( new SwDocStyleSheet ( * ( SwDocStyleSheet * ) pBase ) ) ;
bExcept = ! xTmp - > SetName ( rName ) ;
2000-09-18 23:08:29 +00:00
if ( ! bExcept )
sStyleName = String ( rName ) ;
}
if ( bExcept )
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2000-09-18 23:08:29 +00:00
}
else
sStyleName = String ( rName ) ;
}
2007-06-05 16:36:55 +00:00
sal_Bool SwXStyle : : isUserDefined ( void ) throw ( uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2000-09-18 23:08:29 +00:00
sal_Bool bRet = sal_False ;
if ( pBasePool )
{
pBasePool - > SetSearchMask ( eFamily , SFXSTYLEBIT_ALL ) ;
SfxStyleSheetBase * pBase = pBasePool - > Find ( sStyleName ) ;
//if it is not found it must be non user defined
if ( pBase )
bRet = pBase - > IsUserDefined ( ) ;
}
else
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2000-09-18 23:08:29 +00:00
return bRet ;
}
2007-06-05 16:36:55 +00:00
sal_Bool SwXStyle : : isInUse ( void ) throw ( uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2000-09-18 23:08:29 +00:00
sal_Bool bRet = sal_False ;
if ( pBasePool )
{
pBasePool - > SetSearchMask ( eFamily , SFXSTYLEBIT_USED ) ;
SfxStyleSheetBase * pBase = pBasePool - > Find ( sStyleName ) ;
if ( pBase )
bRet = pBase - > IsUsed ( ) ;
}
else
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2000-09-18 23:08:29 +00:00
return bRet ;
}
2007-06-05 16:36:55 +00:00
OUString SwXStyle : : getParentStyle ( void ) throw ( uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2001-08-16 11:33:56 +00:00
String aString ;
2000-09-18 23:08:29 +00:00
if ( pBasePool )
{
pBasePool - > SetSearchMask ( eFamily , SFXSTYLEBIT_ALL ) ;
SfxStyleSheetBase * pBase = pBasePool - > Find ( sStyleName ) ;
if ( pBase )
2001-08-16 11:33:56 +00:00
aString = pBase - > GetParent ( ) ;
2000-09-18 23:08:29 +00:00
}
else if ( bIsDescriptor )
2001-08-16 11:33:56 +00:00
aString = sParentStyleName ;
2000-09-18 23:08:29 +00:00
else
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2012-10-10 07:34:19 +09:00
SwStyleNameMapper : : FillProgName ( aString , aString , lcl_GetSwEnumFromSfxEnum ( eFamily ) , true ) ;
2001-08-16 11:33:56 +00:00
return OUString ( aString ) ;
2000-09-18 23:08:29 +00:00
}
void SwXStyle : : setParentStyle ( const OUString & rParentStyle )
2007-06-05 16:36:55 +00:00
throw ( container : : NoSuchElementException , uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2001-08-16 11:33:56 +00:00
String sParentStyle ;
2012-10-10 07:34:19 +09:00
SwStyleNameMapper : : FillUIName ( rParentStyle , sParentStyle , lcl_GetSwEnumFromSfxEnum ( eFamily ) , true ) ;
2000-09-18 23:08:29 +00:00
if ( pBasePool )
{
pBasePool - > SetSearchMask ( eFamily ) ;
2012-12-17 18:12:09 +09:00
bool bExcept = false ;
2000-09-18 23:08:29 +00:00
SfxStyleSheetBase * pBase = pBasePool - > Find ( sStyleName ) ;
if ( pBase )
{
2008-03-12 11:35:18 +00:00
rtl : : Reference < SwDocStyleSheet > xBase ( new SwDocStyleSheet ( * ( SwDocStyleSheet * ) pBase ) ) ;
2007-07-18 11:58:25 +00:00
//make it a 'real' style - necessary for pooled styles
2008-03-12 11:35:18 +00:00
xBase - > GetItemSet ( ) ;
if ( xBase - > GetParent ( ) ! = sParentStyle )
2000-09-18 23:08:29 +00:00
{
2008-03-12 11:35:18 +00:00
bExcept = ! xBase - > SetParent ( sParentStyle ) ;
2000-09-18 23:08:29 +00:00
}
}
else
2012-12-17 18:12:09 +09:00
bExcept = true ;
2000-09-18 23:08:29 +00:00
if ( bExcept )
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2000-09-18 23:08:29 +00:00
}
else if ( bIsDescriptor )
{
sParentStyleName = String ( sParentStyle ) ;
2001-10-17 11:27:45 +00:00
try
{
2007-06-05 16:36:55 +00:00
uno : : Any aAny = mxStyleFamily - > getByName ( sParentStyle ) ;
2001-10-17 11:27:45 +00:00
aAny > > = mxStyleData ;
}
catch ( container : : NoSuchElementException & )
{
}
2007-06-05 16:36:55 +00:00
catch ( lang : : WrappedTargetException & )
2001-10-17 11:27:45 +00:00
{
}
2007-06-05 16:36:55 +00:00
catch ( uno : : RuntimeException & )
2001-10-17 11:27:45 +00:00
{
}
2000-09-18 23:08:29 +00:00
}
else
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2000-09-18 23:08:29 +00:00
}
2006-12-01 14:52:41 +00:00
2012-10-12 16:49:40 +02:00
static uno : : Reference < beans : : XPropertySetInfo > lcl_getPropertySetInfo ( SfxStyleFamily eFamily , sal_Bool bIsConditional )
2000-09-18 23:08:29 +00:00
{
2007-06-05 16:36:55 +00:00
uno : : Reference < beans : : XPropertySetInfo > xRet ;
2000-09-18 23:08:29 +00:00
switch ( eFamily )
{
case SFX_STYLE_FAMILY_CHAR :
{
2007-06-05 16:36:55 +00:00
static uno : : Reference < beans : : XPropertySetInfo > xCharRef ;
2000-09-18 23:08:29 +00:00
if ( ! xCharRef . is ( ) )
{
2009-06-03 11:26:39 +00:00
xCharRef = aSwMapProvider . GetPropertySet ( PROPERTY_MAP_CHAR_STYLE ) - > getPropertySetInfo ( ) ;
2000-09-18 23:08:29 +00:00
}
xRet = xCharRef ;
}
break ;
case SFX_STYLE_FAMILY_PARA :
{
2012-12-04 00:39:43 +01:00
static uno : : Reference < beans : : XPropertySetInfo > xCondParaRef ;
2007-06-05 16:36:55 +00:00
static uno : : Reference < beans : : XPropertySetInfo > xParaRef ;
2000-09-18 23:08:29 +00:00
if ( ! xParaRef . is ( ) )
{
2012-12-04 00:39:43 +01:00
xCondParaRef = aSwMapProvider . GetPropertySet (
PROPERTY_MAP_CONDITIONAL_PARA_STYLE ) - > getPropertySetInfo ( ) ;
xParaRef = aSwMapProvider . GetPropertySet (
PROPERTY_MAP_PARA_STYLE ) - > getPropertySetInfo ( ) ;
2000-09-18 23:08:29 +00:00
}
2012-12-04 00:39:43 +01:00
xRet = bIsConditional ? xCondParaRef : xParaRef ;
2000-09-18 23:08:29 +00:00
}
break ;
case SFX_STYLE_FAMILY_PAGE :
{
2007-06-05 16:36:55 +00:00
static uno : : Reference < beans : : XPropertySetInfo > xPageRef ;
2000-09-18 23:08:29 +00:00
if ( ! xPageRef . is ( ) )
{
2009-06-03 11:26:39 +00:00
xPageRef = aSwMapProvider . GetPropertySet ( PROPERTY_MAP_PAGE_STYLE ) - > getPropertySetInfo ( ) ;
2000-09-18 23:08:29 +00:00
}
xRet = xPageRef ;
}
break ;
case SFX_STYLE_FAMILY_FRAME :
{
2007-06-05 16:36:55 +00:00
static uno : : Reference < beans : : XPropertySetInfo > xFrameRef ;
2000-09-18 23:08:29 +00:00
if ( ! xFrameRef . is ( ) )
{
2009-06-03 11:26:39 +00:00
xFrameRef = aSwMapProvider . GetPropertySet ( PROPERTY_MAP_FRAME_STYLE ) - > getPropertySetInfo ( ) ;
2000-09-18 23:08:29 +00:00
}
xRet = xFrameRef ;
}
break ;
case SFX_STYLE_FAMILY_PSEUDO :
{
2007-06-05 16:36:55 +00:00
static uno : : Reference < beans : : XPropertySetInfo > xNumRef ;
2000-09-18 23:08:29 +00:00
if ( ! xNumRef . is ( ) )
{
2009-06-03 11:26:39 +00:00
xNumRef = aSwMapProvider . GetPropertySet ( PROPERTY_MAP_NUM_STYLE ) - > getPropertySetInfo ( ) ;
2000-09-18 23:08:29 +00:00
}
xRet = xNumRef ;
}
break ;
2007-09-27 08:40:48 +00:00
default :
;
2000-09-18 23:08:29 +00:00
}
return xRet ;
}
2006-12-01 14:52:41 +00:00
2007-06-05 16:36:55 +00:00
uno : : Reference < beans : : XPropertySetInfo > SwXStyle : : getPropertySetInfo ( void )
throw ( uno : : RuntimeException )
2006-12-01 14:52:41 +00:00
{
return lcl_getPropertySetInfo ( eFamily , bIsConditional ) ;
}
2010-10-13 16:04:59 +05:30
2000-09-18 23:08:29 +00:00
void SwXStyle : : ApplyDescriptorProperties ( )
{
bIsDescriptor = sal_False ;
2001-10-17 11:27:45 +00:00
mxStyleData . clear ( ) ;
mxStyleFamily . clear ( ) ;
2009-06-03 11:26:39 +00:00
const PropertyEntryVector_t & rPropertyVector = pPropImpl - > GetPropertyVector ( ) ;
PropertyEntryVector_t : : const_iterator aIt = rPropertyVector . begin ( ) ;
while ( aIt ! = rPropertyVector . end ( ) )
2000-09-18 23:08:29 +00:00
{
2007-06-05 16:36:55 +00:00
uno : : Any * pAny ;
2009-06-03 11:26:39 +00:00
pPropImpl - > GetProperty ( aIt - > sName , pAny ) ;
2000-09-18 23:08:29 +00:00
if ( pAny )
2009-06-03 11:26:39 +00:00
setPropertyValue ( aIt - > sName , * pAny ) ;
+ + aIt ;
2000-09-18 23:08:29 +00:00
}
}
2001-04-19 09:40:06 +00:00
struct SwStyleBase_Impl
2000-09-18 23:08:29 +00:00
{
2001-04-25 10:55:37 +00:00
SwDoc & rDoc ;
const SwPageDesc * pOldPageDesc ;
2008-03-12 11:35:18 +00:00
rtl : : Reference < SwDocStyleSheet > mxNewBase ;
2001-04-25 10:55:37 +00:00
SfxItemSet * pItemSet ;
const String & rStyleName ;
2001-10-29 14:16:14 +00:00
sal_uInt16 nPDescPos ;
2001-04-25 10:55:37 +00:00
SwStyleBase_Impl ( SwDoc & rSwDoc , const String & rName ) :
rDoc ( rSwDoc ) ,
2007-09-27 08:40:48 +00:00
pOldPageDesc ( 0 ) ,
2001-04-25 10:55:37 +00:00
pItemSet ( 0 ) ,
2007-09-27 08:40:48 +00:00
rStyleName ( rName ) ,
2001-04-27 11:03:25 +00:00
nPDescPos ( 0xffff )
2001-04-25 10:55:37 +00:00
{ }
2000-09-18 23:08:29 +00:00
2008-03-12 11:35:18 +00:00
~ SwStyleBase_Impl ( ) { delete pItemSet ; }
sal_Bool HasItemSet ( ) { return mxNewBase . is ( ) ; }
2001-04-19 09:40:06 +00:00
SfxItemSet & GetItemSet ( )
{
2011-05-08 22:14:45 +02:00
OSL_ENSURE ( mxNewBase . is ( ) , " no SwDocStyleSheet available " ) ;
2001-04-19 09:40:06 +00:00
if ( ! pItemSet )
2008-03-12 11:35:18 +00:00
pItemSet = new SfxItemSet ( mxNewBase - > GetItemSet ( ) ) ;
2001-04-19 09:40:06 +00:00
return * pItemSet ;
}
2001-04-25 10:55:37 +00:00
const SwPageDesc & GetOldPageDesc ( ) ;
2001-04-19 09:40:06 +00:00
} ;
2001-04-25 10:55:37 +00:00
const SwPageDesc & SwStyleBase_Impl : : GetOldPageDesc ( )
{
if ( ! pOldPageDesc )
{
sal_uInt16 i ;
sal_uInt16 nPDescCount = rDoc . GetPageDescCnt ( ) ;
for ( i = 0 ; i < nPDescCount ; i + + )
{
2012-06-21 13:40:06 +02:00
const SwPageDesc & rDesc = rDoc . GetPageDesc ( i ) ;
2001-04-25 10:55:37 +00:00
if ( rDesc . GetName ( ) = = rStyleName )
{
pOldPageDesc = & rDesc ;
nPDescPos = i ;
break ;
}
}
if ( ! pOldPageDesc )
{
2008-10-29 11:35:03 +00:00
for ( i = RC_POOLPAGEDESC_BEGIN ; i < = STR_POOLPAGE_LANDSCAPE ; + + i )
2001-04-25 10:55:37 +00:00
{
const String aFmtName ( SW_RES ( i ) ) ;
if ( aFmtName = = rStyleName )
{
2007-09-27 08:40:48 +00:00
pOldPageDesc = rDoc . GetPageDescFromPool ( static_cast < sal_uInt16 > ( RES_POOLPAGE_BEGIN + i - RC_POOLPAGEDESC_BEGIN ) ) ;
2001-04-25 10:55:37 +00:00
break ;
}
}
for ( i = 0 ; i < nPDescCount + 1 ; i + + )
{
2012-06-21 13:40:06 +02:00
const SwPageDesc & rDesc = rDoc . GetPageDesc ( i ) ;
2001-04-25 10:55:37 +00:00
if ( rDesc . GetName ( ) = = rStyleName )
{
nPDescPos = i ;
break ;
}
}
}
}
return * pOldPageDesc ;
}
2012-10-12 16:49:40 +02:00
static void lcl_SetStyleProperty ( const SfxItemPropertySimpleEntry & rEntry ,
2009-06-03 11:26:39 +00:00
const SfxItemPropertySet & rPropSet ,
2007-06-05 16:36:55 +00:00
const uno : : Any & rValue ,
2001-04-19 09:40:06 +00:00
SwStyleBase_Impl & rBase ,
SfxStyleSheetBasePool * pBasePool ,
SwDoc * pDoc ,
SfxStyleFamily eFamily )
2007-06-05 16:36:55 +00:00
throw ( beans : : PropertyVetoException , lang : : IllegalArgumentException ,
lang : : WrappedTargetException , uno : : RuntimeException )
2001-04-19 09:40:06 +00:00
{
2009-06-03 11:26:39 +00:00
switch ( rEntry . nWID )
2000-09-18 23:08:29 +00:00
{
2012-12-03 17:48:40 +01:00
case FN_UNO_HIDDEN :
{
sal_Bool bHidden = sal_False ;
if ( rValue > > = bHidden )
{
//make it a 'real' style - necessary for pooled styles
rBase . mxNewBase - > GetItemSet ( ) ;
rBase . mxNewBase - > SetHidden ( bHidden ) ;
}
}
break ;
2001-09-24 18:59:24 +00:00
case RES_PAPER_BIN :
{
2006-08-14 15:57:26 +00:00
SfxPrinter * pPrinter = pDoc - > getPrinter ( true ) ;
2001-09-24 18:59:24 +00:00
OUString sTmp ;
sal_uInt16 nBin = USHRT_MAX ;
if ( ! ( rValue > > = sTmp ) )
2007-06-05 16:36:55 +00:00
throw lang : : IllegalArgumentException ( ) ;
2001-09-24 18:59:24 +00:00
if ( sTmp . equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( " [From printer settings] " ) ) )
nBin = USHRT_MAX - 1 ;
else if ( pPrinter )
{
for ( sal_uInt16 i = 0 , nEnd = pPrinter - > GetPaperBinCount ( ) ; i < nEnd ; i + + )
{
if ( sTmp = = OUString ( pPrinter - > GetPaperBinName ( i ) ) )
{
nBin = i ;
break ;
}
}
}
if ( nBin = = USHRT_MAX )
2007-06-05 16:36:55 +00:00
throw lang : : IllegalArgumentException ( ) ;
2001-09-24 18:59:24 +00:00
else
{
SfxItemSet & rStyleSet = rBase . GetItemSet ( ) ;
2009-06-03 11:26:39 +00:00
SfxItemSet aSet ( * rStyleSet . GetPool ( ) , rEntry . nWID , rEntry . nWID ) ;
2001-09-24 18:59:24 +00:00
aSet . SetParent ( & rStyleSet ) ;
2009-06-03 11:26:39 +00:00
rPropSet . setPropertyValue ( rEntry , uno : : makeAny ( static_cast < sal_Int8 > ( nBin = = USHRT_MAX - 1 ? - 1 : nBin ) ) , aSet ) ;
2001-09-24 18:59:24 +00:00
rStyleSet . Put ( aSet ) ;
}
}
break ;
2001-04-19 09:40:06 +00:00
case FN_UNO_NUM_RULES : //Sonderbehandlung fuer das SvxNumRuleItem:
2000-09-18 23:08:29 +00:00
{
2007-06-05 16:36:55 +00:00
if ( rValue . getValueType ( ) = = : : getCppuType ( ( uno : : Reference < container : : XIndexReplace > * ) 0 ) )
2000-09-18 23:08:29 +00:00
{
2007-06-05 16:36:55 +00:00
uno : : Reference < container : : XIndexReplace > * pxRulesRef =
( uno : : Reference < container : : XIndexReplace > * ) rValue . getValue ( ) ;
2001-04-19 09:40:06 +00:00
2007-06-05 16:36:55 +00:00
uno : : Reference < lang : : XUnoTunnel > xNumberTunnel ( * pxRulesRef , uno : : UNO_QUERY ) ;
2001-04-19 09:40:06 +00:00
SwXNumberingRules * pSwXRules = 0 ;
if ( xNumberTunnel . is ( ) )
2000-09-18 23:08:29 +00:00
{
2007-09-27 08:40:48 +00:00
pSwXRules = reinterpret_cast < SwXNumberingRules * > (
sal : : static_int_cast < sal_IntPtr > ( xNumberTunnel - > getSomething ( SwXNumberingRules : : getUnoTunnelId ( ) ) ) ) ;
2001-04-19 09:40:06 +00:00
}
if ( pSwXRules )
{
const String * pCharStyleNames = pSwXRules - > GetNewCharStyleNames ( ) ;
const String * pBulletFontNames = pSwXRules - > GetBulletFontNames ( ) ;
2000-09-18 23:08:29 +00:00
2001-04-19 09:40:06 +00:00
SwNumRule aSetRule ( * pSwXRules - > GetNumRule ( ) ) ;
const SwCharFmts * pFmts = pDoc - > GetCharFmts ( ) ;
2012-06-20 16:36:51 +02:00
sal_uInt16 nChCount = pFmts - > size ( ) ;
2001-04-19 09:40:06 +00:00
for ( sal_uInt16 i = 0 ; i < MAXLEVEL ; i + + )
{
2000-09-18 23:08:29 +00:00
2001-04-19 09:40:06 +00:00
const SwNumFmt * pFmt = aSetRule . GetNumFmt ( i ) ;
if ( pFmt )
2000-09-18 23:08:29 +00:00
{
2001-04-19 09:40:06 +00:00
SwNumFmt aFmt ( * pFmt ) ;
if (
2012-04-01 21:25:49 +01:00
! SwXNumberingRules : : isInvalidStyle ( pCharStyleNames [ i ] ) & &
2001-04-19 09:40:06 +00:00
( ( pCharStyleNames [ i ] . Len ( ) & & ! pFmt - > GetCharFmt ( ) ) | |
2010-11-06 10:30:17 -05:00
( pCharStyleNames [ i ] . Len ( ) & &
pFmt - > GetCharFmt ( ) - > GetName ( ) ! = pCharStyleNames [ i ] ) ) )
2000-09-18 23:08:29 +00:00
{
2001-04-19 09:40:06 +00:00
SwCharFmt * pCharFmt = 0 ;
if ( pCharStyleNames [ i ] . Len ( ) )
2000-09-18 23:08:29 +00:00
{
2001-04-19 09:40:06 +00:00
for ( sal_uInt16 j = 0 ; j < nChCount ; j + + )
2000-09-18 23:08:29 +00:00
{
2001-04-19 09:40:06 +00:00
SwCharFmt * pTmp = ( * pFmts ) [ j ] ;
if ( pTmp - > GetName ( ) = = pCharStyleNames [ i ] )
2000-09-18 23:08:29 +00:00
{
2001-04-19 09:40:06 +00:00
pCharFmt = pTmp ;
break ;
2000-09-18 23:08:29 +00:00
}
}
2001-04-19 09:40:06 +00:00
if ( ! pCharFmt )
2000-09-18 23:08:29 +00:00
{
2001-04-19 09:40:06 +00:00
SfxStyleSheetBase * pBase ;
pBase = ( ( SfxStyleSheetBasePool * ) pBasePool ) - > Find ( pCharStyleNames [ i ] , SFX_STYLE_FAMILY_CHAR ) ;
if ( ! pBase )
pBase = & pBasePool - > Make ( pCharStyleNames [ i ] , SFX_STYLE_FAMILY_CHAR ) ;
pCharFmt = ( ( SwDocStyleSheet * ) pBase ) - > GetCharFmt ( ) ;
2000-09-18 23:08:29 +00:00
}
2001-04-19 09:40:06 +00:00
aFmt . SetCharFmt ( pCharFmt ) ;
2000-09-18 23:08:29 +00:00
}
}
2001-04-19 09:40:06 +00:00
//jetzt nochmal fuer Fonts
2012-04-01 21:25:49 +01:00
if ( ! SwXNumberingRules : : isInvalidStyle ( pBulletFontNames [ i ] ) & &
2001-04-19 09:40:06 +00:00
( ( pBulletFontNames [ i ] . Len ( ) & & ! pFmt - > GetBulletFont ( ) ) | |
2010-11-06 10:30:17 -05:00
( pBulletFontNames [ i ] . Len ( ) & &
pFmt - > GetBulletFont ( ) - > GetName ( ) ! = pBulletFontNames [ i ] ) ) )
2001-04-19 09:40:06 +00:00
{
const SvxFontListItem * pFontListItem =
( const SvxFontListItem * ) pDoc - > GetDocShell ( )
- > GetItem ( SID_ATTR_CHAR_FONTLIST ) ;
const FontList * pList = pFontListItem - > GetFontList ( ) ;
FontInfo aInfo = pList - > Get (
pBulletFontNames [ i ] , WEIGHT_NORMAL , ITALIC_NONE ) ;
Font aFont ( aInfo ) ;
aFmt . SetBulletFont ( & aFont ) ;
}
aSetRule . Set ( i , & aFmt ) ;
2000-09-18 23:08:29 +00:00
}
}
2008-03-12 11:35:18 +00:00
rBase . mxNewBase - > SetNumRule ( aSetRule ) ;
2000-09-18 23:08:29 +00:00
}
2001-04-19 09:40:06 +00:00
}
else
throw lang : : IllegalArgumentException ( ) ;
}
break ;
2011-02-05 15:56:54 +01:00
case RES_PARATR_OUTLINELEVEL :
2004-11-26 12:28:14 +00:00
{
2009-01-07 11:57:24 +00:00
sal_Int16 nLevel = 0 ;
rValue > > = nLevel ;
if ( 0 < = nLevel & & nLevel < = MAXLEVEL )
rBase . mxNewBase - > GetCollection ( ) - > SetAttrOutlineLevel ( nLevel ) ;
2004-11-26 12:28:14 +00:00
}
2011-02-05 15:56:54 +01:00
break ;
2001-04-19 09:40:06 +00:00
case FN_UNO_FOLLOW_STYLE :
{
OUString sTmp ;
rValue > > = sTmp ;
2001-08-16 11:33:56 +00:00
String aString ;
2012-10-10 07:34:19 +09:00
SwStyleNameMapper : : FillUIName ( sTmp , aString , lcl_GetSwEnumFromSfxEnum ( eFamily ) , true ) ;
2008-03-12 11:35:18 +00:00
rBase . mxNewBase - > SetFollow ( aString ) ;
2001-04-19 09:40:06 +00:00
}
break ;
case RES_PAGEDESC :
2009-06-03 11:26:39 +00:00
if ( MID_PAGEDESC_PAGEDESCNAME ! = rEntry . nMemberId )
2001-04-19 09:40:06 +00:00
goto put_itemset ;
{
// Sonderbehandlung RES_PAGEDESC
if ( rValue . getValueType ( ) ! = : : getCppuType ( ( const OUString * ) 0 ) )
throw lang : : IllegalArgumentException ( ) ;
2001-05-04 07:47:42 +00:00
SfxItemSet & rStyleSet = rBase . GetItemSet ( ) ;
2000-09-18 23:08:29 +00:00
2001-04-19 09:40:06 +00:00
SwFmtPageDesc * pNewDesc = 0 ;
const SfxPoolItem * pItem ;
2001-05-04 07:47:42 +00:00
if ( SFX_ITEM_SET = = rStyleSet . GetItemState ( RES_PAGEDESC , sal_True , & pItem ) )
2001-04-19 09:40:06 +00:00
{
pNewDesc = new SwFmtPageDesc ( * ( ( SwFmtPageDesc * ) pItem ) ) ;
}
if ( ! pNewDesc )
pNewDesc = new SwFmtPageDesc ( ) ;
OUString uDescName ;
rValue > > = uDescName ;
2001-08-16 11:33:56 +00:00
String sDescName ;
2012-10-10 07:34:19 +09:00
SwStyleNameMapper : : FillUIName ( uDescName , sDescName , nsSwGetPoolIdFromName : : GET_POOLID_PAGEDESC , true ) ;
2001-04-19 09:40:06 +00:00
if ( ! pNewDesc - > GetPageDesc ( ) | | pNewDesc - > GetPageDesc ( ) - > GetName ( ) ! = sDescName )
{
sal_Bool bPut = sal_False ;
if ( sDescName . Len ( ) )
{
SwPageDesc * pPageDesc = : : GetPageDescByName_Impl ( * pDoc , sDescName ) ;
if ( pPageDesc )
2000-09-18 23:08:29 +00:00
{
2010-12-17 09:02:23 +01:00
pNewDesc - > RegisterToPageDesc ( * pPageDesc ) ;
2001-04-19 09:40:06 +00:00
bPut = sal_True ;
2000-09-18 23:08:29 +00:00
}
2001-04-19 09:40:06 +00:00
else
2000-09-18 23:08:29 +00:00
{
2001-04-19 09:40:06 +00:00
throw lang : : IllegalArgumentException ( ) ;
2000-09-18 23:08:29 +00:00
}
}
2001-04-19 09:40:06 +00:00
if ( ! bPut )
2000-09-18 23:08:29 +00:00
{
2001-05-04 07:47:42 +00:00
rStyleSet . ClearItem ( RES_BREAK ) ;
rStyleSet . Put ( SwFmtPageDesc ( ) ) ;
2000-09-18 23:08:29 +00:00
}
2001-04-19 09:40:06 +00:00
else
2001-05-04 07:47:42 +00:00
rStyleSet . Put ( * pNewDesc ) ;
2001-04-19 09:40:06 +00:00
}
delete pNewDesc ;
}
break ;
case FN_UNO_IS_AUTO_UPDATE :
{
2011-01-17 15:06:54 +01:00
sal_Bool bAuto = * ( sal_Bool * ) rValue . getValue ( ) ;
2001-04-19 09:40:06 +00:00
if ( SFX_STYLE_FAMILY_PARA = = eFamily )
2008-03-12 11:35:18 +00:00
rBase . mxNewBase - > GetCollection ( ) - > SetAutoUpdateFmt ( bAuto ) ;
2001-04-19 09:40:06 +00:00
else if ( SFX_STYLE_FAMILY_FRAME = = eFamily )
2008-03-12 11:35:18 +00:00
rBase . mxNewBase - > GetFrmFmt ( ) - > SetAutoUpdateFmt ( bAuto ) ;
2001-04-19 09:40:06 +00:00
}
break ;
2005-11-11 12:16:07 +00:00
case FN_UNO_PARA_STYLE_CONDITIONS :
{
uno : : Sequence < beans : : NamedValue > aSeq ;
if ( ! ( rValue > > = aSeq ) )
2007-06-05 16:36:55 +00:00
throw lang : : IllegalArgumentException ( ) ;
2005-11-11 12:16:07 +00:00
2011-05-08 22:14:45 +02:00
OSL_ENSURE ( COND_COMMAND_COUNT = = 28 ,
2005-11-11 12:16:07 +00:00
" invalid size of comman count? " ) ;
const beans : : NamedValue * pSeq = aSeq . getConstArray ( ) ;
sal_Int32 nLen = aSeq . getLength ( ) ;
sal_Bool bFailed = sal_False ;
SwCondCollItem aCondItem ;
2011-01-17 15:06:54 +01:00
for ( sal_uInt16 i = 0 ; i < nLen ; i + + )
2005-11-11 12:16:07 +00:00
{
OUString aTmp ;
if ( ( pSeq [ i ] . Value > > = aTmp ) )
{
// get UI style name from programmatic style name
String aStyleName ;
2012-10-10 07:34:19 +09:00
SwStyleNameMapper : : FillUIName ( aTmp , aStyleName , lcl_GetSwEnumFromSfxEnum ( eFamily ) , true ) ;
2005-11-11 12:16:07 +00:00
//
// check for correct context and style name
//
sal_Int16 nIdx = GetCommandContextIndex ( pSeq [ i ] . Name ) ;
2011-02-05 15:56:54 +01:00
2005-11-11 12:16:07 +00:00
pBasePool - > SetSearchMask ( SFX_STYLE_FAMILY_PARA , SFXSTYLEBIT_ALL ) ;
sal_Bool bStyleFound = sal_False ;
const SfxStyleSheetBase * pBase = pBasePool - > First ( ) ;
while ( pBase & & ! bStyleFound )
{
if ( pBase - > GetName ( ) = = aStyleName )
bStyleFound = sal_True ;
pBase = pBasePool - > Next ( ) ;
}
2011-02-05 15:56:54 +01:00
2005-11-11 12:16:07 +00:00
if ( nIdx = = - 1 | | ! bStyleFound )
{
bFailed = sal_True ;
break ;
}
aCondItem . SetStyle ( & aStyleName , nIdx ) ;
}
else
bFailed = sal_True ;
}
if ( bFailed )
2007-06-05 16:36:55 +00:00
throw lang : : IllegalArgumentException ( ) ;
2005-11-11 12:16:07 +00:00
rBase . GetItemSet ( ) . Put ( aCondItem ) ;
}
break ;
2001-04-19 09:40:06 +00:00
case FN_UNO_CATEGORY :
{
2008-03-12 11:35:18 +00:00
if ( ! rBase . mxNewBase - > IsUserDefined ( ) )
2001-04-19 09:40:06 +00:00
throw lang : : IllegalArgumentException ( ) ;
2007-11-12 15:28:13 +00:00
short nSet = 0 ;
2001-04-19 09:40:06 +00:00
rValue > > = nSet ;
2000-09-18 23:08:29 +00:00
2002-10-24 08:35:02 +00:00
sal_uInt16 nId ;
2001-04-19 09:40:06 +00:00
switch ( nSet )
{
2007-06-05 16:36:55 +00:00
case style : : ParagraphStyleCategory : : TEXT :
2002-10-24 08:35:02 +00:00
nId = SWSTYLEBIT_TEXT ;
2001-04-19 09:40:06 +00:00
break ;
2007-06-05 16:36:55 +00:00
case style : : ParagraphStyleCategory : : CHAPTER :
2002-10-24 08:35:02 +00:00
nId = SWSTYLEBIT_CHAPTER ;
2001-04-19 09:40:06 +00:00
break ;
2007-06-05 16:36:55 +00:00
case style : : ParagraphStyleCategory : : LIST :
2002-10-24 08:35:02 +00:00
nId = SWSTYLEBIT_LIST ;
2001-04-19 09:40:06 +00:00
break ;
2007-06-05 16:36:55 +00:00
case style : : ParagraphStyleCategory : : INDEX :
2002-10-24 08:35:02 +00:00
nId = SWSTYLEBIT_IDX ;
2001-04-19 09:40:06 +00:00
break ;
2007-06-05 16:36:55 +00:00
case style : : ParagraphStyleCategory : : EXTRA :
2002-10-24 08:35:02 +00:00
nId = SWSTYLEBIT_EXTRA ;
2001-04-19 09:40:06 +00:00
break ;
2007-06-05 16:36:55 +00:00
case style : : ParagraphStyleCategory : : HTML :
2002-10-24 08:35:02 +00:00
nId = SWSTYLEBIT_HTML ;
2001-04-19 09:40:06 +00:00
break ;
default : throw lang : : IllegalArgumentException ( ) ;
}
2008-03-12 11:35:18 +00:00
rBase . mxNewBase - > SetMask ( nId | SFXSTYLEBIT_USERDEF ) ;
2001-04-19 09:40:06 +00:00
}
break ;
case SID_SWREGISTER_COLLECTION :
{
OUString sName ;
rValue > > = sName ;
2012-01-17 17:47:34 -02:00
SwRegisterItem aReg ( ! sName . isEmpty ( ) ) ;
2001-04-19 09:40:06 +00:00
aReg . SetWhich ( SID_SWREGISTER_MODE ) ;
2001-05-04 07:47:42 +00:00
rBase . GetItemSet ( ) . Put ( aReg ) ;
2001-08-16 11:33:56 +00:00
String aString ;
2012-10-10 07:34:19 +09:00
SwStyleNameMapper : : FillUIName ( sName , aString , nsSwGetPoolIdFromName : : GET_POOLID_TXTCOLL , true ) ;
2001-04-19 09:40:06 +00:00
2001-08-16 11:33:56 +00:00
rBase . GetItemSet ( ) . Put ( SfxStringItem ( SID_SWREGISTER_COLLECTION , aString ) ) ;
2001-04-19 09:40:06 +00:00
}
break ;
case RES_TXTATR_CJK_RUBY :
2009-06-03 11:26:39 +00:00
if ( MID_RUBY_CHARSTYLE = = rEntry . nMemberId )
2001-04-19 09:40:06 +00:00
{
OUString sTmp ;
if ( rValue > > = sTmp )
2000-11-15 13:04:24 +00:00
{
2001-04-19 09:40:06 +00:00
SfxItemSet & rStyleSet = rBase . GetItemSet ( ) ;
SwFmtRuby * pRuby = 0 ;
const SfxPoolItem * pItem ;
2001-05-04 07:47:42 +00:00
if ( SFX_ITEM_SET = = rStyleSet . GetItemState ( RES_TXTATR_CJK_RUBY , sal_True , & pItem ) )
2001-04-19 09:40:06 +00:00
pRuby = new SwFmtRuby ( * ( ( SwFmtRuby * ) pItem ) ) ;
if ( ! pRuby )
pRuby = new SwFmtRuby ( aEmptyStr ) ;
2001-08-16 11:33:56 +00:00
String sStyle ;
2012-10-10 07:34:19 +09:00
SwStyleNameMapper : : FillUIName ( sTmp , sStyle , nsSwGetPoolIdFromName : : GET_POOLID_CHRFMT , true ) ;
2001-04-19 09:40:06 +00:00
pRuby - > SetCharFmtName ( sTmp ) ;
pRuby - > SetCharFmtId ( 0 ) ;
2012-01-17 17:47:34 -02:00
if ( ! sTmp . isEmpty ( ) )
2000-09-18 23:08:29 +00:00
{
2007-09-27 08:40:48 +00:00
sal_uInt16 nId = SwStyleNameMapper : : GetPoolIdFromUIName ( sTmp , nsSwGetPoolIdFromName : : GET_POOLID_CHRFMT ) ;
2001-04-19 09:40:06 +00:00
pRuby - > SetCharFmtId ( nId ) ;
2000-09-18 23:08:29 +00:00
}
2001-05-04 07:47:42 +00:00
rStyleSet . Put ( * pRuby ) ;
2001-04-19 09:40:06 +00:00
delete pRuby ;
2000-09-18 23:08:29 +00:00
}
2001-04-19 09:40:06 +00:00
else
throw lang : : IllegalArgumentException ( ) ;
}
goto put_itemset ;
case RES_PARATR_DROP :
{
2009-06-03 11:26:39 +00:00
if ( MID_DROPCAP_CHAR_STYLE_NAME = = rEntry . nMemberId )
2001-04-19 09:40:06 +00:00
{
if ( rValue . getValueType ( ) = = : : getCppuType ( ( const OUString * ) 0 ) )
2000-09-18 23:08:29 +00:00
{
2001-05-04 07:47:42 +00:00
SfxItemSet & rStyleSet = rBase . GetItemSet ( ) ;
2000-09-18 23:08:29 +00:00
2001-04-19 09:40:06 +00:00
SwFmtDrop * pDrop = 0 ;
const SfxPoolItem * pItem ;
2001-05-04 07:47:42 +00:00
if ( SFX_ITEM_SET = = rStyleSet . GetItemState ( RES_PARATR_DROP , sal_True , & pItem ) )
2001-04-19 09:40:06 +00:00
pDrop = new SwFmtDrop ( * ( ( SwFmtDrop * ) pItem ) ) ;
if ( ! pDrop )
pDrop = new SwFmtDrop ( ) ;
OUString uStyle ;
rValue > > = uStyle ;
2001-08-16 11:33:56 +00:00
String sStyle ;
2012-10-10 07:34:19 +09:00
SwStyleNameMapper : : FillUIName ( uStyle , sStyle , nsSwGetPoolIdFromName : : GET_POOLID_CHRFMT , true ) ;
2001-04-19 09:40:06 +00:00
SwDocStyleSheet * pStyle =
( SwDocStyleSheet * ) pDoc - > GetDocShell ( ) - > GetStyleSheetPool ( ) - > Find ( sStyle , SFX_STYLE_FAMILY_CHAR ) ;
if ( pStyle )
pDrop - > SetCharFmt ( pStyle - > GetCharFmt ( ) ) ;
else
throw lang : : IllegalArgumentException ( ) ;
2001-05-04 07:47:42 +00:00
rStyleSet . Put ( * pDrop ) ;
2001-04-19 09:40:06 +00:00
delete pDrop ;
2000-09-18 23:08:29 +00:00
}
2001-04-19 09:40:06 +00:00
else
throw lang : : IllegalArgumentException ( ) ;
break ;
2000-09-18 23:08:29 +00:00
}
}
2001-04-19 09:40:06 +00:00
//no break!
default :
put_itemset :
{
SfxItemSet & rStyleSet = rBase . GetItemSet ( ) ;
2009-06-03 11:26:39 +00:00
SfxItemSet aSet ( * rStyleSet . GetPool ( ) , rEntry . nWID , rEntry . nWID ) ;
2001-05-04 07:47:42 +00:00
aSet . SetParent ( & rStyleSet ) ;
2009-06-03 11:26:39 +00:00
rPropSet . setPropertyValue ( rEntry , rValue , aSet ) ;
2001-04-19 09:40:06 +00:00
rStyleSet . Put ( aSet ) ;
2011-02-05 15:56:54 +01:00
// #i70223#
2006-11-01 14:19:49 +00:00
if ( SFX_STYLE_FAMILY_PARA = = eFamily & &
2009-06-03 11:26:39 +00:00
rEntry . nWID = = RES_PARATR_NUMRULE & &
2008-03-12 11:35:18 +00:00
rBase . mxNewBase . is ( ) & & rBase . mxNewBase - > GetCollection ( ) & &
2011-02-05 15:56:54 +01:00
rBase . mxNewBase - > GetCollection ( ) - > IsAssignedToListLevelOfOutlineStyle ( ) )
2009-01-07 11:57:24 +00:00
2006-11-01 14:19:49 +00:00
{
OUString sNewNumberingRuleName ;
rValue > > = sNewNumberingRuleName ;
String sTmp ( sNewNumberingRuleName ) ;
2012-01-17 17:47:34 -02:00
if ( sNewNumberingRuleName . isEmpty ( ) | |
2006-11-01 14:19:49 +00:00
sTmp ! = pDoc - > GetOutlineNumRule ( ) - > GetName ( ) )
{
2011-02-05 15:56:54 +01:00
rBase . mxNewBase - > GetCollection ( ) - > DeleteAssignmentToListLevelOfOutlineStyle ( ) ;
2006-11-01 14:19:49 +00:00
}
}
2001-04-19 09:40:06 +00:00
}
2000-09-18 23:08:29 +00:00
}
}
2003-11-07 14:13:39 +00:00
void SAL_CALL SwXStyle : : SetPropertyValues_Impl (
const uno : : Sequence < OUString > & rPropertyNames ,
2007-06-05 16:36:55 +00:00
const uno : : Sequence < uno : : Any > & rValues )
throw ( beans : : UnknownPropertyException , beans : : PropertyVetoException , lang : : IllegalArgumentException ,
lang : : WrappedTargetException , uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2001-10-17 11:27:45 +00:00
if ( ! m_pDoc )
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2009-06-03 11:26:39 +00:00
sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_STYLE ;
2000-09-18 23:08:29 +00:00
switch ( eFamily )
{
2009-06-03 11:26:39 +00:00
case SFX_STYLE_FAMILY_PARA : nPropSetId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE ; break ;
case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_MAP_FRAME_STYLE ; break ;
case SFX_STYLE_FAMILY_PAGE : nPropSetId = PROPERTY_MAP_PAGE_STYLE ; break ;
case SFX_STYLE_FAMILY_PSEUDO : nPropSetId = PROPERTY_MAP_NUM_STYLE ; break ;
2007-09-27 08:40:48 +00:00
default :
;
2000-09-18 23:08:29 +00:00
}
2009-06-03 11:26:39 +00:00
const SfxItemPropertySet * pPropSet = aSwMapProvider . GetPropertySet ( nPropSetId ) ;
2012-01-05 21:30:06 +00:00
const SfxItemPropertyMap & rMap = pPropSet - > getPropertyMap ( ) ;
2000-09-18 23:08:29 +00:00
2001-04-19 09:40:06 +00:00
if ( rPropertyNames . getLength ( ) ! = rValues . getLength ( ) )
2007-06-05 16:36:55 +00:00
throw lang : : IllegalArgumentException ( ) ;
2001-04-19 09:40:06 +00:00
const OUString * pNames = rPropertyNames . getConstArray ( ) ;
2007-06-05 16:36:55 +00:00
const uno : : Any * pValues = rValues . getConstArray ( ) ;
2001-04-25 10:55:37 +00:00
SwStyleBase_Impl aBaseImpl ( * m_pDoc , sStyleName ) ;
2000-09-18 23:08:29 +00:00
if ( pBasePool )
{
2001-10-29 14:16:14 +00:00
sal_uInt16 nSaveMask = pBasePool - > GetSearchMask ( ) ;
2001-04-19 09:40:06 +00:00
pBasePool - > SetSearchMask ( eFamily ) ;
2000-09-18 23:08:29 +00:00
SfxStyleSheetBase * pBase = pBasePool - > Find ( sStyleName ) ;
pBasePool - > SetSearchMask ( eFamily , nSaveMask ) ;
2011-05-08 22:14:45 +02:00
OSL_ENSURE ( pBase , " where is the style? " ) ;
2001-04-19 09:40:06 +00:00
if ( pBase )
2008-03-12 11:35:18 +00:00
aBaseImpl . mxNewBase = new SwDocStyleSheet ( * ( SwDocStyleSheet * ) pBase ) ;
2001-04-19 09:40:06 +00:00
else
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2001-04-19 09:40:06 +00:00
}
2001-11-28 19:36:01 +00:00
for ( sal_Int16 nProp = 0 ; nProp < rPropertyNames . getLength ( ) ; nProp + + )
2001-04-19 09:40:06 +00:00
{
2012-01-05 21:30:06 +00:00
const SfxItemPropertySimpleEntry * pEntry = rMap . getByName ( pNames [ nProp ] ) ;
2001-11-28 19:36:01 +00:00
2009-06-03 11:26:39 +00:00
if ( ! pEntry | |
2005-11-11 12:16:07 +00:00
( ! bIsConditional & & pNames [ nProp ] . equalsAsciiL ( SW_PROP_NAME ( UNO_NAME_PARA_STYLE_CONDITIONS ) ) ) )
2007-06-05 16:36:55 +00:00
throw beans : : UnknownPropertyException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " Unknown property: " ) ) + pNames [ nProp ] , static_cast < cppu : : OWeakObject * > ( this ) ) ;
2009-06-03 11:26:39 +00:00
if ( pEntry - > nFlags & beans : : PropertyAttribute : : READONLY )
2007-06-05 16:36:55 +00:00
throw beans : : PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " Property is read-only: " ) ) + pNames [ nProp ] , static_cast < cppu : : OWeakObject * > ( this ) ) ;
2008-03-12 11:35:18 +00:00
if ( aBaseImpl . mxNewBase . is ( ) )
2000-09-18 23:08:29 +00:00
{
2009-06-03 11:26:39 +00:00
lcl_SetStyleProperty ( * pEntry , * pPropSet , pValues [ nProp ] , aBaseImpl ,
2001-04-19 09:40:06 +00:00
pBasePool , m_pDoc , eFamily ) ;
}
else if ( bIsDescriptor )
{
if ( ! pPropImpl - > SetProperty ( pNames [ nProp ] , pValues [ nProp ] ) )
throw lang : : IllegalArgumentException ( ) ;
}
else
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2001-04-19 09:40:06 +00:00
}
if ( aBaseImpl . HasItemSet ( ) )
2008-03-12 11:35:18 +00:00
aBaseImpl . mxNewBase - > SetItemSet ( aBaseImpl . GetItemSet ( ) ) ;
2001-04-19 09:40:06 +00:00
}
2003-11-07 14:13:39 +00:00
void SwXStyle : : setPropertyValues (
2007-06-05 16:36:55 +00:00
const uno : : Sequence < OUString > & rPropertyNames ,
const uno : : Sequence < uno : : Any > & rValues )
throw ( beans : : PropertyVetoException , lang : : IllegalArgumentException ,
lang : : WrappedTargetException , uno : : RuntimeException )
2003-11-07 14:13:39 +00:00
{
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2003-11-07 14:13:39 +00:00
// workaround for bad designed API
try
{
SetPropertyValues_Impl ( rPropertyNames , rValues ) ;
}
2012-01-07 15:50:41 +09:00
catch ( const beans : : UnknownPropertyException & rException )
2003-11-07 14:13:39 +00:00
{
// wrap the original (here not allowed) exception in
2007-06-05 16:36:55 +00:00
// a lang::WrappedTargetException that gets thrown instead.
lang : : WrappedTargetException aWExc ;
2003-11-07 14:13:39 +00:00
aWExc . TargetException < < = rException ;
throw aWExc ;
}
}
2012-10-12 16:49:40 +02:00
static uno : : Any lcl_GetStyleProperty ( const SfxItemPropertySimpleEntry & rEntry ,
2009-06-03 11:26:39 +00:00
const SfxItemPropertySet & rPropSet ,
2001-04-19 09:40:06 +00:00
SwStyleBase_Impl & rBase ,
SfxStyleSheetBase * pBase ,
2001-09-24 18:59:24 +00:00
SfxStyleFamily eFamily ,
2007-06-05 16:36:55 +00:00
SwDoc * pDoc ) throw ( uno : : RuntimeException )
2001-04-19 09:40:06 +00:00
{
2007-06-05 16:36:55 +00:00
uno : : Any aRet ;
2009-06-03 11:26:39 +00:00
if ( FN_UNO_IS_PHYSICAL = = rEntry . nWID )
2001-04-19 09:40:06 +00:00
{
2011-01-17 15:06:54 +01:00
sal_Bool bPhys = pBase ! = 0 ;
2001-04-19 09:40:06 +00:00
if ( pBase )
{
bPhys = ( ( SwDocStyleSheet * ) pBase ) - > IsPhysical ( ) ;
// The standard character format is not existing physically
if ( bPhys & & SFX_STYLE_FAMILY_CHAR = = eFamily & &
( ( SwDocStyleSheet * ) pBase ) - > GetCharFmt ( ) & &
( ( SwDocStyleSheet * ) pBase ) - > GetCharFmt ( ) - > IsDefault ( ) )
2011-01-17 15:06:54 +01:00
bPhys = sal_False ;
2001-04-19 09:40:06 +00:00
}
aRet . setValue ( & bPhys , : : getBooleanCppuType ( ) ) ;
}
2012-12-03 17:48:40 +01:00
else if ( FN_UNO_HIDDEN = = rEntry . nWID )
{
sal_Bool bHidden = sal_False ;
if ( pBase )
{
rtl : : Reference < SwDocStyleSheet > xBase ( new SwDocStyleSheet ( * ( SwDocStyleSheet * ) pBase ) ) ;
bHidden = xBase - > IsHidden ( ) ;
}
aRet . setValue ( & bHidden , : : getBooleanCppuType ( ) ) ;
}
2001-04-19 09:40:06 +00:00
else if ( pBase )
{
2008-03-12 11:35:18 +00:00
if ( ! rBase . mxNewBase . is ( ) )
rBase . mxNewBase = new SwDocStyleSheet ( * ( SwDocStyleSheet * ) pBase ) ;
2009-06-03 11:26:39 +00:00
switch ( rEntry . nWID )
2001-04-19 09:40:06 +00:00
{
2001-09-24 18:59:24 +00:00
case RES_PAPER_BIN :
{
SfxItemSet & rSet = rBase . GetItemSet ( ) ;
2009-06-03 11:26:39 +00:00
rPropSet . getPropertyValue ( rEntry , rSet , aRet ) ;
2007-11-12 15:28:13 +00:00
sal_Int8 nBin = 0 ;
2001-09-24 18:59:24 +00:00
aRet > > = nBin ;
if ( nBin = = - 1 )
aRet < < = OUString ( RTL_CONSTASCII_USTRINGPARAM ( " [From printer settings] " ) ) ;
else
{
2006-08-14 15:57:26 +00:00
SfxPrinter * pPrinter = pDoc - > getPrinter ( false ) ;
2001-09-24 18:59:24 +00:00
OUString sTmp ;
if ( pPrinter )
sTmp = pPrinter - > GetPaperBinName ( nBin ) ;
aRet < < = sTmp ;
}
}
break ;
2001-04-19 09:40:06 +00:00
case FN_UNO_NUM_RULES : //Sonderbehandlung fuer das SvxNumRuleItem:
2000-09-18 23:08:29 +00:00
{
2008-03-12 11:35:18 +00:00
const SwNumRule * pRule = rBase . mxNewBase - > GetNumRule ( ) ;
2011-05-08 22:14:45 +02:00
OSL_ENSURE ( pRule , " Wo ist die NumRule? " ) ;
2012-05-02 17:40:10 +02:00
uno : : Reference < container : : XIndexReplace > xRules = new SwXNumberingRules ( * pRule , pDoc ) ;
2007-06-05 16:36:55 +00:00
aRet . setValue ( & xRules , : : getCppuType ( ( uno : : Reference < container : : XIndexReplace > * ) 0 ) ) ;
2001-04-19 09:40:06 +00:00
}
break ;
2011-02-05 15:56:54 +01:00
case RES_PARATR_OUTLINELEVEL :
2004-11-26 12:28:14 +00:00
{
2011-05-08 22:14:45 +02:00
OSL_ENSURE ( SFX_STYLE_FAMILY_PARA = = eFamily , " only paras " ) ;
2009-01-07 11:57:24 +00:00
int nLevel = rBase . mxNewBase - > GetCollection ( ) - > GetAttrOutlineLevel ( ) ;
aRet < < = static_cast < sal_Int16 > ( nLevel ) ;
2004-11-26 12:28:14 +00:00
}
2011-02-05 15:56:54 +01:00
break ;
2001-04-19 09:40:06 +00:00
case FN_UNO_FOLLOW_STYLE :
2001-08-16 11:33:56 +00:00
{
String aString ;
2012-10-10 07:34:19 +09:00
SwStyleNameMapper : : FillProgName ( rBase . mxNewBase - > GetFollow ( ) , aString , lcl_GetSwEnumFromSfxEnum ( eFamily ) , true ) ;
2001-08-16 11:33:56 +00:00
aRet < < = OUString ( aString ) ;
}
2001-04-19 09:40:06 +00:00
break ;
case RES_PAGEDESC :
2009-06-03 11:26:39 +00:00
if ( MID_PAGEDESC_PAGEDESCNAME ! = rEntry . nMemberId )
2001-04-19 09:40:06 +00:00
goto query_itemset ;
{
// Sonderbehandlung RES_PAGEDESC
const SfxPoolItem * pItem ;
if ( SFX_ITEM_SET = = rBase . GetItemSet ( ) . GetItemState ( RES_PAGEDESC , sal_True , & pItem ) )
2000-09-18 23:08:29 +00:00
{
2001-04-19 09:40:06 +00:00
const SwPageDesc * pDesc = ( ( const SwFmtPageDesc * ) pItem ) - > GetPageDesc ( ) ;
if ( pDesc )
2001-08-16 11:33:56 +00:00
{
String aString ;
2012-10-10 07:34:19 +09:00
SwStyleNameMapper : : FillProgName ( pDesc - > GetName ( ) , aString , nsSwGetPoolIdFromName : : GET_POOLID_PAGEDESC , true ) ;
2001-08-16 11:33:56 +00:00
aRet < < = OUString ( aString ) ;
}
2000-09-18 23:08:29 +00:00
}
2001-04-19 09:40:06 +00:00
}
break ;
case FN_UNO_IS_AUTO_UPDATE :
{
2011-01-17 15:06:54 +01:00
sal_Bool bAuto = sal_False ;
2001-04-19 09:40:06 +00:00
if ( SFX_STYLE_FAMILY_PARA = = eFamily )
2008-03-12 11:35:18 +00:00
bAuto = rBase . mxNewBase - > GetCollection ( ) - > IsAutoUpdateFmt ( ) ;
2001-04-19 09:40:06 +00:00
else if ( SFX_STYLE_FAMILY_FRAME = = eFamily )
2008-03-12 11:35:18 +00:00
bAuto = rBase . mxNewBase - > GetFrmFmt ( ) - > IsAutoUpdateFmt ( ) ;
2001-04-19 09:40:06 +00:00
aRet . setValue ( & bAuto , : : getBooleanCppuType ( ) ) ;
}
break ;
case FN_UNO_DISPLAY_NAME :
{
2009-01-06 17:37:13 +00:00
OUString sName ( rBase . mxNewBase - > GetDisplayName ( ) ) ;
2001-04-19 09:40:06 +00:00
aRet < < = sName ;
}
break ;
2005-11-11 12:16:07 +00:00
case FN_UNO_PARA_STYLE_CONDITIONS :
{
2011-05-08 22:14:45 +02:00
OSL_ENSURE ( COND_COMMAND_COUNT = = 28 ,
2005-11-11 12:16:07 +00:00
" invalid size of comman count? " ) ;
uno : : Sequence < beans : : NamedValue > aSeq ( COND_COMMAND_COUNT ) ;
beans : : NamedValue * pSeq = aSeq . getArray ( ) ;
SwFmt * pFmt = ( ( SwDocStyleSheet * ) pBase ) - > GetCollection ( ) ;
const CommandStruct * pCmds = SwCondCollItem : : GetCmds ( ) ;
2011-01-17 15:06:54 +01:00
for ( sal_uInt16 n = 0 ; n < COND_COMMAND_COUNT ; + + n )
2005-11-11 12:16:07 +00:00
{
String aStyleName ;
2007-09-27 08:40:48 +00:00
const SwCollCondition * pCond = 0 ;
2005-11-11 12:16:07 +00:00
if ( pFmt & & RES_CONDTXTFMTCOLL = = pFmt - > Which ( ) & &
0 ! = ( pCond = ( ( SwConditionTxtFmtColl * ) pFmt ) - >
HasCondition ( SwCollCondition ( 0 , pCmds [ n ] . nCnd , pCmds [ n ] . nSubCond ) ) )
& & pCond - > GetTxtFmtColl ( ) )
{
// get programmatic style name from UI style name
aStyleName = pCond - > GetTxtFmtColl ( ) - > GetName ( ) ;
2012-10-10 07:34:19 +09:00
SwStyleNameMapper : : FillProgName ( aStyleName , aStyleName , lcl_GetSwEnumFromSfxEnum ( eFamily ) , true ) ;
2005-11-11 12:16:07 +00:00
}
pSeq [ n ] . Name = GetCommandContextByIndex ( n ) ;
pSeq [ n ] . Value < < = rtl : : OUString ( aStyleName ) ;
}
aRet < < = aSeq ;
}
break ;
2001-04-19 09:40:06 +00:00
case FN_UNO_CATEGORY :
{
2008-03-12 11:35:18 +00:00
sal_uInt16 nPoolId = rBase . mxNewBase - > GetCollection ( ) - > GetPoolFmtId ( ) ;
2001-04-19 09:40:06 +00:00
short nRet = - 1 ;
switch ( COLL_GET_RANGE_BITS & nPoolId )
2000-11-15 13:04:24 +00:00
{
2001-04-19 09:40:06 +00:00
case COLL_TEXT_BITS :
2007-06-05 16:36:55 +00:00
nRet = style : : ParagraphStyleCategory : : TEXT ;
2001-04-19 09:40:06 +00:00
break ;
case COLL_DOC_BITS :
2007-06-05 16:36:55 +00:00
nRet = style : : ParagraphStyleCategory : : CHAPTER ;
2001-04-19 09:40:06 +00:00
break ;
case COLL_LISTS_BITS :
2007-06-05 16:36:55 +00:00
nRet = style : : ParagraphStyleCategory : : LIST ;
2001-04-19 09:40:06 +00:00
break ;
case COLL_REGISTER_BITS :
2007-06-05 16:36:55 +00:00
nRet = style : : ParagraphStyleCategory : : INDEX ;
2001-04-19 09:40:06 +00:00
break ;
case COLL_EXTRA_BITS :
2007-06-05 16:36:55 +00:00
nRet = style : : ParagraphStyleCategory : : EXTRA ;
2001-04-19 09:40:06 +00:00
break ;
case COLL_HTML_BITS :
2007-06-05 16:36:55 +00:00
nRet = style : : ParagraphStyleCategory : : HTML ;
2001-04-19 09:40:06 +00:00
break ;
2000-11-15 13:04:24 +00:00
}
2001-04-19 09:40:06 +00:00
aRet < < = nRet ;
}
break ;
case SID_SWREGISTER_COLLECTION :
{
2008-03-12 11:35:18 +00:00
const SwPageDesc * pPageDesc = rBase . mxNewBase - > GetPageDesc ( ) ;
2001-04-19 09:40:06 +00:00
const SwTxtFmtColl * pCol = 0 ;
2001-08-16 11:33:56 +00:00
String aString ;
2001-04-19 09:40:06 +00:00
if ( pPageDesc )
pCol = pPageDesc - > GetRegisterFmtColl ( ) ;
if ( pCol )
2001-08-16 11:33:56 +00:00
SwStyleNameMapper : : FillProgName (
2012-10-10 07:34:19 +09:00
pCol - > GetName ( ) , aString , nsSwGetPoolIdFromName : : GET_POOLID_TXTCOLL , true ) ;
2001-08-16 11:33:56 +00:00
aRet < < = OUString ( aString ) ;
2001-04-19 09:40:06 +00:00
}
break ;
default :
2000-10-18 10:20:20 +00:00
query_itemset :
2001-04-19 09:40:06 +00:00
{
SfxItemSet & rSet = rBase . GetItemSet ( ) ;
2009-06-03 11:26:39 +00:00
rPropSet . getPropertyValue ( rEntry , rSet , aRet ) ;
2001-04-19 09:40:06 +00:00
}
}
}
else
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2001-04-19 09:40:06 +00:00
return aRet ;
}
2007-06-05 16:36:55 +00:00
uno : : Sequence < uno : : Any > SAL_CALL SwXStyle : : GetPropertyValues_Impl (
2003-11-07 14:13:39 +00:00
const uno : : Sequence < OUString > & rPropertyNames )
2007-06-05 16:36:55 +00:00
throw ( beans : : UnknownPropertyException , lang : : WrappedTargetException , uno : : RuntimeException )
2001-04-19 09:40:06 +00:00
{
2001-10-17 11:27:45 +00:00
if ( ! m_pDoc )
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2009-06-03 11:26:39 +00:00
sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_STYLE ;
2001-04-19 09:40:06 +00:00
switch ( eFamily )
{
2009-06-03 11:26:39 +00:00
case SFX_STYLE_FAMILY_PARA : nPropSetId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE ; break ;
case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_MAP_FRAME_STYLE ; break ;
case SFX_STYLE_FAMILY_PAGE : nPropSetId = PROPERTY_MAP_PAGE_STYLE ; break ;
case SFX_STYLE_FAMILY_PSEUDO : nPropSetId = PROPERTY_MAP_NUM_STYLE ; break ;
2007-09-27 08:40:48 +00:00
default :
;
2001-04-19 09:40:06 +00:00
}
2009-06-03 11:26:39 +00:00
const SfxItemPropertySet * pPropSet = aSwMapProvider . GetPropertySet ( nPropSetId ) ;
2012-01-05 21:30:06 +00:00
const SfxItemPropertyMap & rMap = pPropSet - > getPropertyMap ( ) ;
2005-11-11 12:16:07 +00:00
2001-04-19 09:40:06 +00:00
const OUString * pNames = rPropertyNames . getConstArray ( ) ;
2007-06-05 16:36:55 +00:00
uno : : Sequence < uno : : Any > aRet ( rPropertyNames . getLength ( ) ) ;
uno : : Any * pRet = aRet . getArray ( ) ;
2001-04-25 10:55:37 +00:00
SwStyleBase_Impl aBase ( * m_pDoc , sStyleName ) ;
2001-04-19 09:40:06 +00:00
SfxStyleSheetBase * pBase = 0 ;
for ( sal_Int32 nProp = 0 ; nProp < rPropertyNames . getLength ( ) ; nProp + + )
{
2012-01-05 21:30:06 +00:00
const SfxItemPropertySimpleEntry * pEntry = rMap . getByName ( pNames [ nProp ] ) ;
2009-06-03 11:26:39 +00:00
if ( ! pEntry | |
2005-11-11 12:16:07 +00:00
( ! bIsConditional & & pNames [ nProp ] . equalsAsciiL ( SW_PROP_NAME ( UNO_NAME_PARA_STYLE_CONDITIONS ) ) ) )
2007-06-05 16:36:55 +00:00
throw beans : : UnknownPropertyException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " Unknown property: " ) ) + pNames [ nProp ] , static_cast < cppu : : OWeakObject * > ( this ) ) ;
2001-04-19 09:40:06 +00:00
if ( pBasePool )
{
if ( ! pBase )
{
2001-10-29 14:16:14 +00:00
sal_uInt16 nSaveMask = pBasePool - > GetSearchMask ( ) ;
2001-04-19 09:40:06 +00:00
pBasePool - > SetSearchMask ( eFamily , SFXSTYLEBIT_ALL ) ;
pBase = pBasePool - > Find ( sStyleName ) ;
pBasePool - > SetSearchMask ( eFamily , nSaveMask ) ;
2000-09-18 23:08:29 +00:00
}
2009-06-03 11:26:39 +00:00
pRet [ nProp ] = lcl_GetStyleProperty ( * pEntry , * pPropSet , aBase , pBase , eFamily , GetDoc ( ) ) ;
2001-04-19 09:40:06 +00:00
}
else if ( bIsDescriptor )
{
2007-06-05 16:36:55 +00:00
uno : : Any * pAny = 0 ;
2001-10-17 11:27:45 +00:00
pPropImpl - > GetProperty ( pNames [ nProp ] , pAny ) ;
if ( ! pAny )
{
2012-12-17 18:12:09 +09:00
bool bExcept = false ;
2001-10-17 11:27:45 +00:00
switch ( eFamily )
{
case SFX_STYLE_FAMILY_PSEUDO :
2012-12-17 18:12:09 +09:00
bExcept = true ;
2001-10-17 11:27:45 +00:00
break ;
case SFX_STYLE_FAMILY_PARA :
case SFX_STYLE_FAMILY_PAGE :
pPropImpl - > GetProperty ( pNames [ nProp ] , mxStyleData , pRet [ nProp ] ) ;
break ;
case SFX_STYLE_FAMILY_CHAR :
case SFX_STYLE_FAMILY_FRAME :
{
2009-06-03 11:26:39 +00:00
if ( pEntry - > nWID > = POOLATTR_BEGIN & & pEntry - > nWID < RES_UNKNOWNATR_END )
2001-10-17 11:27:45 +00:00
{
SwFmt * pFmt ;
if ( eFamily = = SFX_STYLE_FAMILY_CHAR )
pFmt = m_pDoc - > GetDfltCharFmt ( ) ;
else
pFmt = m_pDoc - > GetDfltFrmFmt ( ) ;
const SwAttrPool * pPool = pFmt - > GetAttrSet ( ) . GetPool ( ) ;
2009-06-03 11:26:39 +00:00
const SfxPoolItem & rItem = pPool - > GetDefaultItem ( pEntry - > nWID ) ;
rItem . QueryValue ( pRet [ nProp ] , pEntry - > nMemberId ) ;
2001-10-17 11:27:45 +00:00
}
else
2012-12-17 18:12:09 +09:00
bExcept = true ;
2001-10-17 11:27:45 +00:00
}
break ;
2007-09-27 08:40:48 +00:00
default :
;
2001-10-17 11:27:45 +00:00
}
if ( bExcept )
{
2007-06-05 16:36:55 +00:00
uno : : RuntimeException aExcept ;
2001-10-17 11:27:45 +00:00
aExcept . Message = OUString ( RTL_CONSTASCII_USTRINGPARAM ( " No default value for: " ) ) + pNames [ nProp ] ;
throw aExcept ;
}
}
else
2001-10-11 17:50:13 +00:00
pRet [ nProp ] = * pAny ;
2000-09-18 23:08:29 +00:00
}
else
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2000-09-18 23:08:29 +00:00
}
return aRet ;
}
2003-11-07 14:13:39 +00:00
2007-06-05 16:36:55 +00:00
uno : : Sequence < uno : : Any > SwXStyle : : getPropertyValues (
const uno : : Sequence < OUString > & rPropertyNames ) throw ( uno : : RuntimeException )
2003-11-07 14:13:39 +00:00
{
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2007-06-05 16:36:55 +00:00
uno : : Sequence < uno : : Any > aValues ;
2003-11-07 14:13:39 +00:00
// workaround for bad designed API
try
{
aValues = GetPropertyValues_Impl ( rPropertyNames ) ;
}
2007-06-05 16:36:55 +00:00
catch ( beans : : UnknownPropertyException & )
2003-11-07 14:13:39 +00:00
{
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " Unknown property exception caught " ) ) , static_cast < cppu : : OWeakObject * > ( this ) ) ;
2003-11-07 14:13:39 +00:00
}
2007-06-05 16:36:55 +00:00
catch ( lang : : WrappedTargetException & )
2003-11-07 14:13:39 +00:00
{
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " WrappedTargetException caught " ) ) , static_cast < cppu : : OWeakObject * > ( this ) ) ;
2003-11-07 14:13:39 +00:00
}
return aValues ;
}
2010-10-13 16:04:59 +05:30
2001-04-19 09:40:06 +00:00
void SwXStyle : : addPropertiesChangeListener (
2007-09-27 08:40:48 +00:00
const uno : : Sequence < OUString > & /*aPropertyNames*/ ,
const uno : : Reference < beans : : XPropertiesChangeListener > & /*xListener*/ )
2007-06-05 16:36:55 +00:00
throw ( uno : : RuntimeException )
2001-04-19 09:40:06 +00:00
{
}
void SwXStyle : : removePropertiesChangeListener (
2007-09-27 08:40:48 +00:00
const uno : : Reference < beans : : XPropertiesChangeListener > & /*xListener*/ )
2007-06-05 16:36:55 +00:00
throw ( uno : : RuntimeException )
2001-04-19 09:40:06 +00:00
{
}
void SwXStyle : : firePropertiesChangeEvent (
2007-09-27 08:40:48 +00:00
const uno : : Sequence < OUString > & /*aPropertyNames*/ ,
const uno : : Reference < beans : : XPropertiesChangeListener > & /*xListener*/ )
2007-06-05 16:36:55 +00:00
throw ( uno : : RuntimeException )
2001-04-19 09:40:06 +00:00
{
}
2007-06-05 16:36:55 +00:00
void SwXStyle : : setPropertyValue ( const OUString & rPropertyName , const uno : : Any & rValue )
throw ( beans : : UnknownPropertyException ,
beans : : PropertyVetoException ,
lang : : IllegalArgumentException ,
lang : : WrappedTargetException ,
uno : : RuntimeException )
2001-04-19 09:40:06 +00:00
{
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2007-06-05 16:36:55 +00:00
const uno : : Sequence < OUString > aProperties ( & rPropertyName , 1 ) ;
const uno : : Sequence < uno : : Any > aValues ( & rValue , 1 ) ;
2003-11-07 14:13:39 +00:00
SetPropertyValues_Impl ( aProperties , aValues ) ;
2001-04-19 09:40:06 +00:00
}
2007-06-05 16:36:55 +00:00
uno : : Any SwXStyle : : getPropertyValue ( const OUString & rPropertyName )
throw ( beans : : UnknownPropertyException , lang : : WrappedTargetException , uno : : RuntimeException )
2001-04-19 09:40:06 +00:00
{
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2007-06-05 16:36:55 +00:00
const uno : : Sequence < OUString > aProperties ( & rPropertyName , 1 ) ;
2003-11-07 14:13:39 +00:00
return GetPropertyValues_Impl ( aProperties ) . getConstArray ( ) [ 0 ] ;
2001-04-19 09:40:06 +00:00
}
2000-09-18 23:08:29 +00:00
2007-09-27 08:40:48 +00:00
void SwXStyle : : addPropertyChangeListener ( const OUString & /*rPropertyName*/ ,
const uno : : Reference < beans : : XPropertyChangeListener > & /*xListener*/ )
2007-06-05 16:36:55 +00:00
throw ( beans : : UnknownPropertyException , lang : : WrappedTargetException , uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2011-05-08 22:14:45 +02:00
OSL_FAIL ( " not implemented " ) ;
2000-09-18 23:08:29 +00:00
}
2007-09-27 08:40:48 +00:00
void SwXStyle : : removePropertyChangeListener ( const OUString & /*rPropertyName*/ ,
const uno : : Reference < beans : : XPropertyChangeListener > & /*xListener*/ )
2007-06-05 16:36:55 +00:00
throw ( beans : : UnknownPropertyException , lang : : WrappedTargetException , uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2011-05-08 22:14:45 +02:00
OSL_FAIL ( " not implemented " ) ;
2000-09-18 23:08:29 +00:00
}
2007-09-27 08:40:48 +00:00
void SwXStyle : : addVetoableChangeListener ( const OUString & /*rPropertyName*/ ,
const uno : : Reference < beans : : XVetoableChangeListener > & /*xListener*/ )
2007-06-05 16:36:55 +00:00
throw ( beans : : UnknownPropertyException , lang : : WrappedTargetException , uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2011-05-08 22:14:45 +02:00
OSL_FAIL ( " not implemented " ) ;
2000-09-18 23:08:29 +00:00
}
2007-09-27 08:40:48 +00:00
void SwXStyle : : removeVetoableChangeListener ( const OUString & /*rPropertyName*/ ,
const uno : : Reference < beans : : XVetoableChangeListener > & /*xListener*/ )
2007-06-05 16:36:55 +00:00
throw ( beans : : UnknownPropertyException , lang : : WrappedTargetException , uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2011-05-08 22:14:45 +02:00
OSL_FAIL ( " not implemented " ) ;
2000-09-18 23:08:29 +00:00
}
2007-06-05 16:36:55 +00:00
beans : : PropertyState SwXStyle : : getPropertyState ( const OUString & rPropertyName )
throw ( beans : : UnknownPropertyException , uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2000-10-24 14:38:05 +00:00
2007-06-05 16:36:55 +00:00
uno : : Sequence < OUString > aNames ( 1 ) ;
2000-10-24 14:38:05 +00:00
OUString * pNames = aNames . getArray ( ) ;
pNames [ 0 ] = rPropertyName ;
2007-06-05 16:36:55 +00:00
uno : : Sequence < beans : : PropertyState > aStates = getPropertyStates ( aNames ) ;
2000-10-24 14:38:05 +00:00
return aStates . getConstArray ( ) [ 0 ] ;
}
2007-06-05 16:36:55 +00:00
uno : : Sequence < beans : : PropertyState > SwXStyle : : getPropertyStates (
const uno : : Sequence < OUString > & rPropertyNames )
throw ( beans : : UnknownPropertyException , uno : : RuntimeException )
2000-10-24 14:38:05 +00:00
{
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2007-06-05 16:36:55 +00:00
uno : : Sequence < beans : : PropertyState > aRet ( rPropertyNames . getLength ( ) ) ;
beans : : PropertyState * pStates = aRet . getArray ( ) ;
2000-09-18 23:08:29 +00:00
if ( pBasePool )
{
pBasePool - > SetSearchMask ( eFamily ) ;
SfxStyleSheetBase * pBase = pBasePool - > Find ( sStyleName ) ;
2011-05-08 22:14:45 +02:00
OSL_ENSURE ( pBase , " where is the style? " ) ;
2000-09-18 23:08:29 +00:00
if ( pBase )
{
2000-10-24 14:38:05 +00:00
const OUString * pNames = rPropertyNames . getConstArray ( ) ;
2008-03-12 11:35:18 +00:00
rtl : : Reference < SwDocStyleSheet > xStyle ( new SwDocStyleSheet ( * ( SwDocStyleSheet * ) pBase ) ) ;
2009-06-03 11:26:39 +00:00
sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_STYLE ;
2000-10-24 14:38:05 +00:00
switch ( eFamily )
2000-09-18 23:08:29 +00:00
{
2009-06-03 11:26:39 +00:00
case SFX_STYLE_FAMILY_PARA : nPropSetId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE ; break ;
case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_MAP_FRAME_STYLE ; break ;
case SFX_STYLE_FAMILY_PAGE : nPropSetId = PROPERTY_MAP_PAGE_STYLE ; break ;
case SFX_STYLE_FAMILY_PSEUDO : nPropSetId = PROPERTY_MAP_NUM_STYLE ; break ;
2007-09-27 08:40:48 +00:00
default :
;
2000-09-18 23:08:29 +00:00
}
2009-06-03 11:26:39 +00:00
const SfxItemPropertySet * pPropSet = aSwMapProvider . GetPropertySet ( nPropSetId ) ;
2012-01-05 21:30:06 +00:00
const SfxItemPropertyMap & rMap = pPropSet - > getPropertyMap ( ) ;
2000-10-24 14:38:05 +00:00
2008-03-12 11:35:18 +00:00
SfxItemSet aSet = xStyle - > GetItemSet ( ) ;
2000-10-24 14:38:05 +00:00
for ( sal_Int32 i = 0 ; i < rPropertyNames . getLength ( ) ; i + + )
2000-09-18 23:08:29 +00:00
{
2002-06-25 14:41:57 +00:00
const String & rPropName = pNames [ i ] ;
2012-01-05 21:30:06 +00:00
const SfxItemPropertySimpleEntry * pEntry = rMap . getByName ( rPropName ) ;
2009-06-03 11:26:39 +00:00
if ( ! pEntry )
2007-06-05 16:36:55 +00:00
throw beans : : UnknownPropertyException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " Unknown property: " ) ) + rPropName , static_cast < cppu : : OWeakObject * > ( this ) ) ;
2009-06-03 11:26:39 +00:00
if ( FN_UNO_NUM_RULES = = pEntry - > nWID | |
FN_UNO_FOLLOW_STYLE = = pEntry - > nWID )
2000-09-18 23:08:29 +00:00
{
2007-06-05 16:36:55 +00:00
pStates [ i ] = beans : : PropertyState_DIRECT_VALUE ;
2000-10-24 14:38:05 +00:00
}
2000-10-25 11:06:06 +00:00
else if ( SFX_STYLE_FAMILY_PAGE = = eFamily & &
2002-06-25 14:41:57 +00:00
( rPropName . EqualsAscii ( " Header " , 0 , 6 )
| | rPropName . EqualsAscii ( " Footer " , 0 , 6 ) ) )
2000-10-25 11:06:06 +00:00
{
2009-06-03 11:26:39 +00:00
sal_uInt16 nResId = lcl_ConvertFNToRES ( pEntry - > nWID ) ;
2011-01-17 15:06:54 +01:00
sal_Bool bFooter = rPropName . EqualsAscii ( " Footer " , 0 , 6 ) ;
2000-10-25 11:06:06 +00:00
const SvxSetItem * pSetItem ;
if ( SFX_ITEM_SET = = aSet . GetItemState (
bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET ,
sal_False , ( const SfxPoolItem * * ) & pSetItem ) )
{
const SfxItemSet & rSet = pSetItem - > GetItemSet ( ) ;
SfxItemState eState = rSet . GetItemState ( nResId , sal_False ) ;
if ( SFX_ITEM_SET = = eState )
2007-06-05 16:36:55 +00:00
pStates [ i ] = beans : : PropertyState_DIRECT_VALUE ;
2000-10-25 11:06:06 +00:00
else
2007-06-05 16:36:55 +00:00
pStates [ i ] = beans : : PropertyState_DEFAULT_VALUE ;
2000-10-25 11:06:06 +00:00
}
else
2007-06-05 16:36:55 +00:00
pStates [ i ] = beans : : PropertyState_AMBIGUOUS_VALUE ;
2000-10-25 11:06:06 +00:00
}
2000-10-24 14:38:05 +00:00
else
{
2009-06-03 11:26:39 +00:00
pStates [ i ] = pPropSet - > getPropertyState ( * pEntry , aSet ) ;
2002-06-25 14:41:57 +00:00
if ( SFX_STYLE_FAMILY_PAGE = = eFamily & &
2009-06-03 11:26:39 +00:00
SID_ATTR_PAGE_SIZE = = pEntry - > nWID & &
2007-06-05 16:36:55 +00:00
beans : : PropertyState_DIRECT_VALUE = = pStates [ i ] )
2002-06-25 14:41:57 +00:00
{
const SvxSizeItem & rSize =
static_cast < const SvxSizeItem & > (
aSet . Get ( SID_ATTR_PAGE_SIZE ) ) ;
2009-06-03 11:26:39 +00:00
sal_uInt8 nMemberId = pEntry - > nMemberId & 0x7f ;
2002-06-25 14:41:57 +00:00
if ( ( LONG_MAX = = rSize . GetSize ( ) . Width ( ) & &
( MID_SIZE_WIDTH = = nMemberId | |
MID_SIZE_SIZE = = nMemberId ) ) | |
( LONG_MAX = = rSize . GetSize ( ) . Height ( ) & &
MID_SIZE_HEIGHT = = nMemberId ) )
{
2007-06-05 16:36:55 +00:00
pStates [ i ] = beans : : PropertyState_DEFAULT_VALUE ;
2002-06-25 14:41:57 +00:00
}
}
2000-09-18 23:08:29 +00:00
}
}
}
else
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2000-09-18 23:08:29 +00:00
}
else
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2000-09-18 23:08:29 +00:00
return aRet ;
}
void SwXStyle : : setPropertyToDefault ( const OUString & rPropertyName )
2007-06-05 16:36:55 +00:00
throw ( beans : : UnknownPropertyException , uno : : RuntimeException )
2001-10-24 14:51:20 +00:00
{
2007-06-05 16:36:55 +00:00
const uno : : Sequence < OUString > aSequence ( & rPropertyName , 1 ) ;
2001-10-24 14:51:20 +00:00
setPropertiesToDefault ( aSequence ) ;
}
2007-06-05 16:36:55 +00:00
void SAL_CALL SwXStyle : : setPropertiesToDefault ( const uno : : Sequence < OUString > & aPropertyNames )
throw ( beans : : UnknownPropertyException , uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2001-11-06 17:52:15 +00:00
SwFmt * pTargetFmt = 0 ;
2001-10-24 14:51:20 +00:00
2000-09-18 23:08:29 +00:00
if ( pBasePool )
{
pBasePool - > SetSearchMask ( eFamily ) ;
SfxStyleSheetBase * pBase = pBasePool - > Find ( sStyleName ) ;
2011-05-08 22:14:45 +02:00
OSL_ENSURE ( pBase , " Where is the style? " ) ;
2000-09-18 23:08:29 +00:00
if ( pBase )
{
2008-03-12 11:35:18 +00:00
rtl : : Reference < SwDocStyleSheet > xStyle ( new SwDocStyleSheet ( * ( SwDocStyleSheet * ) pBase ) ) ;
2001-10-24 14:51:20 +00:00
switch ( eFamily )
2000-09-18 23:08:29 +00:00
{
2008-03-12 11:35:18 +00:00
case SFX_STYLE_FAMILY_CHAR : pTargetFmt = xStyle - > GetCharFmt ( ) ; break ;
case SFX_STYLE_FAMILY_PARA : pTargetFmt = xStyle - > GetCollection ( ) ; break ;
case SFX_STYLE_FAMILY_FRAME : pTargetFmt = xStyle - > GetFrmFmt ( ) ; break ;
2001-10-24 14:51:20 +00:00
case SFX_STYLE_FAMILY_PAGE :
{
2001-10-29 14:16:14 +00:00
sal_uInt16 nPgDscPos = USHRT_MAX ;
2008-03-12 11:35:18 +00:00
SwPageDesc * pDesc = m_pDoc - > FindPageDescByName ( xStyle - > GetPageDesc ( ) - > GetName ( ) , & nPgDscPos ) ;
2001-10-24 14:51:20 +00:00
if ( pDesc )
pTargetFmt = & pDesc - > GetMaster ( ) ;
}
break ;
case SFX_STYLE_FAMILY_PSEUDO :
break ;
2007-09-27 08:40:48 +00:00
default :
;
2000-09-18 23:08:29 +00:00
}
2001-11-06 17:52:15 +00:00
}
}
2009-06-03 11:26:39 +00:00
sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_STYLE ;
2001-11-06 17:52:15 +00:00
switch ( eFamily )
{
2009-06-03 11:26:39 +00:00
case SFX_STYLE_FAMILY_PARA : nPropSetId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE ; break ;
case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_MAP_FRAME_STYLE ; break ;
case SFX_STYLE_FAMILY_PAGE : nPropSetId = PROPERTY_MAP_PAGE_STYLE ; break ;
case SFX_STYLE_FAMILY_PSEUDO : nPropSetId = PROPERTY_MAP_NUM_STYLE ; break ;
2007-09-27 08:40:48 +00:00
default :
;
2001-11-06 17:52:15 +00:00
}
2009-06-03 11:26:39 +00:00
const SfxItemPropertySet * pPropSet = aSwMapProvider . GetPropertySet ( nPropSetId ) ;
2012-01-05 21:30:06 +00:00
const SfxItemPropertyMap & rMap = pPropSet - > getPropertyMap ( ) ;
2001-10-24 14:51:20 +00:00
2001-11-06 17:52:15 +00:00
const OUString * pNames = aPropertyNames . getConstArray ( ) ;
2001-10-16 11:16:17 +00:00
2001-11-06 17:52:15 +00:00
if ( pTargetFmt )
{
for ( sal_Int32 nProp = 0 , nEnd = aPropertyNames . getLength ( ) ; nProp < nEnd ; nProp + + )
{
2012-01-05 21:30:06 +00:00
const SfxItemPropertySimpleEntry * pEntry = rMap . getByName ( pNames [ nProp ] ) ;
2009-06-03 11:26:39 +00:00
if ( ! pEntry )
2007-06-05 16:36:55 +00:00
throw beans : : UnknownPropertyException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " Property is unknown: " ) ) + pNames [ nProp ] , static_cast < cppu : : OWeakObject * > ( this ) ) ;
2009-06-03 11:26:39 +00:00
if ( pEntry - > nWID = = FN_UNO_FOLLOW_STYLE | | pEntry - > nWID = = FN_UNO_NUM_RULES )
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " Cannot reset: " ) ) + pNames [ nProp ] , static_cast < cppu : : OWeakObject * > ( this ) ) ;
2009-06-03 11:26:39 +00:00
if ( pEntry - > nFlags & beans : : PropertyAttribute : : READONLY )
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " setPropertiesToDefault: property is read-only: " ) ) + pNames [ nProp ] , static_cast < cppu : : OWeakObject * > ( this ) ) ;
2001-11-06 17:52:15 +00:00
2011-02-05 15:56:54 +01:00
if ( pEntry - > nWID = = RES_PARATR_OUTLINELEVEL )
2009-01-07 11:57:24 +00:00
static_cast < SwTxtFmtColl * > ( pTargetFmt ) - > DeleteAssignmentToListLevelOfOutlineStyle ( ) ;
2004-11-26 12:28:14 +00:00
else
2011-02-05 15:56:54 +01:00
pTargetFmt - > ResetFmtAttr ( pEntry - > nWID ) ;
2000-09-18 23:08:29 +00:00
}
}
2001-11-06 17:52:15 +00:00
else if ( bIsDescriptor )
{
for ( sal_Int32 nProp = 0 , nEnd = aPropertyNames . getLength ( ) ; nProp < nEnd ; nProp + + )
pPropImpl - > ClearProperty ( pNames [ nProp ] ) ;
}
2000-09-18 23:08:29 +00:00
}
2001-11-06 17:52:15 +00:00
2001-10-24 14:51:20 +00:00
void SAL_CALL SwXStyle : : setAllPropertiesToDefault ( )
2007-06-05 16:36:55 +00:00
throw ( uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2000-09-18 23:08:29 +00:00
if ( pBasePool )
{
pBasePool - > SetSearchMask ( eFamily ) ;
SfxStyleSheetBase * pBase = pBasePool - > Find ( sStyleName ) ;
2011-05-08 22:14:45 +02:00
OSL_ENSURE ( pBase , " where is the style, you fiend!? " ) ;
2000-09-18 23:08:29 +00:00
if ( pBase )
{
2008-03-12 11:35:18 +00:00
rtl : : Reference < SwDocStyleSheet > xStyle ( new SwDocStyleSheet ( * ( SwDocStyleSheet * ) pBase ) ) ;
2001-10-24 14:51:20 +00:00
SwFmt * pTargetFmt = 0 ;
2001-10-29 14:16:14 +00:00
sal_uInt16 nPgDscPos = USHRT_MAX ;
2001-10-24 14:51:20 +00:00
switch ( eFamily )
{
case SFX_STYLE_FAMILY_CHAR :
2008-03-12 11:35:18 +00:00
pTargetFmt = xStyle - > GetCharFmt ( ) ;
2001-10-24 14:51:20 +00:00
break ;
case SFX_STYLE_FAMILY_PARA :
2004-11-26 12:28:14 +00:00
{
2008-03-12 11:35:18 +00:00
pTargetFmt = xStyle - > GetCollection ( ) ;
if ( xStyle - > GetCollection ( ) )
2011-02-05 15:56:54 +01:00
xStyle - > GetCollection ( ) - > DeleteAssignmentToListLevelOfOutlineStyle ( ) ;
2004-11-26 12:28:14 +00:00
}
2001-10-24 14:51:20 +00:00
break ;
case SFX_STYLE_FAMILY_FRAME :
2008-03-12 11:35:18 +00:00
pTargetFmt = xStyle - > GetFrmFmt ( ) ;
2001-10-24 14:51:20 +00:00
break ;
case SFX_STYLE_FAMILY_PAGE :
{
2008-03-12 11:35:18 +00:00
SwPageDesc * pDesc = m_pDoc - > FindPageDescByName ( xStyle - > GetPageDesc ( ) - > GetName ( ) , & nPgDscPos ) ;
2001-10-24 14:51:20 +00:00
if ( pDesc )
{
pTargetFmt = & pDesc - > GetMaster ( ) ;
2007-09-27 08:40:48 +00:00
pDesc - > SetUseOn ( nsUseOnPage : : PD_ALL ) ;
2001-10-24 14:51:20 +00:00
}
}
break ;
case SFX_STYLE_FAMILY_PSEUDO :
break ;
2007-09-27 08:40:48 +00:00
default :
;
2001-10-24 14:51:20 +00:00
}
if ( pTargetFmt )
2000-09-18 23:08:29 +00:00
{
2001-10-24 14:51:20 +00:00
if ( USHRT_MAX ! = nPgDscPos )
{
2012-06-21 13:40:06 +02:00
SwPageDesc & rPageDesc = m_pDoc - > GetPageDesc ( nPgDscPos ) ;
2002-08-05 13:32:35 +00:00
rPageDesc . ResetAllMasterAttr ( ) ;
2002-06-28 12:05:42 +00:00
2007-05-10 15:03:15 +00:00
SvxLRSpaceItem aLR ( RES_LR_SPACE ) ;
2001-10-24 14:51:20 +00:00
sal_Int32 nSize = GetMetricVal ( CM_1 ) * 2 ;
aLR . SetLeft ( nSize ) ;
aLR . SetLeft ( nSize ) ;
2007-05-10 15:03:15 +00:00
SvxULSpaceItem aUL ( RES_UL_SPACE ) ;
2001-10-24 14:51:20 +00:00
aUL . SetUpper ( static_cast < sal_uInt16 > ( nSize ) ) ;
aUL . SetLower ( static_cast < sal_uInt16 > ( nSize ) ) ;
2008-06-13 09:32:46 +00:00
pTargetFmt - > SetFmtAttr ( aLR ) ;
pTargetFmt - > SetFmtAttr ( aUL ) ;
2001-10-24 14:51:20 +00:00
SwPageDesc * pStdPgDsc = m_pDoc - > GetPageDescFromPool ( RES_POOLPAGE_STANDARD ) ;
2002-08-05 13:32:35 +00:00
SwFmtFrmSize aFrmSz ( ATT_FIX_SIZE ) ;
if ( RES_POOLPAGE_STANDARD = = rPageDesc . GetPoolFmtId ( ) )
{
2006-08-14 15:57:26 +00:00
if ( m_pDoc - > getPrinter ( false ) )
2002-08-05 13:32:35 +00:00
{
const Size aPhysSize ( SvxPaperInfo : : GetPaperSize (
2006-08-14 15:57:26 +00:00
static_cast < Printer * > ( m_pDoc - > getPrinter ( false ) ) ) ) ;
2002-08-05 13:32:35 +00:00
aFrmSz . SetSize ( aPhysSize ) ;
}
else
2009-06-12 09:36:34 +00:00
aFrmSz . SetSize ( SvxPaperInfo : : GetDefaultPaperSize ( ) ) ;
2002-08-05 13:32:35 +00:00
}
else
{
aFrmSz = pStdPgDsc - > GetMaster ( ) . GetFrmSize ( ) ;
}
2001-10-24 14:51:20 +00:00
if ( pStdPgDsc - > GetLandscape ( ) )
{
SwTwips nTmp = aFrmSz . GetHeight ( ) ;
aFrmSz . SetHeight ( aFrmSz . GetWidth ( ) ) ;
aFrmSz . SetWidth ( nTmp ) ;
}
2008-06-13 09:32:46 +00:00
pTargetFmt - > SetFmtAttr ( aFrmSz ) ;
2001-10-24 14:51:20 +00:00
}
else
2007-02-05 09:53:25 +00:00
pTargetFmt - > ResetAllFmtAttr ( ) ;
2001-10-24 14:51:20 +00:00
if ( USHRT_MAX ! = nPgDscPos )
2012-06-21 13:40:06 +02:00
m_pDoc - > ChgPageDesc ( nPgDscPos , m_pDoc - > GetPageDesc ( nPgDscPos ) ) ;
2001-10-24 14:51:20 +00:00
}
}
else
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2001-10-24 14:51:20 +00:00
}
2001-11-06 17:52:15 +00:00
else if ( bIsDescriptor )
pPropImpl - > ClearAllProperties ( ) ;
2001-10-24 14:51:20 +00:00
else
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2001-10-24 14:51:20 +00:00
}
2007-06-05 16:36:55 +00:00
uno : : Sequence < uno : : Any > SAL_CALL SwXStyle : : getPropertyDefaults ( const uno : : Sequence < OUString > & aPropertyNames )
throw ( beans : : UnknownPropertyException , lang : : WrappedTargetException , uno : : RuntimeException )
2001-10-24 14:51:20 +00:00
{
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2001-10-24 14:51:20 +00:00
sal_Int32 nCount = aPropertyNames . getLength ( ) ;
2007-06-05 16:36:55 +00:00
uno : : Sequence < uno : : Any > aRet ( nCount ) ;
2001-10-24 14:51:20 +00:00
if ( nCount )
{
if ( pBasePool )
{
pBasePool - > SetSearchMask ( eFamily ) ;
SfxStyleSheetBase * pBase = pBasePool - > Find ( sStyleName ) ;
2011-05-08 22:14:45 +02:00
OSL_ENSURE ( pBase , " Doesn't seem to be a style! " ) ;
2001-10-24 14:51:20 +00:00
if ( pBase )
{
2008-03-12 11:35:18 +00:00
rtl : : Reference < SwDocStyleSheet > xStyle ( new SwDocStyleSheet ( * ( SwDocStyleSheet * ) pBase ) ) ;
2009-06-03 11:26:39 +00:00
sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_STYLE ;
2000-09-18 23:08:29 +00:00
switch ( eFamily )
{
2009-06-03 11:26:39 +00:00
case SFX_STYLE_FAMILY_PARA : nPropSetId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE ; break ;
case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_MAP_FRAME_STYLE ; break ;
case SFX_STYLE_FAMILY_PAGE : nPropSetId = PROPERTY_MAP_PAGE_STYLE ; break ;
case SFX_STYLE_FAMILY_PSEUDO : nPropSetId = PROPERTY_MAP_NUM_STYLE ; break ;
2007-09-27 08:40:48 +00:00
default :
;
2000-09-18 23:08:29 +00:00
}
2009-06-03 11:26:39 +00:00
const SfxItemPropertySet * pPropSet = aSwMapProvider . GetPropertySet ( nPropSetId ) ;
2012-01-05 21:30:06 +00:00
const SfxItemPropertyMap & rMap = pPropSet - > getPropertyMap ( ) ;
2000-09-18 23:08:29 +00:00
2008-03-12 11:35:18 +00:00
const SfxItemSet & rSet = xStyle - > GetItemSet ( ) , * pParentSet = rSet . GetParent ( ) ;
2001-10-24 14:51:20 +00:00
const OUString * pNames = aPropertyNames . getConstArray ( ) ;
2007-06-05 16:36:55 +00:00
uno : : Any * pRet = aRet . getArray ( ) ;
2001-10-24 14:51:20 +00:00
for ( sal_Int32 i = 0 ; i < nCount ; i + + )
2000-09-18 23:08:29 +00:00
{
2012-01-05 21:30:06 +00:00
const SfxItemPropertySimpleEntry * pEntry = rMap . getByName ( pNames [ i ] ) ;
2009-06-03 11:26:39 +00:00
if ( ! pEntry )
2007-06-05 16:36:55 +00:00
throw beans : : UnknownPropertyException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " Unknown property: " ) ) + pNames [ i ] , static_cast < cppu : : OWeakObject * > ( this ) ) ;
2001-10-24 14:51:20 +00:00
2012-12-03 23:18:55 +01:00
if ( pEntry - > nWID > = RES_UNKNOWNATR_END )
{
// these cannot be in an item set, especially not the
// parent set, so the default value is void
continue ;
}
2001-10-24 14:51:20 +00:00
if ( pParentSet )
2009-06-03 11:26:39 +00:00
aSwMapProvider . GetPropertySet ( nPropSetId ) - > getPropertyValue ( pNames [ i ] , * pParentSet , pRet [ i ] ) ;
else if ( pEntry - > nWID ! = rSet . GetPool ( ) - > GetSlotId ( pEntry - > nWID ) )
2001-10-24 14:51:20 +00:00
{
2009-06-03 11:26:39 +00:00
const SfxPoolItem & rItem = rSet . GetPool ( ) - > GetDefaultItem ( pEntry - > nWID ) ;
rItem . QueryValue ( pRet [ i ] , pEntry - > nMemberId ) ;
2001-10-24 14:51:20 +00:00
}
2000-09-18 23:08:29 +00:00
}
}
2001-10-24 14:51:20 +00:00
else
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2000-09-18 23:08:29 +00:00
}
else
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2000-09-18 23:08:29 +00:00
}
return aRet ;
}
2001-10-24 14:51:20 +00:00
2007-06-05 16:36:55 +00:00
uno : : Any SwXStyle : : getPropertyDefault ( const OUString & rPropertyName )
throw ( beans : : UnknownPropertyException , lang : : WrappedTargetException , uno : : RuntimeException )
2001-10-24 14:51:20 +00:00
{
2007-06-05 16:36:55 +00:00
const uno : : Sequence < OUString > aSequence ( & rPropertyName , 1 ) ;
2001-10-24 14:51:20 +00:00
return getPropertyDefaults ( aSequence ) . getConstArray ( ) [ 0 ] ;
}
2010-10-13 16:04:59 +05:30
2000-09-18 23:08:29 +00:00
void SwXStyle : : Notify ( SfxBroadcaster & rBC , const SfxHint & rHint )
{
SfxSimpleHint * pHint = PTR_CAST ( SfxSimpleHint , & rHint ) ;
if ( pHint )
{
if ( ( pHint - > GetId ( ) & SFX_HINT_DYING ) | | ( pHint - > GetId ( ) & SFX_STYLESHEET_ERASED ) )
{
pBasePool = 0 ;
EndListening ( rBC ) ;
}
else if ( pHint - > GetId ( ) & ( SFX_STYLESHEET_CHANGED | SFX_STYLESHEET_ERASED ) )
{
2008-03-12 11:35:18 +00:00
( ( SfxStyleSheetBasePool & ) rBC ) . SetSearchMask ( eFamily ) ;
SfxStyleSheetBase * pOwnBase = ( ( SfxStyleSheetBasePool & ) rBC ) . Find ( sStyleName ) ;
2000-09-18 23:08:29 +00:00
if ( ! pOwnBase )
{
EndListening ( rBC ) ;
Invalidate ( ) ;
}
}
}
}
void SwXStyle : : Invalidate ( )
{
sStyleName . Erase ( ) ;
pBasePool = 0 ;
m_pDoc = 0 ;
2001-10-17 11:27:45 +00:00
mxStyleData . clear ( ) ;
mxStyleFamily . clear ( ) ;
2000-09-18 23:08:29 +00:00
}
2001-10-24 14:51:20 +00:00
2000-09-18 23:08:29 +00:00
/******************************************************************
* SwXPageStyle
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
SwXPageStyle : : SwXPageStyle ( SfxStyleSheetBasePool & rPool ,
SwDocShell * pDocSh , SfxStyleFamily eFam ,
2011-02-05 15:56:54 +01:00
const String & rStyleName ) :
2012-09-11 11:25:20 +02:00
SwXStyle ( rPool , eFam , pDocSh - > GetDoc ( ) , rStyleName )
2000-09-18 23:08:29 +00:00
{
}
SwXPageStyle : : SwXPageStyle ( SwDocShell * pDocSh ) :
2012-09-11 11:25:20 +02:00
SwXStyle ( pDocSh - > GetDoc ( ) , SFX_STYLE_FAMILY_PAGE )
2000-09-18 23:08:29 +00:00
{
}
SwXPageStyle : : ~ SwXPageStyle ( )
{
}
2012-10-12 16:49:40 +02:00
static void lcl_putItemToSet ( const SvxSetItem * pSetItem , sal_uInt16 nRes , sal_uInt16 nItemType , const uno : : Any & rVal , sal_uInt8 nMemberId , SwStyleBase_Impl & rBaseImpl )
2012-10-02 12:47:08 +02:00
{
SvxSetItem * pNewSetItem = ( SvxSetItem * ) pSetItem - > Clone ( ) ;
SfxItemSet & rSetSet = pNewSetItem - > GetItemSet ( ) ;
const SfxPoolItem * pItem = 0 ;
SfxPoolItem * pNewItem = 0 ;
rSetSet . GetItemState ( nRes , sal_True , & pItem ) ;
if ( ! pItem & & nRes ! = rSetSet . GetPool ( ) - > GetSlotId ( nRes ) )
pItem = & rSetSet . GetPool ( ) - > GetDefaultItem ( nRes ) ;
if ( pItem )
{
pNewItem = pItem - > Clone ( ) ;
}
else
{
switch ( nItemType )
{
case TYPE_BOOL : pNewItem = new SfxBoolItem ( nRes ) ; break ;
case TYPE_SIZE : pNewItem = new SvxSizeItem ( nRes ) ; break ;
case TYPE_BRUSH : pNewItem = new SvxBrushItem ( nRes ) ; break ;
case TYPE_ULSPACE : pNewItem = new SvxULSpaceItem ( nRes ) ; break ;
case TYPE_SHADOW : pNewItem = new SvxShadowItem ( nRes ) ; break ;
case TYPE_LRSPACE : pNewItem = new SvxLRSpaceItem ( nRes ) ; break ;
case TYPE_BOX : pNewItem = new SvxBoxItem ( nRes ) ; break ;
}
}
pNewItem - > PutValue ( rVal , nMemberId ) ;
rSetSet . Put ( * pNewItem ) ;
rBaseImpl . GetItemSet ( ) . Put ( * pNewSetItem ) ;
delete pNewItem ;
delete pNewSetItem ;
}
2003-11-07 14:13:39 +00:00
void SAL_CALL SwXPageStyle : : SetPropertyValues_Impl (
const uno : : Sequence < OUString > & rPropertyNames ,
2007-06-05 16:36:55 +00:00
const uno : : Sequence < uno : : Any > & rValues )
throw ( beans : : UnknownPropertyException , beans : : PropertyVetoException , lang : : IllegalArgumentException ,
lang : : WrappedTargetException , uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2001-04-25 10:55:37 +00:00
if ( ! GetDoc ( ) )
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2001-04-19 09:40:06 +00:00
if ( rPropertyNames . getLength ( ) ! = rValues . getLength ( ) )
2007-06-05 16:36:55 +00:00
throw lang : : IllegalArgumentException ( ) ;
2001-04-19 09:40:06 +00:00
const OUString * pNames = rPropertyNames . getConstArray ( ) ;
2007-06-05 16:36:55 +00:00
const uno : : Any * pValues = rValues . getConstArray ( ) ;
2009-06-03 11:26:39 +00:00
const SfxItemPropertySet * pPropSet = aSwMapProvider . GetPropertySet ( PROPERTY_MAP_PAGE_STYLE ) ;
2012-01-05 21:30:06 +00:00
const SfxItemPropertyMap & rMap = pPropSet - > getPropertyMap ( ) ;
2001-04-25 10:55:37 +00:00
SwStyleBase_Impl aBaseImpl ( * GetDoc ( ) , GetStyleName ( ) ) ;
2000-09-18 23:08:29 +00:00
if ( GetBasePool ( ) )
{
2001-10-29 14:16:14 +00:00
sal_uInt16 nSaveMask = GetBasePool ( ) - > GetSearchMask ( ) ;
2001-04-19 09:40:06 +00:00
GetBasePool ( ) - > SetSearchMask ( GetFamily ( ) ) ;
SfxStyleSheetBase * pBase = GetBasePool ( ) - > Find ( GetStyleName ( ) ) ;
GetBasePool ( ) - > SetSearchMask ( GetFamily ( ) , nSaveMask ) ;
2011-05-08 22:14:45 +02:00
OSL_ENSURE ( pBase , " where is the style? " ) ;
2001-04-19 09:40:06 +00:00
if ( pBase )
2008-03-12 11:35:18 +00:00
aBaseImpl . mxNewBase = new SwDocStyleSheet ( * ( SwDocStyleSheet * ) pBase ) ;
2001-04-19 09:40:06 +00:00
else
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2001-04-19 09:40:06 +00:00
}
2001-11-28 19:36:01 +00:00
for ( sal_Int16 nProp = 0 ; nProp < rPropertyNames . getLength ( ) ; nProp + + )
2001-04-19 09:40:06 +00:00
{
2012-01-05 21:30:06 +00:00
const SfxItemPropertySimpleEntry * pEntry = rMap . getByName ( pNames [ nProp ] ) ;
2009-06-03 11:26:39 +00:00
if ( ! pEntry )
2007-06-05 16:36:55 +00:00
throw beans : : UnknownPropertyException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " Unknown property: " ) ) + pNames [ nProp ] , static_cast < cppu : : OWeakObject * > ( this ) ) ;
2009-06-03 11:26:39 +00:00
if ( pEntry - > nFlags & beans : : PropertyAttribute : : READONLY )
2007-06-05 16:36:55 +00:00
throw beans : : PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " Property is read-only: " ) ) + pNames [ nProp ] , static_cast < cppu : : OWeakObject * > ( this ) ) ;
2001-11-28 19:36:01 +00:00
2001-04-19 09:40:06 +00:00
if ( GetBasePool ( ) )
2000-09-18 23:08:29 +00:00
{
2009-06-03 11:26:39 +00:00
switch ( pEntry - > nWID )
2000-09-18 23:08:29 +00:00
{
2001-04-19 09:40:06 +00:00
case FN_UNO_HEADER_ON :
case FN_UNO_HEADER_BACKGROUND :
case FN_UNO_HEADER_BOX :
case FN_UNO_HEADER_LR_SPACE :
case FN_UNO_HEADER_SHADOW :
case FN_UNO_HEADER_BODY_DISTANCE :
case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE :
case FN_UNO_HEADER_SHARE_CONTENT :
case FN_UNO_HEADER_HEIGHT :
2002-08-30 11:03:12 +00:00
case FN_UNO_HEADER_EAT_SPACING :
2012-07-09 09:45:04 +02:00
case FN_UNO_FIRST_SHARE_CONTENT :
2001-04-19 09:40:06 +00:00
case FN_UNO_FOOTER_ON :
case FN_UNO_FOOTER_BACKGROUND :
case FN_UNO_FOOTER_BOX :
case FN_UNO_FOOTER_LR_SPACE :
case FN_UNO_FOOTER_SHADOW :
case FN_UNO_FOOTER_BODY_DISTANCE :
case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE :
case FN_UNO_FOOTER_SHARE_CONTENT :
case FN_UNO_FOOTER_HEIGHT :
2002-08-30 11:03:12 +00:00
case FN_UNO_FOOTER_EAT_SPACING :
2000-09-18 23:08:29 +00:00
{
2012-12-17 18:12:09 +09:00
bool bFooter = false ;
2001-04-27 11:03:25 +00:00
sal_uInt16 nItemType = TYPE_BOOL ;
sal_uInt16 nRes = 0 ;
2009-06-03 11:26:39 +00:00
switch ( pEntry - > nWID )
2000-09-18 23:08:29 +00:00
{
2012-12-17 18:12:09 +09:00
case FN_UNO_FOOTER_ON : bFooter = true ;
2001-04-27 11:03:25 +00:00
//kein break;
case FN_UNO_HEADER_ON : nRes = SID_ATTR_PAGE_ON ;
break ;
2012-12-17 18:12:09 +09:00
case FN_UNO_FOOTER_BACKGROUND : bFooter = true ;
2001-04-27 11:03:25 +00:00
// kein break;
case FN_UNO_HEADER_BACKGROUND : nRes = RES_BACKGROUND ; nItemType = TYPE_BRUSH ;
break ;
2012-12-17 18:12:09 +09:00
case FN_UNO_FOOTER_BOX : bFooter = true ;
2001-04-27 11:03:25 +00:00
// kein break;
case FN_UNO_HEADER_BOX : nRes = RES_BOX ; nItemType = TYPE_BOX ;
break ;
2012-12-17 18:12:09 +09:00
case FN_UNO_FOOTER_LR_SPACE : bFooter = true ;
2001-04-27 11:03:25 +00:00
// kein break;
case FN_UNO_HEADER_LR_SPACE : nRes = RES_LR_SPACE ; nItemType = TYPE_LRSPACE ;
break ;
2012-12-17 18:12:09 +09:00
case FN_UNO_FOOTER_SHADOW : bFooter = true ;
2001-04-27 11:03:25 +00:00
// kein break;
case FN_UNO_HEADER_SHADOW : nRes = RES_SHADOW ; nItemType = TYPE_SHADOW ;
break ;
2012-12-17 18:12:09 +09:00
case FN_UNO_FOOTER_BODY_DISTANCE : bFooter = true ;
2001-04-27 11:03:25 +00:00
// kein break;
case FN_UNO_HEADER_BODY_DISTANCE : nRes = RES_UL_SPACE ; nItemType = TYPE_ULSPACE ;
break ;
2012-12-17 18:12:09 +09:00
case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE : bFooter = true ;
2001-04-27 11:03:25 +00:00
// kein break;
case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE : nRes = SID_ATTR_PAGE_DYNAMIC ;
break ;
2012-12-17 18:12:09 +09:00
case FN_UNO_FOOTER_SHARE_CONTENT : bFooter = true ;
2001-04-27 11:03:25 +00:00
// kein break;
case FN_UNO_HEADER_SHARE_CONTENT : nRes = SID_ATTR_PAGE_SHARED ;
break ;
2012-07-09 09:45:04 +02:00
case FN_UNO_FIRST_SHARE_CONTENT : nRes = SID_ATTR_PAGE_SHARED_FIRST ;
2012-06-29 11:26:13 +02:00
break ;
2012-12-17 18:12:09 +09:00
case FN_UNO_FOOTER_HEIGHT : bFooter = true ;
2001-04-27 11:03:25 +00:00
// kein break;
case FN_UNO_HEADER_HEIGHT : nRes = SID_ATTR_PAGE_SIZE ; nItemType = TYPE_SIZE ;
break ;
2012-12-17 18:12:09 +09:00
case FN_UNO_FOOTER_EAT_SPACING : bFooter = true ;
2002-08-30 11:03:12 +00:00
// kein break;
case FN_UNO_HEADER_EAT_SPACING : nRes = RES_HEADER_FOOTER_EAT_SPACING ; nItemType = TYPE_SIZE ;
break ;
2001-04-27 11:03:25 +00:00
}
const SvxSetItem * pSetItem ;
if ( SFX_ITEM_SET = = aBaseImpl . GetItemSet ( ) . GetItemState (
bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET ,
sal_False , ( const SfxPoolItem * * ) & pSetItem ) )
{
2012-10-02 12:47:08 +02:00
lcl_putItemToSet ( pSetItem , nRes , nItemType , pValues [ nProp ] , pEntry - > nMemberId , aBaseImpl ) ;
if ( nRes = = SID_ATTR_PAGE_SHARED_FIRST )
2000-09-18 23:08:29 +00:00
{
2012-10-02 12:47:08 +02:00
// Need to add this to the other as well
if ( SFX_ITEM_SET = = aBaseImpl . GetItemSet ( ) . GetItemState (
bFooter ? SID_ATTR_PAGE_HEADERSET : SID_ATTR_PAGE_FOOTERSET ,
sal_False , ( const SfxPoolItem * * ) & pSetItem ) )
lcl_putItemToSet ( pSetItem , nRes , nItemType , pValues [ nProp ] , pEntry - > nMemberId , aBaseImpl ) ;
2000-09-18 23:08:29 +00:00
}
2001-04-27 11:03:25 +00:00
}
else if ( SID_ATTR_PAGE_ON = = nRes )
{
sal_Bool bVal = * ( sal_Bool * ) pValues [ nProp ] . getValue ( ) ;
if ( bVal )
2000-09-18 23:08:29 +00:00
{
2001-04-27 11:03:25 +00:00
SfxItemSet aTempSet ( * aBaseImpl . GetItemSet ( ) . GetPool ( ) ,
RES_BACKGROUND , RES_SHADOW ,
RES_LR_SPACE , RES_UL_SPACE ,
nRes , nRes ,
SID_ATTR_PAGE_SIZE , SID_ATTR_PAGE_SIZE ,
SID_ATTR_PAGE_DYNAMIC , SID_ATTR_PAGE_DYNAMIC ,
SID_ATTR_PAGE_SHARED , SID_ATTR_PAGE_SHARED ,
2012-06-29 11:26:13 +02:00
SID_ATTR_PAGE_SHARED_FIRST , SID_ATTR_PAGE_SHARED_FIRST ,
2001-04-27 11:03:25 +00:00
0 ) ;
aTempSet . Put ( SfxBoolItem ( nRes , sal_True ) ) ;
aTempSet . Put ( SvxSizeItem ( SID_ATTR_PAGE_SIZE , Size ( MM50 , MM50 ) ) ) ;
aTempSet . Put ( SvxLRSpaceItem ( RES_LR_SPACE ) ) ;
aTempSet . Put ( SvxULSpaceItem ( RES_UL_SPACE ) ) ;
aTempSet . Put ( SfxBoolItem ( SID_ATTR_PAGE_SHARED , sal_True ) ) ;
2012-06-29 11:26:13 +02:00
aTempSet . Put ( SfxBoolItem ( SID_ATTR_PAGE_SHARED_FIRST , sal_True ) ) ;
2001-04-27 11:03:25 +00:00
aTempSet . Put ( SfxBoolItem ( SID_ATTR_PAGE_DYNAMIC , sal_True ) ) ;
SvxSetItem aNewSetItem ( bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET ,
aTempSet ) ;
aBaseImpl . GetItemSet ( ) . Put ( aNewSetItem ) ;
2000-09-18 23:08:29 +00:00
}
}
}
2001-04-19 09:40:06 +00:00
break ;
case FN_PARAM_FTN_INFO :
2001-02-13 07:02:30 +00:00
{
2001-04-27 11:03:25 +00:00
const SfxPoolItem & rItem = aBaseImpl . GetItemSet ( ) . Get ( FN_PARAM_FTN_INFO ) ;
SfxPoolItem * pNewFtnItem = rItem . Clone ( ) ;
2009-06-03 11:26:39 +00:00
sal_Bool bPut = pNewFtnItem - > PutValue ( pValues [ nProp ] , pEntry - > nMemberId ) ;
2001-04-27 11:03:25 +00:00
aBaseImpl . GetItemSet ( ) . Put ( * pNewFtnItem ) ;
delete pNewFtnItem ;
if ( ! bPut )
2007-06-05 16:36:55 +00:00
throw lang : : IllegalArgumentException ( ) ;
2001-02-13 07:02:30 +00:00
}
2001-04-19 09:40:06 +00:00
break ;
2007-09-27 08:40:48 +00:00
case FN_UNO_HEADER :
case FN_UNO_HEADER_LEFT :
case FN_UNO_HEADER_RIGHT :
2012-07-02 15:14:07 +02:00
case FN_UNO_HEADER_FIRST :
2007-09-27 08:40:48 +00:00
case FN_UNO_FOOTER :
case FN_UNO_FOOTER_LEFT :
case FN_UNO_FOOTER_RIGHT :
2012-07-02 15:14:07 +02:00
case FN_UNO_FOOTER_FIRST :
2007-09-27 08:40:48 +00:00
throw lang : : IllegalArgumentException ( ) ;
//break;
2001-04-19 09:40:06 +00:00
default :
2009-06-03 11:26:39 +00:00
lcl_SetStyleProperty ( * pEntry , * pPropSet , pValues [ nProp ] , aBaseImpl ,
2001-04-19 09:40:06 +00:00
GetBasePool ( ) , GetDoc ( ) , GetFamily ( ) ) ;
2001-02-13 07:02:30 +00:00
}
2000-09-18 23:08:29 +00:00
}
2001-04-19 09:40:06 +00:00
else if ( IsDescriptor ( ) )
{
if ( ! GetPropImpl ( ) - > SetProperty ( pNames [ nProp ] , pValues [ nProp ] ) )
throw lang : : IllegalArgumentException ( ) ;
}
else
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2000-09-18 23:08:29 +00:00
}
2001-04-19 09:40:06 +00:00
if ( aBaseImpl . HasItemSet ( ) )
2006-04-28 14:00:25 +00:00
{
2010-11-25 14:31:09 +01:00
: : sw : : UndoGuard const undoGuard ( GetDoc ( ) - > GetIDocumentUndoRedo ( ) ) ;
if ( undoGuard . UndoWasEnabled ( ) )
2006-04-28 14:00:25 +00:00
{
// Fix i64460: as long as Undo of page styles with header/footer causes trouble...
2010-11-25 14:31:08 +01:00
GetDoc ( ) - > GetIDocumentUndoRedo ( ) . DelAllUndoObj ( ) ;
2006-04-28 14:00:25 +00:00
}
2008-03-12 11:35:18 +00:00
aBaseImpl . mxNewBase - > SetItemSet ( aBaseImpl . GetItemSet ( ) ) ;
2006-04-28 14:00:25 +00:00
}
2000-09-18 23:08:29 +00:00
}
2003-11-07 14:13:39 +00:00
void SwXPageStyle : : setPropertyValues (
2007-06-05 16:36:55 +00:00
const uno : : Sequence < OUString > & rPropertyNames ,
const uno : : Sequence < uno : : Any > & rValues )
throw ( beans : : PropertyVetoException , lang : : IllegalArgumentException , lang : : WrappedTargetException , uno : : RuntimeException )
2000-09-18 23:08:29 +00:00
{
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2003-11-07 14:13:39 +00:00
// workaround for bad designed API
try
{
SetPropertyValues_Impl ( rPropertyNames , rValues ) ;
}
2012-01-07 15:50:41 +09:00
catch ( const beans : : UnknownPropertyException & rException )
2003-11-07 14:13:39 +00:00
{
// wrap the original (here not allowed) exception in
2007-06-05 16:36:55 +00:00
// a lang::WrappedTargetException that gets thrown instead.
lang : : WrappedTargetException aWExc ;
2003-11-07 14:13:39 +00:00
aWExc . TargetException < < = rException ;
throw aWExc ;
}
}
2010-01-08 17:13:57 +01:00
static uno : : Reference < text : : XText >
lcl_makeHeaderFooter (
const sal_uInt16 nRes , const bool bHeader , SwFrmFmt const * const pFrmFmt )
{
if ( ! pFrmFmt ) { return 0 ; }
const SfxItemSet & rSet = pFrmFmt - > GetAttrSet ( ) ;
const SfxPoolItem * pItem ;
if ( SFX_ITEM_SET = = rSet . GetItemState ( nRes , sal_True , & pItem ) )
{
SwFrmFmt * const pHeadFootFmt = ( bHeader )
? static_cast < SwFmtHeader * > ( const_cast < SfxPoolItem * > ( pItem ) ) - >
GetHeaderFmt ( )
: static_cast < SwFmtFooter * > ( const_cast < SfxPoolItem * > ( pItem ) ) - >
GetFooterFmt ( ) ;
if ( pHeadFootFmt )
{
return SwXHeadFootText : : CreateXHeadFootText ( * pHeadFootFmt , bHeader ) ;
}
}
return 0 ;
}
2007-06-05 16:36:55 +00:00
uno : : Sequence < uno : : Any > SAL_CALL SwXPageStyle : : GetPropertyValues_Impl (
2003-11-07 14:13:39 +00:00
const uno : : Sequence < OUString > & rPropertyNames )
2007-06-05 16:36:55 +00:00
throw ( beans : : UnknownPropertyException , lang : : WrappedTargetException , uno : : RuntimeException )
2003-11-07 14:13:39 +00:00
{
2001-04-25 10:55:37 +00:00
if ( ! GetDoc ( ) )
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2001-04-25 10:55:37 +00:00
2001-09-03 13:58:49 +00:00
sal_Int32 nLength = rPropertyNames . getLength ( ) ;
2001-04-19 09:40:06 +00:00
const OUString * pNames = rPropertyNames . getConstArray ( ) ;
2007-06-05 16:36:55 +00:00
uno : : Sequence < uno : : Any > aRet ( nLength ) ;
2001-09-03 13:58:49 +00:00
2007-06-05 16:36:55 +00:00
uno : : Any * pRet = aRet . getArray ( ) ;
2009-06-03 11:26:39 +00:00
const SfxItemPropertySet * pPropSet = aSwMapProvider . GetPropertySet ( PROPERTY_MAP_PAGE_STYLE ) ;
2012-01-05 21:30:06 +00:00
const SfxItemPropertyMap & rMap = pPropSet - > getPropertyMap ( ) ;
2001-04-25 10:55:37 +00:00
SwStyleBase_Impl aBase ( * GetDoc ( ) , GetStyleName ( ) ) ;
2001-04-19 09:40:06 +00:00
SfxStyleSheetBase * pBase = 0 ;
2001-09-03 13:58:49 +00:00
for ( sal_Int32 nProp = 0 ; nProp < nLength ; nProp + + )
2000-09-18 23:08:29 +00:00
{
2012-01-05 21:30:06 +00:00
const SfxItemPropertySimpleEntry * pEntry = rMap . getByName ( pNames [ nProp ] ) ;
2009-06-03 11:26:39 +00:00
if ( ! pEntry )
2007-06-05 16:36:55 +00:00
throw beans : : UnknownPropertyException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " Unknown property: " ) ) + pNames [ nProp ] , static_cast < cppu : : OWeakObject * > ( this ) ) ;
2001-04-19 09:40:06 +00:00
if ( GetBasePool ( ) )
2000-09-18 23:08:29 +00:00
{
2001-04-19 09:40:06 +00:00
if ( ! pBase )
2000-09-18 23:08:29 +00:00
{
2001-10-29 14:16:14 +00:00
sal_uInt16 nSaveMask = GetBasePool ( ) - > GetSearchMask ( ) ;
2001-04-19 09:40:06 +00:00
GetBasePool ( ) - > SetSearchMask ( GetFamily ( ) , SFXSTYLEBIT_ALL ) ;
pBase = GetBasePool ( ) - > Find ( GetStyleName ( ) ) ;
GetBasePool ( ) - > SetSearchMask ( GetFamily ( ) , nSaveMask ) ;
}
2007-09-27 08:40:48 +00:00
sal_uInt16 nRes = 0 ;
2010-01-08 17:13:57 +01:00
bool bHeader = false ;
2012-12-17 18:12:09 +09:00
bool bLeft = false ;
2012-07-02 15:14:07 +02:00
bool bFirst = false ;
2009-06-03 11:26:39 +00:00
switch ( pEntry - > nWID )
2001-04-19 09:40:06 +00:00
{
case FN_UNO_HEADER_ON :
case FN_UNO_HEADER_BACKGROUND :
case FN_UNO_HEADER_BOX :
case FN_UNO_HEADER_LR_SPACE :
case FN_UNO_HEADER_SHADOW :
case FN_UNO_HEADER_BODY_DISTANCE :
case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE :
case FN_UNO_HEADER_SHARE_CONTENT :
case FN_UNO_HEADER_HEIGHT :
2002-08-30 11:03:12 +00:00
case FN_UNO_HEADER_EAT_SPACING :
2001-04-19 09:40:06 +00:00
2012-07-09 09:45:04 +02:00
case FN_UNO_FIRST_SHARE_CONTENT :
2001-04-19 09:40:06 +00:00
case FN_UNO_FOOTER_ON :
case FN_UNO_FOOTER_BACKGROUND :
case FN_UNO_FOOTER_BOX :
case FN_UNO_FOOTER_LR_SPACE :
case FN_UNO_FOOTER_SHADOW :
case FN_UNO_FOOTER_BODY_DISTANCE :
case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE :
case FN_UNO_FOOTER_SHARE_CONTENT :
case FN_UNO_FOOTER_HEIGHT :
2002-08-30 11:03:12 +00:00
case FN_UNO_FOOTER_EAT_SPACING :
2000-09-18 23:08:29 +00:00
{
2007-09-27 08:40:48 +00:00
SfxStyleSheetBasePool * pBasePool2 = ( ( SwXPageStyle * ) this ) - > GetBasePool ( ) ;
pBasePool2 - > SetSearchMask ( GetFamily ( ) ) ;
SfxStyleSheetBase * pBase2 = pBasePool2 - > Find ( GetStyleName ( ) ) ;
if ( pBase2 )
2000-09-18 23:08:29 +00:00
{
2008-03-12 11:35:18 +00:00
rtl : : Reference < SwDocStyleSheet > xStyle ( new SwDocStyleSheet ( * ( SwDocStyleSheet * ) pBase ) ) ;
const SfxItemSet & rSet = xStyle - > GetItemSet ( ) ;
2012-12-17 18:12:09 +09:00
bool bFooter = false ;
2009-06-03 11:26:39 +00:00
switch ( pEntry - > nWID )
2000-09-18 23:08:29 +00:00
{
2001-04-19 09:40:06 +00:00
case FN_UNO_FOOTER_ON :
2012-12-17 18:12:09 +09:00
bFooter = true ;
2001-04-19 09:40:06 +00:00
// kein break!
case FN_UNO_HEADER_ON :
2000-09-18 23:08:29 +00:00
{
2001-04-19 09:40:06 +00:00
//falls das SetItem nicht da ist, dann ist der Wert sal_False
2011-01-17 15:06:54 +01:00
sal_Bool bRet = sal_False ;
2001-04-19 09:40:06 +00:00
pRet [ nProp ] . setValue ( & bRet , : : getCppuBooleanType ( ) ) ;
nRes = SID_ATTR_PAGE_ON ;
2000-09-18 23:08:29 +00:00
}
2001-04-19 09:40:06 +00:00
break ;
2012-12-17 18:12:09 +09:00
case FN_UNO_FOOTER_BACKGROUND : bFooter = true ;
2001-04-19 09:40:06 +00:00
// kein break;
case FN_UNO_HEADER_BACKGROUND : nRes = RES_BACKGROUND ;
break ;
2012-12-17 18:12:09 +09:00
case FN_UNO_FOOTER_BOX : bFooter = true ;
2001-04-19 09:40:06 +00:00
// kein break;
case FN_UNO_HEADER_BOX : nRes = RES_BOX ;
break ;
2012-12-17 18:12:09 +09:00
case FN_UNO_FOOTER_LR_SPACE : bFooter = true ;
2001-04-19 09:40:06 +00:00
// kein break;
case FN_UNO_HEADER_LR_SPACE : nRes = RES_LR_SPACE ;
break ;
2012-12-17 18:12:09 +09:00
case FN_UNO_FOOTER_SHADOW : bFooter = true ;
2001-04-19 09:40:06 +00:00
// kein break;
case FN_UNO_HEADER_SHADOW : nRes = RES_SHADOW ;
break ;
2012-12-17 18:12:09 +09:00
case FN_UNO_FOOTER_BODY_DISTANCE : bFooter = true ;
2001-04-19 09:40:06 +00:00
// kein break;
case FN_UNO_HEADER_BODY_DISTANCE : nRes = RES_UL_SPACE ;
break ;
2012-12-17 18:12:09 +09:00
case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE : bFooter = true ;
2001-04-19 09:40:06 +00:00
// kein break;
case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE : nRes = SID_ATTR_PAGE_DYNAMIC ;
break ;
2012-12-17 18:12:09 +09:00
case FN_UNO_FOOTER_SHARE_CONTENT : bFooter = true ;
2001-04-19 09:40:06 +00:00
// kein break;
case FN_UNO_HEADER_SHARE_CONTENT : nRes = SID_ATTR_PAGE_SHARED ;
break ;
2012-07-09 09:45:04 +02:00
case FN_UNO_FIRST_SHARE_CONTENT : nRes = SID_ATTR_PAGE_SHARED_FIRST ;
2012-06-29 11:26:13 +02:00
break ;
2012-12-17 18:12:09 +09:00
case FN_UNO_FOOTER_HEIGHT : bFooter = true ;
2001-04-19 09:40:06 +00:00
// kein break;
case FN_UNO_HEADER_HEIGHT : nRes = SID_ATTR_PAGE_SIZE ;
break ;
2012-12-17 18:12:09 +09:00
case FN_UNO_FOOTER_EAT_SPACING : bFooter = true ;
2002-08-30 11:03:12 +00:00
// kein break;
case FN_UNO_HEADER_EAT_SPACING : nRes = RES_HEADER_FOOTER_EAT_SPACING ;
break ;
2000-09-18 23:08:29 +00:00
}
2001-04-19 09:40:06 +00:00
const SvxSetItem * pSetItem ;
if ( SFX_ITEM_SET = = rSet . GetItemState (
bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET ,
sal_False , ( const SfxPoolItem * * ) & pSetItem ) )
2000-09-18 23:08:29 +00:00
{
2007-09-27 08:40:48 +00:00
const SfxItemSet & rTmpSet = pSetItem - > GetItemSet ( ) ;
2001-04-19 09:40:06 +00:00
const SfxPoolItem * pItem = 0 ;
2007-09-27 08:40:48 +00:00
rTmpSet . GetItemState ( nRes , sal_True , & pItem ) ;
if ( ! pItem & & nRes ! = rTmpSet . GetPool ( ) - > GetSlotId ( nRes ) )
pItem = & rTmpSet . GetPool ( ) - > GetDefaultItem ( nRes ) ;
2001-04-19 09:40:06 +00:00
if ( pItem )
2009-06-03 11:26:39 +00:00
pItem - > QueryValue ( pRet [ nProp ] , pEntry - > nMemberId ) ;
2000-09-18 23:08:29 +00:00
}
}
}
2001-04-19 09:40:06 +00:00
break ;
case FN_UNO_HEADER :
2011-02-21 21:02:28 +00:00
goto Header ;
2001-04-19 09:40:06 +00:00
case FN_UNO_HEADER_LEFT :
2012-12-17 18:12:09 +09:00
bLeft = true ; goto Header ;
2012-07-02 15:14:07 +02:00
case FN_UNO_HEADER_FIRST :
bFirst = true ; goto Header ;
2001-04-19 09:40:06 +00:00
case FN_UNO_HEADER_RIGHT :
2011-02-21 21:02:28 +00:00
goto Header ;
2001-04-19 09:40:06 +00:00
Header :
2010-01-08 17:13:57 +01:00
bHeader = true ;
2001-04-19 09:40:06 +00:00
nRes = RES_HEADER ; goto MakeObject ;
case FN_UNO_FOOTER :
2011-02-21 21:02:28 +00:00
goto Footer ;
2001-04-19 09:40:06 +00:00
case FN_UNO_FOOTER_LEFT :
2012-12-17 18:12:09 +09:00
bLeft = true ; goto Footer ;
2012-07-02 15:14:07 +02:00
case FN_UNO_FOOTER_FIRST :
2012-12-17 18:12:09 +09:00
bFirst = true ; goto Footer ;
2001-04-19 09:40:06 +00:00
case FN_UNO_FOOTER_RIGHT :
Footer :
nRes = RES_FOOTER ;
MakeObject :
2001-02-13 07:02:30 +00:00
{
2001-04-25 10:55:37 +00:00
const SwPageDesc & rDesc = aBase . GetOldPageDesc ( ) ;
const SwFrmFmt * pFrmFmt = 0 ;
2012-12-17 18:12:09 +09:00
bool bShare = ( bHeader & & rDesc . IsHeaderShared ( ) ) | |
2010-11-04 13:05:15 +01:00
( ! bHeader & & rDesc . IsFooterShared ( ) ) ;
2012-07-09 09:45:04 +02:00
bool bShareFirst = rDesc . IsFirstShared ( ) ;
2001-04-25 10:55:37 +00:00
// TextLeft returns the left content if there is one,
// Text and TextRight return the master content.
// TextRight does the same as Text and is for
// comptability only.
if ( bLeft & & ! bShare )
2010-01-08 17:13:57 +01:00
{
2001-04-25 10:55:37 +00:00
pFrmFmt = & rDesc . GetLeft ( ) ;
2010-01-08 17:13:57 +01:00
}
2012-07-02 15:14:07 +02:00
else if ( bFirst & & ! bShareFirst )
{
pFrmFmt = & rDesc . GetFirst ( ) ;
}
2001-04-25 10:55:37 +00:00
else
2010-01-08 17:13:57 +01:00
{
2001-04-25 10:55:37 +00:00
pFrmFmt = & rDesc . GetMaster ( ) ;
2010-01-08 17:13:57 +01:00
}
const uno : : Reference < text : : XText > xRet =
lcl_makeHeaderFooter ( nRes , bHeader , pFrmFmt ) ;
if ( xRet . is ( ) )
2001-02-13 07:02:30 +00:00
{
2010-01-08 17:13:57 +01:00
pRet [ nProp ] < < = xRet ;
2001-04-19 09:40:06 +00:00
}
}
break ;
case FN_PARAM_FTN_INFO :
{
2008-03-12 11:35:18 +00:00
rtl : : Reference < SwDocStyleSheet > xStyle ( new SwDocStyleSheet ( * ( SwDocStyleSheet * ) pBase ) ) ;
const SfxItemSet & rSet = xStyle - > GetItemSet ( ) ;
2002-06-19 10:17:56 +00:00
const SfxPoolItem & rItem = rSet . Get ( FN_PARAM_FTN_INFO ) ;
2009-06-03 11:26:39 +00:00
rItem . QueryValue ( pRet [ nProp ] , pEntry - > nMemberId ) ;
2001-02-13 07:02:30 +00:00
}
2001-04-19 09:40:06 +00:00
break ;
default :
2009-06-03 11:26:39 +00:00
pRet [ nProp ] = lcl_GetStyleProperty ( * pEntry , * pPropSet , aBase , pBase , GetFamily ( ) , GetDoc ( ) ) ;
2001-02-13 07:02:30 +00:00
}
2000-09-18 23:08:29 +00:00
}
2001-04-19 09:40:06 +00:00
else if ( IsDescriptor ( ) )
{
2007-06-05 16:36:55 +00:00
uno : : Any * pAny = 0 ;
2001-10-17 11:27:45 +00:00
GetPropImpl ( ) - > GetProperty ( pNames [ nProp ] , pAny ) ;
if ( ! pAny )
GetPropImpl ( ) - > GetProperty ( pNames [ nProp ] , mxStyleData , pRet [ nProp ] ) ;
else
2001-04-19 09:40:06 +00:00
pRet [ nProp ] = * pAny ;
}
else
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2000-09-18 23:08:29 +00:00
}
2001-04-19 09:40:06 +00:00
return aRet ;
}
2003-11-07 14:13:39 +00:00
2007-06-05 16:36:55 +00:00
uno : : Sequence < uno : : Any > SwXPageStyle : : getPropertyValues (
const uno : : Sequence < OUString > & rPropertyNames )
throw ( uno : : RuntimeException )
2003-11-07 14:13:39 +00:00
{
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2007-06-05 16:36:55 +00:00
uno : : Sequence < uno : : Any > aValues ;
2003-11-07 14:13:39 +00:00
// workaround for bad designed API
try
{
aValues = GetPropertyValues_Impl ( rPropertyNames ) ;
}
2007-06-05 16:36:55 +00:00
catch ( beans : : UnknownPropertyException & )
2003-11-07 14:13:39 +00:00
{
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " Unknown property exception caught " ) ) , static_cast < cppu : : OWeakObject * > ( this ) ) ;
2003-11-07 14:13:39 +00:00
}
2007-06-05 16:36:55 +00:00
catch ( lang : : WrappedTargetException & )
2003-11-07 14:13:39 +00:00
{
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " WrappedTargetException caught " ) ) , static_cast < cppu : : OWeakObject * > ( this ) ) ;
2003-11-07 14:13:39 +00:00
}
return aValues ;
}
2001-04-19 09:40:06 +00:00
2007-06-05 16:36:55 +00:00
uno : : Any SwXPageStyle : : getPropertyValue ( const OUString & rPropertyName ) throw (
beans : : UnknownPropertyException , lang : : WrappedTargetException , uno : : RuntimeException )
2001-04-19 09:40:06 +00:00
{
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2007-06-05 16:36:55 +00:00
const uno : : Sequence < OUString > aProperties ( & rPropertyName , 1 ) ;
2003-11-07 14:13:39 +00:00
return GetPropertyValues_Impl ( aProperties ) . getConstArray ( ) [ 0 ] ;
2001-04-19 09:40:06 +00:00
}
2007-06-05 16:36:55 +00:00
void SwXPageStyle : : setPropertyValue ( const OUString & rPropertyName , const uno : : Any & rValue )
throw ( beans : : UnknownPropertyException ,
beans : : PropertyVetoException ,
2001-04-19 09:40:06 +00:00
lang : : IllegalArgumentException ,
2001-05-11 09:03:31 +00:00
lang : : WrappedTargetException ,
2007-06-05 16:36:55 +00:00
uno : : RuntimeException )
2001-04-19 09:40:06 +00:00
{
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2007-06-05 16:36:55 +00:00
const uno : : Sequence < OUString > aProperties ( & rPropertyName , 1 ) ;
const uno : : Sequence < uno : : Any > aValues ( & rValue , 1 ) ;
2003-11-07 14:13:39 +00:00
SetPropertyValues_Impl ( aProperties , aValues ) ;
2000-09-18 23:08:29 +00:00
}
2004-08-12 11:43:38 +00:00
2001-10-17 11:27:45 +00:00
SwXFrameStyle : : SwXFrameStyle ( SwDoc * pDoc )
2011-01-17 15:06:54 +01:00
: SwXStyle ( pDoc , SFX_STYLE_FAMILY_FRAME , sal_False )
2001-10-17 11:27:45 +00:00
{
}
2000-12-19 16:28:58 +00:00
SwXFrameStyle : : ~ SwXFrameStyle ( )
{
}
2007-06-05 16:36:55 +00:00
uno : : Sequence < uno : : Type > SwXFrameStyle : : getTypes ( ) throw ( uno : : RuntimeException )
2000-12-19 16:28:58 +00:00
{
2007-06-05 16:36:55 +00:00
uno : : Sequence < uno : : Type > aTypes = SwXStyle : : getTypes ( ) ;
2000-12-19 16:28:58 +00:00
sal_Int32 nLen = aTypes . getLength ( ) ;
aTypes . realloc ( nLen + 1 ) ;
2007-06-05 16:36:55 +00:00
aTypes . getArray ( ) [ nLen ] = : : getCppuType ( ( uno : : Reference < XEventsSupplier > * ) 0 ) ;
2000-12-19 16:28:58 +00:00
return aTypes ;
}
2007-06-05 16:36:55 +00:00
uno : : Any SwXFrameStyle : : queryInterface ( const uno : : Type & rType ) throw ( uno : : RuntimeException )
2000-12-19 16:28:58 +00:00
{
2007-06-05 16:36:55 +00:00
uno : : Any aRet ;
if ( rType = = : : getCppuType ( ( uno : : Reference < XEventsSupplier > * ) 0 ) )
aRet < < = uno : : Reference < XEventsSupplier > ( this ) ;
2000-12-19 16:28:58 +00:00
else
aRet = SwXStyle : : queryInterface ( rType ) ;
return aRet ;
}
2007-06-05 16:36:55 +00:00
uno : : Reference < container : : XNameReplace > SwXFrameStyle : : getEvents ( ) throw ( uno : : RuntimeException )
2000-12-19 16:28:58 +00:00
{
return new SwFrameStyleEventDescriptor ( * this ) ;
}
2006-12-01 14:52:41 +00:00
SwXAutoStyles : : SwXAutoStyles ( SwDocShell & rDocShell ) :
SwUnoCollection ( rDocShell . GetDoc ( ) ) , pDocShell ( & rDocShell )
{
}
SwXAutoStyles : : ~ SwXAutoStyles ( )
{
}
sal_Int32 SwXAutoStyles : : getCount ( void ) throw ( uno : : RuntimeException )
{
return AUTOSTYLE_FAMILY_COUNT ;
}
uno : : Any SwXAutoStyles : : getByIndex ( sal_Int32 nIndex )
throw ( lang : : IndexOutOfBoundsException , lang : : WrappedTargetException ,
uno : : RuntimeException )
{
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2007-06-05 16:36:55 +00:00
uno : : Any aRet ;
2006-12-01 14:52:41 +00:00
if ( nIndex < 0 | | nIndex > = AUTOSTYLE_FAMILY_COUNT )
throw lang : : IndexOutOfBoundsException ( ) ;
if ( IsValid ( ) )
{
2007-06-05 16:36:55 +00:00
uno : : Reference < style : : XAutoStyleFamily > aRef ;
2006-12-01 14:52:41 +00:00
IStyleAccess : : SwAutoStyleFamily nType = aAutoStyleByIndex [ nIndex ] ;
switch ( nType )
{
case IStyleAccess : : AUTO_STYLE_CHAR :
{
if ( ! xAutoCharStyles . is ( ) )
xAutoCharStyles = new SwXAutoStyleFamily ( pDocShell , nType ) ;
aRef = xAutoCharStyles ;
}
break ;
case IStyleAccess : : AUTO_STYLE_RUBY :
{
if ( ! xAutoRubyStyles . is ( ) )
xAutoRubyStyles = new SwXAutoStyleFamily ( pDocShell , nType ) ;
aRef = xAutoRubyStyles ;
}
break ;
case IStyleAccess : : AUTO_STYLE_PARA :
{
if ( ! xAutoParaStyles . is ( ) )
xAutoParaStyles = new SwXAutoStyleFamily ( pDocShell , nType ) ;
aRef = xAutoParaStyles ;
}
break ;
2007-09-27 08:40:48 +00:00
default :
;
2006-12-01 14:52:41 +00:00
}
2007-06-05 16:36:55 +00:00
aRet . setValue ( & aRef , : : getCppuType ( ( const uno : : Reference < style : : XAutoStyleFamily > * ) 0 ) ) ;
2006-12-01 14:52:41 +00:00
}
else
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2006-12-01 14:52:41 +00:00
return aRet ;
}
uno : : Type SwXAutoStyles : : getElementType ( ) throw ( uno : : RuntimeException )
{
2007-06-05 16:36:55 +00:00
return : : getCppuType ( ( const uno : : Reference < style : : XAutoStyleFamily > * ) 0 ) ;
2006-12-01 14:52:41 +00:00
}
sal_Bool SwXAutoStyles : : hasElements ( ) throw ( uno : : RuntimeException )
{
return sal_True ;
}
uno : : Any SwXAutoStyles : : getByName ( const rtl : : OUString & Name )
throw ( container : : NoSuchElementException , lang : : WrappedTargetException , uno : : RuntimeException )
{
uno : : Any aRet ;
if ( Name . compareToAscii ( " CharacterStyles " ) = = 0 )
aRet = getByIndex ( 0 ) ;
else if ( Name . compareToAscii ( " RubyStyles " ) = = 0 )
aRet = getByIndex ( 1 ) ;
else if ( Name . compareToAscii ( " ParagraphStyles " ) = = 0 )
aRet = getByIndex ( 2 ) ;
else
throw container : : NoSuchElementException ( ) ;
return aRet ;
}
uno : : Sequence < rtl : : OUString > SwXAutoStyles : : getElementNames ( void )
throw ( uno : : RuntimeException )
{
2007-06-05 16:36:55 +00:00
uno : : Sequence < OUString > aNames ( AUTOSTYLE_FAMILY_COUNT ) ;
2006-12-01 14:52:41 +00:00
OUString * pNames = aNames . getArray ( ) ;
2012-12-26 22:49:14 +01:00
pNames [ 0 ] = " CharacterStyles " ;
pNames [ 1 ] = " RubyStyles " ;
pNames [ 2 ] = " ParagraphStyles " ;
2006-12-01 14:52:41 +00:00
return aNames ;
}
sal_Bool SwXAutoStyles : : hasByName ( const rtl : : OUString & Name )
throw ( uno : : RuntimeException )
{
if ( Name . compareToAscii ( " CharacterStyles " ) = = 0 | |
Name . compareToAscii ( " RubyStyles " ) = = 0 | |
Name . compareToAscii ( " ParagraphStyles " ) = = 0 )
return sal_True ;
else
return sal_False ;
}
SwXAutoStyleFamily : : SwXAutoStyleFamily ( SwDocShell * pDocSh , IStyleAccess : : SwAutoStyleFamily nFamily ) :
pDocShell ( pDocSh ) , eFamily ( nFamily )
{
// Register ourselves as a listener to the document (via the page descriptor)
pDocSh - > GetDoc ( ) - > GetPageDescFromPool ( RES_POOLPAGE_STANDARD ) - > Add ( this ) ;
}
SwXAutoStyleFamily : : ~ SwXAutoStyleFamily ( )
{
}
2010-12-17 09:02:23 +01:00
void SwXAutoStyleFamily : : Modify ( const SfxPoolItem * pOld , const SfxPoolItem * pNew )
2006-12-01 14:52:41 +00:00
{
ClientModify ( this , pOld , pNew ) ;
if ( ! GetRegisteredIn ( ) )
pDocShell = 0 ;
}
uno : : Reference < style : : XAutoStyle > SwXAutoStyleFamily : : insertStyle (
const uno : : Sequence < beans : : PropertyValue > & Values )
2007-06-05 16:36:55 +00:00
throw ( uno : : RuntimeException )
2006-12-01 14:52:41 +00:00
{
if ( ! pDocShell )
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2011-01-17 15:06:54 +01:00
const sal_uInt16 * pRange = 0 ;
2009-06-03 11:26:39 +00:00
const SfxItemPropertySet * pPropSet = 0 ;
2006-12-01 14:52:41 +00:00
switch ( eFamily )
{
case IStyleAccess : : AUTO_STYLE_CHAR :
{
2007-09-27 08:40:48 +00:00
pRange = aCharAutoFmtSetRange ;
2009-06-03 11:26:39 +00:00
pPropSet = aSwMapProvider . GetPropertySet ( PROPERTY_MAP_CHAR_AUTO_STYLE ) ;
2006-12-01 14:52:41 +00:00
}
break ;
case IStyleAccess : : AUTO_STYLE_RUBY :
{
2007-09-27 08:40:48 +00:00
pRange = 0 ; //aTxtNodeSetRange;
2009-06-03 11:26:39 +00:00
pPropSet = aSwMapProvider . GetPropertySet ( PROPERTY_MAP_RUBY_AUTO_STYLE ) ;
2006-12-01 14:52:41 +00:00
}
break ;
case IStyleAccess : : AUTO_STYLE_PARA :
{
2007-09-27 08:40:48 +00:00
pRange = aTxtNodeSetRange ;
2009-06-03 11:26:39 +00:00
pPropSet = aSwMapProvider . GetPropertySet ( PROPERTY_MAP_PARA_AUTO_STYLE ) ;
2006-12-01 14:52:41 +00:00
}
break ;
2007-09-27 08:40:48 +00:00
default :
;
2006-12-01 14:52:41 +00:00
}
2007-09-27 08:40:48 +00:00
SwAttrSet aSet ( pDocShell - > GetDoc ( ) - > GetAttrPool ( ) , pRange ) ;
2007-06-05 16:36:55 +00:00
const beans : : PropertyValue * pSeq = Values . getConstArray ( ) ;
2006-12-01 14:52:41 +00:00
sal_Int32 nLen = Values . getLength ( ) ;
for ( sal_Int32 i = 0 ; i < nLen ; + + i )
{
try
{
2009-06-03 11:26:39 +00:00
pPropSet - > setPropertyValue ( pSeq [ i ] . Name , pSeq [ i ] . Value , aSet ) ;
2006-12-01 14:52:41 +00:00
}
2007-06-05 16:36:55 +00:00
catch ( beans : : UnknownPropertyException & )
2006-12-01 14:52:41 +00:00
{
2011-03-12 11:51:35 +01:00
OSL_FAIL ( " Unknown property " ) ;
2006-12-01 14:52:41 +00:00
}
2007-12-12 12:26:08 +00:00
catch ( lang : : IllegalArgumentException & )
{
2011-03-12 11:51:35 +01:00
OSL_FAIL ( " Illegal argument " ) ;
2007-12-12 12:26:08 +00:00
}
2006-12-01 14:52:41 +00:00
}
SfxItemSet_Pointer_t pSet = pDocShell - > GetDoc ( ) - > GetIStyleAccess ( ) . cacheAutomaticStyle ( aSet , eFamily ) ;
uno : : Reference < style : : XAutoStyle > xRet = new SwXAutoStyle ( pDocShell - > GetDoc ( ) , pSet , eFamily ) ;
return xRet ;
}
uno : : Reference < container : : XEnumeration > SwXAutoStyleFamily : : createEnumeration ( )
throw ( uno : : RuntimeException )
{
if ( ! pDocShell )
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2006-12-01 14:52:41 +00:00
return uno : : Reference < container : : XEnumeration >
( new SwXAutoStylesEnumerator ( pDocShell - > GetDoc ( ) , eFamily ) ) ;
}
uno : : Type SwXAutoStyleFamily : : getElementType ( ) throw ( uno : : RuntimeException )
{
2007-06-05 16:36:55 +00:00
return : : getCppuType ( ( const uno : : Reference < style : : XAutoStyle > * ) 0 ) ;
2006-12-01 14:52:41 +00:00
}
sal_Bool SwXAutoStyleFamily : : hasElements ( ) throw ( uno : : RuntimeException )
{
return sal_False ;
}
SwAutoStylesEnumImpl : : SwAutoStylesEnumImpl ( SwDoc * pInitDoc , IStyleAccess : : SwAutoStyleFamily eFam )
: pDoc ( pInitDoc ) , eFamily ( eFam )
{
// special case for ruby auto styles:
if ( IStyleAccess : : AUTO_STYLE_RUBY = = eFam )
{
2011-01-17 15:06:54 +01:00
std : : set < std : : pair < sal_uInt16 , sal_uInt16 > > aRubyMap ;
2006-12-01 14:52:41 +00:00
SwAttrPool & rAttrPool = pDoc - > GetAttrPool ( ) ;
2010-10-18 22:00:21 +02:00
sal_uInt32 nCount = rAttrPool . GetItemCount2 ( RES_TXTATR_CJK_RUBY ) ;
2006-12-01 14:52:41 +00:00
2010-10-18 22:00:21 +02:00
for ( sal_uInt32 nI = 0 ; nI < nCount ; + + nI )
2006-12-01 14:52:41 +00:00
{
2010-10-18 22:00:21 +02:00
const SwFmtRuby * pItem = static_cast < const SwFmtRuby * > ( rAttrPool . GetItem2 ( RES_TXTATR_CJK_RUBY , nI ) ) ;
2006-12-01 14:52:41 +00:00
if ( pItem & & pItem - > GetTxtRuby ( ) )
{
2011-01-17 15:06:54 +01:00
std : : pair < sal_uInt16 , sal_uInt16 > aPair ( pItem - > GetPosition ( ) , pItem - > GetAdjustment ( ) ) ;
2006-12-01 14:52:41 +00:00
if ( aRubyMap . find ( aPair ) = = aRubyMap . end ( ) )
{
aRubyMap . insert ( aPair ) ;
SfxItemSet_Pointer_t pItemSet ( new SfxItemSet ( rAttrPool , RES_TXTATR_CJK_RUBY , RES_TXTATR_CJK_RUBY ) ) ;
pItemSet - > Put ( * pItem ) ;
mAutoStyles . push_back ( pItemSet ) ;
}
}
}
}
else
{
pDoc - > GetIStyleAccess ( ) . getAllStyles ( mAutoStyles , eFamily ) ;
}
aIter = mAutoStyles . begin ( ) ;
}
SwXAutoStylesEnumerator : : SwXAutoStylesEnumerator ( SwDoc * pDoc , IStyleAccess : : SwAutoStyleFamily eFam )
: pImpl ( new SwAutoStylesEnumImpl ( pDoc , eFam ) )
{
// Register ourselves as a listener to the document (via the page descriptor)
pDoc - > GetPageDescFromPool ( RES_POOLPAGE_STANDARD ) - > Add ( this ) ;
}
SwXAutoStylesEnumerator : : ~ SwXAutoStylesEnumerator ( )
{
delete pImpl ;
}
2010-12-17 09:02:23 +01:00
void SwXAutoStylesEnumerator : : Modify ( const SfxPoolItem * pOld , const SfxPoolItem * pNew )
2006-12-01 14:52:41 +00:00
{
ClientModify ( this , pOld , pNew ) ;
if ( ! GetRegisteredIn ( ) )
{
delete pImpl ;
pImpl = 0 ;
}
}
: : sal_Bool SwXAutoStylesEnumerator : : hasMoreElements ( )
throw ( uno : : RuntimeException )
{
if ( ! pImpl )
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2006-12-01 14:52:41 +00:00
return pImpl - > hasMoreElements ( ) ;
}
uno : : Any SwXAutoStylesEnumerator : : nextElement ( )
throw ( container : : NoSuchElementException , lang : : WrappedTargetException , uno : : RuntimeException )
{
if ( ! pImpl )
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
uno : : Any aRet ;
2006-12-01 14:52:41 +00:00
if ( pImpl - > hasMoreElements ( ) )
{
SfxItemSet_Pointer_t pNextSet = pImpl - > nextElement ( ) ;
2007-06-05 16:36:55 +00:00
uno : : Reference < style : : XAutoStyle > xAutoStyle = new SwXAutoStyle ( pImpl - > getDoc ( ) ,
2006-12-01 14:52:41 +00:00
pNextSet , pImpl - > getFamily ( ) ) ;
2007-06-05 16:36:55 +00:00
aRet . setValue ( & xAutoStyle , : : getCppuType ( ( uno : : Reference < style : : XAutoStyle > * ) 0 ) ) ;
2006-12-01 14:52:41 +00:00
}
return aRet ;
}
SwXAutoStyle : : SwXAutoStyle ( SwDoc * pDoc , SfxItemSet_Pointer_t pInitSet , IStyleAccess : : SwAutoStyleFamily eFam )
: pSet ( pInitSet ) , eFamily ( eFam )
{
// Register ourselves as a listener to the document (via the page descriptor)
pDoc - > GetPageDescFromPool ( RES_POOLPAGE_STANDARD ) - > Add ( this ) ;
}
SwXAutoStyle : : ~ SwXAutoStyle ( )
{
}
2010-12-17 09:02:23 +01:00
void SwXAutoStyle : : Modify ( const SfxPoolItem * pOld , const SfxPoolItem * pNew )
2006-12-01 14:52:41 +00:00
{
ClientModify ( this , pOld , pNew ) ;
if ( ! GetRegisteredIn ( ) )
pSet . reset ( ) ;
}
uno : : Reference < beans : : XPropertySetInfo > SwXAutoStyle : : getPropertySetInfo ( )
throw ( uno : : RuntimeException )
{
2007-06-05 16:36:55 +00:00
uno : : Reference < beans : : XPropertySetInfo > xRet ;
2006-12-01 14:52:41 +00:00
switch ( eFamily )
{
case IStyleAccess : : AUTO_STYLE_CHAR :
{
2007-06-05 16:36:55 +00:00
static uno : : Reference < beans : : XPropertySetInfo > xCharRef ;
2006-12-01 14:52:41 +00:00
if ( ! xCharRef . is ( ) )
{
2009-06-03 11:26:39 +00:00
xCharRef = aSwMapProvider . GetPropertySet ( PROPERTY_MAP_CHAR_AUTO_STYLE ) - > getPropertySetInfo ( ) ;
2006-12-01 14:52:41 +00:00
}
xRet = xCharRef ;
}
break ;
case IStyleAccess : : AUTO_STYLE_RUBY :
{
2007-06-05 16:36:55 +00:00
static uno : : Reference < beans : : XPropertySetInfo > xRubyRef ;
2006-12-01 14:52:41 +00:00
if ( ! xRubyRef . is ( ) )
{
sal_uInt16 nMapId = PROPERTY_MAP_RUBY_AUTO_STYLE ;
2009-06-03 11:26:39 +00:00
xRubyRef = aSwMapProvider . GetPropertySet ( nMapId ) - > getPropertySetInfo ( ) ;
2006-12-01 14:52:41 +00:00
}
xRet = xRubyRef ;
}
break ;
case IStyleAccess : : AUTO_STYLE_PARA :
{
2007-06-05 16:36:55 +00:00
static uno : : Reference < beans : : XPropertySetInfo > xParaRef ;
2006-12-01 14:52:41 +00:00
if ( ! xParaRef . is ( ) )
{
sal_uInt16 nMapId = PROPERTY_MAP_PARA_AUTO_STYLE ;
2009-06-03 11:26:39 +00:00
xParaRef = aSwMapProvider . GetPropertySet ( nMapId ) - > getPropertySetInfo ( ) ;
2006-12-01 14:52:41 +00:00
}
xRet = xParaRef ;
}
break ;
2007-09-27 08:40:48 +00:00
default :
;
2006-12-01 14:52:41 +00:00
}
return xRet ;
}
2007-09-27 08:40:48 +00:00
void SwXAutoStyle : : setPropertyValue ( const OUString & /*rPropertyName*/ , const uno : : Any & /*rValue*/ )
2007-06-05 16:36:55 +00:00
throw ( beans : : UnknownPropertyException ,
beans : : PropertyVetoException ,
lang : : IllegalArgumentException ,
lang : : WrappedTargetException ,
uno : : RuntimeException )
2006-12-01 14:52:41 +00:00
{
}
2007-06-05 16:36:55 +00:00
uno : : Any SwXAutoStyle : : getPropertyValue ( const OUString & rPropertyName )
throw ( beans : : UnknownPropertyException ,
2006-12-01 14:52:41 +00:00
lang : : WrappedTargetException ,
2007-06-05 16:36:55 +00:00
uno : : RuntimeException )
2006-12-01 14:52:41 +00:00
{
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2007-06-05 16:36:55 +00:00
const uno : : Sequence < OUString > aProperties ( & rPropertyName , 1 ) ;
2006-12-01 14:52:41 +00:00
return GetPropertyValues_Impl ( aProperties ) . getConstArray ( ) [ 0 ] ;
}
2007-09-27 08:40:48 +00:00
void SwXAutoStyle : : addPropertyChangeListener ( const OUString & /*aPropertyName*/ ,
const uno : : Reference < beans : : XPropertyChangeListener > & /*xListener*/ )
2007-06-05 16:36:55 +00:00
throw ( beans : : UnknownPropertyException ,
2006-12-01 14:52:41 +00:00
lang : : WrappedTargetException ,
2007-06-05 16:36:55 +00:00
uno : : RuntimeException )
2006-12-01 14:52:41 +00:00
{
}
2007-09-27 08:40:48 +00:00
void SwXAutoStyle : : removePropertyChangeListener ( const OUString & /*aPropertyName*/ ,
const uno : : Reference < beans : : XPropertyChangeListener > & /*aListener*/ )
2007-06-05 16:36:55 +00:00
throw ( beans : : UnknownPropertyException ,
2006-12-01 14:52:41 +00:00
lang : : WrappedTargetException ,
2007-06-05 16:36:55 +00:00
uno : : RuntimeException )
2006-12-01 14:52:41 +00:00
{
}
2000-09-18 23:08:29 +00:00
2007-09-27 08:40:48 +00:00
void SwXAutoStyle : : addVetoableChangeListener ( const OUString & /*PropertyName*/ ,
const uno : : Reference < beans : : XVetoableChangeListener > & /*aListener*/ )
2007-06-05 16:36:55 +00:00
throw ( beans : : UnknownPropertyException ,
2006-12-01 14:52:41 +00:00
lang : : WrappedTargetException ,
2007-06-05 16:36:55 +00:00
uno : : RuntimeException )
2006-12-01 14:52:41 +00:00
{
}
2007-09-27 08:40:48 +00:00
void SwXAutoStyle : : removeVetoableChangeListener ( const OUString & /*PropertyName*/ ,
const uno : : Reference < beans : : XVetoableChangeListener > & /*aListener*/ )
2007-06-05 16:36:55 +00:00
throw ( beans : : UnknownPropertyException ,
2006-12-01 14:52:41 +00:00
lang : : WrappedTargetException ,
2007-06-05 16:36:55 +00:00
uno : : RuntimeException )
2006-12-01 14:52:41 +00:00
{
}
void SwXAutoStyle : : setPropertyValues (
2007-09-27 08:40:48 +00:00
const uno : : Sequence < : : rtl : : OUString > & /*aPropertyNames*/ ,
const uno : : Sequence < uno : : Any > & /*aValues*/ )
2006-12-01 14:52:41 +00:00
throw ( beans : : PropertyVetoException , lang : : IllegalArgumentException ,
lang : : WrappedTargetException , uno : : RuntimeException )
{
}
2007-06-05 16:36:55 +00:00
uno : : Sequence < uno : : Any > SwXAutoStyle : : GetPropertyValues_Impl (
2006-12-01 14:52:41 +00:00
const uno : : Sequence < OUString > & rPropertyNames )
2007-06-05 16:36:55 +00:00
throw ( beans : : UnknownPropertyException , lang : : WrappedTargetException , uno : : RuntimeException )
2006-12-01 14:52:41 +00:00
{
if ( ! pSet . get ( ) )
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2006-12-01 14:52:41 +00:00
// query_item
2009-06-03 11:26:39 +00:00
sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE ;
2006-12-01 14:52:41 +00:00
switch ( eFamily )
{
2009-06-03 11:26:39 +00:00
case IStyleAccess : : AUTO_STYLE_CHAR : nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE ; break ;
case IStyleAccess : : AUTO_STYLE_RUBY : nPropSetId = PROPERTY_MAP_RUBY_AUTO_STYLE ; break ;
case IStyleAccess : : AUTO_STYLE_PARA : nPropSetId = PROPERTY_MAP_PARA_AUTO_STYLE ; break ;
2007-09-27 08:40:48 +00:00
default :
;
2006-12-01 14:52:41 +00:00
}
2009-06-03 11:26:39 +00:00
const SfxItemPropertySet * pPropSet = aSwMapProvider . GetPropertySet ( nPropSetId ) ;
2012-01-05 21:30:06 +00:00
const SfxItemPropertyMap & rMap = pPropSet - > getPropertyMap ( ) ;
2006-12-01 14:52:41 +00:00
const OUString * pNames = rPropertyNames . getConstArray ( ) ;
sal_Int32 nLen = rPropertyNames . getLength ( ) ;
2007-06-05 16:36:55 +00:00
uno : : Sequence < uno : : Any > aRet ( nLen ) ;
uno : : Any * pValues = aRet . getArray ( ) ;
2006-12-01 14:52:41 +00:00
SfxItemSet & rSet = * pSet . get ( ) ;
for ( sal_Int32 i = 0 ; i < nLen ; + + i )
{
const String & rPropName = pNames [ i ] ;
2012-01-05 21:30:06 +00:00
const SfxItemPropertySimpleEntry * pEntry = rMap . getByName ( rPropName ) ;
2009-06-03 11:26:39 +00:00
if ( ! pEntry )
2007-06-05 16:36:55 +00:00
throw beans : : UnknownPropertyException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " Unknown property: " ) ) + rPropName , static_cast < cppu : : OWeakObject * > ( this ) ) ;
2009-06-03 11:26:39 +00:00
else if ( RES_TXTATR_AUTOFMT = = pEntry - > nWID | | RES_AUTO_STYLE = = pEntry - > nWID )
2006-12-01 14:52:41 +00:00
{
OUString sName ( StylePool : : nameOf ( pSet ) ) ;
pValues [ i ] < < = sName ;
}
else
2009-06-03 11:26:39 +00:00
pPropSet - > getPropertyValue ( * pEntry , rSet , pValues [ i ] ) ;
2006-12-01 14:52:41 +00:00
}
return aRet ;
}
uno : : Sequence < uno : : Any > SwXAutoStyle : : getPropertyValues (
const uno : : Sequence < : : rtl : : OUString > & rPropertyNames )
throw ( uno : : RuntimeException )
{
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2007-06-05 16:36:55 +00:00
uno : : Sequence < uno : : Any > aValues ;
2006-12-01 14:52:41 +00:00
// workaround for bad designed API
try
{
aValues = GetPropertyValues_Impl ( rPropertyNames ) ;
}
2007-06-05 16:36:55 +00:00
catch ( beans : : UnknownPropertyException & )
2006-12-01 14:52:41 +00:00
{
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " Unknown property exception caught " ) ) , static_cast < cppu : : OWeakObject * > ( this ) ) ;
2006-12-01 14:52:41 +00:00
}
2007-06-05 16:36:55 +00:00
catch ( lang : : WrappedTargetException & )
2006-12-01 14:52:41 +00:00
{
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " WrappedTargetException caught " ) ) , static_cast < cppu : : OWeakObject * > ( this ) ) ;
2006-12-01 14:52:41 +00:00
}
return aValues ;
}
void SwXAutoStyle : : addPropertiesChangeListener (
2007-09-27 08:40:48 +00:00
const uno : : Sequence < : : rtl : : OUString > & /*aPropertyNames*/ ,
const uno : : Reference < beans : : XPropertiesChangeListener > & /*xListener*/ )
2006-12-01 14:52:41 +00:00
throw ( uno : : RuntimeException )
{
}
void SwXAutoStyle : : removePropertiesChangeListener (
2007-09-27 08:40:48 +00:00
const uno : : Reference < beans : : XPropertiesChangeListener > & /*xListener*/ )
2006-12-01 14:52:41 +00:00
throw ( uno : : RuntimeException )
{
}
void SwXAutoStyle : : firePropertiesChangeEvent (
2007-09-27 08:40:48 +00:00
const uno : : Sequence < : : rtl : : OUString > & /*aPropertyNames*/ ,
const uno : : Reference < beans : : XPropertiesChangeListener > & /*xListener*/ )
2006-12-01 14:52:41 +00:00
throw ( uno : : RuntimeException )
{
}
beans : : PropertyState SwXAutoStyle : : getPropertyState ( const OUString & rPropertyName )
throw ( beans : : UnknownPropertyException ,
uno : : RuntimeException )
{
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2006-12-01 14:52:41 +00:00
2007-06-05 16:36:55 +00:00
uno : : Sequence < OUString > aNames ( 1 ) ;
2006-12-01 14:52:41 +00:00
OUString * pNames = aNames . getArray ( ) ;
pNames [ 0 ] = rPropertyName ;
2007-06-05 16:36:55 +00:00
uno : : Sequence < beans : : PropertyState > aStates = getPropertyStates ( aNames ) ;
2006-12-01 14:52:41 +00:00
return aStates . getConstArray ( ) [ 0 ] ;
}
2007-09-27 08:40:48 +00:00
void SwXAutoStyle : : setPropertyToDefault ( const OUString & /*PropertyName*/ )
2006-12-01 14:52:41 +00:00
throw ( beans : : UnknownPropertyException ,
uno : : RuntimeException )
{
}
2007-06-05 16:36:55 +00:00
uno : : Any SwXAutoStyle : : getPropertyDefault ( const OUString & rPropertyName )
2006-12-01 14:52:41 +00:00
throw ( beans : : UnknownPropertyException ,
lang : : WrappedTargetException ,
uno : : RuntimeException )
{
2007-06-05 16:36:55 +00:00
const uno : : Sequence < OUString > aSequence ( & rPropertyName , 1 ) ;
2006-12-01 14:52:41 +00:00
return getPropertyDefaults ( aSequence ) . getConstArray ( ) [ 0 ] ;
}
uno : : Sequence < beans : : PropertyState > SwXAutoStyle : : getPropertyStates (
const uno : : Sequence < : : rtl : : OUString > & rPropertyNames )
throw ( beans : : UnknownPropertyException , uno : : RuntimeException )
{
if ( ! pSet . get ( ) )
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2007-06-05 16:36:55 +00:00
uno : : Sequence < beans : : PropertyState > aRet ( rPropertyNames . getLength ( ) ) ;
beans : : PropertyState * pStates = aRet . getArray ( ) ;
2006-12-01 14:52:41 +00:00
const OUString * pNames = rPropertyNames . getConstArray ( ) ;
2009-06-03 11:26:39 +00:00
sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE ;
2006-12-01 14:52:41 +00:00
switch ( eFamily )
{
2009-06-03 11:26:39 +00:00
case IStyleAccess : : AUTO_STYLE_CHAR : nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE ; break ;
case IStyleAccess : : AUTO_STYLE_RUBY : nPropSetId = PROPERTY_MAP_RUBY_AUTO_STYLE ; break ;
case IStyleAccess : : AUTO_STYLE_PARA : nPropSetId = PROPERTY_MAP_PARA_AUTO_STYLE ; break ;
2007-09-27 08:40:48 +00:00
default :
;
2006-12-01 14:52:41 +00:00
}
2009-06-03 11:26:39 +00:00
const SfxItemPropertySet * pPropSet = aSwMapProvider . GetPropertySet ( nPropSetId ) ;
2012-01-05 21:30:06 +00:00
const SfxItemPropertyMap & rMap = pPropSet - > getPropertyMap ( ) ;
2006-12-01 14:52:41 +00:00
SfxItemSet & rSet = * pSet . get ( ) ;
for ( sal_Int32 i = 0 ; i < rPropertyNames . getLength ( ) ; i + + )
{
const String & rPropName = pNames [ i ] ;
2012-01-05 21:30:06 +00:00
const SfxItemPropertySimpleEntry * pEntry = rMap . getByName ( rPropName ) ;
2009-06-03 11:26:39 +00:00
if ( ! pEntry )
2007-06-05 16:36:55 +00:00
throw beans : : UnknownPropertyException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " Unknown property: " ) ) + rPropName , static_cast < cppu : : OWeakObject * > ( this ) ) ;
2009-06-03 11:26:39 +00:00
pStates [ i ] = pPropSet - > getPropertyState ( * pEntry , rSet ) ;
2006-12-01 14:52:41 +00:00
}
return aRet ;
}
void SwXAutoStyle : : setAllPropertiesToDefault ( )
throw ( uno : : RuntimeException )
{
}
void SwXAutoStyle : : setPropertiesToDefault (
2007-09-27 08:40:48 +00:00
const uno : : Sequence < : : rtl : : OUString > & /*aPropertyNames*/ )
2006-12-01 14:52:41 +00:00
throw ( beans : : UnknownPropertyException , uno : : RuntimeException )
{
}
uno : : Sequence < uno : : Any > SwXAutoStyle : : getPropertyDefaults (
2007-09-27 08:40:48 +00:00
const uno : : Sequence < : : rtl : : OUString > & /*aPropertyNames*/ )
2006-12-01 14:52:41 +00:00
throw ( beans : : UnknownPropertyException , lang : : WrappedTargetException ,
uno : : RuntimeException )
{
uno : : Sequence < uno : : Any > aRet ( 0 ) ;
return aRet ;
}
2007-06-05 16:36:55 +00:00
uno : : Sequence < beans : : PropertyValue > SwXAutoStyle : : getProperties ( ) throw ( uno : : RuntimeException )
2006-12-01 14:52:41 +00:00
{
if ( ! pSet . get ( ) )
2007-06-05 16:36:55 +00:00
throw uno : : RuntimeException ( ) ;
2010-10-13 01:44:10 -05:00
SolarMutexGuard aGuard ;
2007-06-05 16:36:55 +00:00
std : : vector < beans : : PropertyValue > aPropertyVector ;
2006-12-01 14:52:41 +00:00
2007-09-27 08:40:48 +00:00
sal_Int8 nPropSetId = 0 ;
2006-12-01 14:52:41 +00:00
switch ( eFamily )
{
2009-06-03 11:26:39 +00:00
case IStyleAccess : : AUTO_STYLE_CHAR : nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE ; break ;
case IStyleAccess : : AUTO_STYLE_RUBY : nPropSetId = PROPERTY_MAP_RUBY_AUTO_STYLE ; break ;
case IStyleAccess : : AUTO_STYLE_PARA : nPropSetId = PROPERTY_MAP_PARA_AUTO_STYLE ; break ;
2007-09-27 08:40:48 +00:00
default :
;
2006-12-01 14:52:41 +00:00
}
2009-06-03 11:26:39 +00:00
const SfxItemPropertySet * pPropSet = aSwMapProvider . GetPropertySet ( nPropSetId ) ;
2012-01-05 21:30:06 +00:00
const SfxItemPropertyMap & rMap = pPropSet - > getPropertyMap ( ) ;
PropertyEntryVector_t aPropVector = rMap . getPropertyEntries ( ) ;
2006-12-01 14:52:41 +00:00
SfxItemSet & rSet = * pSet . get ( ) ;
SfxItemIter aIter ( rSet ) ;
const SfxPoolItem * pItem = aIter . FirstItem ( ) ;
while ( pItem )
{
2011-01-17 15:06:54 +01:00
const sal_uInt16 nWID = pItem - > Which ( ) ;
2006-12-01 14:52:41 +00:00
2009-06-03 11:26:39 +00:00
// TODO: Optimize - and fix! the old iteration filled each WhichId
// only once but there are more properties than WhichIds
PropertyEntryVector_t : : const_iterator aIt = aPropVector . begin ( ) ;
while ( aIt ! = aPropVector . end ( ) )
{
if ( aIt - > nWID = = nWID )
{
beans : : PropertyValue aPropertyValue ;
aPropertyValue . Name = aIt - > sName ;
pItem - > QueryValue ( aPropertyValue . Value , aIt - > nMemberId ) ;
aPropertyVector . push_back ( aPropertyValue ) ;
}
+ + aIt ;
}
2006-12-01 14:52:41 +00:00
pItem = aIter . NextItem ( ) ;
}
const sal_Int32 nCount = aPropertyVector . size ( ) ;
2007-06-05 16:36:55 +00:00
uno : : Sequence < beans : : PropertyValue > aRet ( nCount ) ;
2006-12-01 14:52:41 +00:00
beans : : PropertyValue * pProps = aRet . getArray ( ) ;
for ( int i = 0 ; i < nCount ; + + i , pProps + + )
{
* pProps = aPropertyVector [ i ] ;
}
return aRet ;
}
2010-10-14 08:30:41 +02:00
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */