1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: unomod.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
33 #include <com/sun/star/text/XModule.hpp>
34 #include <com/sun/star/beans/XPropertySet.hpp>
35 #include <com/sun/star/view/XPrintSettingsSupplier.hpp>
36 #include <com/sun/star/view/XViewSettingsSupplier.hpp>
37 #include <com/sun/star/lang/XServiceInfo.hpp>
38 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
39 #include <cppuhelper/implbase2.hxx> // helper for implementations
40 #include <cppuhelper/implbase3.hxx> // helper for implementations
41 #include <cppuhelper/implbase4.hxx> // helper for implementations
42 #include <comphelper/ChainablePropertySet.hxx>
43 #include <comphelper/SettingsHelper.hxx>
44 #include <usrpref.hxx>
51 /******************************************************************************
53 ******************************************************************************/
54 /*-----------------15.03.98 13:21-------------------
56 --------------------------------------------------*/
58 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> SAL_CALL
SwXModule_CreateInstance(const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> & );
60 class SwXModule
: public cppu::WeakImplHelper4
62 ::com::sun::star::text::XModule
,
63 ::com::sun::star::view::XViewSettingsSupplier
,
64 ::com::sun::star::view::XPrintSettingsSupplier
,
65 ::com::sun::star::lang::XServiceInfo
69 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> * pxViewSettings
;
70 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> * pxPrintSettings
;
79 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> SAL_CALL
getViewSettings(void)
80 throw( ::com::sun::star::uno::RuntimeException
);
83 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> SAL_CALL
getPrintSettings(void)
84 throw( ::com::sun::star::uno::RuntimeException
);
87 virtual rtl::OUString SAL_CALL
getImplementationName(void)
88 throw( ::com::sun::star::uno::RuntimeException
);
89 virtual sal_Bool SAL_CALL
supportsService(const rtl::OUString
& ServiceName
)
90 throw( ::com::sun::star::uno::RuntimeException
);
91 virtual ::com::sun::star::uno::Sequence
< rtl::OUString
> SAL_CALL
getSupportedServiceNames(void)
92 throw( ::com::sun::star::uno::RuntimeException
);
95 enum SwXPrintSettingsType
97 PRINT_SETTINGS_MODULE
,
99 PRINT_SETTINGS_DOCUMENT
102 class SwXPrintSettings
: public comphelper::ChainableHelperNoState
104 friend class SwXDocumentSettings
;
106 SwXPrintSettingsType meType
;
107 SwPrintData
* mpPrtOpt
;
110 virtual void _preSetValues ()
111 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::beans::PropertyVetoException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::WrappedTargetException
);
112 virtual void _setSingleValue( const comphelper::PropertyInfo
& rInfo
, const ::com::sun::star::uno::Any
&rValue
)
113 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::beans::PropertyVetoException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::WrappedTargetException
);
114 virtual void _postSetValues ()
115 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::beans::PropertyVetoException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::WrappedTargetException
);
117 virtual void _preGetValues ()
118 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::beans::PropertyVetoException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::WrappedTargetException
);
119 virtual void _getSingleValue( const comphelper::PropertyInfo
& rInfo
, ::com::sun::star::uno::Any
& rValue
)
120 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
);
121 virtual void _postGetValues ()
122 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::beans::PropertyVetoException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::WrappedTargetException
);
124 virtual ~SwXPrintSettings()
127 SwXPrintSettings( SwXPrintSettingsType eType
, SwDoc
* pDoc
= NULL
);
131 virtual rtl::OUString SAL_CALL
getImplementationName(void)
132 throw( ::com::sun::star::uno::RuntimeException
);
133 virtual sal_Bool SAL_CALL
supportsService(const rtl::OUString
& ServiceName
)
134 throw( ::com::sun::star::uno::RuntimeException
);
135 virtual ::com::sun::star::uno::Sequence
< rtl::OUString
> SAL_CALL
getSupportedServiceNames(void)
136 throw( ::com::sun::star::uno::RuntimeException
);
138 /*-----------------15.03.98 13:21-------------------
140 --------------------------------------------------*/
141 class SwXViewSettings
: public comphelper::ChainableHelperNoState
144 friend class SwXDocumentSettings
;
147 SwViewOption
* mpViewOption
;
148 const SwViewOption
* mpConstViewOption
;
149 sal_Bool bObjectValid
:1, bWeb
:1, mbApplyZoom
;
151 sal_Int32 eHRulerUnit
;
152 sal_Bool mbApplyHRulerMetric
;
153 sal_Int32 eVRulerUnit
;
154 sal_Bool mbApplyVRulerMetric
;
156 virtual void _preSetValues ()
157 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::beans::PropertyVetoException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::WrappedTargetException
);
158 virtual void _setSingleValue( const comphelper::PropertyInfo
& rInfo
, const ::com::sun::star::uno::Any
&rValue
)
159 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::beans::PropertyVetoException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::WrappedTargetException
);
160 virtual void _postSetValues ()
161 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::beans::PropertyVetoException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::WrappedTargetException
);
163 virtual void _preGetValues ()
164 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::beans::PropertyVetoException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::WrappedTargetException
);
165 virtual void _getSingleValue( const comphelper::PropertyInfo
& rInfo
, ::com::sun::star::uno::Any
& rValue
)
166 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
);
167 virtual void _postGetValues ()
168 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::beans::PropertyVetoException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::WrappedTargetException
);
170 virtual ~SwXViewSettings()
173 SwXViewSettings(sal_Bool bWeb
, SwView
* pView
);
177 virtual rtl::OUString SAL_CALL
getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException
);
178 virtual sal_Bool SAL_CALL
supportsService(const rtl::OUString
& ServiceName
) throw( ::com::sun::star::uno::RuntimeException
);
179 virtual ::com::sun::star::uno::Sequence
< rtl::OUString
> SAL_CALL
getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException
);
181 sal_Bool
IsValid() const {return bObjectValid
;}
182 void Invalidate() {bObjectValid
= sal_False
;}
184 /* -----------------24.09.98 10:47-------------------
186 * --------------------------------------------------*/
187 /*class SwXTerminateListener : public ::com::sun::star::frame::XTerminateListener,
191 SwXTerminateListener();
192 virtual ~SwXTerminateListener();
194 SMART_UNO_DECLARATION( SwXTerminateListener, UsrObject );
196 virtual UString getClassName();
197 // automatisch auskommentiert - [getIdlClass or queryInterface] - Bitte XTypeProvider benutzen!
198 // virtual ::com::sun::star::uno::XInterface * queryInterface( ::com::sun::star::uno::Uik aUik);
200 // automatisch auskommentiert - [getIdlClass or queryInterface] - Bitte XTypeProvider benutzen!
201 // virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlClass > > getIdlClasses(void);
205 virtual void queryTermination(const ::com::sun::star::lang::EventObject& aEvent);
206 virtual void notifyTermination(const ::com::sun::star::lang::EventObject& aEvent);
209 virtual void disposing(const ::com::sun::star::lang::EventObject& Source);