Kaydet (Commit) b333506f authored tarafından Frank Schönheit's avatar Frank Schönheit

#104402# importing grid column styles now

üst d4d3e079
......@@ -2,9 +2,9 @@
*
* $RCSfile: elementimport.cxx,v $
*
* $Revision: 1.30 $
* $Revision: 1.31 $
*
* last change: $Author: fs $ $Date: 2002-10-02 14:31:10 $
* last change: $Author: fs $ $Date: 2002-10-25 13:14:15 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -91,6 +91,9 @@
#ifndef _XMLOFF_FORMS_EVENTIMPORT_HXX_
#include "eventimport.hxx"
#endif
#ifndef XMLOFF_FORMSTYLES_HXX
#include "formstyles.hxx"
#endif
#ifndef _COMPHELPER_EXTRACT_HXX_
#include <comphelper/extract.hxx>
......@@ -186,6 +189,7 @@ namespace xmloff
,m_xParentContainer(_rxParentContainer)
,m_rFormImport(_rImport)
,m_rEventManager(_rEventManager)
,m_pStyleElement( NULL )
{
OSL_ENSURE(m_xParentContainer.is(), "OElementImport::OElementImport: invalid parent container!");
}
......@@ -302,6 +306,17 @@ namespace xmloff
}
}
// set the style properties
if ( m_pStyleElement && m_xElement.is() )
{
const_cast< OControlStyleContext* >( m_pStyleElement )->FillPropertySet( m_xElement );
::rtl::OUString sNumberStyleName = const_cast< OControlStyleContext* >( m_pStyleElement )->getNumberStyleName( );
if ( sNumberStyleName.getLength() )
// the style also has a number (sub) style
m_rContext.applyControlNumberStyle( m_xElement, sNumberStyleName );
}
// insert the element into the parent container
if (!m_sName.getLength())
{
......@@ -362,8 +377,17 @@ namespace xmloff
// remember the name for later use in EndElement
m_sName = _rValue;
// let the base class handle it
OPropertyImport::handleAttribute(_nNamespaceKey, _rLocalName, _rValue);
// maybe it's the style attribute?
if ( 0 == _rLocalName.compareToAscii( getSpecialAttributeName( SCA_COLUMN_STYLE_NAME ) ) )
{
const SvXMLStyleContext* pStyleContext = m_rContext.getStyleElement( _rValue );
OSL_ENSURE( pStyleContext, "OPropertyImport::handleAttribute: do not know the style!" );
// remember the element for later usage.
m_pStyleElement = static_cast< const OControlStyleContext* >( pStyleContext );
}
else
// let the base class handle it
OPropertyImport::handleAttribute(_nNamespaceKey, _rLocalName, _rValue);
}
}
......@@ -1389,6 +1413,9 @@ namespace xmloff
/*************************************************************************
* history:
* $Log: not supported by cvs2svn $
* Revision 1.30 2002/10/02 14:31:10 fs
* #103388# some performance logging
*
* Revision 1.29 2002/09/09 13:55:30 fs
* #102475# OControlImport::EndElement: when reading a 'default value' property (such as 'DefaultText'), ensure that it does not wrongly overwrite the 'value' property (such as 'Text')
*
......
......@@ -2,9 +2,9 @@
*
* $RCSfile: elementimport.hxx,v $
*
* $Revision: 1.15 $
* $Revision: 1.16 $
*
* last change: $Author: fs $ $Date: 2002-10-02 14:31:09 $
* last change: $Author: fs $ $Date: 2002-10-25 13:14:15 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -100,6 +100,7 @@ namespace xmloff
class IControlIdMap;
class IFormsImportContext;
class OControlStyleContext;
//=====================================================================
//= OElementNameMap
......@@ -138,6 +139,9 @@ namespace xmloff
IFormsImportContext& m_rFormImport; // the form import context
IEventAttacherManager& m_rEventManager; // the event attacher manager
const OControlStyleContext* m_pStyleElement; // the XML element which describes the style we encountered
// while reading our element
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
m_xParentContainer;
// the parent container to insert the new element into
......@@ -194,6 +198,10 @@ namespace xmloff
private:
::rtl::OUString implGetDefaultName() const;
/** sets the style properties which have been read for the element (if any)
*/
void implSetStyleProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObject );
};
//=====================================================================
......@@ -643,6 +651,9 @@ namespace xmloff
/*************************************************************************
* history:
* $Log: not supported by cvs2svn $
* Revision 1.15 2002/10/02 14:31:09 fs
* #103388# some performance logging
*
* Revision 1.14 2001/11/05 15:24:12 fs
* #94194# +m_bEncounteredLSAttrib
*
......
......@@ -2,9 +2,9 @@
*
* $RCSfile: layerimport.cxx,v $
*
* $Revision: 1.14 $
* $Revision: 1.15 $
*
* last change: $Author: dvo $ $Date: 2001-09-21 16:27:53 $
* last change: $Author: fs $ $Date: 2002-10-25 13:16:25 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -74,6 +74,9 @@
#ifndef _XMLOFF_FORMS_STRINGS_HXX_
#include "strings.hxx"
#endif
#ifndef XMLOFF_FORMSTYLES_HXX
#include "formstyles.hxx"
#endif
#ifndef _XMLOFF_XMLICTXT_HXX
#include "xmlictxt.hxx"
#endif
......@@ -86,6 +89,9 @@
#ifndef _XMLOFF_PROPERTYSETMAPPER_HXX
#include "xmlprmap.hxx"
#endif
#ifndef _XMLOFF_PRSTYLEI_HXX_
#include "prstylei.hxx"
#endif
#ifndef _XMLOFF_XMLIMP_HXX
#include "xmlimp.hxx"
#endif
......@@ -416,6 +422,21 @@ namespace xmloff
return m_rImporter;
}
//---------------------------------------------------------------------
const SvXMLStyleContext* OFormLayerXMLImport_Impl::getStyleElement(const ::rtl::OUString& _rStyleName) const
{
OSL_ENSURE( m_pAutoStyles, "OFormLayerXMLImport_Impl::getStyleElement: have no auto style context!" );
// did you use setAutoStyleContext?
const SvXMLStyleContext* pControlStyle =
m_pAutoStyles ? m_pAutoStyles->FindStyleChildContext( XML_STYLE_FAMILY_CONTROL_ID, _rStyleName ) : NULL;
OSL_ENSURE( pControlStyle || !m_pAutoStyles,
::rtl::OString( "OFormLayerXMLImport_Impl::getStyleElement: did not find the style named \"" )
+= ::rtl::OString( _rStyleName.getStr(), _rStyleName.getLength(), RTL_TEXTENCODING_ASCII_US )
+= ::rtl::OString( "\"!" ) );
return pControlStyle;
}
//---------------------------------------------------------------------
void OFormLayerXMLImport_Impl::enterEventContext()
{
......@@ -572,6 +593,14 @@ namespace xmloff
return new OFormImport(*this, *this, _nPrefix, _rLocalName, m_xForms );
}
//---------------------------------------------------------------------
XMLPropStyleContext* OFormLayerXMLImport_Impl::createControlStyleContext( sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
const Reference< sax::XAttributeList >& _rxAttrList, SvXMLStylesContext& _rParentStyles,
sal_uInt16 _nFamily, sal_Bool _bDefaultStyle )
{
return new OControlStyleContext( m_rImporter, _nPrefix, _rLocalName, _rxAttrList, _rParentStyles, _nFamily, _bDefaultStyle );
}
//---------------------------------------------------------------------
void OFormLayerXMLImport_Impl::seekPage(const Reference< XDrawPage >& _rxDrawPage)
{
......@@ -587,6 +616,11 @@ namespace xmloff
/*************************************************************************
* history:
* $Log: not supported by cvs2svn $
* Revision 1.14 2001/09/21 16:27:53 dvo
* #92176# include PrinterPaperTray property
* SvXMLImportProperty now 'knows' the SvXMLImport in order to
* enable error handling for 'wrong' paper trays and properties
*
* Revision 1.13 2001/05/28 15:04:18 fs
* #86712# no releaseContext anymore
*
......
......@@ -2,9 +2,9 @@
*
* $RCSfile: layerimport.hxx,v $
*
* $Revision: 1.9 $
* $Revision: 1.10 $
*
* last change: $Author: fs $ $Date: 2001-05-28 14:59:18 $
* last change: $Author: fs $ $Date: 2002-10-25 13:17:04 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -86,6 +86,7 @@ class SvXMLImport;
class SvXMLImportContext;
class XMLPropertyHandlerFactory;
class SvXMLImportPropertyMapper;
class XMLPropStyleContext;
SV_DECL_REF( SvXMLStylesContext );
// unfortunately, we can't put this into our namespace, as the macro expands to (amongst others) a forward
......@@ -165,6 +166,11 @@ namespace xmloff
virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
getServiceFactory();
virtual SvXMLImport& getGlobalContext();
const SvXMLStyleContext* getStyleElement(const ::rtl::OUString& _rStyleName) const;
void applyControlNumberStyle(
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel,
const ::rtl::OUString& _rControlNumerStyleName
);
virtual void enterEventContext();
virtual void leaveEventContext();
......@@ -200,6 +206,17 @@ namespace xmloff
const rtl::OUString& _rLocalName,
const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttribs);
/**
*/
XMLPropStyleContext* createControlStyleContext(
sal_uInt16 _nPrefix,
const ::rtl::OUString& _rLocalName,
const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList,
SvXMLStylesContext& _rParentStyles,
sal_uInt16 _nFamily = 0,
sal_Bool _bDefaultStyle = sal_False
);
/** get the control with the given id
*/
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
......@@ -213,17 +230,6 @@ namespace xmloff
/** announces the auto-style context to the form importer
*/
void setAutoStyleContext(SvXMLStylesContext* _pNewContext);
/** sets the given number style on the given control
@param _rxControlModel
the control model which's style is to be set
@param _rControlNumerStyleName
the style name for the control's number style
*/
void applyControlNumberStyle(
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel,
const ::rtl::OUString& _rControlNumerStyleName
);
};
//.........................................................................
......@@ -235,6 +241,9 @@ namespace xmloff
/*************************************************************************
* history:
* $Log: not supported by cvs2svn $
* Revision 1.9 2001/05/28 14:59:18 fs
* #86712# added control number style related functionality
*
* Revision 1.8 2001/03/20 13:39:58 fs
* #83970# +createOfficeFormsContext
*
......
......@@ -2,9 +2,9 @@
*
* $RCSfile: propertyimport.hxx,v $
*
* $Revision: 1.8 $
* $Revision: 1.9 $
*
* last change: $Author: fs $ $Date: 2001-03-29 09:44:19 $
* last change: $Author: fs $ $Date: 2002-10-25 13:19:34 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -84,7 +84,6 @@ namespace com { namespace sun { namespace star { namespace util {
struct Date;
} } } }
class XMLPropStyleContext;
//.........................................................................
namespace xmloff
{
......@@ -105,15 +104,15 @@ namespace xmloff
protected:
DECLARE_STL_VECTOR( ::com::sun::star::beans::PropertyValue, PropertyValueArray );
PropertyValueArray m_aValues;
PropertyValueArray m_aValues;
// the values which the instance collects between StartElement and EndElement
DECLARE_STL_STDKEY_SET( ::rtl::OUString, StringSet );
StringSet m_aEncounteredAttributes;
StringSet m_aEncounteredAttributes;
IFormsImportContext& m_rContext;
IFormsImportContext& m_rContext;
sal_Bool m_bTrackAttributes;
sal_Bool m_bTrackAttributes;
// TODO: think about the restriction that the class does not know anything about the object it is importing.
// Perhaps this object should be known to the class, so setting the properties ('normal' ones as well as
......@@ -276,6 +275,9 @@ namespace xmloff
/*************************************************************************
* history:
* $Log: not supported by cvs2svn $
* Revision 1.8 2001/03/29 09:44:19 fs
* enableTrackAttributes to prevent the (expensive) attribute tracking
*
* Revision 1.7 2001/03/28 13:59:54 fs
* #85371# +simulateDefaultedAttribute / +encounteredAttribute
*
......
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