diff options
author | RĂ¼diger Timm <rt@openoffice.org> | 2004-09-20 09:12:16 +0000 |
---|---|---|
committer | RĂ¼diger Timm <rt@openoffice.org> | 2004-09-20 09:12:16 +0000 |
commit | 6ced26170c354e6f41a2d822f30601d8044eea99 (patch) | |
tree | ce863d6e8f752dd60f1153c90e7c45044d0c7125 /sc | |
parent | 70852b631baf43191cbd1c038bd05b3f09d1ee2e (diff) |
INTEGRATION: CWS keyconfig01 (1.21.70); FILE MERGED
2004/08/20 09:25:34 mba 1.21.70.2: #i32160#: additional parameter for applying styles using the internal name
2004/07/23 10:35:32 as 1.21.70.1: #i29441# support new optional argument SID_STYLE_FAMILYNAME for slot SID_STYLE_APPLY
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/view/formatsh.cxx | 51 |
1 files changed, 48 insertions, 3 deletions
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index e715cc9345ce..284c3fb884bc 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -2,9 +2,9 @@ * * $RCSfile: formatsh.cxx,v $ * - * $Revision: 1.25 $ + * $Revision: 1.26 $ * - * last change: $Author: rt $ $Date: 2004-09-17 13:53:45 $ + * last change: $Author: rt $ $Date: 2004-09-20 10:12:16 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -65,6 +65,18 @@ #pragma hdrstop +#ifndef _COM_SUN_STAR_STYLE_XSTYLEFAMILIESSUPPLIER_HPP_ +#include <com/sun/star/style/XStyleFamiliesSupplier.hpp> +#endif + +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ +#include <com/sun/star/beans/XPropertySet.hpp> +#endif + +#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ +#include <com/sun/star/container/XNameAccess.hpp> +#endif + //------------------------------------------------------------------ //svdraw.hxx @@ -343,6 +355,16 @@ void __EXPORT ScFormatShell::ExecuteStyle( SfxRequest& rReq ) const SfxPoolItem* pFamItem; if ( pArgs && SFX_ITEM_SET == pArgs->GetItemState( SID_STYLE_FAMILY, TRUE, &pFamItem ) ) eFamily = (SfxStyleFamily)((const SfxUInt16Item*)pFamItem)->GetValue(); + else + if ( pArgs && SFX_ITEM_SET == pArgs->GetItemState( SID_STYLE_FAMILYNAME, TRUE, &pFamItem ) ) + { + String sFamily = ((const SfxStringItem*)pFamItem)->GetValue(); + if (sFamily.CompareToAscii("CellStyles") == COMPARE_EQUAL) + eFamily = SFX_STYLE_FAMILY_PARA; + else + if (sFamily.CompareToAscii("PageStyles") == COMPARE_EQUAL) + eFamily = SFX_STYLE_FAMILY_PAGE; + } String aStyleName; USHORT nRetMask = 0xffff; @@ -374,9 +396,32 @@ void __EXPORT ScFormatShell::ExecuteStyle( SfxRequest& rReq ) } break; + case SID_STYLE_APPLY: + { + SFX_REQUEST_ARG( rReq, pNameItem, SfxStringItem, SID_APPLY_STYLE, sal_False ); + SFX_REQUEST_ARG( rReq, pFamilyItem, SfxStringItem, SID_STYLE_FAMILYNAME, sal_False ); + if ( pFamilyItem && pNameItem ) + { + com::sun::star::uno::Reference< com::sun::star::style::XStyleFamiliesSupplier > xModel(pDocSh->GetModel(), com::sun::star::uno::UNO_QUERY); + try + { + com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > xStyles; + com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > xCont = xModel->getStyleFamilies(); + xCont->getByName(pFamilyItem->GetValue()) >>= xStyles; + com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xInfo; + xStyles->getByName( pNameItem->GetValue() ) >>= xInfo; + ::rtl::OUString aUIName; + xInfo->getPropertyValue( ::rtl::OUString::createFromAscii("DisplayName") ) >>= aUIName; + if ( aUIName.getLength() ) + rReq.AppendItem( SfxStringItem( SID_STYLE_APPLY, aUIName ) ); + } + catch( com::sun::star::uno::Exception& ) + { + } + } + } case SID_STYLE_EDIT: case SID_STYLE_DELETE: - case SID_STYLE_APPLY: case SID_STYLE_NEW_BY_EXAMPLE: { const SfxPoolItem* pNameItem; |