2000-09-18 23:08:29 +00:00
/*************************************************************************
*
2005-09-09 04:30:40 +00:00
* OpenOffice . org - a multi - platform office productivity suite
2000-09-18 23:08:29 +00:00
*
2005-09-09 04:30:40 +00:00
* $ RCSfile : unostyle . cxx , v $
2000-09-18 23:08:29 +00:00
*
2007-02-12 13:33:31 +00:00
* $ Revision : 1.70 $
2000-09-18 23:08:29 +00:00
*
2007-02-12 13:33:31 +00:00
* last change : $ Author : kz $ $ Date : 2007 - 02 - 12 14 : 33 : 31 $
2000-09-18 23:08:29 +00:00
*
2005-09-09 04:30:40 +00:00
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1 .
2000-09-18 23:08:29 +00:00
*
*
2005-09-09 04:30:40 +00:00
* GNU Lesser General Public License Version 2.1
* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
* Copyright 2005 by Sun Microsystems , Inc .
* 901 San Antonio Road , Palo Alto , CA 94303 , USA
2000-09-18 23:08:29 +00:00
*
2005-09-09 04:30:40 +00:00
* This library is free software ; you can redistribute it and / or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1 , as published by the Free Software Foundation .
2000-09-18 23:08:29 +00:00
*
2005-09-09 04:30:40 +00:00
* This library is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the GNU
* Lesser General Public License for more details .
2000-09-18 23:08:29 +00:00
*
2005-09-09 04:30:40 +00:00
* You should have received a copy of the GNU Lesser General Public
* License along with this library ; if not , write to the Free Software
* Foundation , Inc . , 59 Temple Place , Suite 330 , Boston ,
* MA 02111 - 1307 USA
2000-09-18 23:08:29 +00:00
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2006-09-16 21:01:21 +00:00
// MARKER(update_precomp.py): autogen include statement, do not remove
# include "precompiled_sw.hxx"
2000-09-18 23:08:29 +00:00
2000-10-31 19:33:20 +00:00
# ifndef _HINTIDS_HXX
# include <hintids.hxx>
# endif
# ifndef _VOS_MUTEX_HXX_ //autogen
# include <vos/mutex.hxx>
# endif
# ifndef _SV_SVAPP_HXX //autogen
# include <vcl/svapp.hxx>
# endif
# ifndef _SFXSMPLHINT_HXX //autogen
# include <svtools/smplhint.hxx>
# endif
# ifndef _CTRLTOOL_HXX //autogen
# include <svtools/ctrltool.hxx>
# endif
# ifndef _SFXSTYLE_HXX
# include <svtools/style.hxx>
# endif
2006-12-01 14:52:41 +00:00
# ifndef _SFXITEMITER_HXX //autogen
# include <svtools/itemiter.hxx>
# endif
2000-10-31 19:33:20 +00:00
# ifndef _SVX_PAGEITEM_HXX //autogen
# define ITEMID_SETITEM
# include <svx/pageitem.hxx>
# endif
# ifndef _SVX_SIZEITEM_HXX //autogen
# define ITEMID_SIZE SID_ATTR_PAGE_SIZE
# include <svx/sizeitem.hxx>
# endif
# ifndef _SVX_ULSPITEM_HXX //autogen
# include <svx/ulspitem.hxx>
# endif
# ifndef _SVX_LRSPITEM_HXX //autogen
# include <svx/lrspitem.hxx>
# endif
# ifndef _SVX_BOXITEM_HXX //autogen
# include <svx/boxitem.hxx>
# endif
# ifndef _SVX_SHADITEM_HXX //autogen
# include <svx/shaditem.hxx>
# endif
# ifndef _SVX_BRSHITEM_HXX //autogen
# include <svx/brshitem.hxx>
# endif
# ifndef _SVX_FLSTITEM_HXX //autogen
# include <svx/flstitem.hxx>
# endif
2002-08-05 13:32:35 +00:00
# ifndef _SVX_PAPERINF_HXX //autogen
# include <svx/paperinf.hxx>
# endif
2000-09-18 23:08:29 +00:00
# ifndef _PAGEDESC_HXX //autogen
# include <pagedesc.hxx>
# endif
# ifndef _DOC_HXX //autogen
# include <doc.hxx>
# endif
# ifndef _DOCARY_HXX
# include <docary.hxx>
# endif
# ifndef _CHARFMT_HXX //autogen
# include <charfmt.hxx>
# endif
# include <cmdid.h>
# ifndef _UNOSTYLE_HXX
# include <unostyle.hxx>
# endif
# ifndef _UNOSETT_HXX
# include <unosett.hxx>
# endif
# ifndef _SWDOCSH_HXX //autogen
# include <docsh.hxx>
# endif
# ifndef _SWSTYLE_H
# include <swstyle.h>
# endif
# ifndef _PARATR_HXX
# include <paratr.hxx>
# endif
# ifndef _UNOPRNMS_HXX
# include <unoprnms.hxx>
# endif
# ifndef _SHELLIO_HXX //autogen
# include <shellio.hxx>
# endif
# ifndef _DOCSTYLE_HXX //autogen
# include <docstyle.hxx>
# endif
# ifndef _UNOOBJ_HXX
# include <unoobj.hxx>
# endif
# ifndef _FMTHDFT_HXX //autogen
# include <fmthdft.hxx>
# endif
# ifndef _FMTPDSC_HXX //autogen wg. SwFmtPageDesc
# include <fmtpdsc.hxx>
# endif
# ifndef _URLOBJ_HXX
# include <tools/urlobj.hxx>
# endif
# ifndef _POOLFMT_HRC
# include <poolfmt.hrc>
# endif
# ifndef _POOLFMT_HXX
# include <poolfmt.hxx>
# endif
2000-12-19 16:28:58 +00:00
# ifndef _UNOEVENT_HXX
# include "unoevent.hxx"
# endif
2001-02-19 07:04:57 +00:00
# ifndef _FMTRUBY_HXX
# include <fmtruby.hxx>
# endif
2001-07-19 15:35:09 +00:00
# ifndef _SWSTYLENAMEMAPPER_HXX
# include <SwStyleNameMapper.hxx>
# endif
2001-09-03 13:58:49 +00:00
# ifndef _SFX_PRINTER_HXX
# include <sfx2/printer.hxx>
# endif
2006-08-14 15:57:26 +00:00
2005-11-11 12:16:07 +00:00
# ifndef _COM_SUN_STAR_STYLE_PARAGRAPHSTYLECATEGORY_HPP_
# include <com/sun/star/style/ParagraphStyleCategory.hpp>
# endif
2006-08-14 15:57:26 +00:00
/*
2001-10-17 11:27:45 +00:00
# ifndef _COM_SUN_STAR_FRAME_XMODEL_HPP_
# include <com/sun/star/frame/XModel.hpp>
# endif
2006-08-14 15:57:26 +00:00
*/
2001-10-17 11:27:45 +00:00
# ifndef _COM_SUN_STAR_STYLE_XSTYLEFAMILIESSUPPLIER_HPP_
# include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
# endif
2001-10-16 11:16:17 +00:00
# ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPPP_
# include <com/sun/star/beans/PropertyAttribute.hpp>
# endif
2005-11-11 12:16:07 +00:00
# ifndef _COM_SUN_STAR_BEANS_NAMEDVALUE_HPPP_
# include <com/sun/star/beans/NamedValue.hpp>
# endif
2006-12-01 14:52:41 +00:00
# include <istyleaccess.hxx>
2005-11-11 12:16:07 +00:00
2001-10-24 14:51:20 +00:00
# ifndef _GETMETRICVAL_HXX
# include <GetMetricVal.hxx>
# endif
# ifndef _FMTFSIZE_HXX
# include <fmtfsize.hxx>
# endif
2005-11-11 12:16:07 +00: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"
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 ;
using namespace : : com : : sun : : star : : lang ;
using namespace : : com : : sun : : star : : uno ;
using namespace : : com : : sun : : star : : style ;
2000-10-24 14:38:05 +00:00
using namespace : : com : : sun : : star : : beans ;
2000-12-19 16:28:58 +00:00
using namespace : : com : : sun : : star : : document ;
using namespace : : com : : sun : : star : : container ;
2000-09-18 23:08:29 +00:00
using namespace : : rtl ;
2001-10-17 11:27:45 +00:00
using com : : sun : : star : : frame : : XModel ;
2005-11-11 12:16:07 +00:00
2000-09-18 23:08:29 +00:00
/******************************************************************************
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
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
2001-10-29 14:16:14 +00:00
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 ;
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
}
2001-07-19 15:35:09 +00:00
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 :
2001-07-19 15:35:09 +00:00
return GET_POOLID_CHRFMT ;
2000-09-18 23:08:29 +00:00
case SFX_STYLE_FAMILY_PARA :
2001-07-19 15:35:09 +00:00
return GET_POOLID_TXTCOLL ;
2000-09-18 23:08:29 +00:00
case SFX_STYLE_FAMILY_FRAME :
2001-07-19 15:35:09 +00:00
return GET_POOLID_FRMFMT ;
2000-09-18 23:08:29 +00:00
case SFX_STYLE_FAMILY_PAGE :
2001-07-19 15:35:09 +00:00
return GET_POOLID_PAGEDESC ;
2000-09-18 23:08:29 +00:00
case SFX_STYLE_FAMILY_PSEUDO :
2001-07-19 15:35:09 +00:00
return GET_POOLID_NUMRULE ;
2001-10-11 17:50:13 +00:00
default :
DBG_ASSERT ( sal_False , " someone asking for all styles in unostyle.cxx! " ) ;
return 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
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* -----------------------------06.04.00 11:24--------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
OUString SwXStyleFamilies : : getImplementationName ( void ) throw ( RuntimeException )
{
return C2U ( " SwXStyleFamilies " ) ;
}
/* -----------------------------06.04.00 11:24--------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
BOOL SwXStyleFamilies : : supportsService ( const OUString & rServiceName ) throw ( RuntimeException )
{
return C2U ( " com.sun.star.style.StyleFamilies " ) = = rServiceName ;
}
/* -----------------------------06.04.00 11:24--------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
Sequence < OUString > SwXStyleFamilies : : getSupportedServiceNames ( void ) throw ( RuntimeException )
{
Sequence < OUString > aRet ( 1 ) ;
OUString * pArray = aRet . getArray ( ) ;
pArray [ 0 ] = C2U ( " com.sun.star.style.StyleFamilies " ) ;
return aRet ;
}
/*-- 16.12.98 15:13:26---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
SwXStyleFamilies : : SwXStyleFamilies ( SwDocShell & rDocShell ) :
SwUnoCollection ( rDocShell . GetDoc ( ) ) ,
pxCharStyles ( 0 ) ,
pxParaStyles ( 0 ) ,
pxFrameStyles ( 0 ) ,
pxPageStyles ( 0 ) ,
pxNumberingStyles ( 0 ) ,
2001-02-23 11:32:44 +00:00
pDocShell ( & rDocShell )
2000-09-18 23:08:29 +00:00
{
}
/*-- 16.12.98 15:13:26---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
SwXStyleFamilies : : ~ SwXStyleFamilies ( )
{
delete pxCharStyles ;
delete pxParaStyles ;
delete pxFrameStyles ;
delete pxPageStyles ;
delete pxNumberingStyles ;
}
/*-- 21.12.98 12:05:22---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
Any SAL_CALL SwXStyleFamilies : : getByName ( const OUString & Name )
throw (
container : : NoSuchElementException ,
lang : : WrappedTargetException ,
RuntimeException )
{
vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
// der Index kommt aus const unsigned short aStyleByIndex[] =
Any aRet ;
if ( ! IsValid ( ) )
throw RuntimeException ( ) ;
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 ;
}
/*-- 21.12.98 12:05:22---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
Sequence < OUString > SwXStyleFamilies : : getElementNames ( void ) throw ( RuntimeException )
{
Sequence < OUString > aNames ( STYLE_FAMILY_COUNT ) ;
OUString * pNames = aNames . getArray ( ) ;
pNames [ 0 ] = C2U ( " CharacterStyles " ) ;
pNames [ 1 ] = C2U ( " ParagraphStyles " ) ;
pNames [ 2 ] = C2U ( " FrameStyles " ) ;
pNames [ 3 ] = C2U ( " PageStyles " ) ;
pNames [ 4 ] = C2U ( " NumberingStyles " ) ;
return aNames ;
}
/*-- 21.12.98 12:05:22---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
sal_Bool SwXStyleFamilies : : hasByName ( const OUString & Name ) throw ( RuntimeException )
{
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 ;
}
/*-- 16.12.98 15:13:27---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
sal_Int32 SwXStyleFamilies : : getCount ( void ) throw ( RuntimeException )
{
return STYLE_FAMILY_COUNT ;
}
/*-- 16.12.98 15:13:27---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
Any SwXStyleFamilies : : getByIndex ( sal_Int32 nIndex )
throw ( lang : : IndexOutOfBoundsException , lang : : WrappedTargetException , RuntimeException )
{
vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
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 ( ) )
{
Reference < container : : XNameContainer > aRef ;
sal_uInt16 nType = aStyleByIndex [ nIndex ] ;
switch ( nType )
{
case SFX_STYLE_FAMILY_CHAR :
{
if ( ! pxCharStyles )
{
( ( SwXStyleFamilies * ) this ) - > pxCharStyles = new Reference < container : : XNameContainer > ( ) ;
* pxCharStyles = new SwXStyleFamily ( pDocShell , nType ) ;
}
aRef = * pxCharStyles ;
}
break ;
case SFX_STYLE_FAMILY_PARA :
{
if ( ! pxParaStyles )
{
( ( SwXStyleFamilies * ) this ) - > pxParaStyles = new Reference < container : : XNameContainer > ( ) ;
* pxParaStyles = new SwXStyleFamily ( pDocShell , nType ) ;
}
aRef = * pxParaStyles ;
}
break ;
case SFX_STYLE_FAMILY_PAGE :
{
if ( ! pxPageStyles )
{
( ( SwXStyleFamilies * ) this ) - > pxPageStyles = new Reference < container : : XNameContainer > ( ) ;
* pxPageStyles = new SwXStyleFamily ( pDocShell , nType ) ;
}
aRef = * pxPageStyles ;
}
break ;
case SFX_STYLE_FAMILY_FRAME :
{
if ( ! pxFrameStyles )
{
( ( SwXStyleFamilies * ) this ) - > pxFrameStyles = new Reference < container : : XNameContainer > ( ) ;
* pxFrameStyles = new SwXStyleFamily ( pDocShell , nType ) ;
}
aRef = * pxFrameStyles ;
}
break ;
case SFX_STYLE_FAMILY_PSEUDO :
{
if ( ! pxNumberingStyles )
{
( ( SwXStyleFamilies * ) this ) - > pxNumberingStyles = new Reference < container : : XNameContainer > ( ) ;
* pxNumberingStyles = new SwXStyleFamily ( pDocShell , nType ) ;
}
aRef = * pxNumberingStyles ;
}
break ;
}
aRet . setValue ( & aRef , : : getCppuType ( ( const Reference < container : : XNameContainer > * ) 0 ) ) ;
}
else
throw RuntimeException ( ) ;
return aRet ;
}
/*-- 16.12.98 15:13:27---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
Type SwXStyleFamilies : : getElementType ( void )
throw ( RuntimeException )
{
return : : getCppuType ( ( const Reference < container : : XNameContainer > * ) 0 ) ;
}
/*-- 16.12.98 15:13:28---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
sal_Bool SwXStyleFamilies : : hasElements ( void ) throw ( RuntimeException )
{
return sal_True ;
}
/*-- 16.12.98 15:13:28---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
void SwXStyleFamilies : : loadStylesFromURL ( const OUString & rURL ,
2000-10-24 14:38:05 +00:00
const Sequence < PropertyValue > & aOptions )
2000-09-18 23:08:29 +00:00
throw ( io : : IOException , RuntimeException )
{
vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
2001-02-23 11:32:44 +00:00
sal_Bool bLoadStyleText = sal_True ;
sal_Bool LoadStyleFrame = sal_True ;
sal_Bool bLoadStylePage = sal_True ;
sal_Bool bLoadStyleOverwrite = sal_True ;
sal_Bool bLoadStyleNumbering = sal_True ;
sal_Bool bLoadStyleFrame = sal_True ;
2001-05-11 09:03:31 +00:00
if ( IsValid ( ) & & rURL . getLength ( ) )
2000-09-18 23:08:29 +00:00
{
2000-11-01 09:14:33 +00:00
const Any * pVal ;
2000-09-18 23:08:29 +00:00
int nCount = aOptions . getLength ( ) ;
2000-10-24 14:38:05 +00:00
const 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 ) ;
2000-11-15 13:11:07 +00:00
ULONG nErr = pDocShell - > LoadStylesFromFile ( rURL , aOpt , TRUE ) ;
2000-11-01 09:14:33 +00:00
if ( nErr )
throw io : : IOException ( ) ;
2000-09-18 23:08:29 +00:00
}
else
throw RuntimeException ( ) ;
}
/*-- 16.12.98 15:13:28---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
2000-10-24 14:38:05 +00:00
Sequence < PropertyValue > SwXStyleFamilies : : getStyleLoaderOptions ( void )
2000-09-18 23:08:29 +00:00
throw ( RuntimeException )
{
vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
2000-10-24 14:38:05 +00:00
Sequence < PropertyValue > aSeq ( 5 ) ;
PropertyValue * pArray = aSeq . getArray ( ) ;
2000-09-18 23:08:29 +00:00
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 ( ) ) ;
2001-06-13 10:48:25 +00:00
pArray [ 0 ] = PropertyValue ( C2U ( SW_PROP_NAME_STR ( UNO_NAME_LOAD_TEXT_STYLES ) ) , - 1 , aVal , PropertyState_DIRECT_VALUE ) ;
2000-09-18 23:08:29 +00:00
aVal . setValue ( & bTemp , : : getCppuBooleanType ( ) ) ;
2001-06-13 10:48:25 +00:00
pArray [ 1 ] = PropertyValue ( C2U ( SW_PROP_NAME_STR ( UNO_NAME_LOAD_FRAME_STYLES ) ) , - 1 , aVal , PropertyState_DIRECT_VALUE ) ;
2000-09-18 23:08:29 +00:00
aVal . setValue ( & bTemp , : : getCppuBooleanType ( ) ) ;
2001-06-13 10:48:25 +00:00
pArray [ 2 ] = PropertyValue ( C2U ( SW_PROP_NAME_STR ( UNO_NAME_LOAD_PAGE_STYLES ) ) , - 1 , aVal , PropertyState_DIRECT_VALUE ) ;
2000-09-18 23:08:29 +00:00
aVal . setValue ( & bTemp , : : getCppuBooleanType ( ) ) ;
2001-06-13 10:48:25 +00:00
pArray [ 3 ] = PropertyValue ( C2U ( SW_PROP_NAME_STR ( UNO_NAME_LOAD_NUMBERING_STYLES ) ) , - 1 , aVal , PropertyState_DIRECT_VALUE ) ;
2000-09-18 23:08:29 +00:00
aVal . setValue ( & bTemp , : : getCppuBooleanType ( ) ) ;
2001-06-13 10:48:25 +00:00
pArray [ 4 ] = PropertyValue ( C2U ( SW_PROP_NAME_STR ( UNO_NAME_OVERWRITE_STYLES ) ) , - 1 , aVal , PropertyState_DIRECT_VALUE ) ;
2000-09-18 23:08:29 +00:00
return aSeq ;
}
/******************************************************************
* SwXStyleFamily
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* -----------------------------06.04.00 11:24--------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
OUString SwXStyleFamily : : getImplementationName ( void ) throw ( RuntimeException )
{
return C2U ( " SwXStyleFamily " ) ;
}
/* -----------------------------06.04.00 11:24--------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
BOOL SwXStyleFamily : : supportsService ( const OUString & rServiceName ) throw ( RuntimeException )
{
return C2U ( " com.sun.star.style.StyleFamily " ) = = rServiceName ;
}
/* -----------------------------06.04.00 11:24--------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
Sequence < OUString > SwXStyleFamily : : getSupportedServiceNames ( void ) throw ( RuntimeException )
{
Sequence < OUString > aRet ( 1 ) ;
OUString * pArray = aRet . getArray ( ) ;
pArray [ 0 ] = C2U ( " com.sun.star.style.StyleFamily " ) ;
return aRet ;
}
/*-- 16.12.98 16:03:56---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
SwXStyleFamily : : SwXStyleFamily ( SwDocShell * pDocSh , sal_uInt16 nFamily ) :
pBasePool ( pDocSh - > GetStyleSheetPool ( ) ) ,
pDocShell ( pDocSh ) ,
eFamily ( ( SfxStyleFamily ) nFamily )
{
/* switch( nFamily )
{
case SFX_STYLE_FAMILY_CHAR :
_pPropMap = aSwMapProvider . GetPropertyMap ( PROPERTY_MAP_CHAR_STYLE ) ;
break ;
case SFX_STYLE_FAMILY_PARA :
_pPropMap = aSwMapProvider . GetPropertyMap ( PROPERTY_MAP_PARA_STYLE ) ;
break ;
case SFX_STYLE_FAMILY_PAGE :
_pPropMap = aSwMapProvider . GetPropertyMap ( PROPERTY_MAP_PAGE_STYLE ) ;
break ;
case SFX_STYLE_FAMILY_FRAME :
_pPropMap = aSwMapProvider . GetPropertyMap ( PROPERTY_MAP_FRAME_STYLE ) ;
break ;
case SFX_STYLE_FAMILY_PSEUDO :
_pPropMap = aSwMapProvider . GetPropertyMap ( PROPERTY_MAP_NUM_STYLE ) ;
break ;
} */
StartListening ( * pBasePool ) ;
}
/*-- 16.12.98 16:03:56---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
SwXStyleFamily : : ~ SwXStyleFamily ( )
{
2001-10-29 14:16:14 +00:00
}
sal_Int32 lcl_GetCountOrName ( const SwDoc & rDoc , SfxStyleFamily eFamily , String * pString , sal_uInt16 nIndex = USHRT_MAX )
{
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 ;
nIndex - = nBaseCount ;
const sal_uInt16 nArrLen = rDoc . GetCharFmts ( ) - > Count ( ) ;
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 ;
nIndex - = nBaseCount ;
const sal_uInt16 nArrLen = rDoc . GetTxtFmtColls ( ) - > Count ( ) ;
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 ;
nIndex - = nBaseCount ;
const sal_uInt16 nArrLen = rDoc . GetFrmFmts ( ) - > Count ( ) ;
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 ;
nIndex - = nBaseCount ;
const sal_uInt16 nArrLen = rDoc . GetPageDescCnt ( ) ;
for ( sal_uInt16 i = 0 ; i < nArrLen ; + + i )
{
const SwPageDesc & rDesc = rDoc . GetPageDesc ( i ) ;
/*if(rDesc.IsDefault() || rDesc.IsAuto())
continue ; */
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 ;
nIndex - = nBaseCount ;
const SwNumRuleTbl & rNumTbl = rDoc . GetNumRuleTbl ( ) ;
for ( USHORT i = 0 ; i < rNumTbl . Count ( ) ; + + i )
{
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 ;
}
return nCount ;
2000-09-18 23:08:29 +00:00
}
/*-- 16.12.98 16:03:57---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
sal_Int32 SwXStyleFamily : : getCount ( void ) throw ( RuntimeException )
{
vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
2001-10-29 14:16:14 +00:00
return lcl_GetCountOrName ( * pDocShell - > GetDoc ( ) , eFamily , NULL ) ;
2000-09-18 23:08:29 +00:00
}
/*-- 16.12.98 16:03:57---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
2001-10-29 14:16:14 +00:00
Any SwXStyleFamily : : getByIndex ( sal_Int32 nTempIndex )
2000-09-18 23:08:29 +00:00
throw ( lang : : IndexOutOfBoundsException , lang : : WrappedTargetException , RuntimeException )
{
vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
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 ) )
SwStyleNameMapper : : FillUIName ( RES_POOLCHR_NORMAL_BEGIN + nIndex , sStyleName ) ;
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 ) )
SwStyleNameMapper : : FillUIName ( RES_POOLCOLL_TEXT_BEGIN + nIndex , sStyleName ) ;
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 ) )
SwStyleNameMapper : : FillUIName ( RES_POOLCOLL_EXTRA_BEGIN
- RES_POOLCOLL_LISTS_END + RES_POOLCOLL_LISTS_BEGIN
- RES_POOLCOLL_TEXT_END + RES_POOLCOLL_TEXT_BEGIN
+ nIndex , sStyleName ) ;
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 ) )
SwStyleNameMapper : : FillUIName ( 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
+ nIndex , sStyleName ) ;
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 ) )
SwStyleNameMapper : : FillUIName ( 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
+ nIndex , sStyleName ) ;
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 ) )
SwStyleNameMapper : : FillUIName ( 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
+ nIndex , sStyleName ) ;
}
break ;
case SFX_STYLE_FAMILY_FRAME :
{
if ( nIndex < ( RES_POOLFRM_END - RES_POOLFRM_BEGIN ) )
{
SwStyleNameMapper : : FillUIName ( RES_POOLFRM_BEGIN + nIndex , sStyleName ) ;
}
}
break ;
case SFX_STYLE_FAMILY_PAGE :
{
if ( nIndex < ( RES_POOLPAGE_END - RES_POOLPAGE_BEGIN ) )
{
SwStyleNameMapper : : FillUIName ( RES_POOLPAGE_BEGIN + nIndex , sStyleName ) ;
}
}
break ;
case SFX_STYLE_FAMILY_PSEUDO :
{
if ( nIndex < ( RES_POOLNUMRULE_END - RES_POOLNUMRULE_BEGIN ) )
{
SwStyleNameMapper : : FillUIName ( RES_POOLNUMRULE_BEGIN + nIndex , sStyleName ) ;
}
}
break ;
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 )
{
Reference < style : : XStyle > xStyle = _FindStyle ( sStyleName ) ;
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 ) ;
}
aRet . setValue ( & xStyle , : : getCppuType ( ( Reference < style : : XStyle > * ) 0 ) ) ;
}
else
throw container : : NoSuchElementException ( ) ;
}
else
throw lang : : IndexOutOfBoundsException ( ) ;
2000-09-18 23:08:29 +00:00
}
else
2001-10-29 14:16:14 +00:00
throw 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
}
/*-- 16.12.98 16:03:57---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
Any SwXStyleFamily : : getByName ( const OUString & rName )
throw ( container : : NoSuchElementException , lang : : WrappedTargetException , RuntimeException )
{
vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
Any aRet ;
2001-08-16 11:33:56 +00:00
String sStyleName ;
SwStyleNameMapper : : FillUIName ( rName , sStyleName , lcl_GetSwEnumFromSfxEnum ( eFamily ) , sal_True ) ;
2000-09-18 23:08:29 +00:00
if ( pBasePool )
{
pBasePool - > SetSearchMask ( eFamily , SFXSTYLEBIT_ALL ) ;
SfxStyleSheetBase * pBase = pBasePool - > Find ( sStyleName ) ;
if ( pBase )
{
2001-10-29 14:16:14 +00:00
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
}
aRet . setValue ( & xStyle , : : getCppuType ( ( Reference < style : : XStyle > * ) 0 ) ) ;
}
else
throw container : : NoSuchElementException ( ) ;
}
else
throw RuntimeException ( ) ;
return aRet ;
}
/*-- 16.12.98 16:03:57---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
Sequence < OUString > SwXStyleFamily : : getElementNames ( void ) throw ( RuntimeException )
{
vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
Sequence < OUString > aRet ;
if ( pBasePool )
{
SfxStyleSheetIterator * pIterator = pBasePool - > CreateIterator ( eFamily , 0xffff ) ;
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
{
SwStyleNameMapper : : FillProgName ( ( * pIterator ) [ i ] - > GetName ( ) , aString , lcl_GetSwEnumFromSfxEnum ( eFamily ) , sal_True ) ;
pArray [ i ] = OUString ( aString ) ;
}
2000-09-18 23:08:29 +00:00
delete pIterator ;
}
else
throw RuntimeException ( ) ;
return aRet ;
}
/*-- 16.12.98 16:03:57---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
sal_Bool SwXStyleFamily : : hasByName ( const OUString & rName ) throw ( RuntimeException )
{
vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
sal_Bool bRet = sal_False ;
if ( pBasePool )
{
2001-08-16 11:33:56 +00:00
String sStyleName ;
SwStyleNameMapper : : FillUIName ( rName , sStyleName , lcl_GetSwEnumFromSfxEnum ( eFamily ) , sal_True ) ;
2000-09-18 23:08:29 +00:00
pBasePool - > SetSearchMask ( eFamily , SFXSTYLEBIT_ALL ) ;
SfxStyleSheetBase * pBase = pBasePool - > Find ( sStyleName ) ;
bRet = 0 ! = pBase ;
}
else
throw RuntimeException ( ) ;
return bRet ;
}
/*-- 16.12.98 16:03:58---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
Type SwXStyleFamily : : getElementType ( void ) throw ( RuntimeException )
{
return : : getCppuType ( ( const Reference < style : : XStyle > * ) 0 ) ;
}
/*-- 16.12.98 16:03:58---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
sal_Bool SwXStyleFamily : : hasElements ( void ) throw ( RuntimeException )
{
if ( ! pBasePool )
throw RuntimeException ( ) ;
return sal_True ;
}
/*-- 16.12.98 16:03:58---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
void SwXStyleFamily : : insertByName ( const OUString & rName , const Any & rElement )
throw ( lang : : IllegalArgumentException , container : : ElementExistException , lang : : WrappedTargetException , RuntimeException )
{
vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
if ( pBasePool )
{
2001-08-16 11:33:56 +00:00
String sStyleName ;
SwStyleNameMapper : : FillUIName ( rName , sStyleName , lcl_GetSwEnumFromSfxEnum ( eFamily ) , sal_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 ( ) = =
TypeClass_INTERFACE )
{
Reference < XInterface > * pxRef =
( Reference < XInterface > * ) rElement . getValue ( ) ;
Reference < lang : : XUnoTunnel > xStyleTunnel ( * pxRef , UNO_QUERY ) ;
SwXStyle * pNewStyle = 0 ;
if ( xStyleTunnel . is ( ) )
{
pNewStyle = ( SwXStyle * ) xStyleTunnel - > getSomething (
SwXStyle : : getUnoTunnelId ( ) ) ;
}
if ( ! pNewStyle | | ! pNewStyle - > IsDescriptor ( ) | |
pNewStyle - > GetFamily ( ) ! = eFamily )
throw lang : : IllegalArgumentException ( ) ;
if ( pNewStyle )
{
2001-10-29 14:16:14 +00:00
sal_uInt16 nMask = 0xffff ;
2000-09-18 23:08:29 +00:00
if ( eFamily = = SFX_STYLE_FAMILY_PARA & & ! pNewStyle - > IsConditional ( ) )
nMask & = ~ SWSTYLEBIT_CONDCOLL ;
SfxStyleSheetBase & rNewBase = pBasePool - > Make ( sStyleName , eFamily , nMask ) ;
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 ) ;
}
//so, jetzt sollten noch die Properties des Descriptors angewandt werden
pNewStyle - > ApplyDescriptorProperties ( ) ;
}
else
throw lang : : IllegalArgumentException ( ) ;
}
else
throw lang : : IllegalArgumentException ( ) ;
}
}
else
throw RuntimeException ( ) ;
}
/*-- 16.12.98 16:03:59---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
void SwXStyleFamily : : replaceByName ( const OUString & rName , const Any & rElement )
throw ( lang : : IllegalArgumentException , container : : NoSuchElementException , lang : : WrappedTargetException , RuntimeException )
{
vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
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
Reference < style : : XStyle > xStyle = _FindStyle ( pBase - > GetName ( ) ) ;
if ( xStyle . is ( ) )
{
Reference < XUnoTunnel > xTunnel ( xStyle , UNO_QUERY ) ;
if ( xTunnel . is ( ) )
{
SwXStyle * pStyle = ( SwXStyle * ) xTunnel - > getSomething (
SwXStyle : : getUnoTunnelId ( ) ) ;
pStyle - > Invalidate ( ) ;
}
}
pBasePool - > Erase ( pBase ) ;
insertByName ( rName , rElement ) ;
}
else
throw RuntimeException ( ) ;
}
/*-- 16.12.98 16:03:59---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
void SwXStyleFamily : : removeByName ( const OUString & rName ) throw ( container : : NoSuchElementException , lang : : WrappedTargetException , RuntimeException )
{
vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
if ( pBasePool )
{
pBasePool - > SetSearchMask ( eFamily , SFXSTYLEBIT_ALL ) ;
2001-08-16 11:33:56 +00:00
String aString ;
SwStyleNameMapper : : FillUIName ( rName , aString , lcl_GetSwEnumFromSfxEnum ( eFamily ) , sal_True ) ;
SfxStyleSheetBase * pBase = pBasePool - > Find ( aString ) ;
2000-09-18 23:08:29 +00:00
if ( pBase )
pBasePool - > Erase ( pBase ) ;
else
throw container : : NoSuchElementException ( ) ;
}
else
throw RuntimeException ( ) ;
}
/*-- 16.12.98 16:03:59---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
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 ) ;
}
}
/*-- 16.12.98 16:03:59---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
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 ) ;
if ( PTR_CAST ( SwXStyle , pListener ) & & ( ( SwXStyle * ) pListener ) - > GetFamily ( ) = = eFamily & & ( ( SwXStyle * ) pListener ) - > GetStyleName ( ) = = rStyleName )
{
return ( SwXStyle * ) pListener ;
}
}
return 0 ;
}
/******************************************************************
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
class SwStyleProperties_Impl
{
const SfxItemPropertyMap * _pMap ;
2001-10-11 17:50:13 +00:00
Any * * pAnyArr ;
sal_uInt16 nArrLen ;
2000-09-18 23:08:29 +00:00
public :
SwStyleProperties_Impl ( const SfxItemPropertyMap * _pMap ) ;
~ SwStyleProperties_Impl ( ) ;
sal_Bool SetProperty ( const String & rName , Any aVal ) ;
sal_Bool GetProperty ( const String & rName , Any * & rpAny ) ;
2001-11-06 17:52:15 +00:00
sal_Bool ClearProperty ( const OUString & rPropertyName ) ;
void ClearAllProperties ( ) ;
2001-10-17 11:27:45 +00:00
void GetProperty ( const OUString & rPropertyName , const Reference < XPropertySet > & rxPropertySet , uno : : Any & rAny ) ;
2000-09-18 23:08:29 +00:00
const SfxItemPropertyMap * GetPropertyMap ( ) const { return _pMap ; }
} ;
//--------------------------------------------------------------------
//--------------------------------------------------------------------
SwStyleProperties_Impl : : SwStyleProperties_Impl ( const SfxItemPropertyMap * pMap ) :
_pMap ( pMap ) ,
nArrLen ( 0 )
{
const SfxItemPropertyMap * pTmp = _pMap ;
while ( pTmp [ nArrLen ] . nWID )
nArrLen + + ;
2001-10-11 17:50:13 +00:00
pAnyArr = new Any * [ nArrLen ] ;
for ( sal_uInt16 i = 0 ; i < nArrLen ; i + + )
2000-09-18 23:08:29 +00:00
pAnyArr [ i ] = 0 ;
}
//--------------------------------------------------------------------
//--------------------------------------------------------------------
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
}
//--------------------------------------------------------------------
//--------------------------------------------------------------------
sal_Bool SwStyleProperties_Impl : : SetProperty ( const String & rName , Any aVal )
{
sal_uInt16 nPos = 0 ;
const SfxItemPropertyMap * pTemp = _pMap ;
while ( pTemp - > pName )
{
if ( rName . EqualsAscii ( pTemp - > pName ) )
break ;
+ + nPos ;
+ + pTemp ;
}
if ( nPos < nArrLen )
{
delete pAnyArr [ nPos ] ;
2001-10-11 17:50:13 +00:00
pAnyArr [ nPos ] = new Any ( aVal ) ;
2000-09-18 23:08:29 +00:00
}
return nPos < nArrLen ;
}
2001-11-06 17:52:15 +00:00
sal_Bool SwStyleProperties_Impl : : ClearProperty ( const OUString & rName )
{
sal_uInt16 nPos = 0 ;
const SfxItemPropertyMap * pTemp = _pMap ;
while ( pTemp - > pName )
{
if ( rName . equalsAsciiL ( pTemp - > pName , pTemp - > nNameLen ) )
break ;
+ + nPos ;
+ + pTemp ;
}
if ( nPos < nArrLen )
{
delete pAnyArr [ nPos ] ;
pAnyArr [ nPos ] = 0 ;
}
return nPos < nArrLen ;
}
void SwStyleProperties_Impl : : ClearAllProperties ( )
{
for ( sal_uInt16 i = 0 ; i < nArrLen ; i + + )
{
delete pAnyArr [ i ] ;
pAnyArr [ i ] = 0 ;
}
}
2000-09-18 23:08:29 +00:00
//--------------------------------------------------------------------
//--------------------------------------------------------------------
sal_Bool SwStyleProperties_Impl : : GetProperty ( const String & rName , Any * & rpAny )
{
sal_uInt16 nPos = 0 ;
const SfxItemPropertyMap * pTemp = _pMap ;
while ( pTemp - > pName )
{
if ( rName . EqualsAscii ( pTemp - > pName ) )
break ;
+ + nPos ;
+ + pTemp ;
}
if ( nPos < nArrLen )
rpAny = pAnyArr [ nPos ] ;
2001-10-11 17:50:13 +00:00
return nPos < nArrLen ;
2000-09-18 23:08:29 +00:00
}
2001-10-17 11:27:45 +00:00
void SwStyleProperties_Impl : : GetProperty ( const OUString & rPropertyName , const Reference < XPropertySet > & rxPropertySet , uno : : Any & rAny )
{
rAny = rxPropertySet - > getPropertyValue ( rPropertyName ) ;
}
2000-09-18 23:08:29 +00:00
/******************************************************************
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* -----------------------------10.03.00 18:02--------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
const Sequence < sal_Int8 > & SwXStyle : : getUnoTunnelId ( )
{
static Sequence < sal_Int8 > aSeq = : : CreateUnoTunnelId ( ) ;
return aSeq ;
}
/* -----------------------------10.03.00 18:04--------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
sal_Int64 SAL_CALL SwXStyle : : getSomething ( const Sequence < sal_Int8 > & rId )
throw ( RuntimeException )
{
if ( rId . getLength ( ) = = 16
& & 0 = = rtl_compareMemory ( getUnoTunnelId ( ) . getConstArray ( ) ,
rId . getConstArray ( ) , 16 ) )
{
return ( sal_Int64 ) this ;
}
return 0 ;
}
TYPEINIT1 ( SwXStyle , SfxListener ) ;
/* -----------------------------06.04.00 11:24--------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
OUString SwXStyle : : getImplementationName ( void ) throw ( RuntimeException )
{
return C2U ( " SwXStyle " ) ;
}
/* -----------------------------06.04.00 11:24--------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
BOOL SwXStyle : : supportsService ( const OUString & rServiceName ) throw ( RuntimeException )
{
BOOL bRet = C2U ( " com.sun.star.style.Style " ) = = rServiceName ;
if ( ! bRet & & SFX_STYLE_FAMILY_CHAR = = eFamily )
2003-11-07 14:13:39 +00:00
bRet = ! rServiceName . compareToAscii ( " com.sun.star.style.CharacterStyle " ) | |
! rServiceName . compareToAscii ( " com.sun.star.style.CharacterProperties " ) | |
2002-09-26 06:18:30 +00:00
! rServiceName . compareToAscii ( " com.sun.star.style.CharacterPropertiesAsian " ) | |
! rServiceName . compareToAscii ( " com.sun.star.style.CharacterPropertiesComplex " ) ;
2000-09-18 23:08:29 +00:00
if ( ! bRet & & SFX_STYLE_FAMILY_PARA = = eFamily )
bRet = ( C2U ( " com.sun.star.style.ParagraphStyle " ) = = rServiceName ) | |
2002-09-26 06:18:30 +00:00
( C2U ( " com.sun.star.style.ParagraphProperties " ) = = rServiceName ) | |
( C2U ( " com.sun.star.style.ParagraphPropertiesAsian " ) = = rServiceName ) | |
( C2U ( " com.sun.star.style.ParagraphPropertiesComplex " ) = = rServiceName ) ;
2001-10-04 11:35:13 +00:00
if ( ! bRet & & SFX_STYLE_FAMILY_PAGE = = eFamily )
2003-11-07 14:13:39 +00:00
bRet = ( C2U ( " com.sun.star.style.PageStyle " ) = = rServiceName ) | |
( C2U ( " com.sun.star.style.PageProperties " ) = = rServiceName ) ;
2000-09-18 23:08:29 +00:00
return bRet ;
}
/* -----------------------------06.04.00 11:24--------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
Sequence < OUString > SwXStyle : : getSupportedServiceNames ( void ) throw ( RuntimeException )
{
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 ;
2000-09-18 23:08:29 +00:00
Sequence < OUString > aRet ( nCount ) ;
OUString * pArray = aRet . getArray ( ) ;
pArray [ 0 ] = C2U ( " com.sun.star.style.Style " ) ;
switch ( eFamily )
{
2001-04-23 09:01:41 +00:00
case SFX_STYLE_FAMILY_CHAR :
2003-11-07 14:13:39 +00:00
pArray [ 1 ] = C2U ( " com.sun.star.style.CharacterStyle " ) ;
pArray [ 2 ] = C2U ( " com.sun.star.style.CharacterProperties " ) ;
pArray [ 3 ] = C2U ( " com.sun.star.style.CharacterPropertiesAsian " ) ;
pArray [ 4 ] = C2U ( " 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 :
2003-11-07 14:13:39 +00:00
pArray [ 1 ] = C2U ( " com.sun.star.style.PageStyle " ) ;
pArray [ 2 ] = C2U ( " 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 :
pArray [ 1 ] = C2U ( " com.sun.star.style.ParagraphStyle " ) ;
pArray [ 2 ] = C2U ( " com.sun.star.style.ParagraphProperties " ) ;
2002-09-26 06:18:30 +00:00
pArray [ 3 ] = C2U ( " com.sun.star.style.ParagraphPropertiesAsian " ) ;
pArray [ 4 ] = C2U ( " com.sun.star.style.ParagraphPropertiesComplex " ) ;
2000-09-18 23:08:29 +00:00
if ( bIsConditional )
2002-09-26 06:18:30 +00:00
pArray [ 5 ] = C2U ( " com.sun.star.style.ConditionalParagraphStyle " ) ;
2000-09-18 23:08:29 +00:00
break ;
}
return aRet ;
}
/*-- 17.12.98 08:26:49---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
2001-10-17 11:27:45 +00:00
SwXStyle : : SwXStyle ( SwDoc * pDoc , SfxStyleFamily eFam , BOOL bConditional ) :
m_pDoc ( pDoc ) ,
2000-09-18 23:08:29 +00:00
bIsDescriptor ( sal_True ) ,
bIsConditional ( bConditional ) ,
eFamily ( eFam ) ,
pBasePool ( 0 )
{
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
Reference < XModel > xModel = pDoc - > GetDocShell ( ) - > GetBaseModel ( ) ;
// Ask the model for it's family supplier interface
Reference < XStyleFamiliesSupplier > xFamilySupplier ( xModel , UNO_QUERY ) ;
// Get the style families
Reference < XNameAccess > xFamilies = xFamilySupplier - > getStyleFamilies ( ) ;
Any aAny ;
sal_uInt16 nMapId ;
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 ;
//aAny = mxStyleFamily->getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Standard" ) ) );
//aAny >>= mxStyleData;
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 ;
2000-09-18 23:08:29 +00:00
}
pPropImpl = new SwStyleProperties_Impl ( aSwMapProvider . GetPropertyMap ( nMapId ) ) ;
}
2001-10-17 11:27:45 +00:00
2000-09-18 23:08:29 +00:00
SwXStyle : : SwXStyle ( SfxStyleSheetBasePool & rPool , SfxStyleFamily eFam ,
SwDoc * pDoc , const String & rStyleName ) :
sStyleName ( rStyleName ) ,
pBasePool ( & rPool ) ,
eFamily ( eFam ) ,
m_pDoc ( pDoc ) ,
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 ) ;
2001-10-24 14:51:20 +00:00
DBG_ASSERT ( pBase , " where is the style? " ) ;
2000-09-18 23:08:29 +00:00
if ( pBase )
{
2001-10-29 14:16:14 +00:00
const sal_uInt16 nId = SwStyleNameMapper : : GetPoolIdFromUIName ( sStyleName , 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 ( ) ;
}
}
}
/*-- 17.12.98 08:26:50---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
SwXStyle : : ~ SwXStyle ( )
{
if ( pBasePool )
EndListening ( * pBasePool ) ;
delete pPropImpl ;
}
/*-- 17.12.98 08:26:51---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
2001-10-17 11:27:45 +00:00
void SwXStyle : : Modify ( SfxPoolItem * pOld , SfxPoolItem * pNew )
{
ClientModify ( this , pOld , pNew ) ;
if ( ! GetRegisteredIn ( ) )
{
m_pDoc = 0 ;
mxStyleData . clear ( ) ;
mxStyleFamily . clear ( ) ;
}
}
2000-09-18 23:08:29 +00:00
OUString SwXStyle : : getName ( void ) throw ( RuntimeException )
{
vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
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 ) ;
2001-10-24 14:51:20 +00:00
DBG_ASSERT ( pBase , " where is the style? " ) ;
2000-09-18 23:08:29 +00:00
if ( ! pBase )
throw RuntimeException ( ) ;
2001-08-16 11:33:56 +00:00
SwStyleNameMapper : : FillProgName ( pBase - > GetName ( ) , aString , lcl_GetSwEnumFromSfxEnum ( eFamily ) , sal_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
}
/*-- 17.12.98 08:26:51---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
void SwXStyle : : setName ( const OUString & rName ) throw ( RuntimeException )
{
vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
if ( pBasePool )
{
pBasePool - > SetSearchMask ( eFamily , SFXSTYLEBIT_ALL ) ;
SfxStyleSheetBase * pBase = pBasePool - > Find ( sStyleName ) ;
2001-10-24 14:51:20 +00:00
DBG_ASSERT ( pBase , " where is the style? " ) ;
2000-09-18 23:08:29 +00:00
sal_Bool bExcept = sal_True ;
if ( pBase & & pBase - > IsUserDefined ( ) )
{
SwDocStyleSheet aTmp ( * ( SwDocStyleSheet * ) pBase ) ;
2001-05-11 09:03:31 +00:00
bExcept = ! aTmp . SetName ( rName ) ;
2000-09-18 23:08:29 +00:00
if ( ! bExcept )
sStyleName = String ( rName ) ;
}
if ( bExcept )
throw RuntimeException ( ) ;
}
else
sStyleName = String ( rName ) ;
}
/*-- 17.12.98 08:26:51---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
sal_Bool SwXStyle : : isUserDefined ( void ) throw ( RuntimeException )
{
vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
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
throw RuntimeException ( ) ;
return bRet ;
}
/*-- 17.12.98 08:26:51---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
sal_Bool SwXStyle : : isInUse ( void ) throw ( RuntimeException )
{
vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
sal_Bool bRet = sal_False ;
if ( pBasePool )
{
pBasePool - > SetSearchMask ( eFamily , SFXSTYLEBIT_USED ) ;
SfxStyleSheetBase * pBase = pBasePool - > Find ( sStyleName ) ;
if ( pBase )
bRet = pBase - > IsUsed ( ) ;
}
else
throw RuntimeException ( ) ;
return bRet ;
}
/*-- 17.12.98 08:26:52---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
OUString SwXStyle : : getParentStyle ( void ) throw ( RuntimeException )
{
vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
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
throw RuntimeException ( ) ;
2001-08-16 11:33:56 +00:00
SwStyleNameMapper : : FillProgName ( aString , aString , lcl_GetSwEnumFromSfxEnum ( eFamily ) , sal_True ) ;
return OUString ( aString ) ;
2000-09-18 23:08:29 +00:00
}
/*-- 17.12.98 08:26:52---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
void SwXStyle : : setParentStyle ( const OUString & rParentStyle )
throw ( container : : NoSuchElementException , RuntimeException )
{
vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
2001-08-16 11:33:56 +00:00
String sParentStyle ;
SwStyleNameMapper : : FillUIName ( rParentStyle , sParentStyle , lcl_GetSwEnumFromSfxEnum ( eFamily ) , sal_True ) ;
2000-09-18 23:08:29 +00:00
if ( pBasePool )
{
pBasePool - > SetSearchMask ( eFamily ) ;
BOOL bExcept = FALSE ;
SfxStyleSheetBase * pBase = pBasePool - > Find ( sStyleName ) ;
if ( pBase )
{
SwDocStyleSheet aBase ( * ( SwDocStyleSheet * ) pBase ) ;
if ( aBase . GetParent ( ) ! = sParentStyle )
{
bExcept = ! aBase . SetParent ( sParentStyle ) ;
}
}
else
bExcept = TRUE ;
if ( bExcept )
throw RuntimeException ( ) ;
}
else if ( bIsDescriptor )
{
sParentStyleName = String ( sParentStyle ) ;
2001-10-17 11:27:45 +00:00
try
{
Any aAny = mxStyleFamily - > getByName ( sParentStyle ) ;
aAny > > = mxStyleData ;
}
catch ( container : : NoSuchElementException & )
{
}
catch ( WrappedTargetException & )
{
}
catch ( RuntimeException & )
{
}
2000-09-18 23:08:29 +00:00
}
else
throw RuntimeException ( ) ;
}
/*-- 17.12.98 08:26:52---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
2006-12-01 14:52:41 +00:00
Reference < XPropertySetInfo > lcl_getPropertySetInfo ( SfxStyleFamily eFamily , sal_Bool bIsConditional )
2000-09-18 23:08:29 +00:00
{
2000-10-24 14:38:05 +00:00
Reference < XPropertySetInfo > xRet ;
2000-09-18 23:08:29 +00:00
switch ( eFamily )
{
case SFX_STYLE_FAMILY_CHAR :
{
2000-10-24 14:38:05 +00:00
static Reference < XPropertySetInfo > xCharRef ;
2000-09-18 23:08:29 +00:00
if ( ! xCharRef . is ( ) )
{
SfxItemPropertySet aPropSet (
aSwMapProvider . GetPropertyMap ( PROPERTY_MAP_CHAR_STYLE ) ) ;
xCharRef = aPropSet . getPropertySetInfo ( ) ;
}
xRet = xCharRef ;
}
break ;
case SFX_STYLE_FAMILY_PARA :
{
2000-10-24 14:38:05 +00:00
static Reference < XPropertySetInfo > xParaRef ;
2000-09-18 23:08:29 +00:00
if ( ! xParaRef . is ( ) )
{
2005-11-11 12:16:07 +00:00
sal_uInt16 nMapId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE ;
2000-09-18 23:08:29 +00:00
SfxItemPropertySet aPropSet (
2005-11-11 12:16:07 +00:00
aSwMapProvider . GetPropertyMap ( nMapId ) ) ;
2000-09-18 23:08:29 +00:00
xParaRef = aPropSet . getPropertySetInfo ( ) ;
}
xRet = xParaRef ;
}
break ;
case SFX_STYLE_FAMILY_PAGE :
{
2000-10-24 14:38:05 +00:00
static Reference < XPropertySetInfo > xPageRef ;
2000-09-18 23:08:29 +00:00
if ( ! xPageRef . is ( ) )
{
SfxItemPropertySet aPropSet (
aSwMapProvider . GetPropertyMap ( PROPERTY_MAP_PAGE_STYLE ) ) ;
xPageRef = aPropSet . getPropertySetInfo ( ) ;
}
xRet = xPageRef ;
}
break ;
case SFX_STYLE_FAMILY_FRAME :
{
2000-10-24 14:38:05 +00:00
static Reference < XPropertySetInfo > xFrameRef ;
2000-09-18 23:08:29 +00:00
if ( ! xFrameRef . is ( ) )
{
SfxItemPropertySet aPropSet (
aSwMapProvider . GetPropertyMap ( PROPERTY_MAP_FRAME_STYLE ) ) ;
xFrameRef = aPropSet . getPropertySetInfo ( ) ;
}
xRet = xFrameRef ;
}
break ;
case SFX_STYLE_FAMILY_PSEUDO :
{
2000-10-24 14:38:05 +00:00
static Reference < XPropertySetInfo > xNumRef ;
2000-09-18 23:08:29 +00:00
if ( ! xNumRef . is ( ) )
{
SfxItemPropertySet aPropSet (
aSwMapProvider . GetPropertyMap ( PROPERTY_MAP_NUM_STYLE ) ) ;
xNumRef = aPropSet . getPropertySetInfo ( ) ;
}
xRet = xNumRef ;
}
break ;
}
return xRet ;
}
2006-12-01 14:52:41 +00:00
Reference < XPropertySetInfo > SwXStyle : : getPropertySetInfo ( void )
throw ( RuntimeException )
{
return lcl_getPropertySetInfo ( eFamily , bIsConditional ) ;
}
2000-09-18 23:08:29 +00:00
/* -----------------23.04.99 13:28-------------------
*
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
void SwXStyle : : ApplyDescriptorProperties ( )
{
bIsDescriptor = sal_False ;
2001-10-17 11:27:45 +00:00
mxStyleData . clear ( ) ;
mxStyleFamily . clear ( ) ;
2000-09-18 23:08:29 +00:00
const SfxItemPropertyMap * pTemp = pPropImpl - > GetPropertyMap ( ) ;
while ( pTemp - > nWID )
{
Any * pAny ;
String sPropName ( C2S ( pTemp - > pName ) ) ;
OUString sUPropName ( sPropName ) ;
pPropImpl - > GetProperty ( sPropName , pAny ) ;
if ( pAny )
setPropertyValue ( sUPropName , * pAny ) ;
pTemp + + ;
}
}
2001-04-19 09:40:06 +00:00
/*-- 18.04.01 13:07:27---------------------------------------------------
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 ;
SwDocStyleSheet * pNewBase ;
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 ) ,
rStyleName ( rName ) ,
pNewBase ( 0 ) ,
pItemSet ( 0 ) ,
pOldPageDesc ( 0 ) ,
2001-04-27 11:03:25 +00:00
nPDescPos ( 0xffff )
2001-04-25 10:55:37 +00:00
{ }
2001-04-27 11:03:25 +00:00
~ SwStyleBase_Impl ( ) { delete pNewBase ; delete pItemSet ; }
2000-09-18 23:08:29 +00:00
2001-04-19 09:40:06 +00:00
sal_Bool HasItemSet ( ) { return 0 ! = pNewBase ; }
SfxItemSet & GetItemSet ( )
{
DBG_ASSERT ( pNewBase , " no SwDocStyleSheet available " )
if ( ! pItemSet )
pItemSet = new SfxItemSet ( pNewBase - > GetItemSet ( ) ) ;
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
/* -----------------------------25.04.01 12:44--------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
const SwPageDesc & SwStyleBase_Impl : : GetOldPageDesc ( )
{
if ( ! pOldPageDesc )
{
sal_uInt16 i ;
sal_uInt16 nPDescCount = rDoc . GetPageDescCnt ( ) ;
for ( i = 0 ; i < nPDescCount ; i + + )
{
2004-05-25 14:07:30 +00:00
const SwPageDesc & rDesc =
const_cast < const SwDoc & > ( rDoc ) . GetPageDesc ( i ) ;
2001-04-25 10:55:37 +00:00
if ( rDesc . GetName ( ) = = rStyleName )
{
pOldPageDesc = & rDesc ;
nPDescPos = i ;
break ;
}
}
if ( ! pOldPageDesc )
{
for ( i = RC_POOLPAGEDESC_BEGIN ; i < = STR_POOLPAGE_ENDNOTE ; + + i )
{
const String aFmtName ( SW_RES ( i ) ) ;
if ( aFmtName = = rStyleName )
{
pOldPageDesc = rDoc . GetPageDescFromPool ( RES_POOLPAGE_BEGIN + i - RC_POOLPAGEDESC_BEGIN ) ;
break ;
}
}
for ( i = 0 ; i < nPDescCount + 1 ; i + + )
{
2004-05-25 14:07:30 +00:00
const SwPageDesc & rDesc =
const_cast < const SwDoc & > ( rDoc ) . GetPageDesc ( i ) ;
2001-04-25 10:55:37 +00:00
if ( rDesc . GetName ( ) = = rStyleName )
{
nPDescPos = i ;
break ;
}
}
}
}
return * pOldPageDesc ;
}
2001-04-19 09:40:06 +00:00
/* -----------------------------19.04.01 09:44--------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
2005-11-11 12:16:07 +00:00
2001-04-19 09:40:06 +00:00
void lcl_SetStyleProperty ( const SfxItemPropertyMap * pMap ,
SfxItemPropertySet & rPropSet ,
const Any & rValue ,
SwStyleBase_Impl & rBase ,
SfxStyleSheetBasePool * pBasePool ,
SwDoc * pDoc ,
SfxStyleFamily eFamily )
throw ( PropertyVetoException , IllegalArgumentException ,
WrappedTargetException , RuntimeException )
{
switch ( pMap - > nWID )
2000-09-18 23:08:29 +00:00
{
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 ) )
throw IllegalArgumentException ( ) ;
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 )
throw IllegalArgumentException ( ) ;
else
{
SfxItemSet & rStyleSet = rBase . GetItemSet ( ) ;
SfxItemSet aSet ( * rStyleSet . GetPool ( ) , pMap - > nWID , pMap - > nWID ) ;
aSet . SetParent ( & rStyleSet ) ;
rPropSet . setPropertyValue ( * pMap , makeAny ( static_cast < sal_Int8 > ( nBin = = USHRT_MAX - 1 ? - 1 : nBin ) ) , aSet ) ;
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
{
2001-04-19 09:40:06 +00:00
if ( rValue . getValueType ( ) = = : : getCppuType ( ( Reference < container : : XIndexReplace > * ) 0 ) )
2000-09-18 23:08:29 +00:00
{
2001-04-19 09:40:06 +00:00
Reference < container : : XIndexReplace > * pxRulesRef =
( Reference < container : : XIndexReplace > * ) rValue . getValue ( ) ;
Reference < lang : : XUnoTunnel > xNumberTunnel ( * pxRulesRef , UNO_QUERY ) ;
SwXNumberingRules * pSwXRules = 0 ;
if ( xNumberTunnel . is ( ) )
2000-09-18 23:08:29 +00:00
{
2001-04-19 09:40:06 +00:00
pSwXRules = ( SwXNumberingRules * )
xNumberTunnel - > getSomething (
SwXNumberingRules : : getUnoTunnelId ( ) ) ;
}
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 ( ) ;
sal_uInt16 nChCount = pFmts - > Count ( ) ;
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 (
pCharStyleNames [ i ] ! = SwXNumberingRules : : GetInvalidStyle ( ) & &
( ( pCharStyleNames [ i ] . Len ( ) & & ! pFmt - > GetCharFmt ( ) ) | |
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
if ( pBulletFontNames [ i ] ! = SwXNumberingRules : : GetInvalidStyle ( ) & &
( ( pBulletFontNames [ i ] . Len ( ) & & ! pFmt - > GetBulletFont ( ) ) | |
pBulletFontNames [ i ] . Len ( ) & &
pFmt - > GetBulletFont ( ) - > GetName ( ) ! = pBulletFontNames [ i ] ) )
{
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
}
}
2001-04-19 09:40:06 +00:00
rBase . pNewBase - > SetNumRule ( aSetRule ) ;
2000-09-18 23:08:29 +00:00
}
2001-04-19 09:40:06 +00:00
}
else
throw lang : : IllegalArgumentException ( ) ;
}
break ;
2004-11-26 12:28:14 +00:00
case FN_UNO_DEFAULT_OUTLINE_LEVEL :
{
sal_Int8 nLevel ;
if ( rValue > > = nLevel )
rBase . pNewBase - > GetCollection ( ) - > SetOutlineLevel ( nLevel ) ;
else
rBase . pNewBase - > GetCollection ( ) - > SetOutlineLevel ( NO_NUMBERING ) ;
}
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 ;
SwStyleNameMapper : : FillUIName ( sTmp , aString , lcl_GetSwEnumFromSfxEnum ( eFamily ) , sal_True ) ;
rBase . pNewBase - > SetFollow ( aString ) ;
2001-04-19 09:40:06 +00:00
}
break ;
case RES_PAGEDESC :
if ( MID_PAGEDESC_PAGEDESCNAME ! = pMap - > nMemberId )
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 ;
SwStyleNameMapper : : FillUIName ( uDescName , sDescName , GET_POOLID_PAGEDESC , sal_True ) ;
2001-04-19 09:40:06 +00:00
if ( ! pNewDesc - > GetPageDesc ( ) | | pNewDesc - > GetPageDesc ( ) - > GetName ( ) ! = sDescName )
{
sal_uInt16 nCount = pDoc - > GetPageDescCnt ( ) ;
sal_Bool bPut = sal_False ;
if ( sDescName . Len ( ) )
{
SwPageDesc * pPageDesc = : : GetPageDescByName_Impl ( * pDoc , sDescName ) ;
if ( pPageDesc )
2000-09-18 23:08:29 +00:00
{
2001-04-19 09:40:06 +00:00
pPageDesc - > Add ( pNewDesc ) ;
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 :
{
BOOL bAuto = * ( sal_Bool * ) rValue . getValue ( ) ;
if ( SFX_STYLE_FAMILY_PARA = = eFamily )
rBase . pNewBase - > GetCollection ( ) - > SetAutoUpdateFmt ( bAuto ) ;
else if ( SFX_STYLE_FAMILY_FRAME = = eFamily )
rBase . pNewBase - > GetFrmFmt ( ) - > SetAutoUpdateFmt ( bAuto ) ;
}
break ;
2005-11-11 12:16:07 +00:00
case FN_UNO_PARA_STYLE_CONDITIONS :
{
uno : : Sequence < beans : : NamedValue > aSeq ;
if ( ! ( rValue > > = aSeq ) )
throw IllegalArgumentException ( ) ;
DBG_ASSERT ( COND_COMMAND_COUNT = = 28 ,
" invalid size of comman count? " ) ;
const beans : : NamedValue * pSeq = aSeq . getConstArray ( ) ;
sal_Int32 nLen = aSeq . getLength ( ) ;
sal_Bool bFailed = sal_False ;
SwCondCollItem aCondItem ;
for ( USHORT i = 0 ; i < nLen ; i + + )
{
OUString aTmp ;
if ( ( pSeq [ i ] . Value > > = aTmp ) )
{
// get UI style name from programmatic style name
String aStyleName ;
SwStyleNameMapper : : FillUIName ( aTmp , aStyleName , lcl_GetSwEnumFromSfxEnum ( eFamily ) , sal_True ) ;
//
// check for correct context and style name
//
sal_Int16 nIdx = GetCommandContextIndex ( pSeq [ i ] . Name ) ;
//
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 ( ) ;
}
//
if ( nIdx = = - 1 | | ! bStyleFound )
{
bFailed = sal_True ;
break ;
}
aCondItem . SetStyle ( & aStyleName , nIdx ) ;
}
else
bFailed = sal_True ;
}
if ( bFailed )
throw IllegalArgumentException ( ) ;
rBase . GetItemSet ( ) . Put ( aCondItem ) ;
}
break ;
2001-04-19 09:40:06 +00:00
case FN_UNO_CATEGORY :
{
if ( ! rBase . pNewBase - > IsUserDefined ( ) )
throw lang : : IllegalArgumentException ( ) ;
short nSet ;
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 )
{
case ParagraphStyleCategory : : TEXT :
2002-10-24 08:35:02 +00:00
nId = SWSTYLEBIT_TEXT ;
2001-04-19 09:40:06 +00:00
break ;
case ParagraphStyleCategory : : CHAPTER :
2002-10-24 08:35:02 +00:00
nId = SWSTYLEBIT_CHAPTER ;
2001-04-19 09:40:06 +00:00
break ;
case ParagraphStyleCategory : : LIST :
2002-10-24 08:35:02 +00:00
nId = SWSTYLEBIT_LIST ;
2001-04-19 09:40:06 +00:00
break ;
case ParagraphStyleCategory : : INDEX :
2002-10-24 08:35:02 +00:00
nId = SWSTYLEBIT_IDX ;
2001-04-19 09:40:06 +00:00
break ;
case ParagraphStyleCategory : : EXTRA :
2002-10-24 08:35:02 +00:00
nId = SWSTYLEBIT_EXTRA ;
2001-04-19 09:40:06 +00:00
break ;
case 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 ( ) ;
}
2002-10-24 08:35:02 +00:00
rBase . pNewBase - > SetMask ( nId | SFXSTYLEBIT_USERDEF ) ;
2001-04-19 09:40:06 +00:00
}
break ;
case SID_SWREGISTER_COLLECTION :
{
OUString sName ;
rValue > > = sName ;
SwRegisterItem aReg ( sName . getLength ( ) ! = 0 ) ;
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 ;
SwStyleNameMapper : : FillUIName ( sName , aString , GET_POOLID_TXTCOLL , sal_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 :
if ( MID_RUBY_CHARSTYLE = = pMap - > nMemberId )
{
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 ;
SwStyleNameMapper : : FillUIName ( sTmp , sStyle , GET_POOLID_CHRFMT , sal_True ) ;
2001-04-19 09:40:06 +00:00
pRuby - > SetCharFmtName ( sTmp ) ;
pRuby - > SetCharFmtId ( 0 ) ;
if ( sTmp . getLength ( ) )
2000-09-18 23:08:29 +00:00
{
2001-07-19 15:35:09 +00:00
sal_uInt16 nId = SwStyleNameMapper : : GetPoolIdFromUIName ( sTmp , 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 ;
break ;
case RES_PARATR_DROP :
{
if ( MID_DROPCAP_CHAR_STYLE_NAME = = pMap - > nMemberId )
{
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 ;
SwStyleNameMapper : : FillUIName ( uStyle , sStyle , GET_POOLID_CHRFMT , sal_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 ( ) ;
SfxItemSet aSet ( * rStyleSet . GetPool ( ) , pMap - > nWID , pMap - > nWID ) ;
2001-05-04 07:47:42 +00:00
aSet . SetParent ( & rStyleSet ) ;
2001-04-19 09:40:06 +00:00
rPropSet . setPropertyValue ( * pMap , rValue , aSet ) ;
rStyleSet . Put ( aSet ) ;
2006-11-01 14:19:49 +00:00
// --> OD 2006-10-18 #i70223#
if ( SFX_STYLE_FAMILY_PARA = = eFamily & &
pMap - > nWID = = RES_PARATR_NUMRULE & &
rBase . pNewBase & & rBase . pNewBase - > GetCollection ( ) & &
rBase . pNewBase - > GetCollection ( ) - > GetOutlineLevel ( ) < MAXLEVEL /* assigned to list level of outline style */ )
{
OUString sNewNumberingRuleName ;
rValue > > = sNewNumberingRuleName ;
String sTmp ( sNewNumberingRuleName ) ;
if ( sNewNumberingRuleName . getLength ( ) = = 0 | |
sTmp ! = pDoc - > GetOutlineNumRule ( ) - > GetName ( ) )
{
// delete assignment to list level of outline style.
rBase . pNewBase - > GetCollection ( ) - > SetOutlineLevel ( NO_NUMBERING ) ;
}
}
2001-04-19 09:40:06 +00:00
}
2000-09-18 23:08:29 +00:00
}
}
2001-04-19 09:40:06 +00:00
/* -----------------------------18.04.01 13:29--------------------------------
2000-09-18 23:08:29 +00:00
2001-04-19 09:40:06 +00:00
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
2003-11-07 14:13:39 +00:00
void SAL_CALL SwXStyle : : SetPropertyValues_Impl (
const uno : : Sequence < OUString > & rPropertyNames ,
const uno : : Sequence < Any > & rValues )
throw ( UnknownPropertyException , PropertyVetoException , IllegalArgumentException ,
WrappedTargetException , RuntimeException )
2000-09-18 23:08:29 +00:00
{
2001-10-17 11:27:45 +00:00
if ( ! m_pDoc )
throw RuntimeException ( ) ;
2000-09-18 23:08:29 +00:00
sal_Int8 nPropSetId = PROPERTY_SET_CHAR_STYLE ;
switch ( eFamily )
{
2005-11-11 12:16:07 +00:00
case SFX_STYLE_FAMILY_PARA : nPropSetId = bIsConditional ? PROPERTY_SET_CONDITIONAL_PARA_STYLE : PROPERTY_SET_PARA_STYLE ; break ;
case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_SET_FRAME_STYLE ; break ;
case SFX_STYLE_FAMILY_PAGE : nPropSetId = PROPERTY_SET_PAGE_STYLE ; break ;
2000-09-18 23:08:29 +00:00
case SFX_STYLE_FAMILY_PSEUDO : nPropSetId = PROPERTY_SET_NUM_STYLE ; break ;
}
2005-11-11 12:16:07 +00:00
SfxItemPropertySet & rPropSet = aSwMapProvider . GetPropertySet ( nPropSetId ) ;
const SfxItemPropertyMap * pMap = rPropSet . getPropertyMap ( ) ;
2000-09-18 23:08:29 +00:00
2001-04-19 09:40:06 +00:00
if ( rPropertyNames . getLength ( ) ! = rValues . getLength ( ) )
throw IllegalArgumentException ( ) ;
const OUString * pNames = rPropertyNames . getConstArray ( ) ;
const 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 ) ;
2001-10-24 14:51:20 +00:00
DBG_ASSERT ( pBase , " where is the style? " ) ;
2001-04-19 09:40:06 +00:00
if ( pBase )
aBaseImpl . pNewBase = new SwDocStyleSheet ( * ( SwDocStyleSheet * ) pBase ) ;
else
throw RuntimeException ( ) ;
}
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
{
pMap = SfxItemPropertyMap : : GetByName ( pMap , pNames [ nProp ] ) ;
2001-11-28 19:36:01 +00:00
2005-11-11 12:16:07 +00:00
if ( ! pMap | |
( ! bIsConditional & & pNames [ nProp ] . equalsAsciiL ( SW_PROP_NAME ( UNO_NAME_PARA_STYLE_CONDITIONS ) ) ) )
2001-11-28 19:36:01 +00:00
throw UnknownPropertyException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " Unknown property: " ) ) + pNames [ nProp ] , static_cast < cppu : : OWeakObject * > ( this ) ) ;
if ( pMap - > nFlags & PropertyAttribute : : READONLY )
2002-08-14 08:44:44 +00:00
throw PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " Property is read-only: " ) ) + pNames [ nProp ] , static_cast < cppu : : OWeakObject * > ( this ) ) ;
2001-04-19 09:40:06 +00:00
if ( aBaseImpl . pNewBase )
2000-09-18 23:08:29 +00:00
{
2005-11-11 12:16:07 +00:00
lcl_SetStyleProperty ( pMap , rPropSet , 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
throw RuntimeException ( ) ;
}
if ( aBaseImpl . HasItemSet ( ) )
aBaseImpl . pNewBase - > SetItemSet ( aBaseImpl . GetItemSet ( ) ) ;
}
2003-11-07 14:13:39 +00:00
void SwXStyle : : setPropertyValues (
const Sequence < OUString > & rPropertyNames ,
const Sequence < Any > & rValues )
throw ( PropertyVetoException , IllegalArgumentException ,
WrappedTargetException , RuntimeException )
{
vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
// workaround for bad designed API
try
{
SetPropertyValues_Impl ( rPropertyNames , rValues ) ;
}
catch ( UnknownPropertyException & rException )
{
// wrap the original (here not allowed) exception in
// a WrappedTargetException that gets thrown instead.
WrappedTargetException aWExc ;
aWExc . TargetException < < = rException ;
throw aWExc ;
}
}
2005-11-11 12:16:07 +00:00
2001-04-19 09:40:06 +00:00
Any lcl_GetStyleProperty ( const SfxItemPropertyMap * pMap ,
SfxItemPropertySet & rPropSet ,
SwStyleBase_Impl & rBase ,
SfxStyleSheetBase * pBase ,
2001-09-24 18:59:24 +00:00
SfxStyleFamily eFamily ,
SwDoc * pDoc ) throw ( RuntimeException )
2001-04-19 09:40:06 +00:00
{
Any aRet ;
if ( FN_UNO_IS_PHYSICAL = = pMap - > nWID )
{
BOOL bPhys = pBase ! = 0 ;
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 ( ) )
bPhys = FALSE ;
}
aRet . setValue ( & bPhys , : : getBooleanCppuType ( ) ) ;
}
else if ( pBase )
{
if ( ! rBase . pNewBase )
rBase . pNewBase = new SwDocStyleSheet ( * ( SwDocStyleSheet * ) pBase ) ;
switch ( pMap - > nWID )
{
2001-09-24 18:59:24 +00:00
case RES_PAPER_BIN :
{
SfxItemSet & rSet = rBase . GetItemSet ( ) ;
aRet = rPropSet . getPropertyValue ( * pMap , rSet ) ;
sal_Int8 nBin ;
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
{
2001-04-19 09:40:06 +00:00
const SwNumRule * pRule = rBase . pNewBase - > GetNumRule ( ) ;
DBG_ASSERT ( pRule , " Wo ist die NumRule? " )
Reference < container : : XIndexReplace > xRules = new SwXNumberingRules ( * pRule ) ;
aRet . setValue ( & xRules , : : getCppuType ( ( Reference < container : : XIndexReplace > * ) 0 ) ) ;
}
break ;
2004-11-26 12:28:14 +00:00
case FN_UNO_DEFAULT_OUTLINE_LEVEL :
{
DBG_ASSERT ( SFX_STYLE_FAMILY_PARA = = eFamily , " only paras " ) ;
BYTE nLevel = rBase . pNewBase - > GetCollection ( ) - > GetOutlineLevel ( ) ;
if ( nLevel ! = NO_NUMBERING )
aRet < < = static_cast < sal_Int8 > ( nLevel ) ;
}
break ;
2001-04-19 09:40:06 +00:00
case FN_UNO_FOLLOW_STYLE :
2001-08-16 11:33:56 +00:00
{
String aString ;
SwStyleNameMapper : : FillProgName ( rBase . pNewBase - > GetFollow ( ) , aString , lcl_GetSwEnumFromSfxEnum ( eFamily ) , sal_True ) ;
aRet < < = OUString ( aString ) ;
}
2001-04-19 09:40:06 +00:00
break ;
case RES_PAGEDESC :
if ( MID_PAGEDESC_PAGEDESCNAME ! = pMap - > nMemberId )
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 ;
SwStyleNameMapper : : FillProgName ( pDesc - > GetName ( ) , aString , GET_POOLID_PAGEDESC , sal_True ) ;
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 :
{
BOOL bAuto = FALSE ;
if ( SFX_STYLE_FAMILY_PARA = = eFamily )
bAuto = rBase . pNewBase - > GetCollection ( ) - > IsAutoUpdateFmt ( ) ;
else if ( SFX_STYLE_FAMILY_FRAME = = eFamily )
bAuto = rBase . pNewBase - > GetFrmFmt ( ) - > IsAutoUpdateFmt ( ) ;
aRet . setValue ( & bAuto , : : getBooleanCppuType ( ) ) ;
}
break ;
case FN_UNO_DISPLAY_NAME :
{
OUString sName ( rBase . pNewBase - > GetName ( ) ) ;
aRet < < = sName ;
}
break ;
2005-11-11 12:16:07 +00:00
case FN_UNO_PARA_STYLE_CONDITIONS :
{
DBG_ASSERT ( COND_COMMAND_COUNT = = 28 ,
" invalid size of comman count? " ) ;
//SfxItemSet& rStyleSet = rBase.GetItemSet();
uno : : Sequence < beans : : NamedValue > aSeq ( COND_COMMAND_COUNT ) ;
beans : : NamedValue * pSeq = aSeq . getArray ( ) ;
SwFmt * pFmt = ( ( SwDocStyleSheet * ) pBase ) - > GetCollection ( ) ;
const CommandStruct * pCmds = SwCondCollItem : : GetCmds ( ) ;
for ( USHORT n = 0 ; n < COND_COMMAND_COUNT ; + + n )
{
String aStyleName ;
const SwCollCondition * pCond ;
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 ( ) ;
SwStyleNameMapper : : FillProgName ( aStyleName , aStyleName , lcl_GetSwEnumFromSfxEnum ( eFamily ) , sal_True ) ;
}
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 :
{
2001-10-29 14:16:14 +00:00
sal_uInt16 nPoolId = rBase . pNewBase - > 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 :
nRet = ParagraphStyleCategory : : TEXT ;
break ;
case COLL_DOC_BITS :
nRet = ParagraphStyleCategory : : CHAPTER ;
break ;
case COLL_LISTS_BITS :
nRet = ParagraphStyleCategory : : LIST ;
break ;
case COLL_REGISTER_BITS :
nRet = ParagraphStyleCategory : : INDEX ;
break ;
case COLL_EXTRA_BITS :
nRet = ParagraphStyleCategory : : EXTRA ;
break ;
case COLL_HTML_BITS :
nRet = ParagraphStyleCategory : : HTML ;
break ;
2000-11-15 13:04:24 +00:00
}
2001-04-19 09:40:06 +00:00
aRet < < = nRet ;
}
break ;
case SID_SWREGISTER_COLLECTION :
{
const SwPageDesc * pPageDesc = rBase . pNewBase - > GetPageDesc ( ) ;
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 (
pCol - > GetName ( ) , aString , GET_POOLID_TXTCOLL , sal_True ) ;
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 ( ) ;
aRet = rPropSet . getPropertyValue ( * pMap , rSet ) ;
}
}
}
else
throw RuntimeException ( ) ;
return aRet ;
}
/* -----------------------------19.04.01 09:26--------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
2003-11-07 14:13:39 +00:00
uno : : Sequence < Any > SAL_CALL SwXStyle : : GetPropertyValues_Impl (
const uno : : Sequence < OUString > & rPropertyNames )
throw ( UnknownPropertyException , WrappedTargetException , RuntimeException )
2001-04-19 09:40:06 +00:00
{
2001-10-17 11:27:45 +00:00
if ( ! m_pDoc )
throw RuntimeException ( ) ;
2001-04-19 09:40:06 +00:00
sal_Int8 nPropSetId = PROPERTY_SET_CHAR_STYLE ;
switch ( eFamily )
{
2005-11-11 12:16:07 +00:00
case SFX_STYLE_FAMILY_PARA : nPropSetId = bIsConditional ? PROPERTY_SET_CONDITIONAL_PARA_STYLE : PROPERTY_SET_PARA_STYLE ; break ;
case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_SET_FRAME_STYLE ; break ;
case SFX_STYLE_FAMILY_PAGE : nPropSetId = PROPERTY_SET_PAGE_STYLE ; break ;
2001-04-19 09:40:06 +00:00
case SFX_STYLE_FAMILY_PSEUDO : nPropSetId = PROPERTY_SET_NUM_STYLE ; break ;
}
2005-11-11 12:16:07 +00:00
SfxItemPropertySet & rPropSet = aSwMapProvider . GetPropertySet ( nPropSetId ) ;
const SfxItemPropertyMap * pMap = rPropSet . getPropertyMap ( ) ;
2001-04-19 09:40:06 +00:00
const OUString * pNames = rPropertyNames . getConstArray ( ) ;
Sequence < Any > aRet ( rPropertyNames . getLength ( ) ) ;
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 + + )
{
pMap = SfxItemPropertyMap : : GetByName ( pMap , pNames [ nProp ] ) ;
2005-11-11 12:16:07 +00:00
if ( ! pMap | |
( ! bIsConditional & & pNames [ nProp ] . equalsAsciiL ( SW_PROP_NAME ( UNO_NAME_PARA_STYLE_CONDITIONS ) ) ) )
2001-11-28 19:36:01 +00:00
throw 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
}
2005-11-11 12:16:07 +00:00
pRet [ nProp ] = lcl_GetStyleProperty ( pMap , rPropSet , aBase , pBase , eFamily , GetDoc ( ) ) ;
2001-04-19 09:40:06 +00:00
}
else if ( bIsDescriptor )
{
2001-10-11 17:50:13 +00:00
Any * pAny = 0 ;
2001-10-17 11:27:45 +00:00
pPropImpl - > GetProperty ( pNames [ nProp ] , pAny ) ;
if ( ! pAny )
{
sal_Bool bExcept = sal_False ;
switch ( eFamily )
{
case SFX_STYLE_FAMILY_PSEUDO :
bExcept = sal_True ;
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 :
{
if ( pMap - > nWID > = POOLATTR_BEGIN & & pMap - > nWID < RES_UNKNOWNATR_END )
{
SwFmt * pFmt ;
if ( eFamily = = SFX_STYLE_FAMILY_CHAR )
pFmt = m_pDoc - > GetDfltCharFmt ( ) ;
else
pFmt = m_pDoc - > GetDfltFrmFmt ( ) ;
const SwAttrPool * pPool = pFmt - > GetAttrSet ( ) . GetPool ( ) ;
const SfxPoolItem & rItem = pPool - > GetDefaultItem ( pMap - > nWID ) ;
rItem . QueryValue ( pRet [ nProp ] , pMap - > nMemberId ) ;
}
else
bExcept = sal_True ;
}
break ;
}
if ( bExcept )
{
RuntimeException aExcept ;
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
throw RuntimeException ( ) ;
}
return aRet ;
}
2003-11-07 14:13:39 +00:00
/* -----------------------------04.11.03 09:26--------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
Sequence < Any > SwXStyle : : getPropertyValues (
const Sequence < OUString > & rPropertyNames ) throw ( RuntimeException )
{
vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
Sequence < Any > aValues ;
// workaround for bad designed API
try
{
aValues = GetPropertyValues_Impl ( rPropertyNames ) ;
}
catch ( UnknownPropertyException & )
{
throw RuntimeException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " Unknown property exception caught " ) ) , static_cast < cppu : : OWeakObject * > ( this ) ) ;
}
catch ( WrappedTargetException & )
{
throw RuntimeException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " WrappedTargetException caught " ) ) , static_cast < cppu : : OWeakObject * > ( this ) ) ;
}
return aValues ;
}
2001-04-19 09:40:06 +00:00
/*-- 18.04.01 13:07:29---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
void SwXStyle : : addPropertiesChangeListener (
const Sequence < OUString > & aPropertyNames ,
const Reference < XPropertiesChangeListener > & xListener )
throw ( RuntimeException )
{
}
/*-- 18.04.01 13:07:30---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
void SwXStyle : : removePropertiesChangeListener (
const Reference < XPropertiesChangeListener > & xListener )
throw ( RuntimeException )
{
}
/*-- 18.04.01 13:07:30---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
void SwXStyle : : firePropertiesChangeEvent (
const Sequence < OUString > & aPropertyNames ,
const Reference < XPropertiesChangeListener > & xListener )
throw ( RuntimeException )
{
}
/*-- 17.12.98 08:26:53---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
void SwXStyle : : setPropertyValue ( const OUString & rPropertyName , const Any & rValue )
throw ( UnknownPropertyException ,
PropertyVetoException ,
IllegalArgumentException ,
WrappedTargetException ,
RuntimeException )
{
2003-11-07 14:13:39 +00:00
vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
2001-04-19 09:40:06 +00:00
const Sequence < OUString > aProperties ( & rPropertyName , 1 ) ;
const Sequence < Any > aValues ( & rValue , 1 ) ;
2003-11-07 14:13:39 +00:00
SetPropertyValues_Impl ( aProperties , aValues ) ;
2001-04-19 09:40:06 +00:00
}
/*-- 17.12.98 08:26:53---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
Any SwXStyle : : getPropertyValue ( const OUString & rPropertyName )
throw ( UnknownPropertyException , lang : : WrappedTargetException , RuntimeException )
{
2003-11-07 14:13:39 +00:00
vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
2001-04-19 09:40:06 +00:00
const 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
/*-- 17.12.98 08:26:53---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
void SwXStyle : : addPropertyChangeListener ( const OUString & PropertyName ,
2000-10-24 14:38:05 +00:00
const Reference < XPropertyChangeListener > & aListener )
throw ( UnknownPropertyException , lang : : WrappedTargetException , RuntimeException )
2000-09-18 23:08:29 +00:00
{
DBG_WARNING ( " not implemented " )
}
/*-- 17.12.98 08:26:54---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
void SwXStyle : : removePropertyChangeListener ( const OUString & PropertyName ,
2000-10-24 14:38:05 +00:00
const Reference < XPropertyChangeListener > & aListener )
throw ( UnknownPropertyException , lang : : WrappedTargetException , RuntimeException )
2000-09-18 23:08:29 +00:00
{
DBG_WARNING ( " not implemented " )
}
/*-- 17.12.98 08:26:54---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
void SwXStyle : : addVetoableChangeListener ( const OUString & PropertyName ,
2000-10-24 14:38:05 +00:00
const Reference < XVetoableChangeListener > & aListener )
throw ( UnknownPropertyException , lang : : WrappedTargetException , RuntimeException )
2000-09-18 23:08:29 +00:00
{
DBG_WARNING ( " not implemented " )
}
/*-- 17.12.98 08:26:54---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
void SwXStyle : : removeVetoableChangeListener ( const OUString & PropertyName ,
2000-10-24 14:38:05 +00:00
const Reference < XVetoableChangeListener > & aListener )
throw ( UnknownPropertyException , lang : : WrappedTargetException , RuntimeException )
2000-09-18 23:08:29 +00:00
{
DBG_WARNING ( " not implemented " )
}
/*-- 08.03.99 10:50:26---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
2000-10-24 14:38:05 +00:00
PropertyState SwXStyle : : getPropertyState ( const OUString & rPropertyName )
throw ( UnknownPropertyException , RuntimeException )
2000-09-18 23:08:29 +00:00
{
vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
2000-10-24 14:38:05 +00:00
Sequence < OUString > aNames ( 1 ) ;
OUString * pNames = aNames . getArray ( ) ;
pNames [ 0 ] = rPropertyName ;
Sequence < PropertyState > aStates = getPropertyStates ( aNames ) ;
return aStates . getConstArray ( ) [ 0 ] ;
}
/*-- 08.03.99 10:50:27---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
Sequence < PropertyState > SwXStyle : : getPropertyStates (
const Sequence < OUString > & rPropertyNames )
throw ( UnknownPropertyException , RuntimeException )
{
vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
Sequence < PropertyState > aRet ( rPropertyNames . getLength ( ) ) ;
PropertyState * pStates = aRet . getArray ( ) ;
2000-09-18 23:08:29 +00:00
if ( pBasePool )
{
pBasePool - > SetSearchMask ( eFamily ) ;
SfxStyleSheetBase * pBase = pBasePool - > Find ( sStyleName ) ;
2001-10-24 14:51:20 +00:00
DBG_ASSERT ( 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 ( ) ;
2000-09-18 23:08:29 +00:00
SwDocStyleSheet aStyle ( * ( SwDocStyleSheet * ) pBase ) ;
2000-10-24 14:38:05 +00:00
sal_Int8 nPropSetId = PROPERTY_SET_CHAR_STYLE ;
switch ( eFamily )
2000-09-18 23:08:29 +00:00
{
2005-11-11 12:16:07 +00:00
case SFX_STYLE_FAMILY_PARA : nPropSetId = bIsConditional ? PROPERTY_SET_CONDITIONAL_PARA_STYLE : PROPERTY_SET_PARA_STYLE ; break ;
case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_SET_FRAME_STYLE ; break ;
case SFX_STYLE_FAMILY_PAGE : nPropSetId = PROPERTY_SET_PAGE_STYLE ; break ;
2000-10-24 14:38:05 +00:00
case SFX_STYLE_FAMILY_PSEUDO : nPropSetId = PROPERTY_SET_NUM_STYLE ; break ;
2000-09-18 23:08:29 +00:00
}
2005-11-11 12:16:07 +00:00
SfxItemPropertySet & rPropSet = aSwMapProvider . GetPropertySet ( nPropSetId ) ;
const SfxItemPropertyMap * pMap = rPropSet . getPropertyMap ( ) ;
2000-10-24 14:38:05 +00:00
SfxItemSet aSet = aStyle . GetItemSet ( ) ;
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 ] ;
2005-11-11 12:16:07 +00:00
pMap = SfxItemPropertyMap : : GetByName ( pMap , rPropName ) ;
2002-06-25 14:41:57 +00:00
if ( ! pMap )
throw UnknownPropertyException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " Unknown property: " ) ) + rPropName , static_cast < cppu : : OWeakObject * > ( this ) ) ;
if ( FN_UNO_NUM_RULES = = pMap - > nWID | |
FN_UNO_FOLLOW_STYLE = = pMap - > nWID )
2000-09-18 23:08:29 +00:00
{
2000-10-24 14:38:05 +00:00
pStates [ i ] = PropertyState_DIRECT_VALUE ;
}
2004-11-26 12:28:14 +00:00
else if ( FN_UNO_DEFAULT_OUTLINE_LEVEL = = pMap - > nWID )
{
pStates [ i ] =
( aStyle . GetCollection ( ) - > GetOutlineLevel ( )
= = NO_NUMBERING )
? PropertyState_DEFAULT_VALUE
: PropertyState_DIRECT_VALUE ;
}
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
{
2001-10-29 14:16:14 +00:00
sal_uInt16 nResId = lcl_ConvertFNToRES ( pMap - > nWID ) ;
2002-06-25 14:41:57 +00:00
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 )
pStates [ i ] = PropertyState_DIRECT_VALUE ;
else
pStates [ i ] = PropertyState_DEFAULT_VALUE ;
}
else
pStates [ i ] = PropertyState_AMBIGUOUS_VALUE ;
}
2000-10-24 14:38:05 +00:00
else
{
2005-11-11 12:16:07 +00:00
pStates [ i ] = rPropSet . getPropertyState ( * pMap , aSet ) ;
2002-06-25 14:41:57 +00:00
if ( SFX_STYLE_FAMILY_PAGE = = eFamily & &
SID_ATTR_PAGE_SIZE = = pMap - > nWID & &
PropertyState_DIRECT_VALUE = = pStates [ i ] )
{
const SvxSizeItem & rSize =
static_cast < const SvxSizeItem & > (
aSet . Get ( SID_ATTR_PAGE_SIZE ) ) ;
sal_uInt8 nMemberId = pMap - > nMemberId & 0x7f ;
if ( ( LONG_MAX = = rSize . GetSize ( ) . Width ( ) & &
( MID_SIZE_WIDTH = = nMemberId | |
MID_SIZE_SIZE = = nMemberId ) ) | |
( LONG_MAX = = rSize . GetSize ( ) . Height ( ) & &
MID_SIZE_HEIGHT = = nMemberId ) )
{
pStates [ i ] = PropertyState_DEFAULT_VALUE ;
}
}
2000-09-18 23:08:29 +00:00
}
}
}
else
throw RuntimeException ( ) ;
}
else
throw RuntimeException ( ) ;
return aRet ;
}
/*-- 08.03.99 10:50:27---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
void SwXStyle : : setPropertyToDefault ( const OUString & rPropertyName )
2000-10-24 14:38:05 +00:00
throw ( UnknownPropertyException , RuntimeException )
2001-10-24 14:51:20 +00:00
{
const Sequence < OUString > aSequence ( & rPropertyName , 1 ) ;
setPropertiesToDefault ( aSequence ) ;
}
void SAL_CALL SwXStyle : : setPropertiesToDefault ( const Sequence < OUString > & aPropertyNames )
throw ( UnknownPropertyException , RuntimeException )
2000-09-18 23:08:29 +00:00
{
vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
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 ) ;
2001-10-24 14:51:20 +00:00
DBG_ASSERT ( pBase , " Where is the style? " )
2000-09-18 23:08:29 +00:00
if ( pBase )
{
SwDocStyleSheet aStyle ( * ( SwDocStyleSheet * ) pBase ) ;
2001-10-24 14:51:20 +00:00
switch ( eFamily )
2000-09-18 23:08:29 +00:00
{
2001-11-06 17:52:15 +00:00
case SFX_STYLE_FAMILY_CHAR : pTargetFmt = aStyle . GetCharFmt ( ) ; break ;
case SFX_STYLE_FAMILY_PARA : pTargetFmt = aStyle . GetCollection ( ) ; break ;
case SFX_STYLE_FAMILY_FRAME : pTargetFmt = aStyle . 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 ;
2001-10-24 14:51:20 +00:00
SwPageDesc * pDesc = m_pDoc - > FindPageDescByName ( aStyle . GetPageDesc ( ) - > GetName ( ) , & nPgDscPos ) ;
if ( pDesc )
pTargetFmt = & pDesc - > GetMaster ( ) ;
}
break ;
case SFX_STYLE_FAMILY_PSEUDO :
break ;
2000-09-18 23:08:29 +00:00
}
2001-11-06 17:52:15 +00:00
}
}
sal_Int8 nPropSetId = PROPERTY_SET_CHAR_STYLE ;
switch ( eFamily )
{
2005-11-11 12:16:07 +00:00
case SFX_STYLE_FAMILY_PARA : nPropSetId = bIsConditional ? PROPERTY_SET_CONDITIONAL_PARA_STYLE : PROPERTY_SET_PARA_STYLE ; break ;
case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_SET_FRAME_STYLE ; break ;
case SFX_STYLE_FAMILY_PAGE : nPropSetId = PROPERTY_SET_PAGE_STYLE ; break ;
case SFX_STYLE_FAMILY_PSEUDO : nPropSetId = PROPERTY_SET_NUM_STYLE ; break ;
2001-11-06 17:52:15 +00:00
}
2005-11-11 12:16:07 +00:00
SfxItemPropertySet & rPropSet = aSwMapProvider . GetPropertySet ( nPropSetId ) ;
const SfxItemPropertyMap * pMap = rPropSet . 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 + + )
{
pMap = SfxItemPropertyMap : : GetByName ( pMap , pNames [ nProp ] ) ;
if ( ! pMap )
throw UnknownPropertyException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " Property is unknown: " ) ) + pNames [ nProp ] , static_cast < cppu : : OWeakObject * > ( this ) ) ;
if ( pMap - > nWID = = FN_UNO_FOLLOW_STYLE | | pMap - > nWID = = FN_UNO_NUM_RULES )
throw RuntimeException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " Cannot reset: " ) ) + pNames [ nProp ] , static_cast < cppu : : OWeakObject * > ( this ) ) ;
if ( pMap - > nFlags & PropertyAttribute : : READONLY )
2004-08-11 14:43:55 +00:00
throw 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
2004-11-26 12:28:14 +00:00
if ( pMap - > nWID = = FN_UNO_DEFAULT_OUTLINE_LEVEL )
static_cast < SwTxtFmtColl * > ( pTargetFmt ) - > SetOutlineLevel ( NO_NUMBERING ) ;
else
pTargetFmt - > ResetAttr ( pMap - > 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 ( )
throw ( RuntimeException )
2000-09-18 23:08:29 +00:00
{
vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
if ( pBasePool )
{
pBasePool - > SetSearchMask ( eFamily ) ;
SfxStyleSheetBase * pBase = pBasePool - > Find ( sStyleName ) ;
2001-10-24 14:51:20 +00:00
DBG_ASSERT ( pBase , " where is the style, you fiend!? " )
2000-09-18 23:08:29 +00:00
if ( pBase )
{
SwDocStyleSheet aStyle ( * ( SwDocStyleSheet * ) pBase ) ;
2001-10-24 14:51:20 +00:00
SwFmt * pTargetFmt = 0 ;
SwPageDesc * pTargetDesc = 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 :
pTargetFmt = aStyle . GetCharFmt ( ) ;
break ;
case SFX_STYLE_FAMILY_PARA :
2004-11-26 12:28:14 +00:00
{
pTargetFmt = aStyle . GetCollection ( ) ;
aStyle . GetCollection ( ) - > SetOutlineLevel ( NO_NUMBERING ) ;
}
2001-10-24 14:51:20 +00:00
break ;
case SFX_STYLE_FAMILY_FRAME :
pTargetFmt = aStyle . GetFrmFmt ( ) ;
break ;
case SFX_STYLE_FAMILY_PAGE :
{
SwPageDesc * pDesc = m_pDoc - > FindPageDescByName ( aStyle . GetPageDesc ( ) - > GetName ( ) , & nPgDscPos ) ;
if ( pDesc )
{
pTargetFmt = & pDesc - > GetMaster ( ) ;
pDesc - > SetUseOn ( PD_ALL ) ;
}
}
break ;
case SFX_STYLE_FAMILY_PSEUDO :
break ;
}
if ( pTargetFmt )
2000-09-18 23:08:29 +00:00
{
2001-10-24 14:51:20 +00:00
if ( USHRT_MAX ! = nPgDscPos )
{
2002-08-05 13:32:35 +00:00
SwPageDesc & rPageDesc = m_pDoc - > _GetPageDesc ( nPgDscPos ) ;
rPageDesc . ResetAllMasterAttr ( ) ;
2002-06-28 12:05:42 +00:00
2001-10-24 14:51:20 +00:00
SvxLRSpaceItem aLR ;
sal_Int32 nSize = GetMetricVal ( CM_1 ) * 2 ;
aLR . SetLeft ( nSize ) ;
aLR . SetLeft ( nSize ) ;
SvxULSpaceItem aUL ;
aUL . SetUpper ( static_cast < sal_uInt16 > ( nSize ) ) ;
aUL . SetLower ( static_cast < sal_uInt16 > ( nSize ) ) ;
pTargetFmt - > SetAttr ( aLR ) ;
pTargetFmt - > SetAttr ( aUL ) ;
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
{
aFrmSz . SetWidth ( LONG_MAX ) ;
aFrmSz . SetHeight ( LONG_MAX ) ;
}
}
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 ) ;
}
pTargetFmt - > SetAttr ( aFrmSz ) ;
}
else
2007-02-05 09:53:25 +00:00
{
// --> OD 2007-01-25 #i73790# - method renamed
pTargetFmt - > ResetAllFmtAttr ( ) ;
// <--
}
2001-10-24 14:51:20 +00:00
if ( USHRT_MAX ! = nPgDscPos )
2004-05-25 14:07:30 +00:00
m_pDoc - > ChgPageDesc ( nPgDscPos ,
const_cast < const SwDoc * > ( m_pDoc )
- > GetPageDesc ( nPgDscPos ) ) ;
2001-10-24 14:51:20 +00:00
}
}
else
throw RuntimeException ( ) ;
}
2001-11-06 17:52:15 +00:00
else if ( bIsDescriptor )
pPropImpl - > ClearAllProperties ( ) ;
2001-10-24 14:51:20 +00:00
else
throw RuntimeException ( ) ;
}
Sequence < Any > SAL_CALL SwXStyle : : getPropertyDefaults ( const Sequence < OUString > & aPropertyNames )
throw ( UnknownPropertyException , WrappedTargetException , RuntimeException )
{
vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
sal_Int32 nCount = aPropertyNames . getLength ( ) ;
Sequence < Any > aRet ( nCount ) ;
if ( nCount )
{
if ( pBasePool )
{
pBasePool - > SetSearchMask ( eFamily ) ;
SfxStyleSheetBase * pBase = pBasePool - > Find ( sStyleName ) ;
DBG_ASSERT ( pBase , " Doesn't seem to be a style! " )
if ( pBase )
{
SwDocStyleSheet aStyle ( * ( SwDocStyleSheet * ) pBase ) ;
2000-09-18 23:08:29 +00:00
sal_Int8 nPropSetId = PROPERTY_SET_CHAR_STYLE ;
switch ( eFamily )
{
2005-11-11 12:16:07 +00:00
case SFX_STYLE_FAMILY_PARA : nPropSetId = bIsConditional ? PROPERTY_SET_CONDITIONAL_PARA_STYLE : PROPERTY_SET_PARA_STYLE ; break ;
case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_SET_FRAME_STYLE ; break ;
case SFX_STYLE_FAMILY_PAGE : nPropSetId = PROPERTY_SET_PAGE_STYLE ; break ;
case SFX_STYLE_FAMILY_PSEUDO : nPropSetId = PROPERTY_SET_NUM_STYLE ; break ;
2000-09-18 23:08:29 +00:00
}
2005-11-11 12:16:07 +00:00
SfxItemPropertySet & rPropSet = aSwMapProvider . GetPropertySet ( nPropSetId ) ;
const SfxItemPropertyMap * pMap = rPropSet . getPropertyMap ( ) ;
2000-09-18 23:08:29 +00:00
2001-10-24 14:51:20 +00:00
const SfxItemSet & rSet = aStyle . GetItemSet ( ) , * pParentSet = rSet . GetParent ( ) ;
const OUString * pNames = aPropertyNames . getConstArray ( ) ;
Any * pRet = aRet . getArray ( ) ;
for ( sal_Int32 i = 0 ; i < nCount ; i + + )
2000-09-18 23:08:29 +00:00
{
2001-10-24 14:51:20 +00:00
pMap = SfxItemPropertyMap : : GetByName ( pMap , pNames [ i ] ) ;
if ( ! pMap )
throw UnknownPropertyException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " Unknown property: " ) ) + pNames [ i ] , static_cast < cppu : : OWeakObject * > ( this ) ) ;
if ( pParentSet )
pRet [ i ] = aSwMapProvider . GetPropertySet ( nPropSetId ) . getPropertyValue ( pNames [ i ] , * pParentSet ) ;
else if ( pMap - > nWID ! = rSet . GetPool ( ) - > GetSlotId ( pMap - > nWID ) )
{
const SfxPoolItem & rItem = rSet . GetPool ( ) - > GetDefaultItem ( pMap - > nWID ) ;
rItem . QueryValue ( pRet [ i ] , pMap - > nMemberId ) ;
}
2000-09-18 23:08:29 +00:00
}
}
2001-10-24 14:51:20 +00:00
else
throw RuntimeException ( ) ;
2000-09-18 23:08:29 +00:00
}
else
throw RuntimeException ( ) ;
}
return aRet ;
}
2001-10-24 14:51:20 +00:00
/*-- 08.03.99 10:50:27---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
Any SwXStyle : : getPropertyDefault ( const OUString & rPropertyName )
throw ( UnknownPropertyException , lang : : WrappedTargetException , RuntimeException )
{
const Sequence < OUString > aSequence ( & rPropertyName , 1 ) ;
return getPropertyDefaults ( aSequence ) . getConstArray ( ) [ 0 ] ;
}
2000-09-18 23:08:29 +00:00
/* -----------------21.01.99 13:08-------------------
*
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
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 ) )
{
( ( SfxStyleSheetPool & ) rBC ) . SetSearchMask ( eFamily ) ;
SfxStyleSheetBase * pOwnBase = ( ( SfxStyleSheetPool & ) rBC ) . Find ( sStyleName ) ;
if ( ! pOwnBase )
{
EndListening ( rBC ) ;
Invalidate ( ) ;
}
}
}
}
/* -----------------------------15.08.00 11:35--------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
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
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*-- 17.12.98 08:43:35---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
SwXPageStyle : : SwXPageStyle ( SfxStyleSheetBasePool & rPool ,
SwDocShell * pDocSh , SfxStyleFamily eFam ,
const String & rStyleName ) : //, const SfxItemPropertyMap* _pMap) :
SwXStyle ( rPool , eFam , pDocSh - > GetDoc ( ) , rStyleName ) , //, _pMap),
pDocShell ( pDocSh )
{
}
/* -----------------23.08.99 15:52-------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
SwXPageStyle : : SwXPageStyle ( SwDocShell * pDocSh ) :
2001-10-17 11:27:45 +00:00
SwXStyle ( pDocSh - > GetDoc ( ) , SFX_STYLE_FAMILY_PAGE ) ,
2000-09-18 23:08:29 +00:00
pDocShell ( pDocSh )
{
}
/*-- 17.12.98 08:43:35---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
SwXPageStyle : : ~ SwXPageStyle ( )
{
}
2001-04-19 09:40:06 +00:00
/* -----------------------------18.04.01 13:50--------------------------------
2000-09-18 23:08:29 +00:00
2001-04-19 09:40:06 +00:00
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
2003-11-07 14:13:39 +00:00
void SAL_CALL SwXPageStyle : : SetPropertyValues_Impl (
const uno : : Sequence < OUString > & rPropertyNames ,
const uno : : Sequence < Any > & rValues )
throw ( UnknownPropertyException , PropertyVetoException , IllegalArgumentException ,
WrappedTargetException , RuntimeException )
2000-09-18 23:08:29 +00:00
{
2001-04-25 10:55:37 +00:00
if ( ! GetDoc ( ) )
throw RuntimeException ( ) ;
2001-04-19 09:40:06 +00:00
SfxItemPropertySet & aPropSet = aSwMapProvider . GetPropertySet ( PROPERTY_SET_PAGE_STYLE ) ;
if ( rPropertyNames . getLength ( ) ! = rValues . getLength ( ) )
throw IllegalArgumentException ( ) ;
const OUString * pNames = rPropertyNames . getConstArray ( ) ;
const Any * pValues = rValues . getConstArray ( ) ;
const SfxItemPropertyMap * pMap = aPropSet . 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 ) ;
2001-10-24 14:51:20 +00:00
DBG_ASSERT ( pBase , " where is the style? " ) ;
2001-04-19 09:40:06 +00:00
if ( pBase )
aBaseImpl . pNewBase = new SwDocStyleSheet ( * ( SwDocStyleSheet * ) pBase ) ;
else
throw RuntimeException ( ) ;
}
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
{
pMap = SfxItemPropertyMap : : GetByName ( pMap , pNames [ nProp ] ) ;
2001-11-28 19:36:01 +00:00
if ( ! pMap )
throw UnknownPropertyException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " Unknown property: " ) ) + pNames [ nProp ] , static_cast < cppu : : OWeakObject * > ( this ) ) ;
if ( pMap - > nFlags & PropertyAttribute : : READONLY )
2002-08-14 08:44:44 +00:00
throw 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
{
2001-04-19 09:40:06 +00:00
switch ( pMap - > 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 :
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
{
2001-04-27 11:03:25 +00:00
sal_Bool bSetItem = sal_False ;
sal_Bool bFooter = sal_False ;
sal_uInt16 nItemType = TYPE_BOOL ;
sal_uInt16 nRes = 0 ;
switch ( pMap - > nWID )
2000-09-18 23:08:29 +00:00
{
2001-04-27 11:03:25 +00:00
case FN_UNO_FOOTER_ON : bFooter = sal_True ;
//kein break;
case FN_UNO_HEADER_ON : nRes = SID_ATTR_PAGE_ON ;
break ;
case FN_UNO_FOOTER_BACKGROUND : bFooter = sal_True ;
// kein break;
case FN_UNO_HEADER_BACKGROUND : nRes = RES_BACKGROUND ; nItemType = TYPE_BRUSH ;
break ;
case FN_UNO_FOOTER_BOX : bFooter = sal_True ;
// kein break;
case FN_UNO_HEADER_BOX : nRes = RES_BOX ; nItemType = TYPE_BOX ;
break ;
case FN_UNO_FOOTER_LR_SPACE : bFooter = sal_True ;
// kein break;
case FN_UNO_HEADER_LR_SPACE : nRes = RES_LR_SPACE ; nItemType = TYPE_LRSPACE ;
break ;
case FN_UNO_FOOTER_SHADOW : bFooter = sal_True ;
// kein break;
case FN_UNO_HEADER_SHADOW : nRes = RES_SHADOW ; nItemType = TYPE_SHADOW ;
break ;
case FN_UNO_FOOTER_BODY_DISTANCE : bFooter = sal_True ;
// kein break;
case FN_UNO_HEADER_BODY_DISTANCE : nRes = RES_UL_SPACE ; nItemType = TYPE_ULSPACE ;
break ;
case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE : bFooter = sal_True ;
// kein break;
case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE : nRes = SID_ATTR_PAGE_DYNAMIC ;
break ;
case FN_UNO_FOOTER_SHARE_CONTENT : bFooter = sal_True ;
// kein break;
case FN_UNO_HEADER_SHARE_CONTENT : nRes = SID_ATTR_PAGE_SHARED ;
break ;
case FN_UNO_FOOTER_HEIGHT : bFooter = sal_True ;
// kein break;
case FN_UNO_HEADER_HEIGHT : nRes = SID_ATTR_PAGE_SIZE ; nItemType = TYPE_SIZE ;
break ;
2002-08-30 11:03:12 +00:00
case FN_UNO_FOOTER_EAT_SPACING : bFooter = sal_True ;
// 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 ) )
{
SvxSetItem * pNewSetItem = ( SvxSetItem * ) pSetItem - > Clone ( ) ;
SfxItemSet & rSetSet = pNewSetItem - > GetItemSet ( ) ;
const SfxPoolItem * pItem = 0 ;
SfxPoolItem * pNewItem = 0 ;
SfxItemState eState = rSetSet . GetItemState ( nRes , sal_True , & pItem ) ;
if ( ! pItem & & nRes ! = rSetSet . GetPool ( ) - > GetSlotId ( nRes ) )
pItem = & rSetSet . GetPool ( ) - > GetDefaultItem ( nRes ) ;
if ( pItem )
{
pNewItem = pItem - > Clone ( ) ;
2001-04-19 09:40:06 +00:00
}
2001-04-27 11:03:25 +00:00
else
2000-09-18 23:08:29 +00:00
{
2001-04-27 11:03:25 +00:00
switch ( nItemType )
2001-04-19 09:40:06 +00:00
{
2001-04-27 11:03:25 +00:00
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 ;
2001-04-19 09:40:06 +00:00
}
2000-09-18 23:08:29 +00:00
}
2001-04-27 11:03:25 +00:00
bSetItem = pNewItem - > PutValue ( pValues [ nProp ] , pMap - > nMemberId ) ;
rSetSet . Put ( * pNewItem ) ;
aBaseImpl . GetItemSet ( ) . Put ( * pNewSetItem ) ;
delete pNewItem ;
delete pNewSetItem ;
}
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 ,
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 ) ) ;
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_UNO_HEADER :
case FN_UNO_HEADER_LEFT :
case FN_UNO_HEADER_RIGHT :
case FN_UNO_FOOTER :
case FN_UNO_FOOTER_LEFT :
case FN_UNO_FOOTER_RIGHT :
throw lang : : IllegalArgumentException ( ) ;
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 ( ) ;
sal_Bool bPut = pNewFtnItem - > PutValue ( pValues [ nProp ] , pMap - > nMemberId ) ;
aBaseImpl . GetItemSet ( ) . Put ( * pNewFtnItem ) ;
delete pNewFtnItem ;
if ( ! bPut )
2001-04-25 10:55:37 +00:00
throw IllegalArgumentException ( ) ;
2001-02-13 07:02:30 +00:00
}
2001-04-19 09:40:06 +00:00
break ;
default :
lcl_SetStyleProperty ( pMap , aPropSet , pValues [ nProp ] , aBaseImpl ,
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
throw 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
{
BOOL bDoesUndo = GetDoc ( ) - > DoesUndo ( ) ;
if ( bDoesUndo )
{
// Fix i64460: as long as Undo of page styles with header/footer causes trouble...
GetDoc ( ) - > DelAllUndoObj ( ) ;
GetDoc ( ) - > DoUndo ( FALSE ) ;
}
2001-04-19 09:40:06 +00:00
aBaseImpl . pNewBase - > SetItemSet ( aBaseImpl . GetItemSet ( ) ) ;
2006-04-28 14:00:25 +00:00
GetDoc ( ) - > DoUndo ( bDoesUndo ) ;
}
2000-09-18 23:08:29 +00:00
}
2003-11-07 14:13:39 +00:00
void SwXPageStyle : : setPropertyValues (
const Sequence < OUString > & rPropertyNames ,
const Sequence < Any > & rValues )
throw ( PropertyVetoException , IllegalArgumentException , WrappedTargetException , RuntimeException )
2000-09-18 23:08:29 +00:00
{
vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
2003-11-07 14:13:39 +00:00
// workaround for bad designed API
try
{
SetPropertyValues_Impl ( rPropertyNames , rValues ) ;
}
catch ( UnknownPropertyException & rException )
{
// wrap the original (here not allowed) exception in
// a WrappedTargetException that gets thrown instead.
WrappedTargetException aWExc ;
aWExc . TargetException < < = rException ;
throw aWExc ;
}
}
/* -----------------------------04.11.03 13:50--------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
uno : : Sequence < Any > SAL_CALL SwXPageStyle : : GetPropertyValues_Impl (
const uno : : Sequence < OUString > & rPropertyNames )
throw ( UnknownPropertyException , WrappedTargetException , RuntimeException )
{
2001-04-25 10:55:37 +00:00
if ( ! GetDoc ( ) )
throw RuntimeException ( ) ;
2001-09-03 13:58:49 +00:00
sal_Int32 nLength = rPropertyNames . getLength ( ) ;
2001-04-19 09:40:06 +00:00
SfxItemPropertySet & aPropSet = aSwMapProvider . GetPropertySet ( PROPERTY_SET_PAGE_STYLE ) ;
const OUString * pNames = rPropertyNames . getConstArray ( ) ;
2001-09-03 13:58:49 +00:00
Sequence < Any > aRet ( nLength ) ;
2001-04-19 09:40:06 +00:00
Any * pRet = aRet . getArray ( ) ;
const SfxItemPropertyMap * pMap = aPropSet . 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
{
2001-04-19 09:40:06 +00:00
pMap = SfxItemPropertyMap : : GetByName ( pMap , pNames [ nProp ] ) ;
2001-11-28 19:36:01 +00:00
if ( ! pMap )
throw 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 ) ;
}
sal_uInt16 nRes ;
sal_Bool bHeader = sal_False , bAll = sal_False , bLeft = sal_False , bRight = sal_False ;
switch ( pMap - > nWID )
{
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
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
{
2001-04-19 09:40:06 +00:00
SfxStyleSheetBasePool * pBasePool = ( ( SwXPageStyle * ) this ) - > GetBasePool ( ) ;
pBasePool - > SetSearchMask ( GetFamily ( ) ) ;
SfxStyleSheetBase * pBase = pBasePool - > Find ( GetStyleName ( ) ) ;
if ( pBase )
2000-09-18 23:08:29 +00:00
{
2001-04-19 09:40:06 +00:00
SwDocStyleSheet aStyle ( * ( SwDocStyleSheet * ) pBase ) ;
const SfxItemSet & rSet = aStyle . GetItemSet ( ) ;
sal_Bool bFooter = sal_False ;
sal_uInt16 nRes = 0 ;
switch ( pMap - > nWID )
2000-09-18 23:08:29 +00:00
{
2001-04-19 09:40:06 +00:00
case FN_UNO_FOOTER_ON :
bFooter = sal_True ;
// 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
BOOL bRet = sal_False ;
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 ;
case FN_UNO_FOOTER_BACKGROUND : bFooter = sal_True ;
// kein break;
case FN_UNO_HEADER_BACKGROUND : nRes = RES_BACKGROUND ;
break ;
case FN_UNO_FOOTER_BOX : bFooter = sal_True ;
// kein break;
case FN_UNO_HEADER_BOX : nRes = RES_BOX ;
break ;
case FN_UNO_FOOTER_LR_SPACE : bFooter = sal_True ;
// kein break;
case FN_UNO_HEADER_LR_SPACE : nRes = RES_LR_SPACE ;
break ;
case FN_UNO_FOOTER_SHADOW : bFooter = sal_True ;
// kein break;
case FN_UNO_HEADER_SHADOW : nRes = RES_SHADOW ;
break ;
case FN_UNO_FOOTER_BODY_DISTANCE : bFooter = sal_True ;
// kein break;
case FN_UNO_HEADER_BODY_DISTANCE : nRes = RES_UL_SPACE ;
break ;
case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE : bFooter = sal_True ;
// kein break;
case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE : nRes = SID_ATTR_PAGE_DYNAMIC ;
break ;
case FN_UNO_FOOTER_SHARE_CONTENT : bFooter = sal_True ;
// kein break;
case FN_UNO_HEADER_SHARE_CONTENT : nRes = SID_ATTR_PAGE_SHARED ;
break ;
case FN_UNO_FOOTER_HEIGHT : bFooter = sal_True ;
// kein break;
case FN_UNO_HEADER_HEIGHT : nRes = SID_ATTR_PAGE_SIZE ;
break ;
2002-08-30 11:03:12 +00:00
case FN_UNO_FOOTER_EAT_SPACING : bFooter = sal_True ;
// 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
{
2001-04-19 09:40:06 +00:00
const SfxItemSet & rSet = pSetItem - > GetItemSet ( ) ;
const SfxPoolItem * pItem = 0 ;
SfxItemState eState = rSet . GetItemState ( nRes , sal_True , & pItem ) ;
if ( ! pItem & & nRes ! = rSet . GetPool ( ) - > GetSlotId ( nRes ) )
pItem = & rSet . GetPool ( ) - > GetDefaultItem ( nRes ) ;
if ( pItem )
pItem - > QueryValue ( pRet [ nProp ] , pMap - > nMemberId ) ;
2000-09-18 23:08:29 +00:00
}
}
}
2001-04-19 09:40:06 +00:00
break ;
case FN_UNO_HEADER :
bAll = sal_True ; goto Header ;
case FN_UNO_HEADER_LEFT :
bLeft = sal_True ; goto Header ;
case FN_UNO_HEADER_RIGHT :
bRight = sal_True ; goto Header ;
Header :
bHeader = sal_True ;
nRes = RES_HEADER ; goto MakeObject ;
case FN_UNO_FOOTER :
bAll = sal_True ; goto Footer ;
case FN_UNO_FOOTER_LEFT :
bLeft = sal_True ; goto Footer ;
case FN_UNO_FOOTER_RIGHT :
bRight = sal_True ;
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 ;
sal_Bool bShare = bHeader & & rDesc . IsHeaderShared ( ) | |
! bHeader & & rDesc . IsFooterShared ( ) ;
// 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 )
pFrmFmt = & rDesc . GetLeft ( ) ;
else
pFrmFmt = & rDesc . GetMaster ( ) ;
if ( pFrmFmt )
2001-02-13 07:02:30 +00:00
{
2001-04-25 10:55:37 +00:00
const SfxItemSet & rSet = pFrmFmt - > GetAttrSet ( ) ;
const SfxPoolItem * pItem ;
SwFrmFmt * pHeadFootFmt ;
if ( SFX_ITEM_SET = = rSet . GetItemState ( nRes , sal_True , & pItem ) & &
0 ! = ( pHeadFootFmt = bHeader ?
( ( SwFmtHeader * ) pItem ) - > GetHeaderFmt ( ) :
( ( SwFmtFooter * ) pItem ) - > GetFooterFmt ( ) ) )
2001-02-13 07:02:30 +00:00
{
2001-04-25 10:55:37 +00:00
// gibt es schon ein Objekt dafuer?
SwXHeadFootText * pxHdFt = ( SwXHeadFootText * ) SwClientIter ( * pHeadFootFmt ) .
First ( TYPE ( SwXHeadFootText ) ) ;
Reference < text : : XText > xRet = pxHdFt ;
if ( ! pxHdFt )
xRet = new SwXHeadFootText ( * pHeadFootFmt , bHeader ) ;
pRet [ nProp ] . setValue ( & xRet , : : getCppuType ( ( Reference < text : : XText > * ) 0 ) ) ;
2001-02-13 07:02:30 +00:00
}
2001-04-19 09:40:06 +00:00
}
2001-04-25 10:55:37 +00:00
break ;
2001-04-19 09:40:06 +00:00
}
break ;
case FN_PARAM_FTN_INFO :
{
2002-06-19 10:17:56 +00:00
SwDocStyleSheet aStyle ( * ( SwDocStyleSheet * ) pBase ) ;
const SfxItemSet & rSet = aStyle . GetItemSet ( ) ;
const SfxPoolItem & rItem = rSet . Get ( FN_PARAM_FTN_INFO ) ;
2001-04-27 11:03:25 +00:00
rItem . QueryValue ( pRet [ nProp ] , pMap - > nMemberId ) ;
2001-02-13 07:02:30 +00:00
}
2001-04-19 09:40:06 +00:00
break ;
default :
2001-09-24 18:59:24 +00:00
pRet [ nProp ] = lcl_GetStyleProperty ( pMap , aPropSet , 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 ( ) )
{
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
throw 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
/* -----------------------------18.04.01 13:50--------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
Sequence < Any > SwXPageStyle : : getPropertyValues (
const Sequence < OUString > & rPropertyNames )
throw ( RuntimeException )
{
vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
Sequence < Any > aValues ;
// workaround for bad designed API
try
{
aValues = GetPropertyValues_Impl ( rPropertyNames ) ;
}
catch ( UnknownPropertyException & )
{
throw RuntimeException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " Unknown property exception caught " ) ) , static_cast < cppu : : OWeakObject * > ( this ) ) ;
}
catch ( WrappedTargetException & )
{
throw RuntimeException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " WrappedTargetException caught " ) ) , static_cast < cppu : : OWeakObject * > ( this ) ) ;
}
return aValues ;
}
2001-04-19 09:40:06 +00:00
/*-- 17.12.98 08:43:36---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
Any SwXPageStyle : : getPropertyValue ( const OUString & rPropertyName ) throw (
UnknownPropertyException , WrappedTargetException , RuntimeException )
{
2003-11-07 14:13:39 +00:00
vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
2001-04-19 09:40:06 +00:00
const 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
}
/*-- 17.12.98 08:43:36---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
void SwXPageStyle : : setPropertyValue ( const OUString & rPropertyName , const Any & rValue )
throw ( UnknownPropertyException ,
PropertyVetoException ,
lang : : IllegalArgumentException ,
2001-05-11 09:03:31 +00:00
lang : : WrappedTargetException ,
2001-04-19 09:40:06 +00:00
RuntimeException )
{
2003-11-07 14:13:39 +00:00
vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
2001-04-19 09:40:06 +00:00
const Sequence < OUString > aProperties ( & rPropertyName , 1 ) ;
const Sequence < 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 )
: SwXStyle ( pDoc , SFX_STYLE_FAMILY_FRAME , FALSE )
{
}
2000-12-19 16:28:58 +00:00
/* -----------------------------15.12.00 15:45--------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
SwXFrameStyle : : ~ SwXFrameStyle ( )
{
}
/* -----------------------------15.12.00 14:30--------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
Sequence < uno : : Type > SwXFrameStyle : : getTypes ( ) throw ( RuntimeException )
{
Sequence < uno : : Type > aTypes = SwXStyle : : getTypes ( ) ;
sal_Int32 nLen = aTypes . getLength ( ) ;
aTypes . realloc ( nLen + 1 ) ;
2001-01-30 12:17:25 +00:00
aTypes . getArray ( ) [ nLen ] = : : getCppuType ( ( Reference < XEventsSupplier > * ) 0 ) ;
2000-12-19 16:28:58 +00:00
return aTypes ;
}
/* -----------------------------15.12.00 14:30--------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
Any SwXFrameStyle : : queryInterface ( const uno : : Type & rType ) throw ( RuntimeException )
{
Any aRet ;
2001-01-30 12:17:25 +00:00
if ( rType = = : : getCppuType ( ( Reference < XEventsSupplier > * ) 0 ) )
aRet < < = Reference < XEventsSupplier > ( this ) ;
2000-12-19 16:28:58 +00:00
else
aRet = SwXStyle : : queryInterface ( rType ) ;
return aRet ;
}
/* -----------------------------15.12.00 14:30--------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
Reference < XNameReplace > SwXFrameStyle : : getEvents ( ) throw ( RuntimeException )
{
return new SwFrameStyleEventDescriptor ( * this ) ;
}
2006-12-01 14:52:41 +00:00
/*-- 19.05.2006 11:23:55---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
SwXAutoStyles : : SwXAutoStyles ( SwDocShell & rDocShell ) :
SwUnoCollection ( rDocShell . GetDoc ( ) ) , pDocShell ( & rDocShell )
{
}
/*-- 19.05.2006 11:23:56---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
SwXAutoStyles : : ~ SwXAutoStyles ( )
{
}
/*-- 19.05.2006 11:23:57---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
sal_Int32 SwXAutoStyles : : getCount ( void ) throw ( uno : : RuntimeException )
{
return AUTOSTYLE_FAMILY_COUNT ;
}
/*-- 19.05.2006 11:23:57---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
uno : : Any SwXAutoStyles : : getByIndex ( sal_Int32 nIndex )
throw ( lang : : IndexOutOfBoundsException , lang : : WrappedTargetException ,
uno : : RuntimeException )
{
vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
Any aRet ;
if ( nIndex < 0 | | nIndex > = AUTOSTYLE_FAMILY_COUNT )
throw lang : : IndexOutOfBoundsException ( ) ;
if ( IsValid ( ) )
{
Reference < style : : XAutoStyleFamily > aRef ;
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 ;
}
aRet . setValue ( & aRef , : : getCppuType ( ( const Reference < style : : XAutoStyleFamily > * ) 0 ) ) ;
}
else
throw RuntimeException ( ) ;
return aRet ;
}
/*-- 19.05.2006 11:23:57---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
uno : : Type SwXAutoStyles : : getElementType ( ) throw ( uno : : RuntimeException )
{
return : : getCppuType ( ( const Reference < style : : XAutoStyleFamily > * ) 0 ) ;
}
/*-- 19.05.2006 11:23:58---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
sal_Bool SwXAutoStyles : : hasElements ( ) throw ( uno : : RuntimeException )
{
return sal_True ;
}
/*-- 19.05.2006 11:23:58---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
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 ;
}
/*-- 19.05.2006 11:23:59---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
uno : : Sequence < rtl : : OUString > SwXAutoStyles : : getElementNames ( void )
throw ( uno : : RuntimeException )
{
Sequence < OUString > aNames ( AUTOSTYLE_FAMILY_COUNT ) ;
OUString * pNames = aNames . getArray ( ) ;
pNames [ 0 ] = C2U ( " CharacterStyles " ) ;
pNames [ 1 ] = C2U ( " RubyStyles " ) ;
pNames [ 2 ] = C2U ( " ParagraphStyles " ) ;
return aNames ;
}
/*-- 19.05.2006 11:24:00---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
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 ;
}
/*-- 19.05.2006 11:24:02---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
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 ) ;
}
/*-- 19.05.2006 11:24:02---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
SwXAutoStyleFamily : : ~ SwXAutoStyleFamily ( )
{
}
void SwXAutoStyleFamily : : Modify ( SfxPoolItem * pOld , SfxPoolItem * pNew )
{
ClientModify ( this , pOld , pNew ) ;
if ( ! GetRegisteredIn ( ) )
pDocShell = 0 ;
}
/*-- 31.05.2006 11:24:02---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
uno : : Reference < style : : XAutoStyle > SwXAutoStyleFamily : : insertStyle (
const uno : : Sequence < beans : : PropertyValue > & Values )
throw ( : : com : : sun : : star : : uno : : RuntimeException )
{
if ( ! pDocShell )
throw RuntimeException ( ) ;
const USHORT * aRange ;
const SfxItemPropertyMap * pMap ;
switch ( eFamily )
{
case IStyleAccess : : AUTO_STYLE_CHAR :
{
2007-02-12 13:33:31 +00:00
aRange = aCharAutoFmtSetRange ;
2006-12-01 14:52:41 +00:00
pMap = aSwMapProvider . GetPropertyMap ( PROPERTY_MAP_CHAR_AUTO_STYLE ) ;
}
break ;
case IStyleAccess : : AUTO_STYLE_RUBY :
{
aRange = 0 ; //aTxtNodeSetRange;
pMap = aSwMapProvider . GetPropertyMap ( PROPERTY_MAP_RUBY_AUTO_STYLE ) ;
}
break ;
case IStyleAccess : : AUTO_STYLE_PARA :
{
aRange = aTxtNodeSetRange ;
pMap = aSwMapProvider . GetPropertyMap ( PROPERTY_MAP_PARA_AUTO_STYLE ) ;
}
break ;
}
SwAttrSet aSet ( pDocShell - > GetDoc ( ) - > GetAttrPool ( ) , aRange ) ;
SfxItemPropertySet aPropSet ( pMap ) ;
const PropertyValue * pSeq = Values . getConstArray ( ) ;
sal_Int32 nLen = Values . getLength ( ) ;
for ( sal_Int32 i = 0 ; i < nLen ; + + i )
{
try
{
aPropSet . setPropertyValue ( pSeq [ i ] . Name , pSeq [ i ] . Value , aSet ) ;
}
catch ( UnknownPropertyException & )
{
ASSERT ( false , " Unknown property " ) ;
}
}
SfxItemSet_Pointer_t pSet = pDocShell - > GetDoc ( ) - > GetIStyleAccess ( ) . cacheAutomaticStyle ( aSet , eFamily ) ;
uno : : Reference < style : : XAutoStyle > xRet = new SwXAutoStyle ( pDocShell - > GetDoc ( ) , pSet , eFamily ) ;
return xRet ;
}
/*-- 31.05.2006 11:24:02---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
uno : : Reference < container : : XEnumeration > SwXAutoStyleFamily : : createEnumeration ( )
throw ( uno : : RuntimeException )
{
if ( ! pDocShell )
throw RuntimeException ( ) ;
return uno : : Reference < container : : XEnumeration >
( new SwXAutoStylesEnumerator ( pDocShell - > GetDoc ( ) , eFamily ) ) ;
}
/*-- 19.05.2006 11:24:03---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
uno : : Type SwXAutoStyleFamily : : getElementType ( ) throw ( uno : : RuntimeException )
{
return : : getCppuType ( ( const Reference < style : : XAutoStyle > * ) 0 ) ;
}
/*-- 19.05.2006 11:24:04---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
sal_Bool SwXAutoStyleFamily : : hasElements ( ) throw ( uno : : RuntimeException )
{
return sal_False ;
}
/*-- 31.05.2006 11:24:05---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
SwAutoStylesEnumImpl : : SwAutoStylesEnumImpl ( SwDoc * pInitDoc , IStyleAccess : : SwAutoStyleFamily eFam )
: pDoc ( pInitDoc ) , eFamily ( eFam )
{
// special case for ruby auto styles:
if ( IStyleAccess : : AUTO_STYLE_RUBY = = eFam )
{
std : : set < std : : pair < USHORT , USHORT > > aRubyMap ;
SwAttrPool & rAttrPool = pDoc - > GetAttrPool ( ) ;
USHORT nCount = rAttrPool . GetItemCount ( RES_TXTATR_CJK_RUBY ) ;
for ( USHORT nI = 0 ; nI < nCount ; + + nI )
{
const SwFmtRuby * pItem = static_cast < const SwFmtRuby * > ( rAttrPool . GetItem ( RES_TXTATR_CJK_RUBY , nI ) ) ;
if ( pItem & & pItem - > GetTxtRuby ( ) )
{
std : : pair < USHORT , USHORT > aPair ( pItem - > GetPosition ( ) , pItem - > GetAdjustment ( ) ) ;
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 ( ) ;
}
/*-- 31.05.2006 11:24:05---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
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 ) ;
}
/*-- 31.05.2006 11:24:05---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
SwXAutoStylesEnumerator : : ~ SwXAutoStylesEnumerator ( )
{
delete pImpl ;
}
void SwXAutoStylesEnumerator : : Modify ( SfxPoolItem * pOld , SfxPoolItem * pNew )
{
ClientModify ( this , pOld , pNew ) ;
if ( ! GetRegisteredIn ( ) )
{
delete pImpl ;
pImpl = 0 ;
}
}
/*-- 31.05.2006 11:24:05---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
: : sal_Bool SwXAutoStylesEnumerator : : hasMoreElements ( )
throw ( uno : : RuntimeException )
{
if ( ! pImpl )
throw RuntimeException ( ) ;
return pImpl - > hasMoreElements ( ) ;
}
/*-- 31.05.2006 11:24:05---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
uno : : Any SwXAutoStylesEnumerator : : nextElement ( )
throw ( container : : NoSuchElementException , lang : : WrappedTargetException , uno : : RuntimeException )
{
if ( ! pImpl )
throw RuntimeException ( ) ;
Any aRet ;
if ( pImpl - > hasMoreElements ( ) )
{
SfxItemSet_Pointer_t pNextSet = pImpl - > nextElement ( ) ;
Reference < style : : XAutoStyle > xAutoStyle = new SwXAutoStyle ( pImpl - > getDoc ( ) ,
pNextSet , pImpl - > getFamily ( ) ) ;
aRet . setValue ( & xAutoStyle , : : getCppuType ( ( Reference < style : : XAutoStyle > * ) 0 ) ) ;
}
return aRet ;
}
/*-- 19.05.2006 11:24:09---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
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 ) ;
}
/*-- 19.05.2006 11:24:09---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
SwXAutoStyle : : ~ SwXAutoStyle ( )
{
}
void SwXAutoStyle : : Modify ( SfxPoolItem * pOld , SfxPoolItem * pNew )
{
ClientModify ( this , pOld , pNew ) ;
if ( ! GetRegisteredIn ( ) )
pSet . reset ( ) ;
}
/*-- 19.05.2006 11:24:09---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
uno : : Reference < beans : : XPropertySetInfo > SwXAutoStyle : : getPropertySetInfo ( )
throw ( uno : : RuntimeException )
{
Reference < XPropertySetInfo > xRet ;
switch ( eFamily )
{
case IStyleAccess : : AUTO_STYLE_CHAR :
{
static Reference < XPropertySetInfo > xCharRef ;
if ( ! xCharRef . is ( ) )
{
SfxItemPropertySet aPropSet (
aSwMapProvider . GetPropertyMap ( PROPERTY_MAP_CHAR_AUTO_STYLE ) ) ;
xCharRef = aPropSet . getPropertySetInfo ( ) ;
}
xRet = xCharRef ;
}
break ;
case IStyleAccess : : AUTO_STYLE_RUBY :
{
static Reference < XPropertySetInfo > xRubyRef ;
if ( ! xRubyRef . is ( ) )
{
sal_uInt16 nMapId = PROPERTY_MAP_RUBY_AUTO_STYLE ;
SfxItemPropertySet aPropSet (
aSwMapProvider . GetPropertyMap ( nMapId ) ) ;
xRubyRef = aPropSet . getPropertySetInfo ( ) ;
}
xRet = xRubyRef ;
}
break ;
case IStyleAccess : : AUTO_STYLE_PARA :
{
static Reference < XPropertySetInfo > xParaRef ;
if ( ! xParaRef . is ( ) )
{
sal_uInt16 nMapId = PROPERTY_MAP_PARA_AUTO_STYLE ;
SfxItemPropertySet aPropSet (
aSwMapProvider . GetPropertyMap ( nMapId ) ) ;
xParaRef = aPropSet . getPropertySetInfo ( ) ;
}
xRet = xParaRef ;
}
break ;
}
return xRet ;
}
/*-- 19.05.2006 11:24:09---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
void SwXAutoStyle : : setPropertyValue ( const OUString & rPropertyName , const Any & rValue )
throw ( UnknownPropertyException ,
PropertyVetoException ,
IllegalArgumentException ,
WrappedTargetException ,
RuntimeException )
{
}
/*-- 19.05.2006 11:24:09---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
Any SwXAutoStyle : : getPropertyValue ( const OUString & rPropertyName )
throw ( UnknownPropertyException ,
lang : : WrappedTargetException ,
RuntimeException )
{
vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
const Sequence < OUString > aProperties ( & rPropertyName , 1 ) ;
return GetPropertyValues_Impl ( aProperties ) . getConstArray ( ) [ 0 ] ;
}
/*-- 19.05.2006 11:24:09---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
void SwXAutoStyle : : addPropertyChangeListener ( const OUString & aPropertyName ,
const Reference < beans : : XPropertyChangeListener > & xListener )
throw ( UnknownPropertyException ,
lang : : WrappedTargetException ,
RuntimeException )
{
}
/*-- 19.05.2006 11:24:09---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
void SwXAutoStyle : : removePropertyChangeListener ( const OUString & aPropertyName ,
const Reference < beans : : XPropertyChangeListener > & aListener )
throw ( UnknownPropertyException ,
lang : : WrappedTargetException ,
RuntimeException )
{
}
2000-09-18 23:08:29 +00:00
2006-12-01 14:52:41 +00:00
/*-- 19.05.2006 11:24:09---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
void SwXAutoStyle : : addVetoableChangeListener ( const OUString & PropertyName ,
const Reference < beans : : XVetoableChangeListener > & aListener )
throw ( UnknownPropertyException ,
lang : : WrappedTargetException ,
RuntimeException )
{
}
/*-- 19.05.2006 11:24:09---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
void SwXAutoStyle : : removeVetoableChangeListener ( const OUString & PropertyName ,
const Reference < beans : : XVetoableChangeListener > & aListener )
throw ( UnknownPropertyException ,
lang : : WrappedTargetException ,
RuntimeException )
{
}
/*-- 19.05.2006 11:24:09---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
void SwXAutoStyle : : setPropertyValues (
const uno : : Sequence < : : rtl : : OUString > & aPropertyNames ,
const uno : : Sequence < uno : : Any > & aValues )
throw ( beans : : PropertyVetoException , lang : : IllegalArgumentException ,
lang : : WrappedTargetException , uno : : RuntimeException )
{
}
/*-- 19.05.2006 11:24:09---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
uno : : Sequence < Any > SwXAutoStyle : : GetPropertyValues_Impl (
const uno : : Sequence < OUString > & rPropertyNames )
throw ( UnknownPropertyException , WrappedTargetException , RuntimeException )
{
if ( ! pSet . get ( ) )
throw RuntimeException ( ) ;
// query_item
sal_Int8 nPropSetId ;
switch ( eFamily )
{
case IStyleAccess : : AUTO_STYLE_CHAR : nPropSetId = PROPERTY_SET_CHAR_AUTO_STYLE ; break ;
case IStyleAccess : : AUTO_STYLE_RUBY : nPropSetId = PROPERTY_SET_RUBY_AUTO_STYLE ; break ;
case IStyleAccess : : AUTO_STYLE_PARA : nPropSetId = PROPERTY_SET_PARA_AUTO_STYLE ; break ;
}
SfxItemPropertySet & rPropSet = aSwMapProvider . GetPropertySet ( nPropSetId ) ;
const SfxItemPropertyMap * pMap = rPropSet . getPropertyMap ( ) ;
const OUString * pNames = rPropertyNames . getConstArray ( ) ;
sal_Int32 nLen = rPropertyNames . getLength ( ) ;
Sequence < Any > aRet ( nLen ) ;
Any * pValues = aRet . getArray ( ) ;
SfxItemSet & rSet = * pSet . get ( ) ;
for ( sal_Int32 i = 0 ; i < nLen ; + + i )
{
const String & rPropName = pNames [ i ] ;
pMap = SfxItemPropertyMap : : GetByName ( pMap , rPropName ) ;
if ( ! pMap )
throw UnknownPropertyException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " Unknown property: " ) ) + rPropName , static_cast < cppu : : OWeakObject * > ( this ) ) ;
else if ( RES_TXTATR_AUTOFMT = = pMap - > nWID | | RES_AUTO_STYLE = = pMap - > nWID )
{
OUString sName ( StylePool : : nameOf ( pSet ) ) ;
pValues [ i ] < < = sName ;
}
else
pValues [ i ] = rPropSet . getPropertyValue ( * pMap , rSet ) ;
}
return aRet ;
}
/*-- 19.05.2006 11:24:09---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
uno : : Sequence < uno : : Any > SwXAutoStyle : : getPropertyValues (
const uno : : Sequence < : : rtl : : OUString > & rPropertyNames )
throw ( uno : : RuntimeException )
{
vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
Sequence < Any > aValues ;
// workaround for bad designed API
try
{
aValues = GetPropertyValues_Impl ( rPropertyNames ) ;
}
catch ( UnknownPropertyException & )
{
throw RuntimeException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " Unknown property exception caught " ) ) , static_cast < cppu : : OWeakObject * > ( this ) ) ;
}
catch ( WrappedTargetException & )
{
throw RuntimeException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " WrappedTargetException caught " ) ) , static_cast < cppu : : OWeakObject * > ( this ) ) ;
}
return aValues ;
}
/*-- 19.05.2006 11:24:10---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
void SwXAutoStyle : : addPropertiesChangeListener (
const uno : : Sequence < : : rtl : : OUString > & aPropertyNames ,
const uno : : Reference < beans : : XPropertiesChangeListener > & xListener )
throw ( uno : : RuntimeException )
{
}
/*-- 19.05.2006 11:24:10---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
void SwXAutoStyle : : removePropertiesChangeListener (
const uno : : Reference < beans : : XPropertiesChangeListener > & xListener )
throw ( uno : : RuntimeException )
{
}
/*-- 19.05.2006 11:24:11---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
void SwXAutoStyle : : firePropertiesChangeEvent (
const uno : : Sequence < : : rtl : : OUString > & aPropertyNames ,
const uno : : Reference < beans : : XPropertiesChangeListener > & xListener )
throw ( uno : : RuntimeException )
{
}
/*-- 19.05.2006 11:24:11---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
beans : : PropertyState SwXAutoStyle : : getPropertyState ( const OUString & rPropertyName )
throw ( beans : : UnknownPropertyException ,
uno : : RuntimeException )
{
vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
Sequence < OUString > aNames ( 1 ) ;
OUString * pNames = aNames . getArray ( ) ;
pNames [ 0 ] = rPropertyName ;
Sequence < PropertyState > aStates = getPropertyStates ( aNames ) ;
return aStates . getConstArray ( ) [ 0 ] ;
}
/*-- 19.05.2006 11:24:11---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
void SwXAutoStyle : : setPropertyToDefault ( const OUString & PropertyName )
throw ( beans : : UnknownPropertyException ,
uno : : RuntimeException )
{
}
/*-- 19.05.2006 11:24:11---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
Any SwXAutoStyle : : getPropertyDefault ( const OUString & rPropertyName )
throw ( beans : : UnknownPropertyException ,
lang : : WrappedTargetException ,
uno : : RuntimeException )
{
const Sequence < OUString > aSequence ( & rPropertyName , 1 ) ;
return getPropertyDefaults ( aSequence ) . getConstArray ( ) [ 0 ] ;
}
/*-- 19.05.2006 11:24:12---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
uno : : Sequence < beans : : PropertyState > SwXAutoStyle : : getPropertyStates (
const uno : : Sequence < : : rtl : : OUString > & rPropertyNames )
throw ( beans : : UnknownPropertyException , uno : : RuntimeException )
{
if ( ! pSet . get ( ) )
throw RuntimeException ( ) ;
vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
Sequence < PropertyState > aRet ( rPropertyNames . getLength ( ) ) ;
PropertyState * pStates = aRet . getArray ( ) ;
const OUString * pNames = rPropertyNames . getConstArray ( ) ;
sal_Int8 nPropSetId ;
switch ( eFamily )
{
case IStyleAccess : : AUTO_STYLE_CHAR : nPropSetId = PROPERTY_SET_CHAR_AUTO_STYLE ; break ;
case IStyleAccess : : AUTO_STYLE_RUBY : nPropSetId = PROPERTY_SET_RUBY_AUTO_STYLE ; break ;
case IStyleAccess : : AUTO_STYLE_PARA : nPropSetId = PROPERTY_SET_PARA_AUTO_STYLE ; break ;
}
SfxItemPropertySet & rPropSet = aSwMapProvider . GetPropertySet ( nPropSetId ) ;
const SfxItemPropertyMap * pMap = rPropSet . getPropertyMap ( ) ;
SfxItemSet & rSet = * pSet . get ( ) ;
for ( sal_Int32 i = 0 ; i < rPropertyNames . getLength ( ) ; i + + )
{
const String & rPropName = pNames [ i ] ;
pMap = SfxItemPropertyMap : : GetByName ( pMap , rPropName ) ;
if ( ! pMap )
throw UnknownPropertyException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( " Unknown property: " ) ) + rPropName , static_cast < cppu : : OWeakObject * > ( this ) ) ;
pStates [ i ] = rPropSet . getPropertyState ( * pMap , rSet ) ;
}
return aRet ;
}
/*-- 19.05.2006 11:24:12---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
void SwXAutoStyle : : setAllPropertiesToDefault ( )
throw ( uno : : RuntimeException )
{
}
/*-- 19.05.2006 11:24:13---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
void SwXAutoStyle : : setPropertiesToDefault (
const uno : : Sequence < : : rtl : : OUString > & aPropertyNames )
throw ( beans : : UnknownPropertyException , uno : : RuntimeException )
{
}
/*-- 19.05.2006 11:24:14---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
uno : : Sequence < uno : : Any > SwXAutoStyle : : getPropertyDefaults (
const uno : : Sequence < : : rtl : : OUString > & aPropertyNames )
throw ( beans : : UnknownPropertyException , lang : : WrappedTargetException ,
uno : : RuntimeException )
{
uno : : Sequence < uno : : Any > aRet ( 0 ) ;
return aRet ;
}
/*-- 19.05.2006 11:24:14---------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
uno : : Sequence < beans : : PropertyValue > SwXAutoStyle : : getProperties ( ) throw ( : : com : : sun : : star : : uno : : RuntimeException )
{
if ( ! pSet . get ( ) )
throw RuntimeException ( ) ;
vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
std : : vector < PropertyValue > aPropertyVector ;
sal_Int8 nPropSetId ;
switch ( eFamily )
{
case IStyleAccess : : AUTO_STYLE_CHAR : nPropSetId = PROPERTY_SET_CHAR_AUTO_STYLE ; break ;
case IStyleAccess : : AUTO_STYLE_RUBY : nPropSetId = PROPERTY_SET_RUBY_AUTO_STYLE ; break ;
case IStyleAccess : : AUTO_STYLE_PARA : nPropSetId = PROPERTY_SET_PARA_AUTO_STYLE ; break ;
}
SfxItemPropertySet & rPropSet = aSwMapProvider . GetPropertySet ( nPropSetId ) ;
const SfxItemPropertyMap * pMap = rPropSet . getPropertyMap ( ) ;
SfxItemSet & rSet = * pSet . get ( ) ;
SfxItemIter aIter ( rSet ) ;
const SfxPoolItem * pItem = aIter . FirstItem ( ) ;
while ( pItem )
{
const USHORT nWID = pItem - > Which ( ) ;
// TODO: Optimize
int i = 0 ;
while ( pMap [ i ] . nWID ! = 0 )
{
if ( pMap [ i ] . nWID = = nWID )
{
beans : : PropertyValue aPropertyValue ;
String sString ( OUString : : createFromAscii ( pMap [ i ] . pName ) ) ;
aPropertyValue . Name = sString ;
pItem - > QueryValue ( aPropertyValue . Value , pMap [ i ] . nMemberId ) ;
aPropertyVector . push_back ( aPropertyValue ) ;
break ;
}
+ + i ;
}
pItem = aIter . NextItem ( ) ;
}
const sal_Int32 nCount = aPropertyVector . size ( ) ;
Sequence < beans : : PropertyValue > aRet ( nCount ) ;
beans : : PropertyValue * pProps = aRet . getArray ( ) ;
for ( int i = 0 ; i < nCount ; + + i , pProps + + )
{
* pProps = aPropertyVector [ i ] ;
}
return aRet ;
}