Kaydet (Commit) 21ff69e4 authored tarafından Rüdiger Timm's avatar Rüdiger Timm

INTEGRATION: CWS impresstables2 (1.49.80); FILE MERGED

2008/03/11 18:21:59 cl 1.49.80.7: RESYNC: (1.50-1.51); FILE MERGED
2008/02/13 20:09:57 cl 1.49.80.6: #i68103# import table shapes only in impress and draw
2008/01/01 18:32:44 cl 1.49.80.5: #i68103# export preview image for draw tables
2007/11/29 18:50:29 cl 1.49.80.4: #i68103# working on table templates
2007/08/01 14:16:02 cl 1.49.80.3: RESYNC: (1.49-1.50); FILE MERGED
2007/07/27 09:09:52 cl 1.49.80.2: fixed build issues due to pch and namespace ::rtl
2007/07/26 17:13:25 cl 1.49.80.1: #i68103# working on tables in draw
üst 2248c068
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
* *
* $RCSfile: ximpstyl.cxx,v $ * $RCSfile: ximpstyl.cxx,v $
* *
* $Revision: 1.51 $ * $Revision: 1.52 $
* *
* last change: $Author: kz $ $Date: 2008-03-06 16:19:48 $ * last change: $Author: rt $ $Date: 2008-03-12 10:39:37 $
* *
* The Contents of this file are made available subject to * The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1. * the terms of GNU Lesser General Public License Version 2.1.
...@@ -66,43 +66,19 @@ ...@@ -66,43 +66,19 @@
#include <tools/debug.hxx> #include <tools/debug.hxx>
#endif #endif
#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp>
#endif #include <com/sun/star/lang/XSingleServiceFactory.hpp>
#ifndef _COM_SUN_STAR_PRESENTATION_XPRESENTATIONPAGE_HPP_
#include <com/sun/star/presentation/XPresentationPage.hpp> #include <com/sun/star/presentation/XPresentationPage.hpp>
#endif
#ifndef _COM_SUN_STAR_DRAWING_XDRAWPAGES_HPP_
#include <com/sun/star/drawing/XDrawPages.hpp> #include <com/sun/star/drawing/XDrawPages.hpp>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_XNAMED_HPP_
#include <com/sun/star/container/XNamed.hpp> #include <com/sun/star/container/XNamed.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
#include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertySet.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSTATE_HPP_
#include <com/sun/star/beans/XPropertyState.hpp> #include <com/sun/star/beans/XPropertyState.hpp>
#endif #include <com/sun/star/presentation/XHandoutMasterSupplier.hpp>
#ifndef _COMPHELPER_NAMECONTAINER_HXX_ #ifndef _COMPHELPER_NAMECONTAINER_HXX_
#include <comphelper/namecontainer.hxx> #include <comphelper/namecontainer.hxx>
#endif #endif
#ifndef _COM_SUN_STAR_PRESENTATION_XHANDOUTMASTERSUPPLIER_HPP_
#include <com/sun/star/presentation/XHandoutMasterSupplier.hpp>
#endif
// #110680#
//#ifndef _COMPHELPER_PROCESSFACTORY_HXX_
//#include <comphelper/processfactory.hxx>
//#endif
#ifndef _XMLOFF_XMLPROPERTYSETCONTEXT_HXX #ifndef _XMLOFF_XMLPROPERTYSETCONTEXT_HXX
#include <xmloff/xmlprcon.hxx> #include <xmloff/xmlprcon.hxx>
#endif #endif
...@@ -143,7 +119,9 @@ ...@@ -143,7 +119,9 @@
#include "xmlerror.hxx" #include "xmlerror.hxx"
#endif #endif
using namespace ::rtl; using ::rtl::OUString;
using ::rtl::OUStringBuffer;
using namespace ::com::sun::star; using namespace ::com::sun::star;
using namespace ::com::sun::star::uno; using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::xml::sax; using namespace ::com::sun::star::xml::sax;
...@@ -1151,6 +1129,11 @@ SvXMLStyleContext* SdXMLStylesContext::CreateStyleChildContext( ...@@ -1151,6 +1129,11 @@ SvXMLStyleContext* SdXMLStylesContext::CreateStyleChildContext(
} }
} }
if(!pContext && (nPrefix == XML_NAMESPACE_TABLE) && IsXMLToken( rLocalName, XML_TABLE_TEMPLATE ) )
{
pContext = GetImport().GetShapeImport()->GetShapeTableImport()->CreateTableTemplateContext(nPrefix, rLocalName, xAttrList );
}
// call base class // call base class
if(!pContext) if(!pContext)
pContext = SvXMLStylesContext::CreateStyleChildContext(nPrefix, rLocalName, xAttrList); pContext = SvXMLStylesContext::CreateStyleChildContext(nPrefix, rLocalName, xAttrList);
...@@ -1173,6 +1156,11 @@ SvXMLStyleContext* SdXMLStylesContext::CreateStyleStyleChildContext( ...@@ -1173,6 +1156,11 @@ SvXMLStyleContext* SdXMLStylesContext::CreateStyleStyleChildContext(
case XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID: case XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID:
pContext = new SdXMLDrawingPageStyleContext(GetSdImport(), nPrefix, rLocalName, xAttrList, *this ); pContext = new SdXMLDrawingPageStyleContext(GetSdImport(), nPrefix, rLocalName, xAttrList, *this );
break; break;
case XML_STYLE_FAMILY_TABLE_CELL:
case XML_STYLE_FAMILY_TABLE_COLUMN:
case XML_STYLE_FAMILY_TABLE_ROW:
pContext = new XMLShapeStyleContext( GetSdImport(), nPrefix, rLocalName, xAttrList, *this, nFamily );
break;
} }
// call base class // call base class
...@@ -1250,7 +1238,9 @@ UniReference< SvXMLImportPropertyMapper > SdXMLStylesContext::GetImportPropertyM ...@@ -1250,7 +1238,9 @@ UniReference< SvXMLImportPropertyMapper > SdXMLStylesContext::GetImportPropertyM
// return xMapper; // return xMapper;
// } // }
if(XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID == nFamily) switch( nFamily )
{
case XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID:
{ {
if(!xPresImpPropMapper.is()) if(!xPresImpPropMapper.is())
{ {
...@@ -1259,11 +1249,29 @@ UniReference< SvXMLImportPropertyMapper > SdXMLStylesContext::GetImportPropertyM ...@@ -1259,11 +1249,29 @@ UniReference< SvXMLImportPropertyMapper > SdXMLStylesContext::GetImportPropertyM
aImpHelper->GetPresPagePropsMapper(); aImpHelper->GetPresPagePropsMapper();
} }
xMapper = xPresImpPropMapper; xMapper = xPresImpPropMapper;
return xMapper; break;
}
case XML_STYLE_FAMILY_TABLE_COLUMN:
case XML_STYLE_FAMILY_TABLE_ROW:
case XML_STYLE_FAMILY_TABLE_CELL:
{
const rtl::Reference< XMLTableImport >& xTableImport( const_cast< SvXMLImport& >( GetImport() ).GetShapeImport()->GetShapeTableImport() );
switch( nFamily )
{
case XML_STYLE_FAMILY_TABLE_COLUMN: xMapper = xTableImport->GetColumnImportPropertySetMapper().get(); break;
case XML_STYLE_FAMILY_TABLE_ROW: xMapper = xTableImport->GetRowImportPropertySetMapper().get(); break;
case XML_STYLE_FAMILY_TABLE_CELL: xMapper = xTableImport->GetCellImportPropertySetMapper().get(); break;
}
break;
}
} }
// call base class // call base class
return SvXMLStylesContext::GetImportPropertyMapper(nFamily); if( !xMapper.is() )
xMapper = SvXMLStylesContext::GetImportPropertyMapper(nFamily);
return xMapper;
} }
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
...@@ -1314,6 +1322,8 @@ void SdXMLStylesContext::EndElement() ...@@ -1314,6 +1322,8 @@ void SdXMLStylesContext::EndElement()
{ {
// Process styles list // Process styles list
ImpSetGraphicStyles(); ImpSetGraphicStyles();
ImpSetCellStyles();
GetImport().GetShapeImport()->GetShapeTableImport()->finishStyles();
// put style infos in the info set for other components ( content import f.e. ) // put style infos in the info set for other components ( content import f.e. )
uno::Reference< beans::XPropertySet > xInfoSet( GetImport().getImportInfo() ); uno::Reference< beans::XPropertySet > xInfoSet( GetImport().getImportInfo() );
...@@ -1337,13 +1347,14 @@ void SdXMLStylesContext::SetMasterPageStyles(SdXMLMasterPageContext& rMaster) co ...@@ -1337,13 +1347,14 @@ void SdXMLStylesContext::SetMasterPageStyles(SdXMLMasterPageContext& rMaster) co
UniString sPrefix(rMaster.GetDisplayName(), (sal_uInt16)rMaster.GetDisplayName().getLength()); UniString sPrefix(rMaster.GetDisplayName(), (sal_uInt16)rMaster.GetDisplayName().getLength());
sPrefix += sal_Unicode('-'); sPrefix += sal_Unicode('-');
if(GetSdImport().GetLocalDocStyleFamilies().is() && GetSdImport().GetLocalDocStyleFamilies()->hasByName(rMaster.GetDisplayName())) if(GetSdImport().GetLocalDocStyleFamilies().is() && GetSdImport().GetLocalDocStyleFamilies()->hasByName(rMaster.GetDisplayName())) try
{ {
uno::Reference< container::XNameAccess > xMasterPageStyles( GetSdImport().GetLocalDocStyleFamilies()->getByName(rMaster.GetDisplayName()), UNO_QUERY ); uno::Reference< container::XNameAccess > xMasterPageStyles( GetSdImport().GetLocalDocStyleFamilies()->getByName(rMaster.GetDisplayName()), UNO_QUERY_THROW );
if(xMasterPageStyles.is()) ImpSetGraphicStyles(xMasterPageStyles, XML_STYLE_FAMILY_SD_PRESENTATION_ID, sPrefix);
{ }
ImpSetGraphicStyles(xMasterPageStyles, XML_STYLE_FAMILY_SD_PRESENTATION_ID, sPrefix); catch( uno::Exception& )
} {
DBG_ERROR( "xmloff::SdXMLStylesContext::SetMasterPageStyles(), exception caught!" );
} }
} }
...@@ -1353,36 +1364,40 @@ void SdXMLStylesContext::SetMasterPageStyles(SdXMLMasterPageContext& rMaster) co ...@@ -1353,36 +1364,40 @@ void SdXMLStylesContext::SetMasterPageStyles(SdXMLMasterPageContext& rMaster) co
// //
void SdXMLStylesContext::ImpSetGraphicStyles() const void SdXMLStylesContext::ImpSetGraphicStyles() const
{ {
if(GetSdImport().GetLocalDocStyleFamilies().is()) if(GetSdImport().GetLocalDocStyleFamilies().is()) try
{ {
uno::Reference< container::XNameAccess > xGraphicPageStyles; const OUString sGraphicStyleName(OUString(RTL_CONSTASCII_USTRINGPARAM("graphics")));
try uno::Reference< container::XNameAccess > xGraphicPageStyles( GetSdImport().GetLocalDocStyleFamilies()->getByName(sGraphicStyleName), uno::UNO_QUERY_THROW );
{
const OUString sGraphicStyleName(OUString(RTL_CONSTASCII_USTRINGPARAM("graphics")));
GetSdImport().GetLocalDocStyleFamilies()->getByName(sGraphicStyleName) >>= xGraphicPageStyles;
if(xGraphicPageStyles.is()) UniString aPrefix;
{ ImpSetGraphicStyles(xGraphicPageStyles, XML_STYLE_FAMILY_SD_GRAPHICS_ID, aPrefix);
UniString aPrefix; }
ImpSetGraphicStyles(xGraphicPageStyles, XML_STYLE_FAMILY_SD_GRAPHICS_ID, aPrefix); catch( uno::Exception& )
} {
} DBG_ERROR( "xmloff::SdXMLStylesContext::ImpSetGraphicStyles(), exception caught!" );
catch( uno::Exception& e ) }
{ }
(void)e;
}
DBG_ASSERT( xGraphicPageStyles.is(), "xmloff::SdXMLStylesContext::ImpSetGraphicStyles(), no graphic style" ); void SdXMLStylesContext::ImpSetCellStyles() const
{
if(GetSdImport().GetLocalDocStyleFamilies().is()) try
{
const OUString sCellStyleName(OUString(RTL_CONSTASCII_USTRINGPARAM("cell")));
uno::Reference< container::XNameAccess > xGraphicPageStyles( GetSdImport().GetLocalDocStyleFamilies()->getByName(sCellStyleName), uno::UNO_QUERY_THROW );
UniString aPrefix;
ImpSetGraphicStyles(xGraphicPageStyles, XML_STYLE_FAMILY_TABLE_CELL, aPrefix);
}
catch( uno::Exception& )
{
DBG_ERROR( "xmloff::SdXMLStylesContext::ImpSetCellStyles(), exception caught!" );
} }
} }
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// help function used by ImpSetGraphicStyles() and ImpSetMasterPageStyles() // help function used by ImpSetGraphicStyles() and ImpSetMasterPageStyles()
// //
void SdXMLStylesContext::ImpSetGraphicStyles( void SdXMLStylesContext::ImpSetGraphicStyles( uno::Reference< container::XNameAccess >& xPageStyles, sal_uInt16 nFamily, const UniString& rPrefix) const
uno::Reference< container::XNameAccess >& xPageStyles,
sal_uInt16 nFamily,
const UniString& rPrefix) const
{ {
xub_StrLen nPrefLen(rPrefix.Len()); xub_StrLen nPrefLen(rPrefix.Len());
...@@ -1454,13 +1469,10 @@ void SdXMLStylesContext::ImpSetGraphicStyles( ...@@ -1454,13 +1469,10 @@ void SdXMLStylesContext::ImpSetGraphicStyles(
else else
{ {
// graphics style does not exist, create and add it // graphics style does not exist, create and add it
uno::Reference< lang::XMultiServiceFactory > xServiceFact(GetSdImport().GetModel(), uno::UNO_QUERY); uno::Reference< lang::XSingleServiceFactory > xServiceFact(xPageStyles, uno::UNO_QUERY);
if(xServiceFact.is()) if(xServiceFact.is())
{ {
uno::Reference< style::XStyle > xNewStyle( uno::Reference< style::XStyle > xNewStyle( xServiceFact->createInstance(), uno::UNO_QUERY);
xServiceFact->createInstance(
OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.Style"))),
uno::UNO_QUERY);
if(xNewStyle.is()) if(xNewStyle.is())
{ {
...@@ -1478,8 +1490,7 @@ void SdXMLStylesContext::ImpSetGraphicStyles( ...@@ -1478,8 +1490,7 @@ void SdXMLStylesContext::ImpSetGraphicStyles(
if(xStyle.is()) if(xStyle.is())
{ {
// set properties at style // set properties at style
XMLShapeStyleContext* pPropStyle = XMLPropStyleContext* pPropStyle = dynamic_cast< XMLPropStyleContext* >( const_cast< SvXMLStyleContext* >( pStyle ) );
(pStyle->ISA(XMLShapeStyleContext)) ? (XMLShapeStyleContext*)pStyle : 0L;
uno::Reference< beans::XPropertySet > xPropSet(xStyle, uno::UNO_QUERY); uno::Reference< beans::XPropertySet > xPropSet(xStyle, uno::UNO_QUERY);
if(xPropSet.is() && pPropStyle) if(xPropSet.is() && pPropStyle)
...@@ -1490,9 +1501,8 @@ void SdXMLStylesContext::ImpSetGraphicStyles( ...@@ -1490,9 +1501,8 @@ void SdXMLStylesContext::ImpSetGraphicStyles(
} }
} }
} }
catch( Exception&e ) catch( Exception& e)
{ {
(void)e;
uno::Sequence<OUString> aSeq(0); uno::Sequence<OUString> aSeq(0);
const_cast<SdXMLImport*>(&GetSdImport())->SetError( XMLERROR_FLAG_WARNING | XMLERROR_API, aSeq, e.Message, NULL ); const_cast<SdXMLImport*>(&GetSdImport())->SetError( XMLERROR_FLAG_WARNING | XMLERROR_API, aSeq, e.Message, NULL );
} }
...@@ -1533,7 +1543,6 @@ void SdXMLStylesContext::ImpSetGraphicStyles( ...@@ -1533,7 +1543,6 @@ void SdXMLStylesContext::ImpSetGraphicStyles(
} }
catch( Exception& e ) catch( Exception& e )
{ {
(void)e;
uno::Sequence<OUString> aSeq(0); uno::Sequence<OUString> aSeq(0);
const_cast<SdXMLImport*>(&GetSdImport())->SetError( XMLERROR_FLAG_WARNING | XMLERROR_API, aSeq, e.Message, NULL ); const_cast<SdXMLImport*>(&GetSdImport())->SetError( XMLERROR_FLAG_WARNING | XMLERROR_API, aSeq, e.Message, NULL );
} }
...@@ -1641,8 +1650,7 @@ SvXMLImportContext* SdXMLMasterStylesContext::CreateChildContext( ...@@ -1641,8 +1650,7 @@ SvXMLImportContext* SdXMLMasterStylesContext::CreateChildContext(
} }
} }
} }
else if( nPrefix == XML_NAMESPACE_DRAW else if( (nPrefix == XML_NAMESPACE_DRAW )&& IsXMLToken( rLocalName, XML_LAYER_SET ) )
&& IsXMLToken( rLocalName, XML_LAYER_SET ) )
{ {
pContext = new SdXMLLayerSetContext( GetImport(), nPrefix, rLocalName, xAttrList ); pContext = new SdXMLLayerSetContext( GetImport(), nPrefix, rLocalName, xAttrList );
} }
......
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