Files
libreoffice/xmloff/source/draw/XMLShapeStyleContext.cxx

327 lines
12 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
re-base on ALv2 code. Includes: Patches contributed by: Armin Le Grand. #118558# Correcting OLE attributes of LO3.4 at load time by loading as OOo3.3, details see task. http://svn.apache.org/viewvc?view=revision&revision=1195906 #118485# - Styles for OLEs are not saved. http://svn.apache.org/viewvc?view=revision&revision=1182166 #118898# Adapted ImpGraphic::ImplGetBitmap to correctly convert metafiles http://svn.apache.org/viewvc?view=revision&revision=1293316 #119337# Solves the wrong get/setPropertyValue calls in SvxShapeText (and thus in SvxOle2Shape) http://svn.apache.org/viewvc?view=revision&revision=1344156 Patches contributed by Mathias Bauer (and others) gnumake4 work variously http://svn.apache.org/viewvc?view=revision&revision=1394707 http://svn.apache.org/viewvc?view=revision&revision=1394326 cws mba34issues01: #i117717#: remove wrong assertion http://svn.apache.org/viewvc?view=revision&revision=1172349 Patch contributed by Herbert Duerr goodbye Registration and License dialogs, don't let the door hit you http://svn.apache.org/viewvc?view=revision&revision=1172613 help gcc 4.6.0 on 32bit ubuntu 11.10" http://svn.apache.org/viewvc?view=revision&revision=1245357 Do not add targets for junit tests when junit is disabled. Patch contributed by Andre Fischer http://svn.apache.org/viewvc?view=revision&revision=1241508 Revert "sb140: #i117082# avoid unncessary static class data members commit 21d97438e2944861e26e4984195f959a0cce1e41. remove obsolete FreeBSD visibility special case. retain consolidated BSD bridge code, remove OS/2 pieces.
2012-11-12 17:21:24 +00:00
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 .
*/
2000-09-18 16:07:07 +00:00
2001-01-16 15:36:55 +00:00
#include <tools/debug.hxx>
#include <xmloff/XMLShapeStyleContext.hxx>
#include "XMLShapePropertySetContext.hxx"
#include <xmloff/contextid.hxx>
#include <com/sun/star/drawing/XControlShape.hpp>
#include <com/sun/star/beans/XPropertySetInfo.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/drawing/FillStyle.hpp>
#include <xmloff/xmlimp.hxx>
#include <xmloff/xmlnumi.hxx>
#include <xmloff/xmlnmspe.hxx>
#include <xmloff/xmltoken.hxx>
#include <xmloff/xmlerror.hxx>
#include <xmloff/maptype.hxx>
2000-12-01 18:19:53 +00:00
#include "sdpropls.hxx"
2000-09-18 16:07:07 +00:00
using namespace ::com::sun::star;
2000-12-01 18:19:53 +00:00
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::drawing;
using ::xmloff::token::IsXMLToken;
using ::xmloff::token::XML_TEXT_PROPERTIES;
using ::xmloff::token::XML_GRAPHIC_PROPERTIES;
using ::xmloff::token::XML_PARAGRAPH_PROPERTIES;
2000-09-18 16:07:07 +00:00
TYPEINIT1( XMLShapeStyleContext, XMLPropStyleContext );
XMLShapeStyleContext::XMLShapeStyleContext(
SvXMLImport& rImport,
sal_uInt16 nPrfx,
const OUString& rLName,
const uno::Reference< xml::sax::XAttributeList >& xAttrList,
SvXMLStylesContext& rStyles,
sal_uInt16 nFamily)
: XMLPropStyleContext(rImport, nPrfx, rLName, xAttrList, rStyles, nFamily ),
m_bIsNumRuleAlreadyConverted( false ),
Related: #i124638# Second step of DrawingLayer FillAttributes... for Writer objects, now added support for Paragraph and PageStyle (including Header and Footer) for direct attributes and style attributes (cherry picked from commit cc25c58f7052827bfebdc9fbeec668c8fa29ed1b) Conflicts: cui/source/factory/dlgfact.cxx cui/source/factory/dlgfact.hxx cui/source/inc/bbdlg.hxx cui/source/inc/cuires.hrc cui/source/tabpages/bbdlg.cxx cui/source/tabpages/bbdlg.src cui/source/tabpages/page.cxx cui/source/tabpages/tparea.cxx include/svx/pagectrl.hxx include/svx/svxdlg.hxx include/svx/svxids.hrc include/xmloff/PageMasterStyleMap.hxx include/xmloff/prstylei.hxx include/xmloff/txtprmap.hxx svx/Package_inc.mk svx/inc/svx/hdft.hxx svx/source/dialog/hdft.cxx svx/source/dialog/pagectrl.cxx svx/source/tbxctrls/tbxcolorupdate.cxx svx/source/unodraw/unobrushitemhelper.cxx sw/Library_sw.mk sw/inc/fillattributes.hxx sw/inc/format.hxx sw/inc/frmatr.hxx sw/inc/frmfmt.hxx sw/inc/hintids.hxx sw/inc/hints.hxx sw/inc/ndtxt.hxx sw/inc/node.hxx sw/inc/swunohelper.hxx sw/inc/unobrushitemhelper.hxx sw/inc/unoprnms.hxx sw/source/core/attr/format.cxx sw/source/core/attr/hints.cxx sw/source/core/doc/docdesc.cxx sw/source/core/doc/docdraw.cxx sw/source/core/doc/docfmt.cxx sw/source/core/doc/docnew.cxx sw/source/core/doc/docredln.cxx sw/source/core/doc/poolfmt.cxx sw/source/core/doc/visiturl.cxx sw/source/core/docnode/node.cxx sw/source/core/inc/frame.hxx sw/source/core/inc/frmtool.hxx sw/source/core/inc/rolbck.hxx sw/source/core/layout/atrfrm.cxx sw/source/core/layout/fillattributes.cxx sw/source/core/layout/findfrm.cxx sw/source/core/layout/paintfrm.cxx sw/source/core/txtnode/ndtxt.cxx sw/source/core/txtnode/thints.cxx sw/source/core/txtnode/txtedt.cxx sw/source/core/undo/rolbck.cxx sw/source/core/unocore/swunohelper.cxx sw/source/core/unocore/unoframe.cxx sw/source/core/unocore/unomap.cxx sw/source/core/unocore/unoparagraph.cxx sw/source/core/unocore/unoprnms.cxx sw/source/core/unocore/unostyle.cxx sw/source/ui/chrdlg/paradlg.src sw/source/ui/chrdlg/pardlg.cxx sw/source/ui/fmtui/tmpdlg.cxx sw/source/ui/fmtui/tmpdlg.src sw/source/uibase/app/docst.cxx sw/source/uibase/app/docstyle.cxx sw/source/uibase/frmdlg/colex.cxx sw/source/uibase/shells/basesh.cxx sw/source/uibase/shells/textsh1.cxx sw/source/uibase/uiview/viewstat.cxx sw/source/uibase/utlui/uitool.cxx xmloff/inc/PageMasterImportContext.hxx xmloff/inc/xmloff/XMLShapeStyleContext.hxx xmloff/source/draw/XMLShapeStyleContext.cxx xmloff/source/draw/sdpropls.hxx xmloff/source/style/PageMasterExportPropMapper.cxx xmloff/source/style/PageMasterImportContext.cxx xmloff/source/style/PageMasterPropHdlFactory.cxx xmloff/source/style/PageMasterStyleMap.cxx xmloff/source/style/prstylei.cxx xmloff/source/text/txtexppr.cxx xmloff/source/text/txtprhdl.cxx xmloff/source/text/txtprmap.cxx xmloff/source/text/txtstyli.cxx Conflicts: svx/source/dialog/hdft.cxx sw/source/core/doc/visiturl.cxx sw/source/core/txtnode/thints.cxx sw/source/core/txtnode/txtatr2.cxx sw/source/core/unocore/unostyle.cxx Change-Id: I7e8779db6c0cbd1e242b63eab888f468f2de509a
2014-06-02 15:00:50 +00:00
m_bIsFillStyleAlreadyConverted(false) //UUUU
2000-09-18 16:07:07 +00:00
{
}
XMLShapeStyleContext::~XMLShapeStyleContext()
{
}
void XMLShapeStyleContext::SetAttribute( sal_uInt16 nPrefixKey, const OUString& rLocalName, const OUString& rValue )
{
if (m_sControlDataStyleName.isEmpty() && (::xmloff::token::GetXMLToken(::xmloff::token::XML_DATA_STYLE_NAME) == rLocalName))
{
m_sControlDataStyleName = rValue;
}
else if( (XML_NAMESPACE_STYLE == nPrefixKey) && IsXMLToken( rLocalName, ::xmloff::token::XML_LIST_STYLE_NAME ) )
{
m_sListStyleName = rValue;
}
else
{
XMLPropStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
if( (XML_NAMESPACE_STYLE == nPrefixKey) &&
( IsXMLToken( rLocalName, ::xmloff::token::XML_NAME ) || IsXMLToken( rLocalName, ::xmloff::token::XML_DISPLAY_NAME ) ) )
{
if( !GetName().isEmpty() && !GetDisplayName().isEmpty() && GetName() != GetDisplayName() )
{
const_cast< SvXMLImport&>( GetImport() ).
AddStyleDisplayName( GetFamily(), GetName(), GetDisplayName() );
}
}
}
}
2000-12-01 18:19:53 +00:00
SvXMLImportContext *XMLShapeStyleContext::CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const Reference< xml::sax::XAttributeList > & xAttrList )
{
SvXMLImportContext *pContext = 0;
if( XML_NAMESPACE_STYLE == nPrefix || XML_NAMESPACE_LO_EXT == nPrefix )
2000-12-01 18:19:53 +00:00
{
sal_uInt32 nFamily = 0;
if( IsXMLToken( rLocalName, XML_TEXT_PROPERTIES ) )
nFamily = XML_TYPE_PROP_TEXT;
else if( IsXMLToken( rLocalName, XML_PARAGRAPH_PROPERTIES ) )
nFamily = XML_TYPE_PROP_PARAGRAPH;
else if( IsXMLToken( rLocalName, XML_GRAPHIC_PROPERTIES ) )
nFamily = XML_TYPE_PROP_GRAPHIC;
if( nFamily )
{
rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap =
GetStyles()->GetImportPropertyMapper( GetFamily() );
if( xImpPrMap.is() )
pContext = new XMLShapePropertySetContext( GetImport(), nPrefix,
rLocalName, xAttrList,
nFamily,
GetProperties(),
xImpPrMap );
}
2000-12-01 18:19:53 +00:00
}
if( !pContext )
pContext = XMLPropStyleContext::CreateChildContext( nPrefix, rLocalName,
xAttrList );
return pContext;
}
2000-09-18 16:07:07 +00:00
void XMLShapeStyleContext::FillPropertySet( const Reference< beans::XPropertySet > & rPropSet )
{
if( !m_bIsNumRuleAlreadyConverted )
{
m_bIsNumRuleAlreadyConverted = true;
// for compatibility to beta files, search for CTF_SD_NUMBERINGRULES_NAME to
// import numbering rules from the style:properties element
const rtl::Reference< XMLPropertySetMapper >&rMapper = GetStyles()->GetImportPropertyMapper( GetFamily() )->getPropertySetMapper();
::std::vector< XMLPropertyState > &rProperties = GetProperties();
::std::vector< XMLPropertyState >::iterator end( rProperties.end() );
::std::vector< XMLPropertyState >::iterator property;
// first, look for the old format, where we had a text:list-style-name
// attribute in the style:properties element
2011-07-30 23:51:40 +02:00
for( property = rProperties.begin(); property != end; ++property )
{
// find properties with context
if( (property->mnIndex != -1) && (rMapper->GetEntryContextId( property->mnIndex ) == CTF_SD_NUMBERINGRULES_NAME) )
break;
}
// if we did not find an old list-style-name in the properties, and we need one
// because we got a style:list-style attribute in the style-style element
// we generate one
if( (property == end) && ( !m_sListStyleName.isEmpty() ) )
{
sal_Int32 nIndex = rMapper->FindEntryIndex( CTF_SD_NUMBERINGRULES_NAME );
DBG_ASSERT( -1 != nIndex, "can't find numbering rules property entry, can't set numbering rule!" );
XMLPropertyState aNewState( nIndex );
rProperties.push_back( aNewState );
end = rProperties.end();
property = end - 1;
}
// so, if we have an old or a new list style name, we set its value to
// a numbering rule
if( property != end )
{
if( m_sListStyleName.isEmpty() )
{
property->maValue >>= m_sListStyleName;
}
const SvxXMLListStyleContext *pListStyle = GetImport().GetTextImport()->FindAutoListStyle( m_sListStyleName );
DBG_ASSERT( pListStyle, "list-style not found for shape style" );
if( pListStyle )
{
uno::Reference< container::XIndexReplace > xNumRule( SvxXMLListStyleContext::CreateNumRule( GetImport().GetModel() ) );
pListStyle->FillUnoNumRule(xNumRule, NULL /* const SvI18NMap * ??? */ );
property->maValue <<= xNumRule;
}
else
{
property->mnIndex = -1;
}
}
}
Related: #i124638# Second step of DrawingLayer FillAttributes... for Writer objects, now added support for Paragraph and PageStyle (including Header and Footer) for direct attributes and style attributes (cherry picked from commit cc25c58f7052827bfebdc9fbeec668c8fa29ed1b) Conflicts: cui/source/factory/dlgfact.cxx cui/source/factory/dlgfact.hxx cui/source/inc/bbdlg.hxx cui/source/inc/cuires.hrc cui/source/tabpages/bbdlg.cxx cui/source/tabpages/bbdlg.src cui/source/tabpages/page.cxx cui/source/tabpages/tparea.cxx include/svx/pagectrl.hxx include/svx/svxdlg.hxx include/svx/svxids.hrc include/xmloff/PageMasterStyleMap.hxx include/xmloff/prstylei.hxx include/xmloff/txtprmap.hxx svx/Package_inc.mk svx/inc/svx/hdft.hxx svx/source/dialog/hdft.cxx svx/source/dialog/pagectrl.cxx svx/source/tbxctrls/tbxcolorupdate.cxx svx/source/unodraw/unobrushitemhelper.cxx sw/Library_sw.mk sw/inc/fillattributes.hxx sw/inc/format.hxx sw/inc/frmatr.hxx sw/inc/frmfmt.hxx sw/inc/hintids.hxx sw/inc/hints.hxx sw/inc/ndtxt.hxx sw/inc/node.hxx sw/inc/swunohelper.hxx sw/inc/unobrushitemhelper.hxx sw/inc/unoprnms.hxx sw/source/core/attr/format.cxx sw/source/core/attr/hints.cxx sw/source/core/doc/docdesc.cxx sw/source/core/doc/docdraw.cxx sw/source/core/doc/docfmt.cxx sw/source/core/doc/docnew.cxx sw/source/core/doc/docredln.cxx sw/source/core/doc/poolfmt.cxx sw/source/core/doc/visiturl.cxx sw/source/core/docnode/node.cxx sw/source/core/inc/frame.hxx sw/source/core/inc/frmtool.hxx sw/source/core/inc/rolbck.hxx sw/source/core/layout/atrfrm.cxx sw/source/core/layout/fillattributes.cxx sw/source/core/layout/findfrm.cxx sw/source/core/layout/paintfrm.cxx sw/source/core/txtnode/ndtxt.cxx sw/source/core/txtnode/thints.cxx sw/source/core/txtnode/txtedt.cxx sw/source/core/undo/rolbck.cxx sw/source/core/unocore/swunohelper.cxx sw/source/core/unocore/unoframe.cxx sw/source/core/unocore/unomap.cxx sw/source/core/unocore/unoparagraph.cxx sw/source/core/unocore/unoprnms.cxx sw/source/core/unocore/unostyle.cxx sw/source/ui/chrdlg/paradlg.src sw/source/ui/chrdlg/pardlg.cxx sw/source/ui/fmtui/tmpdlg.cxx sw/source/ui/fmtui/tmpdlg.src sw/source/uibase/app/docst.cxx sw/source/uibase/app/docstyle.cxx sw/source/uibase/frmdlg/colex.cxx sw/source/uibase/shells/basesh.cxx sw/source/uibase/shells/textsh1.cxx sw/source/uibase/uiview/viewstat.cxx sw/source/uibase/utlui/uitool.cxx xmloff/inc/PageMasterImportContext.hxx xmloff/inc/xmloff/XMLShapeStyleContext.hxx xmloff/source/draw/XMLShapeStyleContext.cxx xmloff/source/draw/sdpropls.hxx xmloff/source/style/PageMasterExportPropMapper.cxx xmloff/source/style/PageMasterImportContext.cxx xmloff/source/style/PageMasterPropHdlFactory.cxx xmloff/source/style/PageMasterStyleMap.cxx xmloff/source/style/prstylei.cxx xmloff/source/text/txtexppr.cxx xmloff/source/text/txtprhdl.cxx xmloff/source/text/txtprmap.cxx xmloff/source/text/txtstyli.cxx Conflicts: svx/source/dialog/hdft.cxx sw/source/core/doc/visiturl.cxx sw/source/core/txtnode/thints.cxx sw/source/core/txtnode/txtatr2.cxx sw/source/core/unocore/unostyle.cxx Change-Id: I7e8779db6c0cbd1e242b63eab888f468f2de509a
2014-06-02 15:00:50 +00:00
//UUUU need to filter out old fill definitions when the new ones are used. The new
// ones are used when a FillStyle is defined
if(!m_bIsFillStyleAlreadyConverted && GetProperties().size())
{
if(doNewDrawingLayerFillStyleDefinitionsExist(OUString("FillStyle")))
{
Related: #i124638# Second step of DrawingLayer FillAttributes... for Writer objects, now added support for Paragraph and PageStyle (including Header and Footer) for direct attributes and style attributes (cherry picked from commit cc25c58f7052827bfebdc9fbeec668c8fa29ed1b) Conflicts: cui/source/factory/dlgfact.cxx cui/source/factory/dlgfact.hxx cui/source/inc/bbdlg.hxx cui/source/inc/cuires.hrc cui/source/tabpages/bbdlg.cxx cui/source/tabpages/bbdlg.src cui/source/tabpages/page.cxx cui/source/tabpages/tparea.cxx include/svx/pagectrl.hxx include/svx/svxdlg.hxx include/svx/svxids.hrc include/xmloff/PageMasterStyleMap.hxx include/xmloff/prstylei.hxx include/xmloff/txtprmap.hxx svx/Package_inc.mk svx/inc/svx/hdft.hxx svx/source/dialog/hdft.cxx svx/source/dialog/pagectrl.cxx svx/source/tbxctrls/tbxcolorupdate.cxx svx/source/unodraw/unobrushitemhelper.cxx sw/Library_sw.mk sw/inc/fillattributes.hxx sw/inc/format.hxx sw/inc/frmatr.hxx sw/inc/frmfmt.hxx sw/inc/hintids.hxx sw/inc/hints.hxx sw/inc/ndtxt.hxx sw/inc/node.hxx sw/inc/swunohelper.hxx sw/inc/unobrushitemhelper.hxx sw/inc/unoprnms.hxx sw/source/core/attr/format.cxx sw/source/core/attr/hints.cxx sw/source/core/doc/docdesc.cxx sw/source/core/doc/docdraw.cxx sw/source/core/doc/docfmt.cxx sw/source/core/doc/docnew.cxx sw/source/core/doc/docredln.cxx sw/source/core/doc/poolfmt.cxx sw/source/core/doc/visiturl.cxx sw/source/core/docnode/node.cxx sw/source/core/inc/frame.hxx sw/source/core/inc/frmtool.hxx sw/source/core/inc/rolbck.hxx sw/source/core/layout/atrfrm.cxx sw/source/core/layout/fillattributes.cxx sw/source/core/layout/findfrm.cxx sw/source/core/layout/paintfrm.cxx sw/source/core/txtnode/ndtxt.cxx sw/source/core/txtnode/thints.cxx sw/source/core/txtnode/txtedt.cxx sw/source/core/undo/rolbck.cxx sw/source/core/unocore/swunohelper.cxx sw/source/core/unocore/unoframe.cxx sw/source/core/unocore/unomap.cxx sw/source/core/unocore/unoparagraph.cxx sw/source/core/unocore/unoprnms.cxx sw/source/core/unocore/unostyle.cxx sw/source/ui/chrdlg/paradlg.src sw/source/ui/chrdlg/pardlg.cxx sw/source/ui/fmtui/tmpdlg.cxx sw/source/ui/fmtui/tmpdlg.src sw/source/uibase/app/docst.cxx sw/source/uibase/app/docstyle.cxx sw/source/uibase/frmdlg/colex.cxx sw/source/uibase/shells/basesh.cxx sw/source/uibase/shells/textsh1.cxx sw/source/uibase/uiview/viewstat.cxx sw/source/uibase/utlui/uitool.cxx xmloff/inc/PageMasterImportContext.hxx xmloff/inc/xmloff/XMLShapeStyleContext.hxx xmloff/source/draw/XMLShapeStyleContext.cxx xmloff/source/draw/sdpropls.hxx xmloff/source/style/PageMasterExportPropMapper.cxx xmloff/source/style/PageMasterImportContext.cxx xmloff/source/style/PageMasterPropHdlFactory.cxx xmloff/source/style/PageMasterStyleMap.cxx xmloff/source/style/prstylei.cxx xmloff/source/text/txtexppr.cxx xmloff/source/text/txtprhdl.cxx xmloff/source/text/txtprmap.cxx xmloff/source/text/txtstyli.cxx Conflicts: svx/source/dialog/hdft.cxx sw/source/core/doc/visiturl.cxx sw/source/core/txtnode/thints.cxx sw/source/core/txtnode/txtatr2.cxx sw/source/core/unocore/unostyle.cxx Change-Id: I7e8779db6c0cbd1e242b63eab888f468f2de509a
2014-06-02 15:00:50 +00:00
deactivateOldFillStyleDefinitions(getStandardSet());
}
m_bIsFillStyleAlreadyConverted = true;
}
struct _ContextID_Index_Pair aContextIDs[] =
{
{ CTF_DASHNAME , -1 },
{ CTF_LINESTARTNAME , -1 },
{ CTF_LINEENDNAME , -1 },
{ CTF_FILLGRADIENTNAME, -1 },
{ CTF_FILLTRANSNAME , -1 },
{ CTF_FILLHATCHNAME , -1 },
{ CTF_FILLBITMAPNAME , -1 },
{ CTF_SD_OLE_VIS_AREA_IMPORT_LEFT, -1 },
{ CTF_SD_OLE_VIS_AREA_IMPORT_TOP, -1 },
{ CTF_SD_OLE_VIS_AREA_IMPORT_WIDTH, -1 },
{ CTF_SD_OLE_VIS_AREA_IMPORT_HEIGHT, -1 },
{ -1, -1 }
};
static const sal_uInt16 aFamilies[] =
{
XML_STYLE_FAMILY_SD_STROKE_DASH_ID,
XML_STYLE_FAMILY_SD_MARKER_ID,
XML_STYLE_FAMILY_SD_MARKER_ID,
XML_STYLE_FAMILY_SD_GRADIENT_ID,
XML_STYLE_FAMILY_SD_GRADIENT_ID,
XML_STYLE_FAMILY_SD_HATCH_ID,
XML_STYLE_FAMILY_SD_FILL_IMAGE_ID
};
rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap =
GetStyles()->GetImportPropertyMapper( GetFamily() );
DBG_ASSERT( xImpPrMap.is(), "There is the import prop mapper" );
if( xImpPrMap.is() )
xImpPrMap->FillPropertySet( GetProperties(), rPropSet, aContextIDs );
Reference< XPropertySetInfo > xInfo;
// get property set mapper
rtl::Reference<XMLPropertySetMapper> xPropMapper( xImpPrMap->getPropertySetMapper() );
for( sal_uInt16 i=0; aContextIDs[i].nContextID != -1; i++ )
{
sal_Int32 nIndex = aContextIDs[i].nIndex;
if( nIndex != -1 ) switch( aContextIDs[i].nContextID )
{
case CTF_DASHNAME:
case CTF_LINESTARTNAME:
case CTF_LINEENDNAME:
case CTF_FILLGRADIENTNAME:
case CTF_FILLTRANSNAME:
case CTF_FILLHATCHNAME:
case CTF_FILLBITMAPNAME:
{
struct XMLPropertyState& rState = GetProperties()[nIndex];
OUString sStyleName;
rState.maValue >>= sStyleName;
sStyleName = GetImport().GetStyleDisplayName( aFamilies[i], sStyleName );
try
{
// set property
const OUString& rPropertyName = xPropMapper->GetEntryAPIName(rState.mnIndex);
if( !xInfo.is() )
xInfo = rPropSet->getPropertySetInfo();
if ( xInfo->hasPropertyByName( rPropertyName ) )
{
rPropSet->setPropertyValue( rPropertyName, Any( sStyleName ) );
}
}
2012-01-09 03:16:33 +09:00
catch ( const ::com::sun::star::lang::IllegalArgumentException& e )
{
Sequence<OUString> aSeq(1);
aSeq[0] = sStyleName;
GetImport().SetError(
XMLERROR_STYLE_PROP_VALUE | XMLERROR_FLAG_WARNING,
aSeq, e.Message, NULL );
}
break;
}
case CTF_SD_OLE_VIS_AREA_IMPORT_LEFT:
case CTF_SD_OLE_VIS_AREA_IMPORT_TOP:
case CTF_SD_OLE_VIS_AREA_IMPORT_WIDTH:
case CTF_SD_OLE_VIS_AREA_IMPORT_HEIGHT:
{
struct XMLPropertyState& rState = GetProperties()[nIndex];
const OUString& rPropertyName = xPropMapper->GetEntryAPIName(rState.mnIndex);
try
{
if( !xInfo.is() )
xInfo = rPropSet->getPropertySetInfo();
if ( xInfo->hasPropertyByName( rPropertyName ) )
{
rPropSet->setPropertyValue( rPropertyName, rState.maValue );
}
}
2012-01-09 03:16:33 +09:00
catch ( const ::com::sun::star::lang::IllegalArgumentException& e )
{
Sequence<OUString> aSeq;
GetImport().SetError(
XMLERROR_STYLE_PROP_VALUE | XMLERROR_FLAG_WARNING,
aSeq, e.Message, NULL );
}
break;
}
}
}
if (!m_sControlDataStyleName.isEmpty())
{ // we had a data-style-name attribute
// set the formatting on the control model of the control shape
uno::Reference< drawing::XControlShape > xControlShape(rPropSet, uno::UNO_QUERY);
DBG_ASSERT(xControlShape.is(), "XMLShapeStyleContext::FillPropertySet: data style for a non-control shape!");
if (xControlShape.is())
{
uno::Reference< beans::XPropertySet > xControlModel(xControlShape->getControl(), uno::UNO_QUERY);
DBG_ASSERT(xControlModel.is(), "XMLShapeStyleContext::FillPropertySet: no control model for the shape!");
if (xControlModel.is())
{
GetImport().GetFormImport()->applyControlNumberStyle(xControlModel, m_sControlDataStyleName);
}
}
}
}
void XMLShapeStyleContext::Finish( bool /*bOverwrite*/ )
2000-12-01 18:19:53 +00:00
{
}
2001-01-16 15:36:55 +00:00
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */