1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef INCLUDED_unotools_COMPATIBILITY_HXX 24 #define INCLUDED_unotools_COMPATIBILITY_HXX 25 26 //_________________________________________________________________________________________________________________ 27 // includes 28 //_________________________________________________________________________________________________________________ 29 30 #include "unotools/unotoolsdllapi.h" 31 #include <sal/types.h> 32 #include <osl/mutex.hxx> 33 #include <com/sun/star/uno/Sequence.h> 34 #include <com/sun/star/beans/PropertyValue.hpp> 35 #include <unotools/options.hxx> 36 37 //_________________________________________________________________________________________________________________ 38 // types, enums, ... 39 //_________________________________________________________________________________________________________________ 40 41 enum CompatibilityOptions 42 { 43 COPT_USE_PRINTERDEVICE = 0, 44 COPT_ADD_SPACING, 45 COPT_ADD_SPACING_AT_PAGES, 46 COPT_USE_OUR_TABSTOPS, 47 COPT_NO_EXTLEADING, 48 COPT_USE_LINESPACING, 49 COPT_ADD_TABLESPACING, 50 COPT_USE_OBJECTPOSITIONING, 51 COPT_USE_OUR_TEXTWRAPPING, 52 COPT_CONSIDER_WRAPPINGSTYLE, 53 COPT_EXPAND_WORDSPACE 54 }; 55 56 /*-************************************************************************************************************//** 57 @descr The method GetList() returns a list of property values. 58 Use follow defines to separate values by names. 59 *//*-*************************************************************************************************************/ 60 #define COMPATIBILITY_PROPERTYNAME_NAME OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ) 61 #define COMPATIBILITY_PROPERTYNAME_MODULE OUString( RTL_CONSTASCII_USTRINGPARAM( "Module" ) ) 62 #define COMPATIBILITY_PROPERTYNAME_USEPRTMETRICS OUString( RTL_CONSTASCII_USTRINGPARAM( "UsePrinterMetrics" ) ) 63 #define COMPATIBILITY_PROPERTYNAME_ADDSPACING OUString( RTL_CONSTASCII_USTRINGPARAM( "AddSpacing" ) ) 64 #define COMPATIBILITY_PROPERTYNAME_ADDSPACINGATPAGES OUString( RTL_CONSTASCII_USTRINGPARAM( "AddSpacingAtPages" ) ) 65 #define COMPATIBILITY_PROPERTYNAME_USEOURTABSTOPS OUString( RTL_CONSTASCII_USTRINGPARAM( "UseOurTabStopFormat" ) ) 66 #define COMPATIBILITY_PROPERTYNAME_NOEXTLEADING OUString( RTL_CONSTASCII_USTRINGPARAM( "NoExternalLeading" ) ) 67 #define COMPATIBILITY_PROPERTYNAME_USELINESPACING OUString( RTL_CONSTASCII_USTRINGPARAM( "UseLineSpacing" ) ) 68 #define COMPATIBILITY_PROPERTYNAME_ADDTABLESPACING OUString( RTL_CONSTASCII_USTRINGPARAM( "AddTableSpacing" ) ) 69 #define COMPATIBILITY_PROPERTYNAME_USEOBJECTPOSITIONING OUString( RTL_CONSTASCII_USTRINGPARAM( "UseObjectPositioning" ) ) 70 #define COMPATIBILITY_PROPERTYNAME_USEOURTEXTWRAPPING OUString( RTL_CONSTASCII_USTRINGPARAM( "UseOurTextWrapping" ) ) 71 #define COMPATIBILITY_PROPERTYNAME_CONSIDERWRAPPINGSTYLE OUString( RTL_CONSTASCII_USTRINGPARAM( "ConsiderWrappingStyle" ) ) 72 #define COMPATIBILITY_PROPERTYNAME_EXPANDWORDSPACE OUString( RTL_CONSTASCII_USTRINGPARAM( "ExpandWordSpace" ) ) 73 74 #define COMPATIBILITY_DEFAULT_NAME OUString( RTL_CONSTASCII_USTRINGPARAM( "_default" ) ) 75 76 //_________________________________________________________________________________________________________________ 77 // forward declarations 78 //_________________________________________________________________________________________________________________ 79 80 /*-************************************************************************************************************//** 81 @short forward declaration to our private date container implementation 82 @descr We use these class as internal member to support small memory requirements. 83 You can create the container if it is necessary. The class which use these mechanism 84 is faster and smaller then a complete implementation! 85 *//*-*************************************************************************************************************/ 86 87 class SvtCompatibilityOptions_Impl; 88 89 //_________________________________________________________________________________________________________________ 90 // declarations 91 //_________________________________________________________________________________________________________________ 92 93 /*-************************************************************************************************************//** 94 @short collect informations about dynamic menus 95 @descr Make it possible to configure dynamic menu structures of menus like "new" or "wizard". 96 97 @implements - 98 @base - 99 100 @devstatus ready to use 101 *//*-*************************************************************************************************************/ 102 103 class UNOTOOLS_DLLPUBLIC SvtCompatibilityOptions: public utl::detail::Options 104 { 105 //------------------------------------------------------------------------------------------------------------- 106 // public methods 107 //------------------------------------------------------------------------------------------------------------- 108 109 public: 110 111 //--------------------------------------------------------------------------------------------------------- 112 // constructor / destructor 113 //--------------------------------------------------------------------------------------------------------- 114 115 /*-****************************************************************************************************//** 116 @short standard constructor and destructor 117 @descr This will initialize an instance with default values. 118 We implement these class with a refcount mechanism! Every instance of this class increase it 119 at create and decrease it at delete time - but all instances use the same data container! 120 He is implemented as a static member ... 121 122 @seealso member m_nRefCount 123 @seealso member m_pDataContainer 124 125 @param - 126 @return - 127 128 @onerror - 129 *//*-*****************************************************************************************************/ 130 131 SvtCompatibilityOptions(); 132 virtual ~SvtCompatibilityOptions(); 133 134 //--------------------------------------------------------------------------------------------------------- 135 // interface 136 //--------------------------------------------------------------------------------------------------------- 137 138 /*-****************************************************************************************************//** 139 @short clear complete specified list 140 @descr Call this methods to clear the whole list. 141 142 @seealso - 143 144 @param - 145 @return - 146 147 @onerror - 148 *//*-*****************************************************************************************************/ 149 150 void Clear(); 151 152 /*-****************************************************************************************************//** 153 @short return complete specified list 154 @descr Call it to get all entries of compatibility options. 155 We return a list of all nodes with its names and properties. 156 157 @seealso - 158 159 @param - 160 @return A list of compatibility options is returned. 161 162 @onerror We return an empty list. 163 *//*-*****************************************************************************************************/ 164 165 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > GetList() const; 166 167 /*-****************************************************************************************************//** 168 @short append a new item 169 @descr 170 171 @seealso method Clear() 172 173 @param "sName" Name 174 @param "sModule" Module 175 176 @return - 177 178 @onerror - 179 *//*-*****************************************************************************************************/ 180 181 void AppendItem( const ::rtl::OUString& sName, 182 const ::rtl::OUString& sModule, 183 bool bUsePrtMetrics, 184 bool bAddSpacing, 185 bool bAddSpacingAtPages, 186 bool bUseOurTabStops, 187 bool bNoExtLeading, 188 bool bUseLineSpacing, 189 bool bAddTableSpacing, 190 bool bUseObjectPositioning, 191 bool bUseOurTextWrapping, 192 bool bConsiderWrappingStyle, 193 bool bExpandWordSpace ); 194 195 bool IsUsePrtDevice() const; 196 bool IsAddSpacing() const; 197 bool IsAddSpacingAtPages() const; 198 bool IsUseOurTabStops() const; 199 bool IsNoExtLeading() const; 200 bool IsUseLineSpacing() const; 201 bool IsAddTableSpacing() const; 202 bool IsUseObjectPositioning() const; 203 bool IsUseOurTextWrapping() const; 204 bool IsConsiderWrappingStyle() const; 205 bool IsExpandWordSpace() const; 206 207 //------------------------------------------------------------------------------------------------------------- 208 // private methods 209 //------------------------------------------------------------------------------------------------------------- 210 211 private: 212 213 /*-****************************************************************************************************//** 214 @short return a reference to a static mutex 215 @descr These class is partially threadsafe (for de-/initialization only). 216 All access methods are'nt safe! 217 We create a static mutex only for one ime and use at different times. 218 219 @seealso - 220 221 @param - 222 @return A reference to a static mutex member. 223 224 @onerror - 225 *//*-*****************************************************************************************************/ 226 227 UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); 228 229 //------------------------------------------------------------------------------------------------------------- 230 // private member 231 //------------------------------------------------------------------------------------------------------------- 232 233 private: 234 235 /*Attention 236 237 Don't initialize these static member in these header! 238 a) Double dfined symbols will be detected ... 239 b) and unresolved externals exist at linking time. 240 Do it in your source only. 241 */ 242 243 static SvtCompatibilityOptions_Impl* m_pDataContainer; /// impl. data container as dynamic pointer for smaller memory requirements! 244 static sal_Int32 m_nRefCount ; /// internal ref count mechanism 245 246 }; // class SvtCompatibilityOptions 247 248 #endif // #ifndef INCLUDED_unotools_COMPATIBILITY_HXX 249 250