Kaydet (Commit) bcd0d6f8 authored tarafından Michael Brauer's avatar Michael Brauer

default styles

üst 3729f52e
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: xmlkywd.hxx,v $ * $RCSfile: xmlkywd.hxx,v $
* *
* $Revision: 1.83 $ * $Revision: 1.84 $
* *
* last change: $Author: mib $ $Date: 2001-01-03 11:31:32 $ * last change: $Author: mib $ $Date: 2001-01-05 09:59:58 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -477,6 +477,7 @@ XML_CONSTASCII_ACTION( sXML_decorate_words_only, "decorate-words-only" ); ...@@ -477,6 +477,7 @@ XML_CONSTASCII_ACTION( sXML_decorate_words_only, "decorate-words-only" );
XML_CONSTASCII_ACTION( sXML_decorative, "decorative" ); XML_CONSTASCII_ACTION( sXML_decorative, "decorative" );
XML_CONSTASCII_ACTION( sXML_deep, "deep" ); XML_CONSTASCII_ACTION( sXML_deep, "deep" );
XML_CONSTASCII_ACTION( sXML_default, "default" ); XML_CONSTASCII_ACTION( sXML_default, "default" );
XML_CONSTASCII_ACTION( sXML_default_style, "default-style" );
XML_CONSTASCII_ACTION( sXML_default_style_name, "default-style-name" ); XML_CONSTASCII_ACTION( sXML_default_style_name, "default-style-name" );
XML_CONSTASCII_ACTION( sXML_degree, "degree" ); XML_CONSTASCII_ACTION( sXML_degree, "degree" );
XML_CONSTASCII_ACTION( sXML_delay, "delay" ); XML_CONSTASCII_ACTION( sXML_delay, "delay" );
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: prstylei.cxx,v $ * $RCSfile: prstylei.cxx,v $
* *
* $Revision: 1.3 $ * $Revision: 1.4 $
* *
* last change: $Author: mib $ $Date: 2000-11-07 13:33:06 $ * last change: $Author: mib $ $Date: 2001-01-05 10:01:15 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -115,7 +115,14 @@ void XMLPropStyleContext::SetAttribute( sal_uInt16 nPrefixKey, ...@@ -115,7 +115,14 @@ void XMLPropStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
if( XML_NAMESPACE_STYLE == nPrefixKey && if( XML_NAMESPACE_STYLE == nPrefixKey &&
rLocalName.compareToAscii( sXML_family ) == 0 ) rLocalName.compareToAscii( sXML_family ) == 0 )
{ {
#ifndef PRODUCT
sal_uInt16 nOldFam = GetFamily();
#endif
SetFamily( ((SvXMLStylesContext *)&xStyles)->GetFamily( rValue ) ); SetFamily( ((SvXMLStylesContext *)&xStyles)->GetFamily( rValue ) );
#ifndef PRODUCT
DBG_ASSERT( 0 == nOldFam || GetFamily() == nOldFam,
"unexpected style family" );
#endif
} }
else else
{ {
...@@ -128,11 +135,13 @@ TYPEINIT1( XMLPropStyleContext, SvXMLStyleContext ); ...@@ -128,11 +135,13 @@ TYPEINIT1( XMLPropStyleContext, SvXMLStyleContext );
XMLPropStyleContext::XMLPropStyleContext( SvXMLImport& rImport, XMLPropStyleContext::XMLPropStyleContext( SvXMLImport& rImport,
sal_uInt16 nPrfx, const OUString& rLName, sal_uInt16 nPrfx, const OUString& rLName,
const Reference< XAttributeList > & xAttrList, const Reference< XAttributeList > & xAttrList,
SvXMLStylesContext& rStyles ) : SvXMLStylesContext& rStyles, sal_uInt16 nFamily,
SvXMLStyleContext( rImport, nPrfx, rLName, xAttrList ), sal_Bool bDefault ) :
SvXMLStyleContext( rImport, nPrfx, rLName, xAttrList, nFamily ),
xStyles( &rStyles ), xStyles( &rStyles ),
sIsPhysical( RTL_CONSTASCII_USTRINGPARAM( "IsPhysical" ) ), sIsPhysical( RTL_CONSTASCII_USTRINGPARAM( "IsPhysical" ) ),
sFollowStyle( RTL_CONSTASCII_USTRINGPARAM( "FollowStyle" ) ) sFollowStyle( RTL_CONSTASCII_USTRINGPARAM( "FollowStyle" ) ),
bDefaultStyle( bDefault )
{ {
} }
...@@ -203,7 +212,7 @@ Reference < XStyle > XMLPropStyleContext::Create() ...@@ -203,7 +212,7 @@ Reference < XStyle > XMLPropStyleContext::Create()
void XMLPropStyleContext::CreateAndInsert( sal_Bool bOverwrite ) void XMLPropStyleContext::CreateAndInsert( sal_Bool bOverwrite )
{ {
const OUString& rName = GetName(); const OUString& rName = GetName();
if( 0 == rName.getLength() ) if( 0 == rName.getLength() || bDefaultStyle )
return; return;
Reference < XNameContainer > xFamilies = Reference < XNameContainer > xFamilies =
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: styleexp.cxx,v $ * $RCSfile: styleexp.cxx,v $
* *
* $Revision: 1.5 $ * $Revision: 1.6 $
* *
* last change: $Author: dvo $ $Date: 2000-12-20 15:34:09 $ * last change: $Author: mib $ $Date: 2001-01-05 10:01:15 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -173,7 +173,7 @@ sal_Bool XMLStyleExport::exportStyle( ...@@ -173,7 +173,7 @@ sal_Bool XMLStyleExport::exportStyle(
const Reference< XStyle >& rStyle, const Reference< XStyle >& rStyle,
const sal_Char *pXMLFamily, const sal_Char *pXMLFamily,
const UniReference < SvXMLExportPropertyMapper >& rPropMapper, const UniReference < SvXMLExportPropertyMapper >& rPropMapper,
const OUString* pPrefix) const OUString* pPrefix )
{ {
Reference< XPropertySet > xPropSet( rStyle, UNO_QUERY ); Reference< XPropertySet > xPropSet( rStyle, UNO_QUERY );
Reference< XPropertySetInfo > xPropSetInfo = Reference< XPropertySetInfo > xPropSetInfo =
...@@ -293,6 +293,63 @@ sal_Bool XMLStyleExport::exportStyle( ...@@ -293,6 +293,63 @@ sal_Bool XMLStyleExport::exportStyle(
return sal_True; return sal_True;
} }
sal_Bool XMLStyleExport::exportDefaultStyle(
const Reference< XStyle >& rStyle,
const sal_Char *pXMLFamily,
const UniReference < SvXMLExportPropertyMapper >& rPropMapper )
{
Reference< XPropertySet > xPropSet( rStyle, UNO_QUERY );
Reference< XPropertySetInfo > xPropSetInfo =
xPropSet->getPropertySetInfo();
Any aAny;
// <style:default-style ...>
GetExport().CheckAttrList();
// style:family="..."
if( pXMLFamily )
GetExport().AddAttributeASCII( XML_NAMESPACE_STYLE, sXML_family,
pXMLFamily );
// style:list-style-name="..." (SW paragarph styles only)
if( xPropSetInfo->hasPropertyByName( sNumberingStyleName ) )
{
Reference< XPropertyState > xPropState( xPropSet, uno::UNO_QUERY );
aAny = xPropState->getPropertyDefault( sNumberingStyleName );
if( aAny.hasValue() )
{
OUString sListName;
aAny >>= sListName;
if( sListName.getLength() )
GetExport().AddAttribute( XML_NAMESPACE_STYLE,
sXML_list_style_name, sListName );
}
}
// style:pool-id="..." is not required any longer since we use
// english style names only
exportStyleAttributes( rStyle );
{
// <style:style>
SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_STYLE,
sXML_default_style,
sal_True, sal_True );
// <style:properties>
::std::vector< XMLPropertyState > xPropStates =
rPropMapper->FilterDefaults( xPropSet );
rPropMapper->exportXML( GetExport().GetDocHandler(), xPropStates,
GetExport().GetMM100UnitConverter(),
GetExport().GetNamespaceMap(),
XML_EXPORT_FLAG_IGN_WS );
exportStyleContent( rStyle );
}
return sal_True;
}
#if 0
void XMLStyleExport::exportStyleFamily( void XMLStyleExport::exportStyleFamily(
const sal_Char *pFamily, const sal_Char *pFamily,
const sal_Char *pXMLFamily, const sal_Char *pXMLFamily,
...@@ -316,22 +373,25 @@ void XMLStyleExport::exportStyleFamily( ...@@ -316,22 +373,25 @@ void XMLStyleExport::exportStyleFamily(
exportStyleFamily( rFamily, pXMLFamily, xExpPropMapper, bUsed, nFamily, exportStyleFamily( rFamily, pXMLFamily, xExpPropMapper, bUsed, nFamily,
pPrefix); pPrefix);
} }
#endif
void XMLStyleExport::exportStyleFamily( void XMLStyleExport::exportStyleFamily(
const sal_Char *pFamily, const sal_Char *pFamily,
const sal_Char *pXMLFamily, const sal_Char *pXMLFamily,
const UniReference < SvXMLExportPropertyMapper >& rPropMapper, const UniReference < SvXMLExportPropertyMapper >& rPropMapper,
sal_Bool bUsed, sal_uInt16 nFamily, const OUString* pPrefix) sal_Bool bUsed, sal_uInt16 nFamily, const OUString* pPrefix,
sal_Bool bExportDefault )
{ {
const OUString sFamily(OUString::createFromAscii(pFamily )); const OUString sFamily(OUString::createFromAscii(pFamily ));
exportStyleFamily( sFamily, pXMLFamily, rPropMapper, bUsed, nFamily, exportStyleFamily( sFamily, pXMLFamily, rPropMapper, bUsed, nFamily,
pPrefix); pPrefix, bExportDefault );
} }
void XMLStyleExport::exportStyleFamily( void XMLStyleExport::exportStyleFamily(
const OUString& rFamily, const sal_Char *pXMLFamily, const OUString& rFamily, const sal_Char *pXMLFamily,
const UniReference < SvXMLExportPropertyMapper >& rPropMapper, const UniReference < SvXMLExportPropertyMapper >& rPropMapper,
sal_Bool bUsed, sal_uInt16 nFamily, const OUString* pPrefix) sal_Bool bUsed, sal_uInt16 nFamily, const OUString* pPrefix,
sal_Bool bExportDefault )
{ {
DBG_ASSERT( GetExport().GetModel().is(), "There is the model?" ); DBG_ASSERT( GetExport().GetModel().is(), "There is the model?" );
Reference< XStyleFamiliesSupplier > xFamiliesSupp( GetExport().GetModel(), Reference< XStyleFamiliesSupplier > xFamiliesSupp( GetExport().GetModel(),
...@@ -373,9 +433,16 @@ void XMLStyleExport::exportStyleFamily( ...@@ -373,9 +433,16 @@ void XMLStyleExport::exportStyleFamily(
DBG_ASSERT( xStyle.is(), "Style not found for export!" ); DBG_ASSERT( xStyle.is(), "Style not found for export!" );
if( xStyle.is() ) if( xStyle.is() )
{ {
if( bExportDefault && !xStyle->getParentStyle().getLength() )
{
Reference< XPropertySet > xPropSet( xStyle, UNO_QUERY );
exportDefaultStyle( xStyle, pXMLFamily, rPropMapper );
bExportDefault = sal_False;
}
if( !bUsed || xStyle->isInUse() ) if( !bUsed || xStyle->isInUse() )
{ {
BOOL bExported = exportStyle( xStyle, pXMLFamily, rPropMapper, pPrefix ); BOOL bExported = exportStyle( xStyle, pXMLFamily, rPropMapper,
pPrefix );
if( bUsed && bFirstStyle && bExported ) if( bUsed && bFirstStyle && bExported )
{ {
// If this is the first style, find out wether next styles // If this is the first style, find out wether next styles
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: xmlexppr.cxx,v $ * $RCSfile: xmlexppr.cxx,v $
* *
* $Revision: 1.9 $ * $Revision: 1.10 $
* *
* last change: $Author: sab $ $Date: 2000-12-15 13:52:14 $ * last change: $Author: mib $ $Date: 2001-01-05 10:01:15 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -258,6 +258,52 @@ vector< XMLPropertyState > SvXMLExportPropertyMapper::Filter( ...@@ -258,6 +258,52 @@ vector< XMLPropertyState > SvXMLExportPropertyMapper::Filter(
return aPropStateArray; return aPropStateArray;
} }
vector< XMLPropertyState > SvXMLExportPropertyMapper::FilterDefaults(
const Reference< XPropertySet > xPropSet ) const
{
vector< XMLPropertyState > aPropStateArray;
// Retrieve XPropertySetInfo and XPropertyState
Reference< XPropertySetInfo > xInfo( xPropSet->getPropertySetInfo() );
Reference< XPropertyState > xPropState( xPropSet, UNO_QUERY );
if( xInfo.is() && xPropState.is() )
{
sal_Int32 nProps = maPropMapper->GetEntryCount();
for( sal_Int32 i=0; i < nProps; i++ )
{
// Does the PropertySet contain name of mpEntries-array ?
if( (maPropMapper->GetEntryFlags( i ) &
MID_FLAG_DEFAULT_ITEM_EXPORT) != 0 )
{
const OUString& rAPIName = maPropMapper->GetEntryAPIName( i );
if( xInfo->hasPropertyByName( rAPIName ) )
{
XMLPropertyState aNewProperty( i,
xPropState->getPropertyDefault( rAPIName ) );
aPropStateArray.push_back( aNewProperty );
}
}
}
// Call centext-filter
ContextFilter( aPropStateArray, xPropSet );
// Have to do if we change from a vector to a list or something like that
/*vector< XMLPropertyState >::iterator aItr = aPropStateArray.begin();
while (aItr != aPropStateArray.end())
{
if (aItr->mnIndex == -1)
aItr = aPropStateArray.erase(aItr);
else
aItr++;
}*/
}
return aPropStateArray;
}
void SvXMLExportPropertyMapper::ContextFilter( void SvXMLExportPropertyMapper::ContextFilter(
vector< XMLPropertyState >& rProperties, vector< XMLPropertyState >& rProperties,
Reference< XPropertySet > rPropSet ) const Reference< XPropertySet > rPropSet ) const
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: xmlstyle.cxx,v $ * $RCSfile: xmlstyle.cxx,v $
* *
* $Revision: 1.15 $ * $Revision: 1.16 $
* *
* last change: $Author: mib $ $Date: 2001-01-03 11:07:58 $ * last change: $Author: mib $ $Date: 2001-01-05 10:01:15 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -194,6 +194,7 @@ static __FAR_DATA SvXMLTokenMapEntry aStyleStylesElemTokenMap[] = ...@@ -194,6 +194,7 @@ static __FAR_DATA SvXMLTokenMapEntry aStyleStylesElemTokenMap[] =
{ XML_NAMESPACE_STYLE, sXML_page_master, XML_TOK_STYLE_PAGE_MASTER }, { XML_NAMESPACE_STYLE, sXML_page_master, XML_TOK_STYLE_PAGE_MASTER },
{ XML_NAMESPACE_TEXT, sXML_list_style, XML_TOK_TEXT_LIST_STYLE }, { XML_NAMESPACE_TEXT, sXML_list_style, XML_TOK_TEXT_LIST_STYLE },
{ XML_NAMESPACE_TEXT, sXML_outline_style, XML_TOK_TEXT_OUTLINE }, { XML_NAMESPACE_TEXT, sXML_outline_style, XML_TOK_TEXT_OUTLINE },
{ XML_NAMESPACE_STYLE, sXML_default_style, XML_TOK_STYLE_DEFAULT_STYLE },
{ XML_NAMESPACE_DRAW, sXML_gradient, XML_TOK_STYLES_GRADIENTSTYLES }, { XML_NAMESPACE_DRAW, sXML_gradient, XML_TOK_STYLES_GRADIENTSTYLES },
{ XML_NAMESPACE_DRAW, sXML_hatch, XML_TOK_STYLES_HATCHSTYLES }, { XML_NAMESPACE_DRAW, sXML_hatch, XML_TOK_STYLES_HATCHSTYLES },
{ XML_NAMESPACE_DRAW, sXML_fill_image, XML_TOK_STYLES_BITMAPSTYLES }, { XML_NAMESPACE_DRAW, sXML_fill_image, XML_TOK_STYLES_BITMAPSTYLES },
...@@ -264,13 +265,14 @@ void SvXMLStyleContext::SetAttribute( sal_uInt16 nPrefixKey, ...@@ -264,13 +265,14 @@ void SvXMLStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
TYPEINIT1( SvXMLStyleContext, SvXMLImportContext ); TYPEINIT1( SvXMLStyleContext, SvXMLImportContext );
SvXMLStyleContext::SvXMLStyleContext( SvXMLImport& rImp, sal_uInt16 nPrfx, SvXMLStyleContext::SvXMLStyleContext(
const OUString& rLName, SvXMLImport& rImp, sal_uInt16 nPrfx,
const uno::Reference< xml::sax::XAttributeList >& ) : const OUString& rLName,
const uno::Reference< xml::sax::XAttributeList >&,
sal_uInt16 nFam ) :
SvXMLImportContext( rImp, nPrfx, rLName ), SvXMLImportContext( rImp, nPrfx, rLName ),
nHelpId( UCHAR_MAX ), nHelpId( UCHAR_MAX ),
nFamily( 0 ), nFamily( nFam ),
nSubFamily( 0U ),
bValid( sal_True ), bValid( sal_True ),
bNew( sal_True ) bNew( sal_True )
{ {
...@@ -319,16 +321,13 @@ class SvXMLStyleIndex_Impl ...@@ -319,16 +321,13 @@ class SvXMLStyleIndex_Impl
{ {
OUString sName; OUString sName;
sal_uInt16 nFamily; sal_uInt16 nFamily;
sal_uInt16 nSubFamily;
const SvXMLStyleContext *pStyle; const SvXMLStyleContext *pStyle;
public: public:
SvXMLStyleIndex_Impl( sal_uInt16 nFam, sal_uInt16 nSubFam, SvXMLStyleIndex_Impl( sal_uInt16 nFam, const OUString& rName ) :
const OUString& rName ) :
sName( rName ), sName( rName ),
nFamily( nFam ), nFamily( nFam ),
nSubFamily( nSubFam ),
pStyle ( 0 ) pStyle ( 0 )
{ {
} }
...@@ -336,14 +335,12 @@ public: ...@@ -336,14 +335,12 @@ public:
SvXMLStyleIndex_Impl( const SvXMLStyleContext *pStl ) : SvXMLStyleIndex_Impl( const SvXMLStyleContext *pStl ) :
sName( pStl->GetName() ), sName( pStl->GetName() ),
nFamily( pStl->GetFamily() ), nFamily( pStl->GetFamily() ),
nSubFamily( pStl->GetSubFamily() ),
pStyle ( pStl ) pStyle ( pStl )
{ {
} }
const OUString& GetName() const { return sName; } const OUString& GetName() const { return sName; }
sal_uInt16 GetFamily() const { return nFamily; } sal_uInt16 GetFamily() const { return nFamily; }
sal_uInt16 GetSubFamily() const { return nSubFamily; }
const SvXMLStyleContext *GetStyle() const { return pStyle; } const SvXMLStyleContext *GetStyle() const { return pStyle; }
}; };
...@@ -355,10 +352,6 @@ int SvXMLStyleIndexCmp_Impl( const SvXMLStyleIndex_Impl& r1, ...@@ -355,10 +352,6 @@ int SvXMLStyleIndexCmp_Impl( const SvXMLStyleIndex_Impl& r1,
nRet = -1; nRet = -1;
else if( (sal_uInt16)r1.GetFamily() > (sal_uInt16)r2.GetFamily() ) else if( (sal_uInt16)r1.GetFamily() > (sal_uInt16)r2.GetFamily() )
nRet = 1; nRet = 1;
else if( r1.GetSubFamily() < r2.GetSubFamily() )
nRet = -1;
else if( r1.GetSubFamily() > r2.GetSubFamily() )
nRet = 1;
else else
nRet = (int)r1.GetName().compareTo( r2.GetName() ); nRet = (int)r1.GetName().compareTo( r2.GetName() );
...@@ -410,7 +403,6 @@ public: ...@@ -410,7 +403,6 @@ public:
void Clear(); void Clear();
const SvXMLStyleContext *FindStyleChildContext( sal_uInt16 nFamily, const SvXMLStyleContext *FindStyleChildContext( sal_uInt16 nFamily,
sal_uInt16 nSubFamily,
const OUString& rName, const OUString& rName,
sal_Bool bCreateIndex ) const; sal_Bool bCreateIndex ) const;
...@@ -463,7 +455,6 @@ void SvXMLStylesContext_Impl::Clear() ...@@ -463,7 +455,6 @@ void SvXMLStylesContext_Impl::Clear()
const SvXMLStyleContext *SvXMLStylesContext_Impl::FindStyleChildContext( const SvXMLStyleContext *SvXMLStylesContext_Impl::FindStyleChildContext(
sal_uInt16 nFamily, sal_uInt16 nFamily,
sal_uInt16 nSubFamily,
const OUString& rName, const OUString& rName,
sal_Bool bCreateIndex ) const sal_Bool bCreateIndex ) const
{ {
...@@ -486,7 +477,7 @@ const SvXMLStyleContext *SvXMLStylesContext_Impl::FindStyleChildContext( ...@@ -486,7 +477,7 @@ const SvXMLStyleContext *SvXMLStylesContext_Impl::FindStyleChildContext(
if( pIndices ) if( pIndices )
{ {
SvXMLStyleIndex_Impl aIndex( nFamily, nSubFamily, rName ); SvXMLStyleIndex_Impl aIndex( nFamily, rName );
sal_uInt32 nPos = 0; sal_uInt32 nPos = 0;
if( pIndices->Seek_Entry( &aIndex, &nPos ) ) if( pIndices->Seek_Entry( &aIndex, &nPos ) )
pStyle = pIndices->GetObject( nPos )->GetStyle(); pStyle = pIndices->GetObject( nPos )->GetStyle();
...@@ -497,7 +488,6 @@ const SvXMLStyleContext *SvXMLStylesContext_Impl::FindStyleChildContext( ...@@ -497,7 +488,6 @@ const SvXMLStyleContext *SvXMLStylesContext_Impl::FindStyleChildContext(
{ {
const SvXMLStyleContext *pS = aStyles.GetObject( i ); const SvXMLStyleContext *pS = aStyles.GetObject( i );
if( pS->GetFamily() == nFamily && if( pS->GetFamily() == nFamily &&
pS->GetSubFamily() == nSubFamily &&
pS->GetName() == rName ) pS->GetName() == rName )
pStyle = pS; pStyle = pS;
} }
...@@ -541,9 +531,11 @@ SvXMLStyleContext *SvXMLStylesContext::CreateStyleChildContext( ...@@ -541,9 +531,11 @@ SvXMLStyleContext *SvXMLStylesContext::CreateStyleChildContext(
if (!pStyle) if (!pStyle)
{ {
const SvXMLTokenMap& rTokenMap = GetStyleStylesElemTokenMap(); const SvXMLTokenMap& rTokenMap = GetStyleStylesElemTokenMap();
switch( rTokenMap.Get( nPrefix, rLocalName ) ) sal_uInt16 nToken = rTokenMap.Get( nPrefix, rLocalName );
switch( nToken )
{ {
case XML_TOK_STYLE_STYLE: case XML_TOK_STYLE_STYLE:
case XML_TOK_STYLE_DEFAULT_STYLE:
{ {
sal_uInt16 nFamily = 0; sal_uInt16 nFamily = 0;
sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
...@@ -562,7 +554,10 @@ SvXMLStyleContext *SvXMLStylesContext::CreateStyleChildContext( ...@@ -562,7 +554,10 @@ SvXMLStyleContext *SvXMLStylesContext::CreateStyleChildContext(
break; break;
} }
} }
pStyle = CreateStyleStyleChildContext( nFamily, nPrefix, pStyle = XML_TOK_STYLE_STYLE==nToken
? CreateStyleStyleChildContext( nFamily, nPrefix,
rLocalName, xAttrList )
: CreateDefaultStyleStyleChildContext( nFamily, nPrefix,
rLocalName, xAttrList ); rLocalName, xAttrList );
} }
break; break;
...@@ -655,7 +650,7 @@ SvXMLStyleContext *SvXMLStylesContext::CreateStyleStyleChildContext( ...@@ -655,7 +650,7 @@ SvXMLStyleContext *SvXMLStylesContext::CreateStyleStyleChildContext(
case XML_STYLE_FAMILY_TEXT_TEXT: case XML_STYLE_FAMILY_TEXT_TEXT:
case XML_STYLE_FAMILY_TEXT_SECTION: case XML_STYLE_FAMILY_TEXT_SECTION:
pStyle = new XMLTextStyleContext( GetImport(), nPrefix, rLocalName, pStyle = new XMLTextStyleContext( GetImport(), nPrefix, rLocalName,
xAttrList, *this ); xAttrList, *this, nFamily );
break; break;
case XML_STYLE_FAMILY_CONTROL_ID: case XML_STYLE_FAMILY_CONTROL_ID:
case XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID: case XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID:
...@@ -677,6 +672,14 @@ SvXMLStyleContext *SvXMLStylesContext::CreateStyleStyleChildContext( ...@@ -677,6 +672,14 @@ SvXMLStyleContext *SvXMLStylesContext::CreateStyleStyleChildContext(
return pStyle; return pStyle;
} }
SvXMLStyleContext *SvXMLStylesContext::CreateDefaultStyleStyleChildContext(
sal_uInt16 nFamily, sal_uInt16 nPrefix, const OUString& rLocalName,
const uno::Reference< xml::sax::XAttributeList > & xAttrList )
{
return 0;
}
sal_Bool SvXMLStylesContext::InsertStyleFamily( sal_uInt16 ) const sal_Bool SvXMLStylesContext::InsertStyleFamily( sal_uInt16 ) const
{ {
return sal_True; return sal_True;
...@@ -976,8 +979,8 @@ void SvXMLStylesContext::CopyStylesToDoc( sal_Bool bOverwrite, ...@@ -976,8 +979,8 @@ void SvXMLStylesContext::CopyStylesToDoc( sal_Bool bOverwrite,
sal_Bool bFinish ) sal_Bool bFinish )
{ {
// pass 1: create text, paragraph and frame styles // pass 1: create text, paragraph and frame styles
sal_uInt16 nCount = GetStyleCount(); sal_uInt32 nCount = GetStyleCount();
for( sal_uInt16 i=0; i<nCount; i++ ) for( sal_uInt32 i=0; i<nCount; i++ )
{ {
SvXMLStyleContext *pStyle = GetStyle( i ); SvXMLStyleContext *pStyle = GetStyle( i );
if( !pStyle ) if( !pStyle )
...@@ -1005,8 +1008,8 @@ void SvXMLStylesContext::CopyStylesToDoc( sal_Bool bOverwrite, ...@@ -1005,8 +1008,8 @@ void SvXMLStylesContext::CopyStylesToDoc( sal_Bool bOverwrite,
void SvXMLStylesContext::FinishStyles( sal_Bool bOverwrite ) void SvXMLStylesContext::FinishStyles( sal_Bool bOverwrite )
{ {
sal_uInt16 nCount = GetStyleCount(); sal_uInt32 nCount = GetStyleCount();
for( sal_uInt16 i=0; i<nCount; i++ ) for( sal_uInt32 i=0; i<nCount; i++ )
{ {
SvXMLStyleContext *pStyle = GetStyle( i ); SvXMLStyleContext *pStyle = GetStyle( i );
if( !pStyle || !pStyle->IsValid() ) if( !pStyle || !pStyle->IsValid() )
...@@ -1030,12 +1033,10 @@ const OUString& SvXMLStylesContext::GetParentHRef() const ...@@ -1030,12 +1033,10 @@ const OUString& SvXMLStylesContext::GetParentHRef() const
const SvXMLStyleContext *SvXMLStylesContext::FindStyleChildContext( const SvXMLStyleContext *SvXMLStylesContext::FindStyleChildContext(
sal_uInt16 nFamily, sal_uInt16 nFamily,
sal_uInt16 nSubFamily,
const OUString& rName, const OUString& rName,
sal_Bool bCreateIndex ) const sal_Bool bCreateIndex ) const
{ {
return pImpl->FindStyleChildContext( nFamily, nSubFamily,rName, return pImpl->FindStyleChildContext( nFamily, rName, bCreateIndex );
bCreateIndex );
} }
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: xmltabe.cxx,v $ * $RCSfile: xmltabe.cxx,v $
* *
* $Revision: 1.2 $ * $Revision: 1.3 $
* *
* last change: $Author: dvo $ $Date: 2000-11-02 15:51:17 $ * last change: $Author: mib $ $Date: 2001-01-05 10:01:15 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -104,7 +104,7 @@ SvXMLEnumMapEntry psXML_tabstop_style[] = ...@@ -104,7 +104,7 @@ SvXMLEnumMapEntry psXML_tabstop_style[] =
{ "center", style::TabAlign_CENTER }, { "center", style::TabAlign_CENTER },
{ "right", style::TabAlign_RIGHT }, { "right", style::TabAlign_RIGHT },
{ "char", style::TabAlign_DECIMAL }, { "char", style::TabAlign_DECIMAL },
{ "????", style::TabAlign_DEFAULT }, // ????????????????????????????????????? { "default", style::TabAlign_DEFAULT }, // ?????????????????????????????????????
{ 0, 0 } { 0, 0 }
}; };
...@@ -221,8 +221,8 @@ void SvxXMLTabStopExport::Export( const uno::Any& rAny, ...@@ -221,8 +221,8 @@ void SvxXMLTabStopExport::Export( const uno::Any& rAny,
const sal_uInt16 nTabs = aSeq.getLength(); const sal_uInt16 nTabs = aSeq.getLength();
// ignore default tab stop here // ignore default tab stop here
if( 1 == nTabs && style::TabAlign_DEFAULT == pTabs[0].Alignment ) //if( 1 == nTabs && style::TabAlign_DEFAULT == pTabs[0].Alignment )
return; // return;
OUString sElem = GetQNameByKey( XML_NAMESPACE_STYLE, OUString sElem = GetQNameByKey( XML_NAMESPACE_STYLE,
OUString::createFromAscii(sXML_tab_stops) ); OUString::createFromAscii(sXML_tab_stops) );
...@@ -236,7 +236,8 @@ void SvxXMLTabStopExport::Export( const uno::Any& rAny, ...@@ -236,7 +236,8 @@ void SvxXMLTabStopExport::Export( const uno::Any& rAny,
nIndex == 0 || nIndex == 0 ||
style::TabAlign_DEFAULT != pTabs[nIndex-1].Alignment, style::TabAlign_DEFAULT != pTabs[nIndex-1].Alignment,
"tab default distance unexpected" ); "tab default distance unexpected" );
if( style::TabAlign_DEFAULT != pTabs[nIndex].Alignment ) if( style::TabAlign_DEFAULT != pTabs[nIndex].Alignment ||
0 == nIndex )
exportTabStop( &(pTabs[nIndex]) ); exportTabStop( &(pTabs[nIndex]) );
} }
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: xmltabi.cxx,v $ * $RCSfile: xmltabi.cxx,v $
* *
* $Revision: 1.3 $ * $Revision: 1.4 $
* *
* last change: $Author: dvo $ $Date: 2000-11-02 15:51:17 $ * last change: $Author: mib $ $Date: 2001-01-05 10:01:15 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -176,22 +176,26 @@ SvxXMLTabStopContext_Impl::SvxXMLTabStopContext_Impl( ...@@ -176,22 +176,26 @@ SvxXMLTabStopContext_Impl::SvxXMLTabStopContext_Impl(
aTabStop.Position = nVal; aTabStop.Position = nVal;
break; break;
case XML_TOK_TABSTOP_TYPE: case XML_TOK_TABSTOP_TYPE:
if( 0 == rValue.compareToAscii( sXML_left, sizeof( sXML_left ) ) ) if( rValue.equalsAsciiL( sXML_left, sizeof( sXML_left )-1 ) )
{ {
aTabStop.Alignment = style::TabAlign_LEFT; aTabStop.Alignment = style::TabAlign_LEFT;
} }
else if( 0 == rValue.compareToAscii( sXML_right, sizeof( sXML_right ) ) ) else if( rValue.equalsAsciiL( sXML_right, sizeof( sXML_right )-1 ) )
{ {
aTabStop.Alignment = style::TabAlign_RIGHT; aTabStop.Alignment = style::TabAlign_RIGHT;
} }
else if( 0 == rValue.compareToAscii( sXML_center, sizeof( sXML_center ) ) ) else if( rValue.equalsAsciiL( sXML_center, sizeof( sXML_center )-1 ) )
{ {
aTabStop.Alignment = style::TabAlign_CENTER; aTabStop.Alignment = style::TabAlign_CENTER;
} }
else if( 0 == rValue.compareToAscii( sXML_char, sizeof( sXML_char ) ) ) else if( rValue.equalsAsciiL( sXML_char, sizeof( sXML_char )-1 ) )
{ {
aTabStop.Alignment = style::TabAlign_DECIMAL; aTabStop.Alignment = style::TabAlign_DECIMAL;
} }
else if( rValue.equalsAsciiL( sXML_default, sizeof( sXML_default )-1 ) )
{
aTabStop.Alignment = style::TabAlign_DEFAULT;
}
break; break;
case XML_TOK_TABSTOP_CHAR: case XML_TOK_TABSTOP_CHAR:
if( 0 != rValue.getLength() ) if( 0 != rValue.getLength() )
...@@ -292,15 +296,26 @@ void SvxXMLTabStopImportContext::EndElement( ) ...@@ -292,15 +296,26 @@ void SvxXMLTabStopImportContext::EndElement( )
if( mpTabStops ) if( mpTabStops )
{ {
sal_uInt16 nCount = mpTabStops->Count(); sal_uInt16 nCount = mpTabStops->Count();
sal_uInt16 nNewCount;
uno::Sequence< style::TabStop> aSeq( nCount ); uno::Sequence< style::TabStop> aSeq( nCount );
style::TabStop* pTabStops = aSeq.getArray(); style::TabStop* pTabStops = aSeq.getArray();
for( sal_uInt16 i=0; i < nCount; i++ ) for( sal_uInt16 i=0; i < nCount; i++ )
{ {
SvxXMLTabStopContext_Impl *pTabStopContext = (*mpTabStops)[i]; SvxXMLTabStopContext_Impl *pTabStopContext = (*mpTabStops)[i];
*pTabStops++ = pTabStopContext->getTabStop(); const style::TabStop& rTabStop = pTabStopContext->getTabStop();
sal_Bool bDflt = style::TabAlign_DEFAULT == rTabStop.Alignment;
if( !bDflt || 0==i )
{
*pTabStops++ = pTabStopContext->getTabStop();
nNewCount++;
}
if( bDflt && 0==i )
break;
} }
if( nCount != nNewCount )
aSeq.realloc( nNewCount );
aProp.maValue <<= aSeq; aProp.maValue <<= aSeq;
} }
else else
......
This diff is collapsed.
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: txtstyle.cxx,v $ * $RCSfile: txtstyle.cxx,v $
* *
* $Revision: 1.5 $ * $Revision: 1.6 $
* *
* last change: $Author: dvo $ $Date: 2000-12-11 19:14:26 $ * last change: $Author: mib $ $Date: 2001-01-05 10:02:58 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -187,13 +187,13 @@ void XMLTextParagraphExport::exportNumStyles( sal_Bool bUsed ) ...@@ -187,13 +187,13 @@ void XMLTextParagraphExport::exportNumStyles( sal_Bool bUsed )
void XMLTextParagraphExport::exportTextStyles( sal_Bool bUsed ) void XMLTextParagraphExport::exportTextStyles( sal_Bool bUsed )
{ {
exportStyleFamily( "ParagraphStyles", sXML_paragraph, GetParaPropMapper(), exportStyleFamily( "ParagraphStyles", sXML_paragraph, GetParaPropMapper(),
bUsed, XML_STYLE_FAMILY_TEXT_PARAGRAPH ); bUsed, XML_STYLE_FAMILY_TEXT_PARAGRAPH, 0, sal_True );
exportStyleFamily( "CharacterStyles", sXML_text, GetTextPropMapper(), exportStyleFamily( "CharacterStyles", sXML_text, GetTextPropMapper(),
bUsed, XML_STYLE_FAMILY_TEXT_TEXT ); bUsed, XML_STYLE_FAMILY_TEXT_TEXT );
// get shape export to make sure the the frame family is added correctly. // get shape export to make sure the the frame family is added correctly.
GetExport().GetShapeExport(); GetExport().GetShapeExport();
exportStyleFamily( "FrameStyles", XML_STYLE_FAMILY_SD_GRAPHICS_NAME, GetFramePropMapper(), exportStyleFamily( "FrameStyles", XML_STYLE_FAMILY_SD_GRAPHICS_NAME, GetFramePropMapper(),
bUsed, XML_STYLE_FAMILY_TEXT_FRAME ); bUsed, XML_STYLE_FAMILY_TEXT_FRAME, 0, sal_True );
exportNumStyles( bUsed ); exportNumStyles( bUsed );
exportTextFootnoteConfiguration(); exportTextFootnoteConfiguration();
XMLSectionExport::ExportBibliographyConfiguration(GetExport()); XMLSectionExport::ExportBibliographyConfiguration(GetExport());
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: txtstyli.cxx,v $ * $RCSfile: txtstyli.cxx,v $
* *
* $Revision: 1.3 $ * $Revision: 1.4 $
* *
* last change: $Author: dvo $ $Date: 2000-12-20 15:34:07 $ * last change: $Author: mib $ $Date: 2001-01-05 10:02:58 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -173,8 +173,10 @@ TYPEINIT1( XMLTextStyleContext, XMLPropStyleContext ); ...@@ -173,8 +173,10 @@ TYPEINIT1( XMLTextStyleContext, XMLPropStyleContext );
XMLTextStyleContext::XMLTextStyleContext( SvXMLImport& rImport, XMLTextStyleContext::XMLTextStyleContext( SvXMLImport& rImport,
sal_uInt16 nPrfx, const OUString& rLName, sal_uInt16 nPrfx, const OUString& rLName,
const Reference< XAttributeList > & xAttrList, const Reference< XAttributeList > & xAttrList,
SvXMLStylesContext& rStyles ) : SvXMLStylesContext& rStyles, sal_uInt16 nFamily,
XMLPropStyleContext( rImport, nPrfx, rLName, xAttrList, rStyles ), sal_Bool bDefaultStyle ) :
XMLPropStyleContext( rImport, nPrfx, rLName, xAttrList, rStyles,
nFamily, bDefaultStyle ),
bAutoUpdate( sal_False ), bAutoUpdate( sal_False ),
bHasMasterPageName( sal_False ), bHasMasterPageName( sal_False ),
pEventContext( NULL ), pEventContext( NULL ),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment