2000-09-18 16:07:07 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
|
|
|
* $RCSfile: xmlnume.cxx,v $
|
|
|
|
*
|
2001-10-17 12:26:13 +00:00
|
|
|
* $Revision: 1.18 $
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2001-10-17 12:26:13 +00:00
|
|
|
* last change: $Author: cl $ $Date: 2001-10-17 13:26:13 $
|
2000-09-18 16:07:07 +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): _______________________________________
|
|
|
|
*
|
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#ifndef _RTL_USTRBUF_HXX_
|
|
|
|
#include <rtl/ustrbuf.hxx>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _URLOBJ_HXX
|
|
|
|
#include <tools/urlobj.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _TOOLS_DEBUG_HXX
|
|
|
|
#include <tools/debug.hxx>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _XMLOFF_NMSPMAP_HXX
|
|
|
|
#include "nmspmap.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef _XMLOFF_XMLNMSPE_HXX
|
|
|
|
#include "xmlnmspe.hxx"
|
|
|
|
#endif
|
2001-06-29 20:07:26 +00:00
|
|
|
#ifndef _XMLOFF_XMLTOKEN_HXX
|
|
|
|
#include "xmltoken.hxx"
|
2000-09-18 16:07:07 +00:00
|
|
|
#endif
|
|
|
|
#ifndef _XMLOFF_XMLUCONV_HXX
|
|
|
|
#include "xmluconv.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef _XMLOFF_PROPERTYHANDLER_FONTTYPES_HXX
|
|
|
|
#include "fonthdl.hxx"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _COM_SUN_STAR_STYLE_XSTYLEFAMILIESSUPPLIER_HPP_
|
|
|
|
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_STYLE_NUMBERINGTYPE_HPP_
|
|
|
|
#include <com/sun/star/style/NumberingType.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_STYLE_XSTYLE_HPP_
|
|
|
|
#include <com/sun/star/style/XStyle.hpp>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
|
|
|
|
#include <com/sun/star/container/XNameContainer.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_CONTAINER_XINDEXREPLACE_HPP_
|
|
|
|
#include <com/sun/star/container/XIndexReplace.hpp>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _COM_SUN_STAR_AWT_XBITMAP_HPP_
|
|
|
|
#include <com/sun/star/awt/XBitmap.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_AWT_FONTDESCRIPTOR_HPP_
|
|
|
|
#include <com/sun/star/awt/FontDescriptor.hpp>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _COM_SUN_STAR_TEXT_HORIORIENTATION_HPP_
|
|
|
|
#include <com/sun/star/text/HoriOrientation.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_TEXT_VERTORIENTATION_HPP_
|
|
|
|
#include <com/sun/star/text/VertOrientation.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_TEXT_XCHAPTERNUMBERINGSUPPLIER_HPP_
|
|
|
|
#include <com/sun/star/text/XChapterNumberingSupplier.hpp>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
|
|
|
|
#include <com/sun/star/beans/PropertyValue.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
|
|
|
|
#include <com/sun/star/beans/XPropertySet.hpp>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _XMLOFF_XMLTEXTLISTAUTOSTYLEPOOL_HXX
|
|
|
|
#include "XMLTextListAutoStylePool.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef _XMLOFF_XMLNUME_HXX
|
|
|
|
#include "xmlnume.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef _XMLOFF_XMLEXP_HXX
|
|
|
|
#include "xmlexp.hxx"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _VCL_VCLENUM_HXX
|
|
|
|
#include <vcl/vclenum.hxx>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
using namespace ::rtl;
|
|
|
|
using namespace ::com::sun::star;
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::style;
|
|
|
|
using namespace ::com::sun::star::text;
|
|
|
|
using namespace ::com::sun::star::container;
|
|
|
|
using namespace ::com::sun::star::beans;
|
2001-06-29 20:07:26 +00:00
|
|
|
using namespace ::xmloff::token;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_SYMBOL_TEXT_DISTANCE[] = "SymbolTextDistance";
|
|
|
|
static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_PARENT_NUMBERING[] = "ParentNumbering";
|
|
|
|
static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_CHAR_STYLE_NAME[] = "CharStyleName";
|
|
|
|
static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_BULLET_CHAR[] = "BulletChar";
|
2000-12-01 17:59:51 +00:00
|
|
|
static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_BULLET_RELSIZE[] = "BulletRelSize";
|
2001-01-16 21:10:35 +00:00
|
|
|
static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_BULLET_COLOR[] = "BulletColor";
|
2000-09-18 16:07:07 +00:00
|
|
|
static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_GRAPHIC_BITMAP[] = "GraphicBitmap";
|
|
|
|
static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_GRAPHIC_SIZE[] = "GraphicSize";
|
|
|
|
static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_VERT_ORIENT[] = "VertOrient";
|
|
|
|
static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_NUMBERINGTYPE[] = "NumberingType";
|
|
|
|
static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_PREFIX[] = "Prefix";
|
|
|
|
static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_SUFFIX[] = "Suffix";
|
|
|
|
static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_ADJUST[] = "Adjust";
|
|
|
|
static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_LEFT_MARGIN[] = "LeftMargin";
|
|
|
|
static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_FIRST_LINE_OFFSET[] =
|
|
|
|
"FirstLineOffset";
|
|
|
|
static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_BULLET_FONT[] = "BulletFont";
|
|
|
|
static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_GRAPHICURL[] = "GraphicURL";
|
|
|
|
static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_START_WITH[] = "StartWith";
|
|
|
|
|
|
|
|
void SvxXMLNumRuleExport::exportLevelStyles( const uno::Reference< ::com::sun::star::container::XIndexReplace > & xNumRule,
|
|
|
|
sal_Bool bOutline )
|
|
|
|
{
|
|
|
|
sal_Int32 nCount = xNumRule ->getCount();
|
|
|
|
for( sal_Int32 i=0; i<nCount; i++ )
|
|
|
|
{
|
|
|
|
uno::Any aEntry( xNumRule->getByIndex( i ) );
|
|
|
|
uno::Sequence<beans::PropertyValue> aSeq;
|
|
|
|
if( aEntry >>= aSeq )
|
|
|
|
{
|
|
|
|
exportLevelStyle( i, aSeq, bOutline );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SvxXMLNumRuleExport::exportLevelStyle( INT32 nLevel,
|
|
|
|
const uno::Sequence<beans::PropertyValue>& rProps,
|
|
|
|
BOOL bOutline )
|
|
|
|
{
|
|
|
|
sal_Int16 eType = NumberingType::CHAR_SPECIAL;
|
|
|
|
|
|
|
|
sal_Int16 eAdjust = HoriOrientation::LEFT;
|
|
|
|
OUString sPrefix, sSuffix;
|
|
|
|
OUString sTextStyleName;
|
2001-01-16 21:10:35 +00:00
|
|
|
sal_Bool bHasColor = sal_False;
|
|
|
|
sal_Int32 nColor = 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
sal_Int32 nSpaceBefore = 0, nMinLabelWidth = 0, nMinLabelDist = 0;
|
|
|
|
|
2000-12-01 17:59:51 +00:00
|
|
|
sal_Int16 nStartValue = 1, nDisplayLevels = 1, nBullRelSize = 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
sal_Unicode cBullet = 0xf095;
|
|
|
|
OUString sBulletFontName, sBulletFontStyleName ;
|
|
|
|
sal_Int16 eBulletFontFamily = FAMILY_DONTKNOW;
|
|
|
|
sal_Int16 eBulletFontPitch = PITCH_DONTKNOW;
|
|
|
|
rtl_TextEncoding eBulletFontEncoding = RTL_TEXTENCODING_DONTKNOW;
|
|
|
|
|
|
|
|
OUString sImageURL;
|
|
|
|
uno::Reference< ::com::sun::star::awt::XBitmap > xBitmap;
|
|
|
|
sal_Int32 nImageWidth = 0, nImageHeight = 0;
|
|
|
|
sal_Int16 eImageVertOrient = VertOrientation::LINE_CENTER;
|
|
|
|
|
|
|
|
sal_Int32 nCount = rProps.getLength();
|
|
|
|
const beans::PropertyValue* pPropArray = rProps.getConstArray();
|
|
|
|
for( sal_Int32 i=0; i<nCount; i++ )
|
|
|
|
{
|
|
|
|
const beans::PropertyValue& rProp = pPropArray[i];
|
|
|
|
|
2001-01-18 10:59:42 +00:00
|
|
|
if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_NUMBERINGTYPE, sizeof(XML_UNO_NAME_NRULE_NUMBERINGTYPE)-1 ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-03-19 08:41:43 +00:00
|
|
|
rProp.Value >>= eType;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2001-01-18 10:59:42 +00:00
|
|
|
else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_PREFIX, sizeof(XML_UNO_NAME_NRULE_PREFIX)-1 ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
rProp.Value >>= sPrefix;
|
|
|
|
}
|
2001-01-18 10:59:42 +00:00
|
|
|
else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_SUFFIX, sizeof(XML_UNO_NAME_NRULE_SUFFIX)-1 ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
rProp.Value >>= sSuffix;
|
|
|
|
}
|
2001-01-18 10:59:42 +00:00
|
|
|
else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_BULLET_CHAR, sizeof(XML_UNO_NAME_NRULE_BULLET_CHAR)-1 ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
OUString sValue;
|
|
|
|
rProp.Value >>= sValue;
|
|
|
|
if( sValue.getLength() > 0 )
|
2000-12-06 09:06:42 +00:00
|
|
|
{
|
2001-06-29 11:34:19 +00:00
|
|
|
cBullet = (sal_Unicode)sValue[0];
|
2000-12-06 09:06:42 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2001-01-18 10:59:42 +00:00
|
|
|
else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_BULLET_RELSIZE, sizeof(XML_UNO_NAME_NRULE_BULLET_RELSIZE)-1 ) )
|
2000-12-01 17:59:51 +00:00
|
|
|
{
|
|
|
|
rProp.Value >>= nBullRelSize;
|
|
|
|
}
|
2001-01-18 10:59:42 +00:00
|
|
|
else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_ADJUST, sizeof(XML_UNO_NAME_NRULE_ADJUST)-1 ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
sal_Int16 nValue;
|
|
|
|
rProp.Value >>= nValue;
|
|
|
|
eAdjust = nValue;
|
|
|
|
}
|
2001-01-18 10:59:42 +00:00
|
|
|
else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_BULLET_FONT, sizeof(XML_UNO_NAME_NRULE_BULLET_FONT)-1 ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
awt::FontDescriptor rFDesc;
|
|
|
|
if( rProp.Value >>= rFDesc )
|
|
|
|
{
|
|
|
|
sBulletFontName = rFDesc.Name;
|
|
|
|
sBulletFontStyleName = rFDesc.StyleName;
|
|
|
|
eBulletFontFamily = (sal_Int16)rFDesc.Family;
|
|
|
|
eBulletFontPitch = (sal_Int16)rFDesc.Pitch;
|
|
|
|
eBulletFontEncoding = (rtl_TextEncoding)rFDesc.CharSet;
|
|
|
|
}
|
|
|
|
}
|
2001-01-18 10:59:42 +00:00
|
|
|
else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_GRAPHICURL, sizeof(XML_UNO_NAME_NRULE_GRAPHICURL)-1 ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
rProp.Value >>= sImageURL;
|
|
|
|
}
|
2001-01-18 10:59:42 +00:00
|
|
|
else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_GRAPHIC_BITMAP, sizeof(XML_UNO_NAME_NRULE_GRAPHIC_BITMAP)-1 ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
rProp.Value >>= xBitmap;
|
|
|
|
}
|
2001-01-18 10:59:42 +00:00
|
|
|
else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_BULLET_COLOR, sizeof(XML_UNO_NAME_NRULE_BULLET_COLOR)-1 ) )
|
2001-01-16 21:10:35 +00:00
|
|
|
{
|
|
|
|
rProp.Value >>= nColor;
|
|
|
|
bHasColor = sal_True;
|
|
|
|
}
|
2001-01-18 10:59:42 +00:00
|
|
|
else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_START_WITH, sizeof(XML_UNO_NAME_NRULE_START_WITH)-1 ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
rProp.Value >>= nStartValue;
|
|
|
|
}
|
2001-01-18 10:59:42 +00:00
|
|
|
else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_LEFT_MARGIN, sizeof(XML_UNO_NAME_NRULE_LEFT_MARGIN)-1 ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
rProp.Value >>= nSpaceBefore;
|
|
|
|
}
|
2001-01-18 10:59:42 +00:00
|
|
|
else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_FIRST_LINE_OFFSET, sizeof(XML_UNO_NAME_NRULE_FIRST_LINE_OFFSET)-1 ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
rProp.Value >>= nMinLabelWidth;
|
|
|
|
}
|
2001-01-18 10:59:42 +00:00
|
|
|
else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_SYMBOL_TEXT_DISTANCE, sizeof(XML_UNO_NAME_NRULE_SYMBOL_TEXT_DISTANCE)-1 ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
rProp.Value >>= nMinLabelDist;
|
|
|
|
}
|
2001-01-18 10:59:42 +00:00
|
|
|
else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_PARENT_NUMBERING, sizeof(XML_UNO_NAME_NRULE_PARENT_NUMBERING)-1 ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
rProp.Value >>= nDisplayLevels;
|
|
|
|
if( nDisplayLevels > nLevel+1 )
|
|
|
|
nDisplayLevels = nLevel+1;
|
|
|
|
}
|
2001-01-18 10:59:42 +00:00
|
|
|
else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_CHAR_STYLE_NAME, sizeof(XML_UNO_NAME_NRULE_CHAR_STYLE_NAME)-1 ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
rProp.Value >>= sTextStyleName;
|
|
|
|
}
|
2001-01-18 10:59:42 +00:00
|
|
|
else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_GRAPHIC_SIZE, sizeof(XML_UNO_NAME_NRULE_GRAPHIC_SIZE)-1 ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
awt::Size aSize;
|
|
|
|
if( rProp.Value >>= aSize )
|
|
|
|
{
|
|
|
|
nImageWidth = aSize.Width;
|
|
|
|
nImageHeight = aSize.Height;
|
|
|
|
}
|
|
|
|
}
|
2001-01-18 10:59:42 +00:00
|
|
|
else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_VERT_ORIENT, sizeof(XML_UNO_NAME_NRULE_VERT_ORIENT)-1 ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
sal_Int16 nValue;
|
|
|
|
rProp.Value >>= nValue;
|
|
|
|
eImageVertOrient = nValue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( bOutline && (NumberingType::CHAR_SPECIAL == eType ||
|
|
|
|
NumberingType::BITMAP == eType) )
|
|
|
|
{
|
|
|
|
DBG_ASSERT( !bOutline,
|
|
|
|
"SvxXMLNumRuleExport::exportLevelStyle: invalid style for outline" );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
GetExport().CheckAttrList();
|
|
|
|
|
|
|
|
// text:level
|
|
|
|
OUStringBuffer sTmp;
|
|
|
|
sTmp.append( nLevel+1L );
|
2001-06-29 20:07:26 +00:00
|
|
|
GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_LEVEL, sTmp.makeStringAndClear() );
|
2000-09-18 16:07:07 +00:00
|
|
|
if( sTextStyleName.getLength() > 0 )
|
2001-06-29 20:07:26 +00:00
|
|
|
GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME, sTextStyleName );
|
2000-09-18 16:07:07 +00:00
|
|
|
if( sPrefix.getLength() > 0 )
|
2001-06-29 20:07:26 +00:00
|
|
|
GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_NUM_PREFIX, sPrefix );
|
2000-09-18 16:07:07 +00:00
|
|
|
if( sSuffix.getLength() > 0 )
|
2001-06-29 20:07:26 +00:00
|
|
|
GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_NUM_SUFFIX, sSuffix );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-06-29 20:07:26 +00:00
|
|
|
enum XMLTokenEnum eElem = XML_LIST_LEVEL_STYLE_NUMBER;
|
2000-09-18 16:07:07 +00:00
|
|
|
if( NumberingType::CHAR_SPECIAL == eType )
|
|
|
|
{
|
|
|
|
// <text:list-level-style-bullet>
|
2001-06-29 20:07:26 +00:00
|
|
|
eElem = XML_LIST_LEVEL_STYLE_BULLET;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-06-29 11:34:19 +00:00
|
|
|
if( cBullet )
|
|
|
|
{
|
2001-10-17 12:26:13 +00:00
|
|
|
if( cBullet < ' ' )
|
|
|
|
{
|
|
|
|
cBullet = 0xF000 + 149;
|
|
|
|
}
|
2001-06-29 11:34:19 +00:00
|
|
|
// text:bullet-char="..."
|
|
|
|
sTmp.append( cBullet );
|
2001-06-29 20:07:26 +00:00
|
|
|
GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_BULLET_CHAR,
|
2001-06-29 11:34:19 +00:00
|
|
|
sTmp.makeStringAndClear() );
|
|
|
|
}
|
2000-12-01 17:59:51 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else if( NumberingType::BITMAP == eType )
|
|
|
|
{
|
|
|
|
// <text:list-level-style-image>
|
|
|
|
|
2001-06-29 20:07:26 +00:00
|
|
|
eElem = XML_LIST_LEVEL_STYLE_IMAGE;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
if( sImageURL.getLength() )
|
|
|
|
{
|
2000-11-29 13:32:08 +00:00
|
|
|
// String sURL( sImageURL );
|
|
|
|
// INetURLObject::AbsToRel( sURL );
|
|
|
|
// sImageURL = sURL;
|
2001-06-19 14:08:23 +00:00
|
|
|
OUString sURL( GetExport().AddEmbeddedGraphicObject( sImageURL ) );
|
|
|
|
if( sURL.getLength() )
|
|
|
|
{
|
2001-06-29 20:07:26 +00:00
|
|
|
GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, sURL );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-06-29 20:07:26 +00:00
|
|
|
GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
|
|
|
|
GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
|
|
|
|
GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
|
2001-06-19 14:08:23 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DBG_ASSERT( !xBitmap.is(),
|
|
|
|
"embedded images are not supported by now" );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// <text:list-level-style-number> or <text:outline-level-style>
|
|
|
|
if( bOutline )
|
2001-06-29 20:07:26 +00:00
|
|
|
eElem = XML_OUTLINE_LEVEL_STYLE;
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2001-06-29 20:07:26 +00:00
|
|
|
eElem = XML_LIST_LEVEL_STYLE_NUMBER;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-03-19 08:41:43 +00:00
|
|
|
GetExport().GetMM100UnitConverter().convertNumFormat( sTmp, eType );
|
2001-06-29 20:07:26 +00:00
|
|
|
GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_NUM_FORMAT,
|
2001-03-19 08:41:43 +00:00
|
|
|
sTmp.makeStringAndClear() );
|
|
|
|
GetExport().GetMM100UnitConverter().convertNumLetterSync( sTmp, eType );
|
|
|
|
if( sTmp.getLength() )
|
|
|
|
GetExport().AddAttribute( XML_NAMESPACE_STYLE,
|
2001-06-29 20:07:26 +00:00
|
|
|
XML_NUM_LETTER_SYNC,
|
2001-03-19 08:41:43 +00:00
|
|
|
sTmp.makeStringAndClear() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-08-21 15:33:20 +00:00
|
|
|
if( nStartValue != 1 )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
sTmp.append( (sal_Int32)nStartValue );
|
2001-06-29 20:07:26 +00:00
|
|
|
GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_START_VALUE,
|
2000-09-18 16:07:07 +00:00
|
|
|
sTmp.makeStringAndClear() );
|
|
|
|
}
|
|
|
|
if( nDisplayLevels > 1 && NumberingType::NUMBER_NONE != eType )
|
|
|
|
{
|
|
|
|
sTmp.append( (sal_Int32)nDisplayLevels );
|
2001-06-29 20:07:26 +00:00
|
|
|
GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_DISPLAY_LEVELS,
|
2000-09-18 16:07:07 +00:00
|
|
|
sTmp.makeStringAndClear() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2001-06-29 20:07:26 +00:00
|
|
|
SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT, eElem,
|
2000-09-18 16:07:07 +00:00
|
|
|
sal_True, sal_True );
|
|
|
|
|
|
|
|
nSpaceBefore += nMinLabelWidth;
|
|
|
|
nMinLabelWidth = -nMinLabelWidth;
|
|
|
|
OUStringBuffer sBuffer;
|
|
|
|
if( nSpaceBefore > 0 )
|
|
|
|
{
|
|
|
|
GetExport().GetMM100UnitConverter().convertMeasure( sBuffer, nSpaceBefore );
|
2001-06-29 20:07:26 +00:00
|
|
|
GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_SPACE_BEFORE,
|
2000-09-18 16:07:07 +00:00
|
|
|
sBuffer.makeStringAndClear() );
|
|
|
|
}
|
|
|
|
if( nMinLabelWidth != 0 )
|
|
|
|
{
|
|
|
|
GetExport().GetMM100UnitConverter().convertMeasure( sBuffer, nMinLabelWidth );
|
2001-06-29 20:07:26 +00:00
|
|
|
GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_MIN_LABEL_WIDTH,
|
2000-09-18 16:07:07 +00:00
|
|
|
sBuffer.makeStringAndClear() );
|
|
|
|
}
|
|
|
|
if( nMinLabelDist > 0 )
|
|
|
|
{
|
|
|
|
GetExport().GetMM100UnitConverter().convertMeasure( sBuffer, nMinLabelDist );
|
2001-06-29 20:07:26 +00:00
|
|
|
GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_MIN_LABEL_DISTANCE,
|
2000-09-18 16:07:07 +00:00
|
|
|
sBuffer.makeStringAndClear() );
|
|
|
|
}
|
|
|
|
if( HoriOrientation::LEFT != eAdjust )
|
|
|
|
{
|
2001-06-29 20:07:26 +00:00
|
|
|
enum XMLTokenEnum eValue = XML_TOKEN_INVALID;
|
2000-09-18 16:07:07 +00:00
|
|
|
switch( eAdjust )
|
|
|
|
{
|
2001-06-29 20:07:26 +00:00
|
|
|
case HoriOrientation::RIGHT: eValue = XML_END; break;
|
|
|
|
case HoriOrientation::CENTER: eValue = XML_CENTER; break;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2001-06-29 20:07:26 +00:00
|
|
|
if( eValue != XML_TOKEN_INVALID )
|
|
|
|
GetExport().AddAttribute( XML_NAMESPACE_FO, XML_TEXT_ALIGN, eValue );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( NumberingType::CHAR_SPECIAL == eType )
|
|
|
|
{
|
|
|
|
if( sBulletFontName.getLength() )
|
|
|
|
{
|
2000-11-13 07:44:24 +00:00
|
|
|
OUString sStyleName =
|
|
|
|
GetExport().GetFontAutoStylePool()->Find(
|
|
|
|
sBulletFontName, sBulletFontStyleName,
|
|
|
|
eBulletFontFamily, eBulletFontPitch,
|
|
|
|
eBulletFontEncoding );
|
|
|
|
|
|
|
|
if( sStyleName.getLength() )
|
|
|
|
{
|
|
|
|
GetExport().AddAttribute( XML_NAMESPACE_STYLE,
|
2001-06-29 20:07:26 +00:00
|
|
|
XML_FONT_NAME,
|
2000-11-13 07:44:24 +00:00
|
|
|
sStyleName );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Any aAny;
|
|
|
|
OUString sTmp;
|
|
|
|
|
|
|
|
const SvXMLUnitConverter& rUnitConv =
|
|
|
|
GetExport().GetMM100UnitConverter();
|
|
|
|
XMLFontFamilyNamePropHdl aFamilyNameHdl;
|
|
|
|
aAny <<= sBulletFontName;
|
|
|
|
if( aFamilyNameHdl.exportXML( sTmp, aAny, rUnitConv ) )
|
|
|
|
GetExport().AddAttribute( XML_NAMESPACE_FO,
|
2001-06-29 20:07:26 +00:00
|
|
|
XML_FONT_FAMILY, sTmp );
|
2000-11-13 07:44:24 +00:00
|
|
|
|
|
|
|
if( sBulletFontStyleName.getLength() )
|
2001-04-20 14:10:43 +00:00
|
|
|
GetExport().AddAttribute( XML_NAMESPACE_STYLE,
|
2001-06-29 20:07:26 +00:00
|
|
|
XML_FONT_STYLE_NAME,
|
2000-11-13 07:44:24 +00:00
|
|
|
sBulletFontStyleName );
|
|
|
|
|
|
|
|
XMLFontFamilyPropHdl aFamilyHdl;
|
|
|
|
aAny <<= (sal_Int16)eBulletFontFamily;
|
|
|
|
if( aFamilyHdl.exportXML( sTmp, aAny, rUnitConv ) )
|
|
|
|
GetExport().AddAttribute( XML_NAMESPACE_STYLE,
|
2001-06-29 20:07:26 +00:00
|
|
|
XML_FONT_FAMILY_GENERIC,
|
2000-11-13 07:44:24 +00:00
|
|
|
sTmp );
|
|
|
|
|
|
|
|
XMLFontPitchPropHdl aPitchHdl;
|
|
|
|
aAny <<= (sal_Int16)eBulletFontPitch;
|
|
|
|
if( aPitchHdl.exportXML( sTmp, aAny, rUnitConv ) )
|
|
|
|
GetExport().AddAttribute( XML_NAMESPACE_STYLE,
|
2001-06-29 20:07:26 +00:00
|
|
|
XML_FONT_PITCH, sTmp );
|
2000-11-13 07:44:24 +00:00
|
|
|
|
|
|
|
XMLFontEncodingPropHdl aEncHdl;
|
|
|
|
aAny <<= (sal_Int16)eBulletFontEncoding;
|
|
|
|
if( aEncHdl.exportXML( sTmp, aAny, rUnitConv ) )
|
|
|
|
GetExport().AddAttribute( XML_NAMESPACE_STYLE,
|
2001-06-29 20:07:26 +00:00
|
|
|
XML_FONT_CHARSET, sTmp );
|
2000-11-13 07:44:24 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if( NumberingType::BITMAP == eType )
|
|
|
|
{
|
2001-06-29 20:07:26 +00:00
|
|
|
enum XMLTokenEnum eValue = XML_TOKEN_INVALID;
|
2000-09-18 16:07:07 +00:00
|
|
|
switch( eImageVertOrient )
|
|
|
|
{
|
|
|
|
case VertOrientation::BOTTOM: // yes, its OK: BOTTOM means that the baseline
|
|
|
|
// hits the frame at its topmost position
|
|
|
|
case VertOrientation::LINE_TOP:
|
|
|
|
case VertOrientation::CHAR_TOP:
|
2001-06-29 20:07:26 +00:00
|
|
|
eValue = XML_TOP;
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
case VertOrientation::CENTER:
|
|
|
|
case VertOrientation::LINE_CENTER:
|
|
|
|
case VertOrientation::CHAR_CENTER:
|
2001-06-29 20:07:26 +00:00
|
|
|
eValue = XML_MIDDLE;
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
case VertOrientation::TOP: // yes, its OK: TOP means that the baseline
|
|
|
|
// hits the frame at its bottommost position
|
|
|
|
case VertOrientation::LINE_BOTTOM:
|
|
|
|
case VertOrientation::CHAR_BOTTOM:
|
2001-06-29 20:07:26 +00:00
|
|
|
eValue = XML_BOTTOM;
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
}
|
2001-06-29 20:07:26 +00:00
|
|
|
if( eValue != XML_TOKEN_INVALID )
|
|
|
|
GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_VERTICAL_POS, eValue );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-06-29 20:07:26 +00:00
|
|
|
eValue = XML_TOKEN_INVALID;
|
2000-09-18 16:07:07 +00:00
|
|
|
switch( eImageVertOrient )
|
|
|
|
{
|
|
|
|
case VertOrientation::TOP:
|
|
|
|
case VertOrientation::CENTER:
|
|
|
|
case VertOrientation::BOTTOM:
|
2001-06-29 20:07:26 +00:00
|
|
|
eValue = XML_BASELINE;
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
case VertOrientation::LINE_TOP:
|
|
|
|
case VertOrientation::LINE_CENTER:
|
|
|
|
case VertOrientation::LINE_BOTTOM:
|
2001-06-29 20:07:26 +00:00
|
|
|
eValue = XML_LINE;
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
case VertOrientation::CHAR_TOP:
|
|
|
|
case VertOrientation::CHAR_CENTER:
|
|
|
|
case VertOrientation::CHAR_BOTTOM:
|
2001-06-29 20:07:26 +00:00
|
|
|
eValue = XML_CHAR;
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
}
|
2001-06-29 20:07:26 +00:00
|
|
|
if( eValue != XML_TOKEN_INVALID )
|
|
|
|
GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_VERTICAL_REL, eValue );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if( nImageWidth > 0 )
|
|
|
|
{
|
|
|
|
GetExport().GetMM100UnitConverter().convertMeasure( sBuffer, nImageWidth );
|
2001-06-29 20:07:26 +00:00
|
|
|
GetExport().AddAttribute( XML_NAMESPACE_FO, XML_WIDTH,
|
2000-09-18 16:07:07 +00:00
|
|
|
sBuffer.makeStringAndClear() );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( nImageHeight > 0 )
|
|
|
|
{
|
|
|
|
GetExport().GetMM100UnitConverter().convertMeasure( sBuffer, nImageHeight );
|
2001-06-29 20:07:26 +00:00
|
|
|
GetExport().AddAttribute( XML_NAMESPACE_FO, XML_HEIGHT,
|
2000-09-18 16:07:07 +00:00
|
|
|
sBuffer.makeStringAndClear() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-01-16 21:10:35 +00:00
|
|
|
if( NumberingType::BITMAP != eType )
|
|
|
|
{
|
|
|
|
// fo:color = "#..."
|
|
|
|
if( bHasColor )
|
|
|
|
{
|
|
|
|
const Color aColor( nColor );
|
|
|
|
SvXMLUnitConverter::convertColor( sBuffer, aColor );
|
2001-06-29 20:07:26 +00:00
|
|
|
GetExport().AddAttribute( XML_NAMESPACE_FO, XML_COLOR,
|
2001-01-16 21:10:35 +00:00
|
|
|
sBuffer.makeStringAndClear() );
|
|
|
|
}
|
|
|
|
|
|
|
|
// fo:height="...%"
|
|
|
|
if( nBullRelSize )
|
|
|
|
{
|
|
|
|
GetExport().GetMM100UnitConverter().convertPercent( sTmp, nBullRelSize );
|
2001-06-29 20:07:26 +00:00
|
|
|
GetExport().AddAttribute( XML_NAMESPACE_FO, XML_FONT_SIZE,
|
2001-01-16 21:10:35 +00:00
|
|
|
sTmp.makeStringAndClear() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
if( GetExport().GetAttrList().getLength() > 0 )
|
|
|
|
{
|
|
|
|
SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_STYLE,
|
2001-06-29 20:07:26 +00:00
|
|
|
XML_PROPERTIES, sal_True, sal_True );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2001-06-19 14:08:23 +00:00
|
|
|
if( NumberingType::BITMAP == eType && sImageURL.getLength() )
|
|
|
|
{
|
|
|
|
// optional office:binary-data
|
|
|
|
GetExport().AddEmbeddedGraphicObjectAsBase64( sImageURL );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uno::Reference< ::com::sun::star::container::XIndexReplace > SvxXMLNumRuleExport::GetUNONumRule() const
|
|
|
|
{
|
|
|
|
return uno::Reference< ::com::sun::star::container::XIndexReplace > ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SvxXMLNumRuleExport::AddListStyleAttributes()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SvxXMLNumRuleExport::SvxXMLNumRuleExport( SvXMLExport& rExp ) :
|
|
|
|
rExport( rExp ),
|
|
|
|
sNumberingRules( RTL_CONSTASCII_USTRINGPARAM( "NumberingRules" ) ),
|
|
|
|
sIsPhysical( RTL_CONSTASCII_USTRINGPARAM( "IsPhysical" ) ),
|
|
|
|
sIsContinuousNumbering( RTL_CONSTASCII_USTRINGPARAM( "IsContinuousNumbering" ) )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SvxXMLNumRuleExport::~SvxXMLNumRuleExport()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void SvxXMLNumRuleExport::Export( const OUString& rName,
|
|
|
|
sal_Bool bContNumbering )
|
|
|
|
{
|
|
|
|
GetExport().CheckAttrList();
|
|
|
|
|
|
|
|
// style:name="..."
|
2000-12-01 17:59:51 +00:00
|
|
|
if( rName.getLength() )
|
2001-06-29 20:07:26 +00:00
|
|
|
GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_NAME, rName );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// text:consecutive-numbering="..."
|
|
|
|
if( bContNumbering )
|
2001-06-29 20:07:26 +00:00
|
|
|
GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_CONSECUTIVE_NUMBERING,
|
|
|
|
XML_TRUE );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// other application specific attributes
|
|
|
|
AddListStyleAttributes();
|
|
|
|
|
|
|
|
OUString sElem = GetExport().GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_TEXT,
|
2001-06-29 20:07:26 +00:00
|
|
|
GetXMLToken(XML_LIST_STYLE) );
|
2001-09-24 13:51:35 +00:00
|
|
|
GetExport().IgnorableWhitespace();
|
|
|
|
GetExport().StartElement( XML_NAMESPACE_TEXT, XML_LIST_STYLE, sal_False );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
uno::Reference< ::com::sun::star::container::XIndexReplace > xNumRule = GetUNONumRule();
|
|
|
|
if( xNumRule.is() )
|
|
|
|
exportLevelStyles( xNumRule );
|
|
|
|
|
2001-09-24 13:51:35 +00:00
|
|
|
GetExport().EndElement( XML_NAMESPACE_TEXT, XML_LIST_STYLE, sal_True );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SvxXMLNumRuleExport::ExportOutline()
|
|
|
|
{
|
2001-09-24 13:51:35 +00:00
|
|
|
GetExport().IgnorableWhitespace( );
|
|
|
|
GetExport().StartElement( XML_NAMESPACE_TEXT, XML_OUTLINE_STYLE, sal_False );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
uno::Reference< ::com::sun::star::container::XIndexReplace > xNumRule = GetUNONumRule();
|
|
|
|
if( xNumRule.is() )
|
|
|
|
exportLevelStyles( xNumRule, sal_True );
|
|
|
|
|
2001-09-24 13:51:35 +00:00
|
|
|
GetExport().EndElement( XML_NAMESPACE_TEXT, XML_OUTLINE_STYLE, sal_True );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SvxXMLNumRuleExport::exportNumberingRule(
|
|
|
|
const OUString& rName,
|
|
|
|
const Reference< XIndexReplace >& rNumRule )
|
|
|
|
{
|
|
|
|
Reference< XPropertySet > xPropSet( rNumRule, UNO_QUERY );
|
|
|
|
Reference< XPropertySetInfo > xPropSetInfo;
|
|
|
|
if( xPropSet.is() )
|
|
|
|
xPropSetInfo = xPropSet->getPropertySetInfo();
|
|
|
|
|
|
|
|
GetExport().CheckAttrList();
|
|
|
|
|
|
|
|
// style:name="..."
|
2000-12-01 17:59:51 +00:00
|
|
|
if( rName.getLength() )
|
2001-06-29 20:07:26 +00:00
|
|
|
GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_NAME, rName );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// text:consecutive-numbering="..."
|
|
|
|
sal_Bool bContNumbering = sal_False;
|
|
|
|
if( xPropSetInfo.is() &&
|
|
|
|
xPropSetInfo->hasPropertyByName( sIsContinuousNumbering ) )
|
|
|
|
{
|
|
|
|
Any aAny( xPropSet->getPropertyValue( sIsContinuousNumbering ) );
|
|
|
|
bContNumbering = *(sal_Bool *)aAny.getValue();
|
|
|
|
}
|
|
|
|
if( bContNumbering )
|
2001-06-29 20:07:26 +00:00
|
|
|
GetExport().AddAttribute( XML_NAMESPACE_TEXT,
|
|
|
|
XML_CONSECUTIVE_NUMBERING, XML_TRUE );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// other application specific attributes
|
|
|
|
AddListStyleAttributes();
|
|
|
|
|
|
|
|
{
|
2001-06-29 20:07:26 +00:00
|
|
|
SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT, XML_LIST_STYLE ,
|
2000-09-18 16:07:07 +00:00
|
|
|
sal_True, sal_True );
|
|
|
|
exportLevelStyles( rNumRule );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool SvxXMLNumRuleExport::exportStyle( const Reference< XStyle >& rStyle )
|
|
|
|
{
|
|
|
|
Reference< XPropertySet > xPropSet( rStyle, UNO_QUERY );
|
|
|
|
Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
|
|
|
|
|
|
|
|
Any aAny;
|
|
|
|
|
|
|
|
// Don't export styles that aren't existing really. This may be the
|
|
|
|
// case for StarOffice Writer's pool styles.
|
|
|
|
if( xPropSetInfo->hasPropertyByName( sIsPhysical ) )
|
|
|
|
{
|
|
|
|
aAny = xPropSet->getPropertyValue( sIsPhysical );
|
|
|
|
if( !*(sal_Bool *)aAny.getValue() )
|
|
|
|
return sal_False;
|
|
|
|
}
|
|
|
|
|
|
|
|
aAny = xPropSet->getPropertyValue( sNumberingRules );
|
|
|
|
Reference<XIndexReplace> xNumRule;
|
|
|
|
aAny >>= xNumRule;
|
|
|
|
|
|
|
|
OUString sName = rStyle->getName();
|
|
|
|
|
|
|
|
exportNumberingRule( sName, xNumRule );
|
|
|
|
|
|
|
|
return sal_True;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SvxXMLNumRuleExport::exportOutline()
|
|
|
|
{
|
|
|
|
Reference< XChapterNumberingSupplier > xCNSupplier( GetExport().GetModel(),
|
|
|
|
UNO_QUERY );
|
|
|
|
DBG_ASSERT( xCNSupplier.is(), "no chapter numbering supplier" );
|
|
|
|
|
|
|
|
if( xCNSupplier.is() )
|
|
|
|
{
|
|
|
|
Reference< XIndexReplace > xNumRule( xCNSupplier->getChapterNumberingRules() );
|
|
|
|
DBG_ASSERT( xNumRule.is(), "no chapter numbering rules" );
|
|
|
|
|
|
|
|
if( xNumRule.is() )
|
|
|
|
{
|
|
|
|
SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT,
|
2001-06-29 20:07:26 +00:00
|
|
|
XML_OUTLINE_STYLE, sal_True, sal_True );
|
2000-09-18 16:07:07 +00:00
|
|
|
exportLevelStyles( xNumRule, sal_True );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SvxXMLNumRuleExport::exportStyles( sal_Bool bUsed,
|
2001-01-18 10:59:42 +00:00
|
|
|
XMLTextListAutoStylePool *pPool,
|
|
|
|
sal_Bool bExportChapterNumbering )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-01-18 10:59:42 +00:00
|
|
|
if( bExportChapterNumbering )
|
|
|
|
exportOutline();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
Reference< XStyleFamiliesSupplier > xFamiliesSupp( GetExport().GetModel(), UNO_QUERY );
|
|
|
|
DBG_ASSERT( xFamiliesSupp.is(), "No XStyleFamiliesSupplier from XModel for export!" );
|
|
|
|
if( xFamiliesSupp.is() )
|
|
|
|
{
|
|
|
|
Reference< XNameAccess > xFamilies( xFamiliesSupp->getStyleFamilies() );
|
|
|
|
DBG_ASSERT( xFamiliesSupp.is(), "getStyleFamilies() from XModel failed for export!" );
|
|
|
|
|
|
|
|
if( xFamilies.is() )
|
|
|
|
{
|
|
|
|
const OUString aNumberStyleName( RTL_CONSTASCII_USTRINGPARAM( "NumberingStyles" ));
|
|
|
|
|
|
|
|
Reference< XIndexAccess > xStyles;
|
|
|
|
if( xFamilies->hasByName( aNumberStyleName ) )
|
|
|
|
{
|
|
|
|
xFamilies->getByName( aNumberStyleName ) >>= xStyles;
|
|
|
|
|
|
|
|
DBG_ASSERT( xStyles.is(), "Style not found for export!" );
|
|
|
|
|
|
|
|
if( xStyles.is() )
|
|
|
|
{
|
|
|
|
const sal_Int32 nStyles = xStyles->getCount();
|
|
|
|
|
|
|
|
for( sal_Int32 i=0; i < nStyles; i++ )
|
|
|
|
{
|
|
|
|
Reference< XStyle > xStyle;
|
|
|
|
xStyles->getByIndex( i ) >>= xStyle;
|
|
|
|
|
|
|
|
if( !bUsed || xStyle->isInUse() )
|
|
|
|
{
|
|
|
|
exportStyle( xStyle );
|
|
|
|
if( pPool )
|
|
|
|
pPool->RegisterName( xStyle->getName() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|