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 
24 #ifndef INCLUDED_unotools_PRINTWARNINGOPTIONS_HXX
25 #define INCLUDED_unotools_PRINTWARNINGOPTIONS_HXX
26 
27 //_________________________________________________________________________________________________________________
28 //  includes
29 //_________________________________________________________________________________________________________________
30 
31 #include "unotools/unotoolsdllapi.h"
32 #include <sal/types.h>
33 #include <osl/mutex.hxx>
34 #include <rtl/ustring.hxx>
35 #include <unotools/options.hxx>
36 
37 //_________________________________________________________________________________________________________________
38 //  forward declarations
39 //_________________________________________________________________________________________________________________
40 
41 /*-************************************************************************************************************//**
42     @short          forward declaration to our private date container implementation
43     @descr          We use these class as internal member to support small memory requirements.
44                     You can create the container if it is necessary. The class which use these mechanism
45                     is faster and smaller then a complete implementation!
46 *//*-*************************************************************************************************************/
47 
48 class SvtPrintWarningOptions_Impl;
49 
50 //_________________________________________________________________________________________________________________
51 //  declarations
52 //_________________________________________________________________________________________________________________
53 
54 /*-************************************************************************************************************//**
55     @short          collect informations about startup features
56     @descr          -
57 
58     @implements     -
59     @base           -
60 
61     @devstatus      ready to use
62 *//*-*************************************************************************************************************/
63 
64 class UNOTOOLS_DLLPUBLIC SvtPrintWarningOptions: public utl::detail::Options
65 {
66     //-------------------------------------------------------------------------------------------------------------
67     //  public methods
68     //-------------------------------------------------------------------------------------------------------------
69 
70     public:
71 
72         //---------------------------------------------------------------------------------------------------------
73         //  constructor / destructor
74         //---------------------------------------------------------------------------------------------------------
75 
76         /*-****************************************************************************************************//**
77             @short      standard constructor and destructor
78             @descr      This will initialize an instance with default values.
79                         We implement these class with a refcount mechanism! Every instance of this class increase it
80                         at create and decrease it at delete time - but all instances use the same data container!
81                         He is implemented as a static member ...
82 
83             @seealso    member m_nRefCount
84             @seealso    member m_pDataContainer
85 
86             @param      -
87             @return     -
88 
89             @onerror    -
90         *//*-*****************************************************************************************************/
91 
92          SvtPrintWarningOptions();
93         virtual ~SvtPrintWarningOptions();
94 
95         //---------------------------------------------------------------------------------------------------------
96         //  interface
97         //---------------------------------------------------------------------------------------------------------
98 
99         /*-****************************************************************************************************//**
100             @short      interface methods to get and set value of config key "org.openoffice.Office.Common/Print/Warning..."
101             @descr      These options describe internal states to enable/disable features of installed office.
102 
103             @seealso    configuration package "org.openoffice.Office.Common/_3D-Engine"
104         *//*-*****************************************************************************************************/
105 
106         sal_Bool    IsPaperSize() const;
107         sal_Bool    IsPaperOrientation() const;
108         sal_Bool    IsNotFound() const;
109         sal_Bool    IsTransparency() const;
110         sal_Bool    IsModifyDocumentOnPrintingAllowed() const;
111 
112         void        SetPaperSize( sal_Bool bState );
113         void        SetPaperOrientation( sal_Bool bState );
114         void        SetNotFound( sal_Bool bState );
115         void        SetTransparency( sal_Bool bState );
116         void        SetModifyDocumentOnPrintingAllowed( sal_Bool bState );
117 
118     //-------------------------------------------------------------------------------------------------------------
119     //  private methods
120     //-------------------------------------------------------------------------------------------------------------
121 
122     private:
123 
124         /*-****************************************************************************************************//**
125             @short      return a reference to a static mutex
126             @descr      These class use his own static mutex to be threadsafe.
127                         We create a static mutex only for one ime and use at different times.
128 
129             @seealso    -
130 
131             @param      -
132             @return     A reference to a static mutex member.
133 
134             @onerror    -
135         *//*-*****************************************************************************************************/
136 
137         UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex();
138 
139     //-------------------------------------------------------------------------------------------------------------
140     //  private member
141     //-------------------------------------------------------------------------------------------------------------
142     private:
143 
144         /*Attention
145 
146             Don't initialize these static member in these header!
147             a) Double dfined symbols will be detected ...
148             b) and unresolved externals exist at linking time.
149             Do it in your source only.
150          */
151 
152         static SvtPrintWarningOptions_Impl* m_pDataContainer    ;   /// impl. data container as dynamic pointer for smaller memory requirements!
153         static sal_Int32                    m_nRefCount         ;   /// internal ref count mechanism
154 
155 };      // class SvtPrintWarningOptions
156 
157 #endif // #ifndef INCLUDED_unotools_PRINTWARNINGOPTIONS_HXX
158