2000-09-18 23:08:29 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
|
|
|
* $RCSfile: unostyle.cxx,v $
|
|
|
|
*
|
2001-04-25 10:55:37 +00:00
|
|
|
* $Revision: 1.21 $
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2001-04-25 10:55:37 +00:00
|
|
|
* last change: $Author: os $ $Date: 2001-04-25 11:55:37 $
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
|
|
|
* The Contents of this file are made available subject to the terms of
|
|
|
|
* either of the following licenses
|
|
|
|
*
|
|
|
|
* - GNU Lesser General Public License Version 2.1
|
|
|
|
* - Sun Industry Standards Source License Version 1.1
|
|
|
|
*
|
|
|
|
* Sun Microsystems Inc., October, 2000
|
|
|
|
*
|
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2000 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Sun Industry Standards Source License Version 1.1
|
|
|
|
* =================================================
|
|
|
|
* The contents of this file are subject to the Sun Industry Standards
|
|
|
|
* Source License Version 1.1 (the "License"); You may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of the
|
|
|
|
* License at http://www.openoffice.org/license.html.
|
|
|
|
*
|
|
|
|
* Software provided under this License is provided on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
|
|
|
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
|
|
|
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
|
|
|
* See the License for the specific provisions governing your rights and
|
|
|
|
* obligations concerning the Software.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
|
|
|
*
|
|
|
|
* Copyright: 2000 by Sun Microsystems, Inc.
|
|
|
|
*
|
|
|
|
* All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s): _______________________________________
|
|
|
|
*
|
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#ifdef PRECOMPILED
|
|
|
|
#include "core_pch.hxx"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#pragma hdrstop
|
|
|
|
|
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
|
|
|
|
#ifndef _SVSTOR_HXX //autogen
|
|
|
|
#include <so3/svstor.hxx>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#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
|
|
|
|
#ifndef _SVX_SVXIDS_HRC //autogen
|
|
|
|
#include <svx/svxids.hrc>
|
|
|
|
#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 _UNOMAP_HXX
|
|
|
|
#include <unomap.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 SW_UNOMID_HXX
|
|
|
|
#include <unomid.h>
|
|
|
|
#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
|
2000-10-31 19:33:20 +00:00
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
#ifndef _COM_SUN_STAR_STYLE_PARAGRAPHSTYLECATEGORY_HPP_
|
|
|
|
#include <com/sun/star/style/ParagraphStyleCategory.hpp>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#define STYLE_FAMILY_COUNT 5 // wir habe fuenf Familien
|
|
|
|
|
|
|
|
#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
|
|
|
|
|
|
|
|
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;
|
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
2000-10-25 11:06:06 +00:00
|
|
|
//convert FN_... to RES_ in header and footer itemset
|
|
|
|
USHORT lcl_ConvertFNToRES(USHORT nFNId)
|
|
|
|
{
|
|
|
|
USHORT nRes = USHRT_MAX;
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
return nRes;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2000-10-25 11:06:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
2000-09-18 23:08:29 +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
|
|
|
|
};
|
|
|
|
|
2000-11-07 08:58:56 +00:00
|
|
|
const Programmatic2UIName_Impl* lcl_GetStyleNameTable(SfxStyleFamily eFamily)
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2000-11-07 08:58:56 +00:00
|
|
|
const Programmatic2UIName_Impl* pRet = 0;
|
2000-09-18 23:08:29 +00:00
|
|
|
switch(eFamily)
|
|
|
|
{
|
|
|
|
case SFX_STYLE_FAMILY_CHAR:
|
|
|
|
{
|
|
|
|
static BOOL bInitialized = FALSE;
|
2000-11-07 08:58:56 +00:00
|
|
|
static Programmatic2UIName_Impl aCharFamilyNames[(STR_POOLCHR_PRGM_CURRENT_END - RC_POOLCHRFMT_PRGM_BEGIN) +
|
2000-09-18 23:08:29 +00:00
|
|
|
(STR_POOLCHR_PRGM_HTML_CURRENT_END - RC_POOLCHRFMT_PRGM_HTML_BEGIN) + 3];
|
|
|
|
if(!bInitialized)
|
|
|
|
{
|
|
|
|
bInitialized = TRUE;
|
|
|
|
int nUIResId;
|
|
|
|
int nProgrammaticResId;
|
|
|
|
int nName = 0;
|
|
|
|
for(nUIResId = RC_POOLCHRFMT_BEGIN, nProgrammaticResId = RC_POOLCHRFMT_PRGM_BEGIN;
|
|
|
|
nProgrammaticResId <= STR_POOLCHR_PRGM_CURRENT_END; nUIResId++, nProgrammaticResId++)
|
|
|
|
{
|
|
|
|
aCharFamilyNames[nName].sUIName = String(SW_RES(nUIResId));
|
|
|
|
aCharFamilyNames[nName++].sProgrammaticName = String(SW_RES(nProgrammaticResId));
|
|
|
|
}
|
|
|
|
for(nUIResId = RC_POOLCHRFMT_HTML_BEGIN, nProgrammaticResId = RC_POOLCHRFMT_PRGM_HTML_BEGIN;
|
|
|
|
nProgrammaticResId <= STR_POOLCHR_PRGM_HTML_CURRENT_END; nUIResId++, nProgrammaticResId++)
|
|
|
|
{
|
|
|
|
aCharFamilyNames[nName].sUIName = String(SW_RES(nUIResId));
|
|
|
|
aCharFamilyNames[nName++].sProgrammaticName = String(SW_RES(nProgrammaticResId));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pRet = &aCharFamilyNames[0];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SFX_STYLE_FAMILY_PARA:
|
|
|
|
{
|
|
|
|
static BOOL bInitialized = FALSE;
|
2000-11-07 08:58:56 +00:00
|
|
|
static Programmatic2UIName_Impl aParaFamilyNames[
|
2000-09-18 23:08:29 +00:00
|
|
|
( STR_POCO_PRGM_HEADLINE10 - STR_POCO_PRGM_STANDARD ) +
|
|
|
|
( STR_POCO_PRGM_BUL_NONUM5 - STR_POCO_PRGM_NUMBUL_BASE )+
|
|
|
|
( STR_POCO_PRGM_LABEL_DRAWING - STR_POCO_PRGM_HEADER )+
|
|
|
|
( STR_POCO_PRGM_TOX_USER10 - STR_POCO_PRGM_REGISTER_BASE )+
|
|
|
|
( STR_POCO_PRGM_DOC_SUBTITEL - STR_POCO_PRGM_DOC_TITEL )+
|
|
|
|
( STR_POCO_PRGM_HTML_DT - STR_POCO_PRGM_HTML_BLOCKQUOTE)+
|
|
|
|
+ 7 ];
|
|
|
|
|
|
|
|
|
|
|
|
if(!bInitialized)
|
|
|
|
{
|
|
|
|
struct ParaIds
|
|
|
|
{
|
|
|
|
USHORT nUIStart, nUIEnd, nProgStart;
|
|
|
|
};
|
|
|
|
ParaIds aParaIds[] =
|
|
|
|
{
|
|
|
|
{STR_POOLCOLL_STANDARD, STR_POOLCOLL_HEADLINE10, STR_POCO_PRGM_STANDARD },
|
|
|
|
{STR_POOLCOLL_NUMBUL_BASE, STR_POOLCOLL_BUL_NONUM5, STR_POCO_PRGM_NUMBUL_BASE },
|
|
|
|
{STR_POOLCOLL_HEADER, STR_POOLCOLL_LABEL_DRAWING, STR_POCO_PRGM_HEADER },
|
|
|
|
{STR_POOLCOLL_REGISTER_BASE, STR_POOLCOLL_TOX_USER10, STR_POCO_PRGM_REGISTER_BASE },
|
|
|
|
{STR_POOLCOLL_DOC_TITEL, STR_POOLCOLL_DOC_SUBTITEL, STR_POCO_PRGM_DOC_TITEL },
|
|
|
|
{STR_POOLCOLL_HTML_BLOCKQUOTE, STR_POOLCOLL_HTML_DT, STR_POCO_PRGM_HTML_BLOCKQUOTE },
|
|
|
|
};
|
|
|
|
bInitialized = TRUE;
|
|
|
|
int nUIResId;
|
|
|
|
int nProgrammaticResId;
|
|
|
|
int nName = 0;
|
|
|
|
for(USHORT nPart = 0; nPart < 6; nPart++)
|
|
|
|
for(nUIResId = aParaIds[nPart].nUIStart, nProgrammaticResId = aParaIds[nPart].nProgStart;
|
|
|
|
nUIResId <= aParaIds[nPart].nUIEnd; nUIResId++, nProgrammaticResId++)
|
|
|
|
{
|
|
|
|
aParaFamilyNames[nName].sUIName = String(SW_RES(nUIResId));
|
|
|
|
aParaFamilyNames[nName++].sProgrammaticName = String(SW_RES(nProgrammaticResId));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pRet = &aParaFamilyNames[0];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SFX_STYLE_FAMILY_FRAME:
|
|
|
|
{
|
|
|
|
static BOOL bInitialized = FALSE;
|
2000-11-07 08:58:56 +00:00
|
|
|
static Programmatic2UIName_Impl aFrameFamilyNames[(STR_POOLFRM_PRGM_LABEL - STR_POOLFRM_PRGM_FRAME) + 2];
|
2000-09-18 23:08:29 +00:00
|
|
|
if(!bInitialized)
|
|
|
|
{
|
|
|
|
bInitialized = TRUE;
|
|
|
|
int nUIResId;
|
|
|
|
int nProgrammaticResId;
|
|
|
|
int nName = 0;
|
|
|
|
for(nUIResId = STR_POOLFRM_FRAME, nProgrammaticResId = STR_POOLFRM_PRGM_FRAME;
|
|
|
|
nProgrammaticResId <= STR_POOLFRM_PRGM_LABEL; nUIResId++, nProgrammaticResId++)
|
|
|
|
{
|
|
|
|
aFrameFamilyNames[nName].sUIName = String(SW_RES(nUIResId));
|
|
|
|
aFrameFamilyNames[nName++].sProgrammaticName = String(SW_RES(nProgrammaticResId));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pRet = &aFrameFamilyNames[0];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SFX_STYLE_FAMILY_PAGE:
|
|
|
|
{
|
|
|
|
static BOOL bInitialized = FALSE;
|
2000-11-07 08:58:56 +00:00
|
|
|
static Programmatic2UIName_Impl aPageFamilyNames[(STR_POOLPAGE_PRGM_ENDNOTE - STR_POOLPAGE_PRGM_STANDARD) + 2];
|
2000-09-18 23:08:29 +00:00
|
|
|
if(!bInitialized)
|
|
|
|
{
|
|
|
|
bInitialized = TRUE;
|
|
|
|
int nUIResId;
|
|
|
|
int nProgrammaticResId;
|
|
|
|
int nName = 0;
|
|
|
|
for(nUIResId = STR_POOLPAGE_STANDARD, nProgrammaticResId = STR_POOLPAGE_PRGM_STANDARD;
|
|
|
|
nProgrammaticResId <= STR_POOLPAGE_PRGM_ENDNOTE; nUIResId++, nProgrammaticResId++)
|
|
|
|
{
|
|
|
|
aPageFamilyNames[nName].sUIName = String(SW_RES(nUIResId));
|
|
|
|
aPageFamilyNames[nName++].sProgrammaticName = String(SW_RES(nProgrammaticResId));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pRet = &aPageFamilyNames[0];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SFX_STYLE_FAMILY_PSEUDO:
|
|
|
|
{
|
|
|
|
static BOOL bInitialized = FALSE;
|
2000-11-07 08:58:56 +00:00
|
|
|
static Programmatic2UIName_Impl aNumFamilyNames[(STR_POOLNUMRULE_PRGM_BUL5 - STR_POOLNUMRULE_PRGM_NUM1) + 2];
|
2000-09-18 23:08:29 +00:00
|
|
|
if(!bInitialized)
|
|
|
|
{
|
|
|
|
bInitialized = TRUE;
|
|
|
|
int nUIResId;
|
|
|
|
int nProgrammaticResId;
|
|
|
|
int nName = 0;
|
|
|
|
for(nUIResId = STR_POOLNUMRULE_NUM1, nProgrammaticResId = STR_POOLNUMRULE_PRGM_NUM1;
|
|
|
|
nProgrammaticResId <= STR_POOLNUMRULE_PRGM_BUL5; nUIResId++, nProgrammaticResId++)
|
|
|
|
{
|
|
|
|
aNumFamilyNames[nName].sUIName = String(SW_RES(nUIResId));
|
|
|
|
aNumFamilyNames[nName++].sProgrammaticName = String(SW_RES(nProgrammaticResId));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pRet = &aNumFamilyNames[0];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return pRet;
|
|
|
|
}
|
|
|
|
const String& SwXStyleFamilies::GetProgrammaticName(const String& rUIName, SfxStyleFamily eFamily)
|
|
|
|
{
|
2000-11-07 08:58:56 +00:00
|
|
|
const Programmatic2UIName_Impl* pNames =lcl_GetStyleNameTable(eFamily);
|
2000-09-18 23:08:29 +00:00
|
|
|
DBG_ASSERT(pNames, "no mapping found!!!")
|
|
|
|
if(pNames)
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if(pNames->sUIName == rUIName)
|
|
|
|
return pNames->sProgrammaticName;
|
|
|
|
}
|
|
|
|
while((++pNames)->sUIName.Len());
|
|
|
|
return rUIName;
|
|
|
|
}
|
|
|
|
const String& SwXStyleFamilies::GetUIName(const String& rProgrammaticName, SfxStyleFamily eFamily)
|
|
|
|
{
|
2000-11-07 08:58:56 +00:00
|
|
|
const Programmatic2UIName_Impl* pNames = lcl_GetStyleNameTable(eFamily);
|
2000-09-18 23:08:29 +00:00
|
|
|
do
|
|
|
|
{
|
|
|
|
if(pNames->sProgrammaticName == rProgrammaticName)
|
|
|
|
return pNames->sUIName;
|
|
|
|
}
|
|
|
|
while((++pNames)->sProgrammaticName.Len());
|
|
|
|
return rProgrammaticName;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* 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;
|
|
|
|
if(nIndex >= STYLE_FAMILY_COUNT)
|
|
|
|
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;
|
2000-09-18 23:08:29 +00:00
|
|
|
if(IsValid() && rURL.len())
|
|
|
|
{
|
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();
|
|
|
|
if( sName.EqualsAscii(UNO_NAME_OVERWRITE_STYLES ))
|
|
|
|
bLoadStyleOverwrite = bVal;
|
|
|
|
else if( sName.EqualsAscii(UNO_NAME_LOAD_NUMBERING_STYLES ))
|
|
|
|
bLoadStyleNumbering = bVal;
|
|
|
|
else if( sName.EqualsAscii(UNO_NAME_LOAD_PAGE_STYLES ))
|
|
|
|
bLoadStylePage = bVal;
|
|
|
|
else if( sName.EqualsAscii(UNO_NAME_LOAD_FRAME_STYLES ))
|
|
|
|
bLoadStyleFrame = bVal;
|
|
|
|
else if( sName.EqualsAscii(UNO_NAME_LOAD_TEXT_STYLES ))
|
|
|
|
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());
|
2000-10-24 14:38:05 +00:00
|
|
|
pArray[0] = PropertyValue(C2U(UNO_NAME_LOAD_TEXT_STYLES), -1, aVal, PropertyState_DIRECT_VALUE);
|
2000-09-18 23:08:29 +00:00
|
|
|
aVal.setValue(&bTemp, ::getCppuBooleanType());
|
2000-10-24 14:38:05 +00:00
|
|
|
pArray[1] = PropertyValue(C2U(UNO_NAME_LOAD_FRAME_STYLES), -1, aVal, PropertyState_DIRECT_VALUE);
|
2000-09-18 23:08:29 +00:00
|
|
|
aVal.setValue(&bTemp, ::getCppuBooleanType());
|
2000-10-24 14:38:05 +00:00
|
|
|
pArray[2] = PropertyValue(C2U(UNO_NAME_LOAD_PAGE_STYLES), -1, aVal, PropertyState_DIRECT_VALUE);
|
2000-09-18 23:08:29 +00:00
|
|
|
aVal.setValue(&bTemp, ::getCppuBooleanType());
|
2000-10-24 14:38:05 +00:00
|
|
|
pArray[3] = PropertyValue(C2U(UNO_NAME_LOAD_NUMBERING_STYLES), -1, aVal, PropertyState_DIRECT_VALUE);
|
2000-09-18 23:08:29 +00:00
|
|
|
aVal.setValue(&bTemp, ::getCppuBooleanType());
|
2000-10-24 14:38:05 +00:00
|
|
|
pArray[4] = PropertyValue(C2U(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()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
/*-- 16.12.98 16:03:57---------------------------------------------------
|
|
|
|
|
|
|
|
-----------------------------------------------------------------------*/
|
|
|
|
sal_Int32 SwXStyleFamily::getCount(void) throw( RuntimeException )
|
|
|
|
{
|
|
|
|
vos::OGuard aGuard(Application::GetSolarMutex());
|
|
|
|
sal_Int32 nRet = 0;
|
|
|
|
if(pBasePool)
|
|
|
|
{
|
|
|
|
SfxStyleSheetIterator* pIterator = pBasePool->CreateIterator(eFamily, 0xffff);
|
|
|
|
nRet = pIterator->Count();
|
|
|
|
delete pIterator;
|
|
|
|
}
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
/*-- 16.12.98 16:03:57---------------------------------------------------
|
|
|
|
|
|
|
|
-----------------------------------------------------------------------*/
|
|
|
|
Any SwXStyleFamily::getByIndex(sal_Int32 nIndex)
|
|
|
|
throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, RuntimeException )
|
|
|
|
{
|
|
|
|
vos::OGuard aGuard(Application::GetSolarMutex());
|
|
|
|
Any aRet;
|
|
|
|
if(pBasePool)
|
|
|
|
{
|
|
|
|
SfxStyleSheetIterator* pIterator = pBasePool->CreateIterator(eFamily, 0xffff);
|
|
|
|
sal_uInt16 nCount= pIterator->Count();
|
|
|
|
if(nIndex < nCount)
|
|
|
|
{
|
|
|
|
SfxStyleSheetBase* pBase = (*pIterator)[(sal_uInt16) nIndex];
|
|
|
|
Reference< style::XStyle > xStyle = _FindStyle(pBase->GetName());
|
|
|
|
if(!xStyle.is())
|
|
|
|
{
|
|
|
|
xStyle =
|
|
|
|
eFamily == SFX_STYLE_FAMILY_PAGE ?
|
|
|
|
new SwXPageStyle(*pBasePool, pDocShell, eFamily, pBase->GetName()):
|
2000-12-19 16:28:58 +00:00
|
|
|
eFamily == SFX_STYLE_FAMILY_FRAME ?
|
|
|
|
new SwXFrameStyle(*pBasePool, pDocShell->GetDoc(), pBase->GetName()):
|
|
|
|
new SwXStyle(*pBasePool, eFamily, pDocShell->GetDoc(), pBase->GetName());
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
aRet.setValue(&xStyle, ::getCppuType((Reference<style::XStyle>*)0));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
throw lang::IndexOutOfBoundsException();
|
|
|
|
delete pIterator;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
throw RuntimeException();
|
|
|
|
return aRet;
|
|
|
|
|
|
|
|
}
|
|
|
|
/*-- 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;
|
|
|
|
String sStyleName = SwXStyleFamilies::GetUIName(rName, eFamily);
|
|
|
|
if(pBasePool)
|
|
|
|
{
|
|
|
|
pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
|
|
|
|
SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
|
|
|
|
if(pBase)
|
|
|
|
{
|
|
|
|
Reference< style::XStyle > xStyle;
|
|
|
|
xStyle = _FindStyle(sStyleName);
|
|
|
|
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();
|
|
|
|
for(sal_uInt16 i = 0; i < nCount; i++)
|
|
|
|
pArray[i] = SwXStyleFamilies::GetProgrammaticName((*pIterator)[i]->GetName(), eFamily);
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
String sStyleName(SwXStyleFamilies::GetUIName(rName, eFamily));
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
String sStyleName(rName);
|
|
|
|
pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
|
|
|
|
SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
|
|
|
|
SfxStyleSheetBase* pUINameBase = pBasePool->Find(SwXStyleFamilies::GetUIName(sStyleName, eFamily));
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
USHORT nMask = 0xffff;
|
|
|
|
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 );
|
|
|
|
SfxStyleSheetBase* pBase = pBasePool->Find(SwXStyleFamilies::GetUIName(rName, eFamily));
|
|
|
|
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;
|
|
|
|
Any** pAnyArr;
|
|
|
|
sal_uInt16 nArrLen;
|
|
|
|
|
|
|
|
public:
|
|
|
|
SwStyleProperties_Impl(const SfxItemPropertyMap* _pMap);
|
|
|
|
~SwStyleProperties_Impl();
|
|
|
|
|
|
|
|
sal_Bool SetProperty(const String& rName, Any aVal);
|
|
|
|
sal_Bool GetProperty(const String& rName, Any*& rpAny);
|
|
|
|
|
|
|
|
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++;
|
|
|
|
}
|
|
|
|
|
|
|
|
pAnyArr = new Any*[nArrLen];
|
|
|
|
for(sal_uInt16 i = 0; i < nArrLen; i++)
|
|
|
|
pAnyArr[i] = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
SwStyleProperties_Impl::~SwStyleProperties_Impl()
|
|
|
|
{
|
|
|
|
for(sal_uInt16 i = 0; i < nArrLen; i++)
|
|
|
|
delete pAnyArr[i];
|
|
|
|
delete pAnyArr;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
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];
|
|
|
|
pAnyArr[nPos] = new Any(aVal);
|
|
|
|
}
|
|
|
|
return nPos < nArrLen;
|
|
|
|
}
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
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];
|
|
|
|
}
|
|
|
|
return rpAny && nPos < nArrLen;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
*
|
|
|
|
******************************************************************/
|
|
|
|
/* -----------------------------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)
|
2001-04-23 09:01:41 +00:00
|
|
|
bRet = !rServiceName.compareToAscii("com.sun.star.style.CharacterProperties")||
|
|
|
|
!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)||
|
|
|
|
(C2U("com.sun.star.style.ParagraphProperties") == rServiceName);
|
|
|
|
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
/* -----------------------------06.04.00 11:24--------------------------------
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------*/
|
|
|
|
Sequence< OUString > SwXStyle::getSupportedServiceNames(void) throw( RuntimeException )
|
|
|
|
{
|
|
|
|
long nCount = 1;
|
|
|
|
if(SFX_STYLE_FAMILY_PARA == eFamily)
|
|
|
|
{
|
|
|
|
nCount = 3;
|
|
|
|
if(bIsConditional)
|
|
|
|
nCount++;
|
|
|
|
}
|
|
|
|
else if(SFX_STYLE_FAMILY_CHAR == eFamily)
|
2001-04-23 09:01:41 +00:00
|
|
|
nCount = 4;
|
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:
|
|
|
|
pArray[1] = C2U("com.sun.star.style.CharacterProperties");
|
|
|
|
pArray[2] = C2U("com.sun.star.style.CharacterPropertiesAsian");
|
|
|
|
pArray[3] = C2U("com.sun.star.style.CharacterPropertiesComplex");
|
|
|
|
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");
|
|
|
|
if(bIsConditional)
|
|
|
|
pArray[3] = C2U("com.sun.star.style.ConditionalParagraphStyle");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
/*-- 17.12.98 08:26:49---------------------------------------------------
|
|
|
|
|
|
|
|
-----------------------------------------------------------------------*/
|
|
|
|
SwXStyle::SwXStyle(SfxStyleFamily eFam, BOOL bConditional) :
|
|
|
|
m_pDoc(0),
|
|
|
|
bIsDescriptor(sal_True),
|
|
|
|
bIsConditional(bConditional),
|
|
|
|
eFamily(eFam),
|
|
|
|
pBasePool(0)
|
|
|
|
{
|
|
|
|
sal_uInt16 nMapId = PROPERTY_MAP_CHAR_STYLE;
|
|
|
|
switch( eFamily )
|
|
|
|
{
|
|
|
|
//case SFX_STYLE_FAMILY_CHAR: nMapId = PROPERTY_MAP_CHAR_STYLE; break;
|
|
|
|
case SFX_STYLE_FAMILY_PARA: nMapId = PROPERTY_MAP_PARA_STYLE; break;
|
|
|
|
case SFX_STYLE_FAMILY_PAGE: nMapId = PROPERTY_MAP_PAGE_STYLE; break;
|
|
|
|
case SFX_STYLE_FAMILY_FRAME : nMapId = PROPERTY_MAP_FRAME_STYLE; break;
|
|
|
|
case SFX_STYLE_FAMILY_PSEUDO: nMapId = PROPERTY_MAP_NUM_STYLE; break;
|
|
|
|
}
|
|
|
|
pPropImpl = new SwStyleProperties_Impl(aSwMapProvider.GetPropertyMap(nMapId));
|
|
|
|
}
|
|
|
|
/*-- 17.12.98 08:26:50---------------------------------------------------
|
|
|
|
|
|
|
|
-----------------------------------------------------------------------*/
|
|
|
|
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);
|
|
|
|
DBG_ASSERT(pBase, "wo ist der Style?")
|
|
|
|
if(pBase)
|
|
|
|
{
|
|
|
|
const USHORT nId = pDoc->GetPoolId(sStyleName, GET_POOLID_TXTCOLL);
|
|
|
|
if(nId != USHRT_MAX)
|
|
|
|
::IsConditionalByPoolId( nId );
|
|
|
|
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---------------------------------------------------
|
|
|
|
|
|
|
|
-----------------------------------------------------------------------*/
|
|
|
|
OUString SwXStyle::getName(void) throw( RuntimeException )
|
|
|
|
{
|
|
|
|
vos::OGuard aGuard(Application::GetSolarMutex());
|
|
|
|
OUString sRet;
|
|
|
|
if(pBasePool)
|
|
|
|
{
|
|
|
|
pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
|
|
|
|
SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
|
|
|
|
DBG_ASSERT(pBase, "wo ist der Style?")
|
|
|
|
if(!pBase)
|
|
|
|
throw RuntimeException();
|
|
|
|
sRet = SwXStyleFamilies::GetProgrammaticName(pBase->GetName(), eFamily);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
sRet = sStyleName;
|
|
|
|
return sRet;
|
|
|
|
}
|
|
|
|
/*-- 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);
|
|
|
|
DBG_ASSERT(pBase, "wo ist der Style?")
|
|
|
|
sal_Bool bExcept = sal_True;
|
|
|
|
if(pBase && pBase->IsUserDefined())
|
|
|
|
{
|
|
|
|
SwDocStyleSheet aTmp( *(SwDocStyleSheet*)pBase );
|
|
|
|
bExcept = !aTmp.SetName(rName);
|
|
|
|
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());
|
|
|
|
OUString sRet;
|
|
|
|
if(pBasePool)
|
|
|
|
{
|
|
|
|
pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL);
|
|
|
|
SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
|
|
|
|
if(pBase)
|
|
|
|
sRet = pBase->GetParent();
|
|
|
|
}
|
|
|
|
else if(bIsDescriptor)
|
|
|
|
sRet = sParentStyleName;
|
|
|
|
else
|
|
|
|
throw RuntimeException();
|
|
|
|
return SwXStyleFamilies::GetProgrammaticName(sRet, eFamily);
|
|
|
|
}
|
|
|
|
/*-- 17.12.98 08:26:52---------------------------------------------------
|
|
|
|
|
|
|
|
-----------------------------------------------------------------------*/
|
|
|
|
void SwXStyle::setParentStyle(const OUString& rParentStyle)
|
|
|
|
throw( container::NoSuchElementException, RuntimeException )
|
|
|
|
{
|
|
|
|
vos::OGuard aGuard(Application::GetSolarMutex());
|
|
|
|
String sParentStyle = SwXStyleFamilies::GetUIName(rParentStyle, eFamily);
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
throw RuntimeException();
|
|
|
|
}
|
|
|
|
/*-- 17.12.98 08:26:52---------------------------------------------------
|
|
|
|
|
|
|
|
-----------------------------------------------------------------------*/
|
2000-10-24 14:38:05 +00:00
|
|
|
Reference< XPropertySetInfo > SwXStyle::getPropertySetInfo(void)
|
2000-09-18 23:08:29 +00:00
|
|
|
throw( RuntimeException )
|
|
|
|
{
|
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())
|
|
|
|
{
|
|
|
|
SfxItemPropertySet aPropSet(
|
|
|
|
aSwMapProvider.GetPropertyMap(PROPERTY_MAP_PARA_STYLE));
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
/* -----------------23.04.99 13:28-------------------
|
|
|
|
*
|
|
|
|
* --------------------------------------------------*/
|
|
|
|
void SwXStyle::ApplyDescriptorProperties()
|
|
|
|
{
|
|
|
|
bIsDescriptor = sal_False;
|
|
|
|
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;
|
|
|
|
SwPageDesc* pNewPageDesc;
|
|
|
|
|
|
|
|
SwDocStyleSheet* pNewBase;
|
|
|
|
SfxItemSet* pItemSet;
|
|
|
|
|
|
|
|
const String& rStyleName;
|
|
|
|
USHORT nPDescPos;
|
|
|
|
|
|
|
|
sal_Bool bChgPDesc;
|
|
|
|
|
|
|
|
SwStyleBase_Impl(SwDoc& rSwDoc, const String& rName) :
|
|
|
|
rDoc(rSwDoc),
|
|
|
|
rStyleName(rName),
|
|
|
|
pNewBase(0),
|
|
|
|
pItemSet(0),
|
|
|
|
pOldPageDesc(0),
|
|
|
|
pNewPageDesc(0),
|
|
|
|
nPDescPos(0xffff),
|
|
|
|
bChgPDesc(sal_False)
|
|
|
|
{}
|
|
|
|
~SwStyleBase_Impl(){delete pNewBase; delete pItemSet; delete pNewPageDesc;}
|
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();
|
|
|
|
SwPageDesc& GetPageDesc()
|
|
|
|
{
|
|
|
|
if(!pNewPageDesc)
|
|
|
|
{
|
|
|
|
if(!pOldPageDesc)
|
|
|
|
GetOldPageDesc();
|
|
|
|
pNewPageDesc = new SwPageDesc(*pOldPageDesc);
|
|
|
|
}
|
|
|
|
return *pNewPageDesc;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetChgPageDesc() {bChgPDesc = sal_True;}
|
|
|
|
void ChgPageDesc()
|
|
|
|
{
|
|
|
|
if(bChgPDesc && pNewPageDesc)
|
|
|
|
rDoc.ChgPageDesc( nPDescPos, *pNewPageDesc );
|
|
|
|
}
|
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++)
|
|
|
|
{
|
|
|
|
const SwPageDesc& rDesc = rDoc.GetPageDesc( i );
|
|
|
|
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++)
|
|
|
|
{
|
|
|
|
const SwPageDesc& rDesc = rDoc.GetPageDesc( i );
|
|
|
|
if(rDesc.GetName() == rStyleName)
|
|
|
|
{
|
|
|
|
nPDescPos = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return *pOldPageDesc;
|
|
|
|
}
|
|
|
|
|
2001-04-19 09:40:06 +00:00
|
|
|
/* -----------------------------19.04.01 09:44--------------------------------
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------*/
|
|
|
|
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-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;
|
|
|
|
case FN_UNO_FOLLOW_STYLE:
|
|
|
|
{
|
|
|
|
OUString sTmp;
|
|
|
|
rValue >>= sTmp;
|
|
|
|
rBase.pNewBase->SetFollow( SwXStyleFamilies::GetUIName(sTmp, eFamily)) ;
|
|
|
|
}
|
|
|
|
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();
|
|
|
|
const SfxItemSet& rStyleSet = rBase.GetItemSet();
|
|
|
|
SfxItemSet aSet(*rStyleSet.GetPool(), RES_PAGEDESC, RES_PAGEDESC);
|
|
|
|
aSet.Put(rStyleSet);
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2001-04-19 09:40:06 +00:00
|
|
|
SwFmtPageDesc* pNewDesc = 0;
|
|
|
|
const SfxPoolItem* pItem;
|
|
|
|
if(SFX_ITEM_SET == aSet.GetItemState( RES_PAGEDESC, sal_True, &pItem ) )
|
|
|
|
{
|
|
|
|
pNewDesc = new SwFmtPageDesc(*((SwFmtPageDesc*)pItem));
|
|
|
|
}
|
|
|
|
if(!pNewDesc)
|
|
|
|
pNewDesc = new SwFmtPageDesc();
|
|
|
|
OUString uDescName;
|
|
|
|
rValue >>= uDescName;
|
|
|
|
String sDescName(SwXStyleFamilies::GetUIName(uDescName, SFX_STYLE_FAMILY_PAGE));
|
|
|
|
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-04-19 09:40:06 +00:00
|
|
|
aSet.ClearItem(RES_BREAK);
|
|
|
|
aSet.Put(SwFmtPageDesc());
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2001-04-19 09:40:06 +00:00
|
|
|
else
|
|
|
|
aSet.Put(*pNewDesc);
|
|
|
|
}
|
|
|
|
rBase.pNewBase->SetItemSet(aSet);
|
|
|
|
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;
|
|
|
|
case FN_UNO_CATEGORY:
|
|
|
|
{
|
|
|
|
if(!rBase.pNewBase->IsUserDefined())
|
|
|
|
throw lang::IllegalArgumentException();
|
|
|
|
short nSet;
|
|
|
|
rValue >>= nSet;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2001-04-19 09:40:06 +00:00
|
|
|
USHORT nId = rBase.pNewBase->GetCollection()->GetPoolFmtId() &
|
|
|
|
~ ( COLL_GET_RANGE_BITS | POOLGRP_NOCOLLID );
|
|
|
|
switch( nSet )
|
|
|
|
{
|
|
|
|
case ParagraphStyleCategory::TEXT:
|
|
|
|
nId |= COLL_TEXT_BITS;
|
|
|
|
break;
|
|
|
|
case ParagraphStyleCategory::CHAPTER:
|
|
|
|
nId |= COLL_DOC_BITS;
|
|
|
|
break;
|
|
|
|
case ParagraphStyleCategory::LIST:
|
|
|
|
nId |= COLL_LISTS_BITS;
|
|
|
|
break;
|
|
|
|
case ParagraphStyleCategory::INDEX:
|
|
|
|
nId |= COLL_REGISTER_BITS;
|
|
|
|
break;
|
|
|
|
case ParagraphStyleCategory::EXTRA:
|
|
|
|
nId |= COLL_EXTRA_BITS;
|
|
|
|
break;
|
|
|
|
case ParagraphStyleCategory::HTML:
|
|
|
|
nId |= COLL_HTML_BITS;
|
|
|
|
break;
|
|
|
|
default: throw lang::IllegalArgumentException();
|
|
|
|
}
|
|
|
|
rBase.pNewBase->GetCollection()->SetPoolFmtId( nId );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SID_SWREGISTER_COLLECTION:
|
|
|
|
{
|
|
|
|
SfxItemSet& rStyleSet = rBase.GetItemSet();
|
|
|
|
SfxItemSet aSet(*rStyleSet.GetPool(),
|
|
|
|
SID_SWREGISTER_MODE,
|
|
|
|
SID_SWREGISTER_COLLECTION);
|
|
|
|
aSet.Put(rStyleSet);
|
|
|
|
OUString sName;
|
|
|
|
rValue >>= sName;
|
|
|
|
SwRegisterItem aReg( sName.getLength() != 0);
|
|
|
|
aReg.SetWhich(SID_SWREGISTER_MODE);
|
|
|
|
aSet.Put(aReg);
|
|
|
|
|
|
|
|
aSet.Put(SfxStringItem(SID_SWREGISTER_COLLECTION,
|
|
|
|
SwXStyleFamilies::GetUIName(sName,
|
|
|
|
SFX_STYLE_FAMILY_PARA) ));
|
|
|
|
rBase.pNewBase->SetItemSet(aSet);
|
|
|
|
}
|
|
|
|
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();
|
|
|
|
SfxItemSet aSet(*rStyleSet.GetPool(), pMap->nWID, pMap->nWID);
|
2000-11-15 13:04:24 +00:00
|
|
|
aSet.Put(rStyleSet);
|
2001-04-19 09:40:06 +00:00
|
|
|
SwFmtRuby* pRuby = 0;
|
|
|
|
const SfxPoolItem* pItem;
|
|
|
|
if(SFX_ITEM_SET == aSet.GetItemState( RES_TXTATR_CJK_RUBY, sal_True, &pItem ) )
|
|
|
|
pRuby = new SwFmtRuby(*((SwFmtRuby*)pItem));
|
|
|
|
if(!pRuby)
|
|
|
|
pRuby = new SwFmtRuby(aEmptyStr);
|
|
|
|
String sStyle(SwXStyleFamilies::GetUIName(sTmp, SFX_STYLE_FAMILY_CHAR));
|
|
|
|
pRuby->SetCharFmtName( sTmp );
|
|
|
|
pRuby->SetCharFmtId( 0 );
|
|
|
|
if(sTmp.getLength())
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-04-19 09:40:06 +00:00
|
|
|
sal_uInt16 nId = SwDoc::GetPoolId( sTmp, GET_POOLID_CHRFMT );
|
|
|
|
pRuby->SetCharFmtId(nId);
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2001-04-19 09:40:06 +00:00
|
|
|
aSet.Put(*pRuby);
|
|
|
|
rBase.pNewBase->SetItemSet(aSet);
|
|
|
|
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-04-19 09:40:06 +00:00
|
|
|
const SfxItemSet& rStyleSet = rBase.GetItemSet();
|
|
|
|
SfxItemSet aSet(*rStyleSet.GetPool(), RES_PARATR_DROP, RES_PARATR_DROP);
|
2000-09-18 23:08:29 +00:00
|
|
|
aSet.Put(rStyleSet);
|
|
|
|
|
2001-04-19 09:40:06 +00:00
|
|
|
SwFmtDrop* pDrop = 0;
|
|
|
|
const SfxPoolItem* pItem;
|
|
|
|
if(SFX_ITEM_SET == aSet.GetItemState( RES_PARATR_DROP, sal_True, &pItem ) )
|
|
|
|
pDrop = new SwFmtDrop(*((SwFmtDrop*)pItem));
|
|
|
|
if(!pDrop)
|
|
|
|
pDrop = new SwFmtDrop();
|
|
|
|
OUString uStyle;
|
|
|
|
rValue >>= uStyle;
|
|
|
|
String sStyle(SwXStyleFamilies::GetUIName(uStyle, SFX_STYLE_FAMILY_CHAR));
|
|
|
|
SwDocStyleSheet* pStyle =
|
|
|
|
(SwDocStyleSheet*)pDoc->GetDocShell()->GetStyleSheetPool()->Find(sStyle, SFX_STYLE_FAMILY_CHAR);
|
|
|
|
if(pStyle)
|
|
|
|
pDrop->SetCharFmt(pStyle->GetCharFmt());
|
|
|
|
else
|
|
|
|
throw lang::IllegalArgumentException();
|
|
|
|
aSet.Put(*pDrop);
|
|
|
|
rBase.pNewBase->SetItemSet(aSet);
|
|
|
|
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);
|
|
|
|
aSet.Put(rStyleSet);
|
|
|
|
rPropSet.setPropertyValue(*pMap, rValue, aSet);
|
|
|
|
rStyleSet.Put(aSet);
|
|
|
|
}
|
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
|
|
|
---------------------------------------------------------------------------*/
|
|
|
|
void SwXStyle::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());
|
|
|
|
sal_Int8 nPropSetId = PROPERTY_SET_CHAR_STYLE;
|
|
|
|
switch(eFamily)
|
|
|
|
{
|
|
|
|
case SFX_STYLE_FAMILY_PARA: nPropSetId = 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;
|
|
|
|
}
|
|
|
|
SfxItemPropertySet& aPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
|
|
|
|
|
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();
|
|
|
|
const SfxItemPropertyMap* pMap = aPropSet.getPropertyMap();
|
2001-04-25 10:55:37 +00:00
|
|
|
if(!m_pDoc)
|
|
|
|
throw RuntimeException();
|
|
|
|
|
|
|
|
SwStyleBase_Impl aBaseImpl(*m_pDoc, sStyleName);
|
2000-09-18 23:08:29 +00:00
|
|
|
if(pBasePool)
|
|
|
|
{
|
|
|
|
USHORT 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-04-19 09:40:06 +00:00
|
|
|
DBG_ASSERT(pBase, "wo ist der Style?")
|
|
|
|
if(pBase)
|
|
|
|
aBaseImpl.pNewBase = new SwDocStyleSheet(*(SwDocStyleSheet*)pBase);
|
|
|
|
else
|
|
|
|
throw RuntimeException();
|
|
|
|
}
|
|
|
|
|
|
|
|
for(sal_Int32 nProp = 0; nProp < rPropertyNames.getLength(); nProp++)
|
|
|
|
{
|
|
|
|
pMap = SfxItemPropertyMap::GetByName( pMap, pNames[nProp]);
|
|
|
|
if(!pMap)
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-04-19 09:40:06 +00:00
|
|
|
UnknownPropertyException aExcept;
|
|
|
|
aExcept.Message = pNames[nProp];
|
|
|
|
throw aExcept;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2001-04-19 09:40:06 +00:00
|
|
|
if(aBaseImpl.pNewBase)
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-04-19 09:40:06 +00:00
|
|
|
lcl_SetStyleProperty(pMap, aPropSet, pValues[nProp], aBaseImpl,
|
|
|
|
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());
|
|
|
|
}
|
|
|
|
/*-- 18.04.01 13:07:29---------------------------------------------------
|
|
|
|
|
|
|
|
-----------------------------------------------------------------------*/
|
|
|
|
Any lcl_GetStyleProperty(const SfxItemPropertyMap* pMap,
|
|
|
|
SfxItemPropertySet& rPropSet,
|
|
|
|
SwStyleBase_Impl& rBase,
|
|
|
|
SfxStyleSheetBase* pBase,
|
|
|
|
SfxStyleFamily eFamily) throw(RuntimeException)
|
|
|
|
{
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
case FN_UNO_FOLLOW_STYLE:
|
|
|
|
aRet <<= OUString(SwXStyleFamilies::GetProgrammaticName(rBase.pNewBase->GetFollow(), eFamily));
|
|
|
|
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)
|
|
|
|
aRet <<= OUString( SwXStyleFamilies::GetProgrammaticName(pDesc->GetName(), SFX_STYLE_FAMILY_PAGE) );
|
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;
|
|
|
|
case FN_UNO_CATEGORY:
|
|
|
|
{
|
|
|
|
USHORT nPoolId = rBase.pNewBase->GetCollection()->GetPoolFmtId();
|
|
|
|
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;
|
|
|
|
OUString sName;
|
|
|
|
if( pPageDesc )
|
|
|
|
pCol = pPageDesc->GetRegisterFmtColl();
|
|
|
|
if( pCol )
|
|
|
|
sName = SwXStyleFamilies::GetProgrammaticName(
|
|
|
|
pCol->GetName(), SFX_STYLE_FAMILY_PARA );
|
|
|
|
aRet <<= sName;
|
|
|
|
}
|
|
|
|
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--------------------------------
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------*/
|
|
|
|
Sequence< Any > SwXStyle::getPropertyValues(
|
|
|
|
const Sequence< OUString >& rPropertyNames ) throw(RuntimeException)
|
|
|
|
{
|
|
|
|
vos::OGuard aGuard(Application::GetSolarMutex());
|
2001-04-25 10:55:37 +00:00
|
|
|
if(!m_pDoc)
|
|
|
|
throw RuntimeException();
|
2001-04-19 09:40:06 +00:00
|
|
|
sal_Int8 nPropSetId = PROPERTY_SET_CHAR_STYLE;
|
|
|
|
switch(eFamily)
|
|
|
|
{
|
|
|
|
case SFX_STYLE_FAMILY_PARA: nPropSetId = 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;
|
|
|
|
}
|
|
|
|
SfxItemPropertySet& aPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
|
|
|
|
const OUString* pNames = rPropertyNames.getConstArray();
|
|
|
|
Sequence< Any > aRet(rPropertyNames.getLength());
|
|
|
|
Any* pRet = aRet.getArray();
|
|
|
|
const SfxItemPropertyMap* pMap = aPropSet.getPropertyMap();
|
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]);
|
|
|
|
if(!pMap)
|
|
|
|
{
|
|
|
|
RuntimeException aExcept;
|
|
|
|
aExcept.Message = pNames[nProp];
|
|
|
|
throw aExcept;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(pBasePool)
|
|
|
|
{
|
|
|
|
if(!pBase)
|
|
|
|
{
|
|
|
|
USHORT nSaveMask = pBasePool->GetSearchMask();
|
|
|
|
pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
|
|
|
|
pBase = pBasePool->Find(sStyleName);
|
|
|
|
pBasePool->SetSearchMask(eFamily, nSaveMask );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2001-04-19 09:40:06 +00:00
|
|
|
pRet[nProp] = lcl_GetStyleProperty(pMap, aPropSet, aBase, pBase, eFamily);
|
|
|
|
}
|
|
|
|
else if(bIsDescriptor)
|
|
|
|
{
|
|
|
|
Any* pAny = 0;
|
|
|
|
if(!pPropImpl->GetProperty(pNames[nProp], pAny))
|
|
|
|
throw RuntimeException();
|
|
|
|
else if(pAny)
|
|
|
|
pRet[nProp] = *pAny;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
throw RuntimeException();
|
|
|
|
}
|
|
|
|
return aRet;
|
|
|
|
}
|
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)
|
|
|
|
{
|
|
|
|
const Sequence<OUString> aProperties(&rPropertyName, 1);
|
|
|
|
const Sequence<Any> aValues(&rValue, 1);
|
|
|
|
setPropertyValues(aProperties, aValues);
|
|
|
|
}
|
|
|
|
/*-- 17.12.98 08:26:53---------------------------------------------------
|
|
|
|
|
|
|
|
-----------------------------------------------------------------------*/
|
|
|
|
Any SwXStyle::getPropertyValue(const OUString& rPropertyName)
|
|
|
|
throw( UnknownPropertyException, lang::WrappedTargetException, RuntimeException )
|
|
|
|
{
|
|
|
|
const Sequence<OUString> aProperties(&rPropertyName, 1);
|
|
|
|
return getPropertyValues(aProperties).getConstArray()[0];
|
|
|
|
|
|
|
|
}
|
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);
|
|
|
|
DBG_ASSERT(pBase, "wo ist der Style?")
|
|
|
|
|
|
|
|
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
|
|
|
{
|
2000-10-24 14:38:05 +00:00
|
|
|
case SFX_STYLE_FAMILY_PARA: nPropSetId = PROPERTY_SET_PARA_STYLE ; break;
|
|
|
|
case SFX_STYLE_FAMILY_FRAME: nPropSetId = PROPERTY_SET_FRAME_STYLE ;break;
|
2000-10-25 11:06:06 +00:00
|
|
|
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
|
|
|
}
|
2000-10-24 14:38:05 +00:00
|
|
|
|
|
|
|
SfxItemSet aSet = aStyle.GetItemSet();
|
2000-10-25 11:06:06 +00:00
|
|
|
SfxItemPropertySet& rStylePropSet = aSwMapProvider.GetPropertySet(nPropSetId);
|
2000-10-24 14:38:05 +00:00
|
|
|
for(sal_Int32 i = 0; i < rPropertyNames.getLength(); i++)
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2000-10-24 14:38:05 +00:00
|
|
|
String sPropName(pNames[i]);
|
|
|
|
if(sPropName.EqualsAscii(UNO_NAME_NUMBERING_RULES)||
|
|
|
|
sPropName.EqualsAscii(UNO_NAME_FOLLOW_STYLE))
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2000-10-24 14:38:05 +00:00
|
|
|
pStates[i] = PropertyState_DIRECT_VALUE;
|
|
|
|
}
|
2000-10-25 11:06:06 +00:00
|
|
|
else if(SFX_STYLE_FAMILY_PAGE == eFamily &&
|
|
|
|
(sPropName.EqualsAscii("Header", 0, 6)
|
|
|
|
|| sPropName.EqualsAscii("Footer", 0, 6)))
|
|
|
|
{
|
|
|
|
const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
|
|
|
|
rStylePropSet.getPropertyMap(), sPropName);
|
|
|
|
if(!pMap)
|
|
|
|
throw UnknownPropertyException();
|
|
|
|
USHORT nResId = lcl_ConvertFNToRES(pMap->nWID);
|
|
|
|
BOOL bFooter = sPropName.EqualsAscii("Footer", 0, 6);
|
|
|
|
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
|
|
|
|
{
|
2000-10-25 11:06:06 +00:00
|
|
|
pStates[i] = rStylePropSet.getPropertyState(sPropName, aSet);
|
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 )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
vos::OGuard aGuard(Application::GetSolarMutex());
|
|
|
|
if(pBasePool)
|
|
|
|
{
|
|
|
|
pBasePool->SetSearchMask(eFamily);
|
|
|
|
SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
|
|
|
|
DBG_ASSERT(pBase, "wo ist der Style?")
|
|
|
|
|
|
|
|
if(pBase)
|
|
|
|
{
|
|
|
|
SwDocStyleSheet aStyle( *(SwDocStyleSheet*)pBase );
|
|
|
|
String sPropName(rPropertyName);
|
|
|
|
//Sonderbehandlung fuer das SvxNumRuleItem:
|
|
|
|
if(sPropName.EqualsAscii(UNO_NAME_NUMBERING_RULES))
|
|
|
|
{
|
|
|
|
throw RuntimeException();
|
|
|
|
}
|
|
|
|
else if(sPropName.EqualsAscii(UNO_NAME_FOLLOW_STYLE))
|
|
|
|
{
|
|
|
|
throw RuntimeException();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sal_Int8 nPropSetId = PROPERTY_SET_CHAR_STYLE;
|
|
|
|
switch(eFamily)
|
|
|
|
{
|
|
|
|
case SFX_STYLE_FAMILY_PARA: nPropSetId = 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;
|
|
|
|
}
|
|
|
|
|
|
|
|
SfxItemSet aSet(aStyle.GetItemSet());
|
|
|
|
const SfxItemPropertyMap* _pMap = aSwMapProvider.GetPropertyMap(nPropSetId);
|
|
|
|
const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
|
|
|
|
_pMap, rPropertyName);
|
|
|
|
|
|
|
|
aSet.InvalidateItem( pMap->nWID);
|
|
|
|
aStyle.SetItemSet(aSet);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
throw RuntimeException();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
throw RuntimeException();
|
|
|
|
}
|
|
|
|
/*-- 08.03.99 10:50:27---------------------------------------------------
|
|
|
|
|
|
|
|
-----------------------------------------------------------------------*/
|
|
|
|
Any SwXStyle::getPropertyDefault(const OUString& rPropertyName)
|
2000-10-24 14:38:05 +00:00
|
|
|
throw( UnknownPropertyException, lang::WrappedTargetException, RuntimeException )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
vos::OGuard aGuard(Application::GetSolarMutex());
|
|
|
|
Any aRet;
|
|
|
|
if(pBasePool)
|
|
|
|
{
|
|
|
|
pBasePool->SetSearchMask(eFamily);
|
|
|
|
SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
|
|
|
|
DBG_ASSERT(pBase, "wo ist der Style?")
|
|
|
|
|
|
|
|
if(pBase)
|
|
|
|
{
|
|
|
|
SwDocStyleSheet aStyle( *(SwDocStyleSheet*)pBase );
|
|
|
|
String sPropName(rPropertyName);
|
|
|
|
//Sonderbehandlung fuer das SvxNumRuleItem:
|
|
|
|
if(!sPropName.EqualsAscii(UNO_NAME_NUMBERING_RULES) &&
|
|
|
|
!sPropName.EqualsAscii(UNO_NAME_FOLLOW_STYLE))
|
|
|
|
{
|
|
|
|
sal_Int8 nPropSetId = PROPERTY_SET_CHAR_STYLE;
|
|
|
|
switch(eFamily)
|
|
|
|
{
|
|
|
|
case SFX_STYLE_FAMILY_PARA: nPropSetId = 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;
|
|
|
|
}
|
|
|
|
|
|
|
|
SfxItemSet aSet = aStyle.GetItemSet();
|
|
|
|
const SfxItemPropertyMap* _pMap = aSwMapProvider.GetPropertyMap(nPropSetId);
|
|
|
|
const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
|
|
|
|
_pMap, sPropName);
|
|
|
|
const SfxItemSet* pParentSet = aSet.GetParent();
|
|
|
|
if(pParentSet)
|
|
|
|
aRet = aSwMapProvider.GetPropertySet(nPropSetId).
|
|
|
|
getPropertyValue(sPropName, *pParentSet);
|
|
|
|
else if(pMap->nWID != aSet.GetPool()->GetSlotId(pMap->nWID))
|
|
|
|
{
|
|
|
|
const SfxPoolItem& rItem = aSet.GetPool()->GetDefaultItem(pMap->nWID);
|
|
|
|
rItem.QueryValue(aRet, pMap->nMemberId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
throw RuntimeException();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
throw RuntimeException();
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
/* -----------------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;
|
|
|
|
}
|
|
|
|
/******************************************************************
|
|
|
|
* 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) :
|
|
|
|
SwXStyle(SFX_STYLE_FAMILY_PAGE),
|
|
|
|
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
|
|
|
---------------------------------------------------------------------------*/
|
|
|
|
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());
|
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-04-19 09:40:06 +00:00
|
|
|
USHORT nSaveMask = GetBasePool()->GetSearchMask();
|
|
|
|
GetBasePool()->SetSearchMask(GetFamily());
|
|
|
|
SfxStyleSheetBase* pBase = GetBasePool()->Find(GetStyleName());
|
|
|
|
GetBasePool()->SetSearchMask(GetFamily(), nSaveMask );
|
|
|
|
DBG_ASSERT(pBase, "wo ist der Style?")
|
|
|
|
if(pBase)
|
|
|
|
aBaseImpl.pNewBase = new SwDocStyleSheet(*(SwDocStyleSheet*)pBase);
|
|
|
|
else
|
|
|
|
throw RuntimeException();
|
|
|
|
}
|
|
|
|
|
|
|
|
for(sal_Int32 nProp = 0; nProp < rPropertyNames.getLength(); nProp++)
|
|
|
|
{
|
|
|
|
pMap = SfxItemPropertyMap::GetByName( pMap, pNames[nProp]);
|
|
|
|
if(!pMap)
|
|
|
|
{
|
|
|
|
UnknownPropertyException aExcept;
|
|
|
|
aExcept.Message = pNames[nProp];
|
|
|
|
throw aExcept;
|
|
|
|
}
|
|
|
|
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:
|
|
|
|
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:
|
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 );
|
|
|
|
SfxItemSet aSet(aStyle.GetItemSet());
|
|
|
|
sal_Bool bSetItem = sal_False;
|
|
|
|
sal_Bool bFooter = sal_False;
|
|
|
|
sal_uInt16 nItemType = TYPE_BOOL;
|
|
|
|
sal_uInt16 nRes = 0;
|
|
|
|
switch(pMap->nWID)
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
|
|
|
|
}
|
|
|
|
const SvxSetItem* pSetItem;
|
|
|
|
if(SFX_ITEM_SET == aSet.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
|
|
|
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();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch(nItemType)
|
|
|
|
{
|
|
|
|
case TYPE_BOOL: pNewItem = new SfxBoolItem(nRes); break;
|
|
|
|
case TYPE_SIZE: pNewItem = new SvxSizeItem(nRes); break;
|
|
|
|
case TYPE_BRUSH: pNewItem = new SvxBrushItem(nRes); break;
|
|
|
|
case TYPE_ULSPACE: pNewItem = new SvxULSpaceItem(nRes); break;
|
|
|
|
case TYPE_SHADOW : pNewItem = new SvxShadowItem(nRes); break;
|
|
|
|
case TYPE_LRSPACE: pNewItem = new SvxLRSpaceItem(nRes); break;
|
|
|
|
case TYPE_BOX: pNewItem = new SvxBoxItem(nRes); break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
bSetItem = pNewItem->PutValue(pValues[nProp], pMap->nMemberId);
|
|
|
|
rSetSet.Put(*pNewItem);
|
|
|
|
aSet.Put(*pNewSetItem);
|
|
|
|
aStyle.SetItemSet(aSet);
|
|
|
|
delete pNewItem;
|
|
|
|
delete pNewSetItem;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2001-04-19 09:40:06 +00:00
|
|
|
else if(SID_ATTR_PAGE_ON == nRes )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-04-19 09:40:06 +00:00
|
|
|
sal_Bool bVal = *(sal_Bool*)pValues[nProp].getValue();
|
|
|
|
if(bVal)
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-04-19 09:40:06 +00:00
|
|
|
SfxItemSet aTempSet(*aSet.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);
|
|
|
|
aSet.Put(aNewSetItem);
|
|
|
|
aStyle.SetItemSet(aSet);
|
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-19 09:40:06 +00:00
|
|
|
sal_Bool bRet = sal_True;
|
2001-04-25 10:55:37 +00:00
|
|
|
SwPageFtnInfo& rInfo = aBaseImpl.GetPageDesc().GetFtnInfo();
|
|
|
|
sal_Int32 nSet32;
|
|
|
|
switch(pMap->nMemberId & ~CONVERT_TWIPS)
|
2001-02-13 07:02:30 +00:00
|
|
|
{
|
2001-04-25 10:55:37 +00:00
|
|
|
case MID_LINE_COLOR :
|
|
|
|
pValues[nProp] >>= nSet32;
|
|
|
|
rInfo.SetLineColor(nSet32);
|
|
|
|
break;
|
|
|
|
case MID_FTN_HEIGHT:
|
|
|
|
case MID_LINE_TEXT_DIST :
|
|
|
|
case MID_LINE_FOOTNOTE_DIST:
|
2001-04-19 09:40:06 +00:00
|
|
|
pValues[nProp] >>= nSet32;
|
2001-04-25 10:55:37 +00:00
|
|
|
if(nSet32 < 0)
|
2001-04-19 09:40:06 +00:00
|
|
|
bRet = sal_False;
|
|
|
|
else
|
2001-04-25 10:55:37 +00:00
|
|
|
{
|
|
|
|
nSet32 = MM100_TO_TWIP(nSet32);
|
|
|
|
switch(pMap->nMemberId & ~CONVERT_TWIPS)
|
|
|
|
{
|
|
|
|
case MID_FTN_HEIGHT: rInfo.SetHeight(nSet32); break;
|
|
|
|
case MID_LINE_TEXT_DIST: rInfo.SetTopDist(nSet32);break;
|
|
|
|
case MID_LINE_FOOTNOTE_DIST: rInfo.SetBottomDist(nSet32);break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case MID_LINE_WEIGHT :
|
|
|
|
{
|
|
|
|
sal_Int16 nSet; pValues[nProp] >>= nSet;
|
|
|
|
if(nSet >= 0)
|
|
|
|
rInfo.SetLineWidth(MM100_TO_TWIP(nSet));
|
|
|
|
else
|
|
|
|
bRet = sal_False;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case MID_LINE_RELWIDTH :
|
|
|
|
{
|
|
|
|
sal_Int8 nSet; pValues[nProp] >>= nSet;
|
|
|
|
if(nSet < 0)
|
|
|
|
bRet = sal_False;
|
|
|
|
else
|
|
|
|
rInfo.SetWidth(Fraction(nSet, 100));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case MID_LINE_ADJUST :
|
|
|
|
{
|
|
|
|
sal_Int16 nSet; pValues[nProp] >>= nSet;
|
|
|
|
if(nSet >= 0 && nSet < 3) //com::sun::star::text::HorizontalAdjust
|
|
|
|
rInfo.SetAdj((SwFtnAdj)nSet);
|
|
|
|
else
|
|
|
|
bRet = sal_False;
|
2001-02-13 07:02:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2001-04-25 10:55:37 +00:00
|
|
|
if(bRet)
|
|
|
|
aBaseImpl.SetChgPageDesc();
|
|
|
|
else
|
|
|
|
throw IllegalArgumentException();
|
|
|
|
break;
|
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-25 10:55:37 +00:00
|
|
|
aBaseImpl.ChgPageDesc();
|
2001-04-19 09:40:06 +00:00
|
|
|
if(aBaseImpl.HasItemSet())
|
|
|
|
aBaseImpl.pNewBase->SetItemSet(aBaseImpl.GetItemSet());
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
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
|
|
|
---------------------------------------------------------------------------*/
|
|
|
|
Sequence< Any > SwXPageStyle::getPropertyValues(
|
|
|
|
const Sequence< OUString >& rPropertyNames )
|
|
|
|
throw(RuntimeException)
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
vos::OGuard aGuard(Application::GetSolarMutex());
|
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);
|
|
|
|
const OUString* pNames = rPropertyNames.getConstArray();
|
|
|
|
Sequence< Any > aRet(rPropertyNames.getLength());
|
|
|
|
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;
|
|
|
|
for(sal_Int32 nProp = 0; nProp < rPropertyNames.getLength(); nProp++)
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-04-19 09:40:06 +00:00
|
|
|
pMap = SfxItemPropertyMap::GetByName( pMap, pNames[nProp]);
|
|
|
|
if(!pMap)
|
|
|
|
{
|
|
|
|
RuntimeException aExcept;
|
|
|
|
aExcept.Message = pNames[nProp];
|
|
|
|
throw aExcept;
|
|
|
|
}
|
|
|
|
|
|
|
|
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-04-19 09:40:06 +00:00
|
|
|
USHORT nSaveMask = GetBasePool()->GetSearchMask();
|
|
|
|
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:
|
|
|
|
|
|
|
|
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:
|
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;
|
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 :
|
|
|
|
{
|
2001-04-25 10:55:37 +00:00
|
|
|
const SwPageFtnInfo& rInfo = (SwPageFtnInfo&)aBase.GetOldPageDesc().GetFtnInfo();
|
|
|
|
switch(pMap->nMemberId & ~CONVERT_TWIPS)
|
2001-04-19 09:40:06 +00:00
|
|
|
{
|
2001-04-25 10:55:37 +00:00
|
|
|
case MID_FTN_HEIGHT : pRet[nProp] <<= (sal_Int32)TWIP_TO_MM100(rInfo.GetHeight());break;
|
|
|
|
case MID_LINE_WEIGHT : pRet[nProp] <<= (sal_Int16)TWIP_TO_MM100(rInfo.GetLineWidth());break;
|
|
|
|
case MID_LINE_COLOR : pRet[nProp] <<= (sal_Int32)rInfo.GetLineColor().GetColor();break;
|
|
|
|
case MID_LINE_RELWIDTH :
|
2001-02-13 07:02:30 +00:00
|
|
|
{
|
2001-04-25 10:55:37 +00:00
|
|
|
Fraction aTmp( 100, 1 );
|
|
|
|
aTmp *= rInfo.GetWidth();
|
|
|
|
pRet[nProp] <<= (sal_Int8)(long)aTmp;
|
2001-02-13 07:02:30 +00:00
|
|
|
}
|
2001-04-25 10:55:37 +00:00
|
|
|
break;
|
|
|
|
case MID_LINE_ADJUST : pRet[nProp] <<= (sal_Int16)rInfo.GetAdj();break;//com::sun::star::text::HorizontalAdjust
|
|
|
|
case MID_LINE_TEXT_DIST : pRet[nProp] <<= (sal_Int32)TWIP_TO_MM100(rInfo.GetTopDist());break;
|
|
|
|
case MID_LINE_FOOTNOTE_DIST: pRet[nProp] <<= (sal_Int32)TWIP_TO_MM100(rInfo.GetBottomDist());break;
|
2001-02-13 07:02:30 +00:00
|
|
|
}
|
|
|
|
}
|
2001-04-19 09:40:06 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
pRet[nProp] = lcl_GetStyleProperty(pMap, aPropSet, aBase, pBase, 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())
|
|
|
|
{
|
|
|
|
Any* pAny = 0;
|
|
|
|
if(!GetPropImpl()->GetProperty(pNames[nProp], pAny))
|
|
|
|
throw RuntimeException();
|
|
|
|
else if(pAny)
|
|
|
|
pRet[nProp] = *pAny;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
throw RuntimeException();
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2001-04-19 09:40:06 +00:00
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
/*-- 17.12.98 08:43:36---------------------------------------------------
|
|
|
|
|
|
|
|
-----------------------------------------------------------------------*/
|
|
|
|
Any SwXPageStyle::getPropertyValue(const OUString& rPropertyName) throw(
|
|
|
|
UnknownPropertyException, WrappedTargetException, RuntimeException)
|
|
|
|
{
|
|
|
|
const Sequence<OUString> aProperties(&rPropertyName, 1);
|
|
|
|
return getPropertyValues(aProperties).getConstArray()[0];
|
|
|
|
}
|
|
|
|
/*-- 17.12.98 08:43:36---------------------------------------------------
|
|
|
|
|
|
|
|
-----------------------------------------------------------------------*/
|
|
|
|
void SwXPageStyle::setPropertyValue(const OUString& rPropertyName, const Any& rValue)
|
|
|
|
throw( UnknownPropertyException,
|
|
|
|
PropertyVetoException,
|
|
|
|
lang::IllegalArgumentException,
|
|
|
|
lang::WrappedTargetException,
|
|
|
|
RuntimeException)
|
|
|
|
{
|
|
|
|
const Sequence<OUString> aProperties(&rPropertyName, 1);
|
|
|
|
const Sequence<Any> aValues(&rValue, 1);
|
|
|
|
setPropertyValues(aProperties, aValues);
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
/* -----------------12.01.99 15:31-------------------
|
|
|
|
* Liefert den StartNode des Headers oder Footers der
|
|
|
|
* linken oder rechten Seite zurueck
|
|
|
|
* Kann auch Null liefern, wenn es keinen gibt
|
|
|
|
* --------------------------------------------------*/
|
|
|
|
const SwStartNode* SwXPageStyle::GetStartNode(sal_Bool bHeader, sal_Bool bLeft)
|
|
|
|
{
|
|
|
|
const SwStartNode* pRet = 0;
|
|
|
|
if(GetBasePool())
|
|
|
|
{
|
|
|
|
sal_uInt16 nRes = bHeader ? RES_HEADER : RES_FOOTER;
|
|
|
|
SwDoc* pDoc = pDocShell->GetDoc();
|
|
|
|
sal_uInt16 nPDescCount = pDoc->GetPageDescCnt();
|
|
|
|
for(sal_uInt16 i = 0; i < nPDescCount; i++)
|
|
|
|
{
|
|
|
|
const SwPageDesc& rDesc = pDoc->GetPageDesc( i );
|
|
|
|
if(rDesc.GetName() == GetStyleName())
|
|
|
|
{
|
|
|
|
const SwFrmFmt* pFrmFmt = 0;
|
|
|
|
sal_Bool bShare = bHeader && rDesc.IsHeaderShared()||
|
|
|
|
!bHeader && rDesc.IsFooterShared();
|
|
|
|
UseOnPage eUse = rDesc.GetUseOn();
|
|
|
|
if(bShare || !bLeft && PD_RIGHT == eUse && PD_LEFT != eUse)
|
|
|
|
pFrmFmt = &rDesc.GetMaster();
|
|
|
|
else if(bLeft && PD_RIGHT != eUse)
|
|
|
|
pFrmFmt = &rDesc.GetLeft();
|
|
|
|
if(pFrmFmt)
|
|
|
|
{
|
|
|
|
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()))
|
|
|
|
{
|
|
|
|
const SwFmtCntnt& rFlyCntnt = pHeadFootFmt->GetCntnt();
|
|
|
|
const SwNode& rNode = rFlyCntnt.GetCntntIdx()->GetNode();
|
|
|
|
pRet = rNode.FindStartNode();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return pRet;
|
|
|
|
}
|
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 );
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|