diff options
author | Christian Lippka <cl@openoffice.org> | 2001-03-27 21:03:08 +0000 |
---|---|---|
committer | Christian Lippka <cl@openoffice.org> | 2001-03-27 21:03:08 +0000 |
commit | e94b0c8f5fc7431b1974877f1da7c13d47579a4f (patch) | |
tree | a6e8d3690e728f44a05bed2ed8548fee3ec1bf6d /sd/source/ui | |
parent | #85020# load document on frame per default (diff) | |
download | core-e94b0c8f5fc7431b1974877f1da7c13d47579a4f.tar.gz core-e94b0c8f5fc7431b1974877f1da7c13d47579a4f.zip |
#82715# added settings support for draw/impress
Diffstat (limited to 'sd/source/ui')
-rw-r--r-- | sd/source/ui/unoidl/UnoDocumentSettings.cxx | 702 | ||||
-rw-r--r-- | sd/source/ui/unoidl/UnoDocumentSettings.hxx | 76 | ||||
-rw-r--r-- | sd/source/ui/unoidl/makefile.mk | 6 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unomodel.cxx | 13 |
4 files changed, 793 insertions, 4 deletions
diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.cxx b/sd/source/ui/unoidl/UnoDocumentSettings.cxx new file mode 100644 index 000000000000..ceb70cbab668 --- /dev/null +++ b/sd/source/ui/unoidl/UnoDocumentSettings.cxx @@ -0,0 +1,702 @@ +/************************************************************************* + * + * $RCSfile: UnoDocumentSettings.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: cl $ $Date: 2001-03-27 22:03:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (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.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <stl/vector> + +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif + +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ +#include <com/sun/star/beans/XPropertySet.hpp> +#endif + +#ifndef _COM_SUN_STAR_BEANS_XMULTIPROPERTYSET_HPP_ +#include <com/sun/star/beans/XMultiPropertySet.hpp> +#endif + +#ifndef _CPPUHELPER_IMPLBASE3_HXX_ +#include <cppuhelper/implbase3.hxx> +#endif + +#ifndef _COMPHELPER_PROPERTYSETHELPER_HXX_ +#include <comphelper/propertysethelper.hxx> +#endif + +#ifndef _COMPHELPER_PROPERTSETINFO_HXX_ +#include <comphelper/propertysetinfo.hxx> +#endif + +#ifndef _URLOBJ_HXX +#include <tools/urlobj.hxx> +#endif + +#ifndef _XTABLE_HXX +#include <svx/xtable.hxx> +#endif + +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif + +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> +#endif + +#include "drawdoc.hxx" +#include "unomodel.hxx" + +#define MAP_LEN(x) x, sizeof(x)-1 + +using namespace ::comphelper; +using namespace ::osl; +using namespace ::rtl; +using namespace ::cppu; +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::util; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::drawing; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::document; +using namespace ::com::sun::star::frame; +using namespace ::com::sun::star::beans; + +namespace sd +{ + class DocumentSettings : public WeakImplHelper3< XPropertySet, XMultiPropertySet, XServiceInfo >, + public comphelper::PropertySetHelper + { + public: + DocumentSettings( SdXImpressDocument* pModel ); + virtual ~DocumentSettings(); + + // XInterface + virtual Any SAL_CALL queryInterface( const Type& aType ) throw (RuntimeException); + virtual void SAL_CALL acquire( ) throw (); + virtual void SAL_CALL release( ) throw (); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XMultiPropertySet + // virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) throw(RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException); + virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(RuntimeException); + + protected: + virtual void _setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const ::com::sun::star::uno::Any* pValues ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ); + virtual void _getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, ::com::sun::star::uno::Any* pValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException ); + + private: + Reference< XModel > mxModel; + SdXImpressDocument* mpModel; + }; + + Reference< XInterface > SAL_CALL DocumentSettings_createInstance( SdXImpressDocument* pModel ) + throw( Exception ) + { + DBG_ASSERT( pModel, "I need a model for the DocumentSettings!" ); + return (XWeak*)new DocumentSettings( pModel ); + } + + const sal_Int32 HANDLE_PRINTDRAWING = 0; + const sal_Int32 HANDLE_PRINTNOTES = 1; + const sal_Int32 HANDLE_PRINTHANDOUT = 2; + const sal_Int32 HANDLE_PRINTOUTLINE = 3; + const sal_Int32 HANDLE_MEASUREUNIT = 4; + const sal_Int32 HANDLE_SCALEX = 5; + const sal_Int32 HANDLE_SCALEY = 6; + const sal_Int32 HANDLE_TABSTOP = 7; + const sal_Int32 HANDLE_SNAPTO_GRID = 8; + const sal_Int32 HANDLE_SNAPTO_SNAPLINES = 9; + const sal_Int32 HANDLE_SNAPTO_PAGEMARGINS = 10; + const sal_Int32 HANDLE_SNAPTO_OBJECTFRAME = 11; + const sal_Int32 HANDLE_SNAPTO_OBJECTPOINTS = 12; + const sal_Int32 HANDLE_SNAPRANGE = 13; + const sal_Int32 HANDLE_SNAPTOGRID = 14; + const sal_Int32 HANDLE_VISIBLEGRID = 15; + const sal_Int32 HANDLE_GRIDRESX = 16; + const sal_Int32 HANDLE_GRIDRESY = 17; + const sal_Int32 HANDLE_GRIDSUBX = 18; + const sal_Int32 HANDLE_GRIDSUBY = 19; + const sal_Int32 HANDLE_GRIDAXISSYNC = 20; + const sal_Int32 HANDLE_PRINTPAGENAME = 21; + const sal_Int32 HANDLE_PRINTDATE = 22; + const sal_Int32 HANDLE_PRINTTIME = 23; + const sal_Int32 HANDLE_PRINTHIDENPAGES = 24; + const sal_Int32 HANDLE_PRINTFITPAGE = 25; + const sal_Int32 HANDLE_PRINTTILEPAGE = 26; + const sal_Int32 HANDLE_PRINTBOOKLET = 27; + const sal_Int32 HANDLE_PRINTBOOKLETFRONT = 28; + const sal_Int32 HANDLE_PRINTBOOKLETBACK = 29; + const sal_Int32 HANDLE_PRINTQUALITY = 30; + + const sal_Int32 HANDLE_COLORTABLEURL = 31; + const sal_Int32 HANDLE_DASHTABLEURL = 32; + const sal_Int32 HANDLE_LINEENDTABLEURL = 33; + const sal_Int32 HANDLE_HATCHTABLEURL = 34; + const sal_Int32 HANDLE_GRADIENTTABLEURL = 35; + const sal_Int32 HANDLE_BITMAPTABLEURL = 36; + + PropertySetInfo* createSettingsInfoImpl( sal_Bool bIsDraw ) + { + static PropertyMapEntry aImpressSettingsInfoMap[] = + { + { MAP_LEN("IsPrintDrawing"), HANDLE_PRINTDRAWING, &::getBooleanCppuType(), 0, 0 }, + { MAP_LEN("IsPrintNotes"), HANDLE_PRINTNOTES, &::getBooleanCppuType(), 0, 0 }, + { MAP_LEN("IsPrintHandout"), HANDLE_PRINTHANDOUT, &::getBooleanCppuType(), 0, 0 }, + { MAP_LEN("IsPrintOutline"), HANDLE_PRINTOUTLINE, &::getBooleanCppuType(), 0, 0 }, + { NULL, 0, 0, NULL, 0, 0 } + }; + + static PropertyMapEntry aDrawSettingsInfoMap[] = + { + { MAP_LEN("MeasureUnit"), HANDLE_MEASUREUNIT, &::getCppuType((const sal_Int32*)0), 0, 0 }, + { MAP_LEN("ScaleX"), HANDLE_SCALEX, &::getCppuType((const sal_Int32*)0), 0, 0 }, + { MAP_LEN("ScaleY"), HANDLE_SCALEY, &::getCppuType((const sal_Int32*)0), 0, 0 }, + { NULL, 0, 0, NULL, 0, 0 } + }; + + static PropertyMapEntry aCommonSettingsInfoMap[] = + { + { MAP_LEN("DefaultTabStop"), HANDLE_TABSTOP, &::getCppuType((const sal_Int32*)0), 0, 0 }, + { MAP_LEN("IsSnapToGrid"), HANDLE_SNAPTO_GRID, &::getBooleanCppuType(), 0, 0 }, + { MAP_LEN("IsSnapToSnapLines"), HANDLE_SNAPTO_SNAPLINES, &::getBooleanCppuType(), 0, 0 }, + { MAP_LEN("IsSnapToPageMargins"), HANDLE_SNAPTO_PAGEMARGINS, &::getBooleanCppuType(), 0, 0 }, + { MAP_LEN("IsSnapToObjectFrame"), HANDLE_SNAPTO_OBJECTFRAME, &::getBooleanCppuType(), 0, 0 }, + { MAP_LEN("IsSnapToObjectPoints"), HANDLE_SNAPTO_OBJECTPOINTS, &::getBooleanCppuType(), 0, 0 }, + { MAP_LEN("SnapRange"), HANDLE_SNAPRANGE, &::getCppuType((const sal_Int32*)0), 0, 0 }, + { MAP_LEN("GridIsEnabled"), HANDLE_SNAPTOGRID, &::getBooleanCppuType(), 0, 0 }, + { MAP_LEN("GridIsVisible"), HANDLE_VISIBLEGRID, &::getBooleanCppuType(), 0, 0 }, + { MAP_LEN("GridResolutionX"), HANDLE_GRIDRESX, &::getCppuType((const sal_Int32*)0), 0, 0 }, + { MAP_LEN("GridResolutionY"), HANDLE_GRIDRESY, &::getCppuType((const sal_Int32*)0), 0, 0 }, + { MAP_LEN("GridSubdivisionX"), HANDLE_GRIDSUBX, &::getCppuType((const sal_Int32*)0), 0, 0 }, + { MAP_LEN("GridSubdivisionY"), HANDLE_GRIDSUBY, &::getCppuType((const sal_Int32*)0), 0, 0 }, + { MAP_LEN("IsGridAxisSynchronized"),HANDLE_GRIDAXISSYNC, &::getBooleanCppuType(), 0, 0 }, + { MAP_LEN("IsPrintPageName"), HANDLE_PRINTPAGENAME, &::getBooleanCppuType(), 0, 0 }, + { MAP_LEN("IsPrintDate"), HANDLE_PRINTDATE, &::getBooleanCppuType(), 0, 0 }, + { MAP_LEN("IsPrintTime"), HANDLE_PRINTTIME, &::getBooleanCppuType(), 0, 0 }, + { MAP_LEN("IsPrintHiddenPages"), HANDLE_PRINTHIDENPAGES, &::getBooleanCppuType(), 0, 0 }, + { MAP_LEN("IsPrintFitPage"), HANDLE_PRINTFITPAGE, &::getBooleanCppuType(), 0, 0 }, + { MAP_LEN("IsPrintTilePage"), HANDLE_PRINTTILEPAGE, &::getBooleanCppuType(), 0, 0 }, + { MAP_LEN("IsPrintBooklet"), HANDLE_PRINTBOOKLET, &::getBooleanCppuType(), 0, 0 }, + { MAP_LEN("IsPrintBookletFront"), HANDLE_PRINTBOOKLETFRONT, &::getBooleanCppuType(), 0, 0 }, + { MAP_LEN("IsPrintBookletBack"), HANDLE_PRINTBOOKLETBACK, &::getBooleanCppuType(), 0, 0 }, + { MAP_LEN("PrintQuality"), HANDLE_PRINTQUALITY, &::getCppuType((const sal_Int32*)0), 0, 0 }, + + { MAP_LEN("ColorTableURL"), HANDLE_COLORTABLEURL, &::getCppuType((const OUString*)0), 0, 0 }, + { MAP_LEN("DashTableURL"), HANDLE_DASHTABLEURL, &::getCppuType((const OUString*)0), 0, 0 }, + { MAP_LEN("LineEndTableURL"), HANDLE_LINEENDTABLEURL, &::getCppuType((const OUString*)0), 0, 0 }, + { MAP_LEN("HatchTableURL"), HANDLE_HATCHTABLEURL, &::getCppuType((const OUString*)0), 0, 0 }, + { MAP_LEN("GradientTableURL"), HANDLE_GRADIENTTABLEURL, &::getCppuType((const OUString*)0), 0, 0 }, + { MAP_LEN("BitmapTableURL"), HANDLE_BITMAPTABLEURL, &::getCppuType((const OUString*)0), 0, 0 }, + { NULL, 0, 0, NULL, 0, 0 } + }; + + PropertySetInfo* pInfo = new PropertySetInfo( aCommonSettingsInfoMap ); + pInfo->add( bIsDraw ? aDrawSettingsInfoMap : aImpressSettingsInfoMap ); + + return pInfo; + } +} + +using namespace ::sd; + +DocumentSettings::DocumentSettings( SdXImpressDocument* pModel ) +: PropertySetHelper( createSettingsInfoImpl( !pModel->IsImpressDocument() ) ), + mxModel( pModel ), + mpModel( pModel ) +{ +} + +DocumentSettings::~DocumentSettings() +{ +} + +void DocumentSettings::_setPropertyValues( const PropertyMapEntry** ppEntries, const Any* pValues ) throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException ) +{ + SdDrawDocument* pDoc = mpModel->GetDoc(); + SdDrawDocShell* pDocSh = mpModel->GetDocShell(); + if( NULL == pDoc || NULL == pDocSh ) + throw UnknownPropertyException(); + + sal_Bool bOk; + + while( *ppEntries ) + { + bOk = sal_False; + switch( (*ppEntries)->mnHandle ) + { + case HANDLE_COLORTABLEURL: + { + OUString aURLString; + if( *pValues >>= aURLString ) + { + INetURLObject aURL( aURLString ); + INetURLObject aPathURL( aURL ); + + aPathURL.removeSegment(); + aPathURL.removeFinalSlash(); + + XColorTable* pColTab = new XColorTable( aPathURL.GetMainURL(), (XOutdevItemPool*)&pDoc->GetPool() ); + pColTab->SetName( aURL.getName() ); + if( pColTab->Load() ) + { + pDoc->SetColorTable( pColTab ); + bOk = sal_True; + } + } + } + break; + case HANDLE_DASHTABLEURL: + { + OUString aURLString; + if( *pValues >>= aURLString ) + { + INetURLObject aURL( aURLString ); + INetURLObject aPathURL( aURL ); + + aPathURL.removeSegment(); + aPathURL.removeFinalSlash(); + + XDashList* pDashTab = new XDashList( aPathURL.GetMainURL(), (XOutdevItemPool*)&pDoc->GetPool() ); + pDashTab->SetName( aURL.getName() ); + if( pDashTab->Load() ) + { + pDoc->SetDashList( pDashTab ); + bOk = sal_True; + } + } + } + break; + case HANDLE_LINEENDTABLEURL: + { + OUString aURLString; + if( *pValues >>= aURLString ) + { + INetURLObject aURL( aURLString ); + INetURLObject aPathURL( aURL ); + + aPathURL.removeSegment(); + aPathURL.removeFinalSlash(); + + XLineEndList* pTab = new XLineEndList( aPathURL.GetMainURL(), (XOutdevItemPool*)&pDoc->GetPool() ); + pTab->SetName( aURL.getName() ); + if( pTab->Load() ) + { + pDoc->SetLineEndList( pTab ); + bOk = sal_True; + } + } + } + break; + case HANDLE_HATCHTABLEURL: + { + OUString aURLString; + if( *pValues >>= aURLString ) + { + INetURLObject aURL( aURLString ); + INetURLObject aPathURL( aURL ); + + aPathURL.removeSegment(); + aPathURL.removeFinalSlash(); + + XHatchList* pTab = new XHatchList( aPathURL.GetMainURL(), (XOutdevItemPool*)&pDoc->GetPool() ); + pTab->SetName( aURL.getName() ); + if( pTab->Load() ) + { + pDoc->SetHatchList( pTab ); + bOk = sal_True; + } + } + } + break; + case HANDLE_GRADIENTTABLEURL: + { + OUString aURLString; + if( *pValues >>= aURLString ) + { + INetURLObject aURL( aURLString ); + INetURLObject aPathURL( aURL ); + + aPathURL.removeSegment(); + aPathURL.removeFinalSlash(); + + XGradientList* pTab = new XGradientList( aPathURL.GetMainURL(), (XOutdevItemPool*)&pDoc->GetPool() ); + pTab->SetName( aURL.getName() ); + if( pTab->Load() ) + { + pDoc->SetGradientList( pTab ); + bOk = sal_True; + } + } + } + break; + case HANDLE_BITMAPTABLEURL: + { + OUString aURLString; + if( *pValues >>= aURLString ) + { + INetURLObject aURL( aURLString ); + INetURLObject aPathURL( aURL ); + + aPathURL.removeSegment(); + aPathURL.removeFinalSlash(); + + XBitmapList* pTab = new XBitmapList( aPathURL.GetMainURL(), (XOutdevItemPool*)&pDoc->GetPool() ); + pTab->SetName( aURL.getName() ); + if( pTab->Load() ) + { + pDoc->SetBitmapList( pTab ); + bOk = sal_True; + } + } + } + break; + case HANDLE_PRINTDRAWING: + case HANDLE_PRINTNOTES: + case HANDLE_PRINTHANDOUT: + case HANDLE_PRINTOUTLINE: + case HANDLE_MEASUREUNIT: + case HANDLE_SCALEX: + case HANDLE_SCALEY: + case HANDLE_TABSTOP: + case HANDLE_SNAPTO_GRID: + case HANDLE_SNAPTO_SNAPLINES: + case HANDLE_SNAPTO_PAGEMARGINS: + case HANDLE_SNAPTO_OBJECTFRAME: + case HANDLE_SNAPTO_OBJECTPOINTS: + case HANDLE_SNAPRANGE: + case HANDLE_SNAPTOGRID: + case HANDLE_VISIBLEGRID: + case HANDLE_GRIDRESX: + case HANDLE_GRIDRESY: + case HANDLE_GRIDSUBX: + case HANDLE_GRIDSUBY: + case HANDLE_GRIDAXISSYNC: + case HANDLE_PRINTPAGENAME: + case HANDLE_PRINTDATE: + case HANDLE_PRINTTIME: + case HANDLE_PRINTHIDENPAGES: + case HANDLE_PRINTFITPAGE: + case HANDLE_PRINTTILEPAGE: + case HANDLE_PRINTBOOKLET: + case HANDLE_PRINTBOOKLETFRONT: + case HANDLE_PRINTBOOKLETBACK: + case HANDLE_PRINTQUALITY: + default: + throw UnknownPropertyException(); + + } + + if( !bOk ) + throw IllegalArgumentException(); + + ppEntries++; + pValues++; + } +} + +void DocumentSettings::_getPropertyValues( const PropertyMapEntry** ppEntries, Any* pValue ) throw(UnknownPropertyException, WrappedTargetException ) +{ + SdDrawDocument* pDoc = mpModel->GetDoc(); + SdDrawDocShell* pDocSh = mpModel->GetDocShell(); + if( NULL == pDoc || NULL == pDocSh ) + throw UnknownPropertyException(); + + while( *ppEntries ) + { + switch( (*ppEntries)->mnHandle ) + { + case HANDLE_COLORTABLEURL: + { + INetURLObject aPathURL( pDoc->GetColorTable()->GetPath() ); + aPathURL.insertName( pDoc->GetColorTable()->GetName() ); + String aExt( RTL_CONSTASCII_USTRINGPARAM("soc") ); + aPathURL.setExtension( aExt ); + OUString aPath( aPathURL.GetMainURL() ); + *pValue <<= aPath; + } + break; + case HANDLE_DASHTABLEURL: + { + INetURLObject aPathURL( pDoc->GetDashList()->GetPath() ); + aPathURL.insertName( pDoc->GetDashList()->GetName() ); + String aExt( RTL_CONSTASCII_USTRINGPARAM("sod") ); + aPathURL.setExtension( aExt ); + OUString aPath( aPathURL.GetMainURL() ); + *pValue <<= aPath; + } + break; + case HANDLE_LINEENDTABLEURL: + { + INetURLObject aPathURL( pDoc->GetLineEndList()->GetPath() ); + aPathURL.insertName( pDoc->GetLineEndList()->GetName() ); + String aExt( RTL_CONSTASCII_USTRINGPARAM("soe") ); + aPathURL.setExtension( aExt ); + OUString aPath( aPathURL.GetMainURL() ); + *pValue <<= aPath; + } + break; + case HANDLE_HATCHTABLEURL: + { + INetURLObject aPathURL( pDoc->GetHatchList()->GetPath() ); + aPathURL.insertName( pDoc->GetHatchList()->GetName() ); + String aExt( RTL_CONSTASCII_USTRINGPARAM("soh") ); + aPathURL.setExtension( aExt ); + OUString aPath( aPathURL.GetMainURL() ); + *pValue <<= aPath; + } + break; + case HANDLE_GRADIENTTABLEURL: + { + INetURLObject aPathURL( pDoc->GetGradientList()->GetPath() ); + aPathURL.insertName( pDoc->GetGradientList()->GetName() ); + String aExt( RTL_CONSTASCII_USTRINGPARAM("sog") ); + aPathURL.setExtension( aExt ); + OUString aPath( aPathURL.GetMainURL() ); + *pValue <<= aPath; + } + break; + case HANDLE_BITMAPTABLEURL: + { + INetURLObject aPathURL( pDoc->GetBitmapList()->GetPath() ); + aPathURL.insertName( pDoc->GetBitmapList()->GetName() ); + String aExt( RTL_CONSTASCII_USTRINGPARAM("sob") ); + aPathURL.setExtension( aExt ); + OUString aPath( aPathURL.GetMainURL() ); + *pValue <<= aPath; + } + break; + + case HANDLE_PRINTDRAWING: + case HANDLE_PRINTNOTES: + case HANDLE_PRINTHANDOUT: + case HANDLE_PRINTOUTLINE: + case HANDLE_MEASUREUNIT: + case HANDLE_SCALEX: + case HANDLE_SCALEY: + case HANDLE_TABSTOP: + case HANDLE_SNAPTO_GRID: + case HANDLE_SNAPTO_SNAPLINES: + case HANDLE_SNAPTO_PAGEMARGINS: + case HANDLE_SNAPTO_OBJECTFRAME: + case HANDLE_SNAPTO_OBJECTPOINTS: + case HANDLE_SNAPRANGE: + case HANDLE_SNAPTOGRID: + case HANDLE_VISIBLEGRID: + case HANDLE_GRIDRESX: + case HANDLE_GRIDRESY: + case HANDLE_GRIDSUBX: + case HANDLE_GRIDSUBY: + case HANDLE_GRIDAXISSYNC: + case HANDLE_PRINTPAGENAME: + case HANDLE_PRINTDATE: + case HANDLE_PRINTTIME: + case HANDLE_PRINTHIDENPAGES: + case HANDLE_PRINTFITPAGE: + case HANDLE_PRINTTILEPAGE: + case HANDLE_PRINTBOOKLET: + case HANDLE_PRINTBOOKLETFRONT: + case HANDLE_PRINTBOOKLETBACK: + case HANDLE_PRINTQUALITY: + default: + throw UnknownPropertyException(); + } + + ppEntries++; + pValue++; + } +} + +// XInterface +Any SAL_CALL DocumentSettings::queryInterface( const Type& aType ) throw (RuntimeException) +{ + return WeakImplHelper3< XPropertySet, XMultiPropertySet, XServiceInfo >::queryInterface( aType ); +} + +void SAL_CALL DocumentSettings::acquire( ) throw () +{ + WeakImplHelper3< XPropertySet, XMultiPropertySet, XServiceInfo >::acquire(); +} + +void SAL_CALL DocumentSettings::release( ) throw () +{ + WeakImplHelper3< XPropertySet, XMultiPropertySet, XServiceInfo >::release(); +} + + +// XPropertySet +Reference< XPropertySetInfo > SAL_CALL DocumentSettings::getPropertySetInfo( ) throw(RuntimeException) +{ + return PropertySetHelper::getPropertySetInfo(); +} + +void SAL_CALL DocumentSettings::setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) +{ + PropertySetHelper::setPropertyValue( aPropertyName, aValue ); +} + +Any SAL_CALL DocumentSettings::getPropertyValue( const OUString& PropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) +{ + return PropertySetHelper::getPropertyValue( PropertyName ); +} + +void SAL_CALL DocumentSettings::addPropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& xListener ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) +{ + PropertySetHelper::addPropertyChangeListener( aPropertyName, xListener ); +} + +void SAL_CALL DocumentSettings::removePropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& aListener ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) +{ + PropertySetHelper::removePropertyChangeListener( aPropertyName, aListener ); +} + +void SAL_CALL DocumentSettings::addVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) +{ + PropertySetHelper::addVetoableChangeListener( PropertyName, aListener ); +} + +void SAL_CALL DocumentSettings::removeVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) +{ + PropertySetHelper::removeVetoableChangeListener( PropertyName, aListener ); +} + +// XMultiPropertySet +void SAL_CALL DocumentSettings::setPropertyValues( const Sequence< OUString >& aPropertyNames, const Sequence< Any >& aValues ) throw(PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) +{ + PropertySetHelper::setPropertyValues( aPropertyNames, aValues ); +} + +Sequence< Any > SAL_CALL DocumentSettings::getPropertyValues( const Sequence< OUString >& aPropertyNames ) throw(RuntimeException) +{ + return PropertySetHelper::getPropertyValues( aPropertyNames ); +} + +void SAL_CALL DocumentSettings::addPropertiesChangeListener( const Sequence< OUString >& aPropertyNames, const Reference< XPropertiesChangeListener >& xListener ) throw(RuntimeException) +{ + PropertySetHelper::addPropertiesChangeListener( aPropertyNames, xListener ); +} + +void SAL_CALL DocumentSettings::removePropertiesChangeListener( const Reference< XPropertiesChangeListener >& xListener ) throw(RuntimeException) +{ + PropertySetHelper::removePropertiesChangeListener( xListener ); +} + +void SAL_CALL DocumentSettings::firePropertiesChangeEvent( const Sequence< OUString >& aPropertyNames, const Reference< XPropertiesChangeListener >& xListener ) throw(RuntimeException) +{ + PropertySetHelper::firePropertiesChangeEvent( aPropertyNames, xListener ); +} + +// XServiceInfo +OUString SAL_CALL DocumentSettings::getImplementationName( ) + throw(RuntimeException) +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Draw.DocumentSettings")); +} + +sal_Bool SAL_CALL DocumentSettings::supportsService( const OUString& ServiceName ) + throw(RuntimeException) +{ + const Sequence< OUString > aSeq( getSupportedServiceNames() ); + sal_Int32 nCount = aSeq.getLength(); + const OUString* pServices = aSeq.getConstArray(); + while( nCount-- ) + { + if( *pServices++ == ServiceName ) + return sal_True; + } + + return sal_True; +} + +Sequence< OUString > SAL_CALL DocumentSettings::getSupportedServiceNames( ) + throw(RuntimeException) +{ + Sequence< OUString > aSeq( 2 ); + aSeq[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.Settings") ); + if( mpModel->IsImpressDocument() ) + { + aSeq[1] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Impress.Settings") ); + } + else + { + aSeq[1] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Draw.Settings") ); + } + + return aSeq; +} + diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.hxx b/sd/source/ui/unoidl/UnoDocumentSettings.hxx new file mode 100644 index 000000000000..49a388db6d19 --- /dev/null +++ b/sd/source/ui/unoidl/UnoDocumentSettings.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * $RCSfile: UnoDocumentSettings.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: cl $ $Date: 2001-03-27 22:03:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (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.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SD_UNODOCUMENTSETTINGS_HXX_ +#define _SD_UNODOCUMENTSETTINGS_HXX_ + +#ifndef _COM_SUN_STAR_FRAME_XMODEL_HPP_ +#include <com/sun/star/frame/XModel.hpp> +#endif + +class SdXImpressDocument; + +namespace sd +{ + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL DocumentSettings_createInstance( SdXImpressDocument* pDoc ) throw(); +} + +#endif diff --git a/sd/source/ui/unoidl/makefile.mk b/sd/source/ui/unoidl/makefile.mk index adc58751147a..603d1bac8ab1 100644 --- a/sd/source/ui/unoidl/makefile.mk +++ b/sd/source/ui/unoidl/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.3 $ +# $Revision: 1.4 $ # -# last change: $Author: cl $ $Date: 2001-03-26 15:59:56 $ +# last change: $Author: cl $ $Date: 2001-03-27 22:03:08 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -80,6 +80,7 @@ AUTOSEG=true # --- Files -------------------------------------------------------- CXXFILES = $(PRJ)$/util$/sd.cxx \ + UnoDocumentSettings.cxx \ facreg.cxx \ UnoGraphicExporter.cxx \ unomodel.cxx \ @@ -105,6 +106,7 @@ NOOPTFILES= $(SLO)$/unowcntr.obj .ENDIF SLOFILES = \ + $(SLO)$/UnoDocumentSettings.obj \ $(SLO)$/facreg.obj \ $(SLO)$/UnoGraphicExporter.obj \ $(SLO)$/unomodel.obj \ diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 79c59b99fa69..6fbf13c0ede9 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -2,9 +2,9 @@ * * $RCSfile: unomodel.cxx,v $ * - * $Revision: 1.20 $ + * $Revision: 1.21 $ * - * last change: $Author: cl $ $Date: 2001-03-19 09:52:58 $ + * last change: $Author: cl $ $Date: 2001-03-27 22:03:08 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -133,6 +133,10 @@ #include <docshell.hxx> #endif +#ifndef _SD_UNODOCUMENTSETTINGS_HXX_ +#include <UnoDocumentSettings.hxx> +#endif + #include <drawdoc.hxx> #include <glob.hrc> #include <sdresid.hxx> @@ -671,6 +675,11 @@ uno::Reference< uno::XInterface > SAL_CALL SdXImpressDocument::createInstance( c return SvUnoImageMapPolygonObject_createInstance( ImplGetSupportedMacroItems() ); } + if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.Settings") ) ) + { + return sd::DocumentSettings_createInstance( this ); + } + uno::Reference< uno::XInterface > xRet; const String aType( aServiceSpecifier ); |