1bae3752eSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3bae3752eSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4bae3752eSAndrew Rist * or more contributor license agreements. See the NOTICE file 5bae3752eSAndrew Rist * distributed with this work for additional information 6bae3752eSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7bae3752eSAndrew Rist * to you under the Apache License, Version 2.0 (the 8bae3752eSAndrew Rist * "License"); you may not use this file except in compliance 9bae3752eSAndrew Rist * with the License. You may obtain a copy of the License at 10bae3752eSAndrew Rist * 11bae3752eSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12bae3752eSAndrew Rist * 13bae3752eSAndrew Rist * Unless required by applicable law or agreed to in writing, 14bae3752eSAndrew Rist * software distributed under the License is distributed on an 15bae3752eSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16bae3752eSAndrew Rist * KIND, either express or implied. See the License for the 17bae3752eSAndrew Rist * specific language governing permissions and limitations 18bae3752eSAndrew Rist * under the License. 19bae3752eSAndrew Rist * 20bae3752eSAndrew Rist *************************************************************/ 21bae3752eSAndrew Rist 22bae3752eSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef INCLUDED_SVTOOLS_MODULEOPTIONS_HXX 25cdf0e10cSrcweir #define INCLUDED_SVTOOLS_MODULEOPTIONS_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 28cdf0e10cSrcweir // includes 29cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 30cdf0e10cSrcweir 31cdf0e10cSrcweir #include "unotools/unotoolsdllapi.h" 32cdf0e10cSrcweir #include <salhelper/singletonref.hxx> 33cdf0e10cSrcweir #include <com/sun/star/frame/XModel.hpp> 34cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx> 35cdf0e10cSrcweir #include <rtl/ustring.hxx> 36cdf0e10cSrcweir #include <sal/types.h> 37cdf0e10cSrcweir #include <osl/mutex.hxx> 38cdf0e10cSrcweir #include <unotools/options.hxx> 39cdf0e10cSrcweir 40cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 41cdf0e10cSrcweir // const 42cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 43cdf0e10cSrcweir 44cdf0e10cSrcweir #define FEATUREFLAG_BASICIDE 0x00000020 45cdf0e10cSrcweir #define FEATUREFLAG_MATH 0x00000100 46cdf0e10cSrcweir #define FEATUREFLAG_CHART 0x00000200 47cdf0e10cSrcweir #define FEATUREFLAG_CALC 0x00000800 48cdf0e10cSrcweir #define FEATUREFLAG_DRAW 0x00001000 49cdf0e10cSrcweir #define FEATUREFLAG_WRITER 0x00002000 50cdf0e10cSrcweir #define FEATUREFLAG_IMPRESS 0x00008000 51cdf0e10cSrcweir #define FEATUREFLAG_INSIGHT 0x00010000 52cdf0e10cSrcweir 53cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 54cdf0e10cSrcweir // forward declarations 55cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 56cdf0e10cSrcweir 57cdf0e10cSrcweir /*-************************************************************************************************************//** 58cdf0e10cSrcweir @short forward declaration to our private date container implementation 59cdf0e10cSrcweir @descr We use these class as internal member to support small memory requirements. 60*86e1cf34SPedro Giffuni You can create the container if it is necessary. The class which use these mechanism 61cdf0e10cSrcweir is faster and smaller then a complete implementation! 62cdf0e10cSrcweir *//*-*************************************************************************************************************/ 63cdf0e10cSrcweir class SvtModuleOptions_Impl; 64cdf0e10cSrcweir 65cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 66cdf0e10cSrcweir // declarations 67cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 68cdf0e10cSrcweir 69cdf0e10cSrcweir /*-************************************************************************************************************//** 70cdf0e10cSrcweir @short collect informations about installation state of modules 71cdf0e10cSrcweir @descr Use these class to get installation state of different office modules like writer, calc etc 72cdf0e10cSrcweir Further you can ask for additional informations; e.g. name of standard template file, which 73cdf0e10cSrcweir should be used by corresponding module; or short/long name of these module factory. 74cdf0e10cSrcweir 75cdf0e10cSrcweir @implements - 76cdf0e10cSrcweir @base - 77cdf0e10cSrcweir 78cdf0e10cSrcweir @devstatus ready to use 79cdf0e10cSrcweir @threadsafe yes 80cdf0e10cSrcweir *//*-*************************************************************************************************************/ 81cdf0e10cSrcweir class UNOTOOLS_DLLPUBLIC SvtModuleOptions: public utl::detail::Options 82cdf0e10cSrcweir { 83cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------- 84cdf0e10cSrcweir // public const declarations! 85cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------- 86cdf0e10cSrcweir public: 87cdf0e10cSrcweir 88cdf0e10cSrcweir enum EModule 89cdf0e10cSrcweir { 90cdf0e10cSrcweir E_SWRITER = 0, 91cdf0e10cSrcweir E_SCALC = 1, 92cdf0e10cSrcweir E_SDRAW = 2, 93cdf0e10cSrcweir E_SIMPRESS = 3, 94cdf0e10cSrcweir E_SMATH = 4, 95cdf0e10cSrcweir E_SCHART = 5, 96cdf0e10cSrcweir E_SSTARTMODULE = 6, 97cdf0e10cSrcweir E_SBASIC = 7, 98cdf0e10cSrcweir E_SDATABASE = 8, 99cdf0e10cSrcweir E_SWEB = 9, 100cdf0e10cSrcweir E_SGLOBAL = 10 101cdf0e10cSrcweir }; 102cdf0e10cSrcweir 103cdf0e10cSrcweir /*ATTENTION: 104cdf0e10cSrcweir If you change these enum ... don't forget to change reading/writing and order of configuration values too! 105cdf0e10cSrcweir See "SvtModuleOptions_Impl::impl_GetSetNames()" and his ctor for further informations. 106cdf0e10cSrcweir */ 107cdf0e10cSrcweir enum EFactory 108cdf0e10cSrcweir { 109cdf0e10cSrcweir E_UNKNOWN_FACTORY = -1, 110cdf0e10cSrcweir E_WRITER = 0, 111cdf0e10cSrcweir E_WRITERWEB = 1, 112cdf0e10cSrcweir E_WRITERGLOBAL = 2, 113cdf0e10cSrcweir E_CALC = 3, 114cdf0e10cSrcweir E_DRAW = 4, 115cdf0e10cSrcweir E_IMPRESS = 5, 116cdf0e10cSrcweir E_MATH = 6, 117cdf0e10cSrcweir E_CHART = 7, 118cdf0e10cSrcweir E_STARTMODULE = 8, 119cdf0e10cSrcweir E_DATABASE = 9, 120cdf0e10cSrcweir E_BASIC = 10 121cdf0e10cSrcweir 122cdf0e10cSrcweir }; 123cdf0e10cSrcweir 124cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------- 125cdf0e10cSrcweir // public methods 126cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------- 127cdf0e10cSrcweir public: 128cdf0e10cSrcweir 129cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 130cdf0e10cSrcweir // constructor / destructor 131cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 132cdf0e10cSrcweir SvtModuleOptions(); 133cdf0e10cSrcweir virtual ~SvtModuleOptions(); 134cdf0e10cSrcweir 135cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 136cdf0e10cSrcweir // interface 137cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 138cdf0e10cSrcweir sal_Bool IsModuleInstalled ( EModule eModule ) const; 139cdf0e10cSrcweir ::rtl::OUString GetModuleName ( EModule eModule ) const; 140cdf0e10cSrcweir ::rtl::OUString GetModuleName ( EFactory eFactory ) const; 141cdf0e10cSrcweir ::rtl::OUString GetFactoryName ( EFactory eFactory ) const; 142cdf0e10cSrcweir ::rtl::OUString GetFactoryShortName ( EFactory eFactory ) const; 143cdf0e10cSrcweir ::rtl::OUString GetFactoryStandardTemplate( EFactory eFactory ) const; 144cdf0e10cSrcweir ::rtl::OUString GetFactoryWindowAttributes( EFactory eFactory ) const; 145cdf0e10cSrcweir ::rtl::OUString GetFactoryEmptyDocumentURL( EFactory eFactory ) const; 146cdf0e10cSrcweir ::rtl::OUString GetFactoryDefaultFilter ( EFactory eFactory ) const; 147cdf0e10cSrcweir sal_Bool IsDefaultFilterReadonly ( EFactory eFactory ) const; 148cdf0e10cSrcweir sal_Int32 GetFactoryIcon ( EFactory eFactory ) const; 149cdf0e10cSrcweir static sal_Bool ClassifyFactoryByName ( const ::rtl::OUString& sName , 150cdf0e10cSrcweir EFactory& eFactory ); 151cdf0e10cSrcweir void SetFactoryStandardTemplate( EFactory eFactory , 152cdf0e10cSrcweir const ::rtl::OUString& sTemplate ); 153cdf0e10cSrcweir void SetFactoryWindowAttributes( EFactory eFactory , 154cdf0e10cSrcweir const ::rtl::OUString& sAttributes); 155cdf0e10cSrcweir void SetFactoryDefaultFilter ( EFactory eFactory , 156cdf0e10cSrcweir const ::rtl::OUString& sFilter ); 157cdf0e10cSrcweir 158cdf0e10cSrcweir //_______________________________________ 159cdf0e10cSrcweir 160cdf0e10cSrcweir /** @short return the corresponding application ID for the given 161cdf0e10cSrcweir document service name. 162cdf0e10cSrcweir */ 163cdf0e10cSrcweir static EFactory ClassifyFactoryByServiceName(const ::rtl::OUString& sName); 164cdf0e10cSrcweir 165cdf0e10cSrcweir //_______________________________________ 166cdf0e10cSrcweir 167cdf0e10cSrcweir /** @short return the corresponding application ID for the given 168cdf0e10cSrcweir short name. 169cdf0e10cSrcweir */ 170cdf0e10cSrcweir static EFactory ClassifyFactoryByShortName(const ::rtl::OUString& sName); 171cdf0e10cSrcweir 172cdf0e10cSrcweir //_______________________________________ 173cdf0e10cSrcweir 174cdf0e10cSrcweir /** @short return the corresponding application ID for the given properties. 175cdf0e10cSrcweir 176cdf0e10cSrcweir @descr Because this search base on filters currently (till we have a better solution) 177cdf0e10cSrcweir a result is not guaranteed everytimes. May a filter does not exists for the specified 178cdf0e10cSrcweir content (but a FrameLoader which is not bound to any application!) ... or 179cdf0e10cSrcweir the given properties describe a stream (and we make no deep detection inside here!). 180cdf0e10cSrcweir 181*86e1cf34SPedro Giffuni @attention The module BASIC can't be detected here. Because it does not 182cdf0e10cSrcweir has an own URL schema. 183cdf0e10cSrcweir 184cdf0e10cSrcweir @param sURL 185cdf0e10cSrcweir the complete URL! 186cdf0e10cSrcweir 187cdf0e10cSrcweir @param lMediaDescriptor 188cdf0e10cSrcweir additional informations 189cdf0e10cSrcweir 190cdf0e10cSrcweir @return A suitable enum value. See EFactory above. 191cdf0e10cSrcweir */ 192cdf0e10cSrcweir static EFactory ClassifyFactoryByURL(const ::rtl::OUString& sURL , 193cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lMediaDescriptor); 194cdf0e10cSrcweir 195cdf0e10cSrcweir //_______________________________________ 196cdf0e10cSrcweir 197cdf0e10cSrcweir /** @short return the corresponding application ID for the given properties. 198cdf0e10cSrcweir 199cdf0e10cSrcweir @descr Here we try to use the list of supported service names of the given model 200cdf0e10cSrcweir to find out the right application module. 201cdf0e10cSrcweir 202*86e1cf34SPedro Giffuni @attention The module BASIC can't be detected here. Because it does not 203cdf0e10cSrcweir support any model/ctrl/view paradigm. 204cdf0e10cSrcweir 205cdf0e10cSrcweir @param xModel 206cdf0e10cSrcweir the document model 207cdf0e10cSrcweir 208cdf0e10cSrcweir @return A suitable enum value. See EFactory above. 209cdf0e10cSrcweir */ 210cdf0e10cSrcweir static EFactory ClassifyFactoryByModel(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel); 211cdf0e10cSrcweir 212cdf0e10cSrcweir ::rtl::OUString GetDefaultModuleName(); 213cdf0e10cSrcweir 214cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 215cdf0e10cSrcweir // old interface ... 216cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 217cdf0e10cSrcweir sal_Bool IsMath () const; 218cdf0e10cSrcweir sal_Bool IsChart () const; 219cdf0e10cSrcweir sal_Bool IsCalc () const; 220cdf0e10cSrcweir sal_Bool IsDraw () const; 221cdf0e10cSrcweir sal_Bool IsWriter () const; 222cdf0e10cSrcweir sal_Bool IsImpress () const; 223cdf0e10cSrcweir sal_Bool IsBasicIDE () const; 224cdf0e10cSrcweir sal_Bool IsDataBase () const; 225cdf0e10cSrcweir sal_uInt32 GetFeatures() const; 226cdf0e10cSrcweir 227cdf0e10cSrcweir ::com::sun::star::uno::Sequence < ::rtl::OUString > GetAllServiceNames(); 228cdf0e10cSrcweir 229cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------- 230cdf0e10cSrcweir // private methods 231cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------- 232cdf0e10cSrcweir private: 233cdf0e10cSrcweir UNOTOOLS_DLLPRIVATE static ::osl::Mutex& impl_GetOwnStaticMutex(); 234cdf0e10cSrcweir 235cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------- 236cdf0e10cSrcweir // private member 237cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------- 238cdf0e10cSrcweir private: 239cdf0e10cSrcweir 240cdf0e10cSrcweir /*Attention 241cdf0e10cSrcweir 242cdf0e10cSrcweir Don't initialize these static member in these header! 243cdf0e10cSrcweir a) Double defined symbols will be detected ... 244cdf0e10cSrcweir b) and unresolved externals exist at linking time. 245cdf0e10cSrcweir Do it in your source only. 246cdf0e10cSrcweir */ 247cdf0e10cSrcweir 248cdf0e10cSrcweir static SvtModuleOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements! 249cdf0e10cSrcweir static sal_Int32 m_nRefCount ; /// internal ref count mechanism 250cdf0e10cSrcweir 251cdf0e10cSrcweir }; // class SvtModuleOptions 252cdf0e10cSrcweir 253cdf0e10cSrcweir #endif // #ifndef INCLUDED_SVTOOLS_MODULEOPTIONS_HXX 254