1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef INCLUDED_unotools_PRINTWARNINGOPTIONS_HXX
29 #define INCLUDED_unotools_PRINTWARNINGOPTIONS_HXX
30 
31 //_________________________________________________________________________________________________________________
32 //  includes
33 //_________________________________________________________________________________________________________________
34 
35 #include "unotools/unotoolsdllapi.h"
36 #include <sal/types.h>
37 #include <osl/mutex.hxx>
38 #include <rtl/ustring.hxx>
39 #include <unotools/options.hxx>
40 
41 //_________________________________________________________________________________________________________________
42 //  forward declarations
43 //_________________________________________________________________________________________________________________
44 
45 /*-************************************************************************************************************//**
46     @short          forward declaration to our private date container implementation
47     @descr          We use these class as internal member to support small memory requirements.
48                     You can create the container if it is neccessary. The class which use these mechanism
49                     is faster and smaller then a complete implementation!
50 *//*-*************************************************************************************************************/
51 
52 class SvtPrintWarningOptions_Impl;
53 
54 //_________________________________________________________________________________________________________________
55 //  declarations
56 //_________________________________________________________________________________________________________________
57 
58 /*-************************************************************************************************************//**
59     @short          collect informations about startup features
60     @descr          -
61 
62     @implements     -
63     @base           -
64 
65     @devstatus      ready to use
66 *//*-*************************************************************************************************************/
67 
68 class UNOTOOLS_DLLPUBLIC SvtPrintWarningOptions: public utl::detail::Options
69 {
70     //-------------------------------------------------------------------------------------------------------------
71     //  public methods
72     //-------------------------------------------------------------------------------------------------------------
73 
74     public:
75 
76         //---------------------------------------------------------------------------------------------------------
77         //  constructor / destructor
78         //---------------------------------------------------------------------------------------------------------
79 
80         /*-****************************************************************************************************//**
81             @short      standard constructor and destructor
82             @descr      This will initialize an instance with default values.
83                         We implement these class with a refcount mechanism! Every instance of this class increase it
84                         at create and decrease it at delete time - but all instances use the same data container!
85                         He is implemented as a static member ...
86 
87             @seealso    member m_nRefCount
88             @seealso    member m_pDataContainer
89 
90             @param      -
91             @return     -
92 
93             @onerror    -
94         *//*-*****************************************************************************************************/
95 
96          SvtPrintWarningOptions();
97         virtual ~SvtPrintWarningOptions();
98 
99         //---------------------------------------------------------------------------------------------------------
100         //  interface
101         //---------------------------------------------------------------------------------------------------------
102 
103         /*-****************************************************************************************************//**
104             @short      interface methods to get and set value of config key "org.openoffice.Office.Common/Print/Warning..."
105             @descr      These options describe internal states to enable/disable features of installed office.
106 
107             @seealso    configuration package "org.openoffice.Office.Common/_3D-Engine"
108         *//*-*****************************************************************************************************/
109 
110         sal_Bool    IsPaperSize() const;
111         sal_Bool    IsPaperOrientation() const;
112         sal_Bool    IsNotFound() const;
113         sal_Bool    IsTransparency() const;
114         sal_Bool    IsModifyDocumentOnPrintingAllowed() const;
115 
116         void        SetPaperSize( sal_Bool bState );
117         void        SetPaperOrientation( sal_Bool bState );
118         void        SetNotFound( sal_Bool bState );
119         void        SetTransparency( sal_Bool bState );
120         void        SetModifyDocumentOnPrintingAllowed( sal_Bool bState );
121 
122     //-------------------------------------------------------------------------------------------------------------
123     //  private methods
124     //-------------------------------------------------------------------------------------------------------------
125 
126     private:
127 
128         /*-****************************************************************************************************//**
129             @short      return a reference to a static mutex
130             @descr      These class use his own static mutex to be threadsafe.
131                         We create a static mutex only for one ime and use at different times.
132 
133             @seealso    -
134 
135             @param      -
136             @return     A reference to a static mutex member.
137 
138             @onerror    -
139         *//*-*****************************************************************************************************/
140 
141         UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex();
142 
143     //-------------------------------------------------------------------------------------------------------------
144     //  private member
145     //-------------------------------------------------------------------------------------------------------------
146     private:
147 
148         /*Attention
149 
150             Don't initialize these static member in these header!
151             a) Double dfined symbols will be detected ...
152             b) and unresolved externals exist at linking time.
153             Do it in your source only.
154          */
155 
156         static SvtPrintWarningOptions_Impl* m_pDataContainer    ;   /// impl. data container as dynamic pointer for smaller memory requirements!
157         static sal_Int32                    m_nRefCount         ;   /// internal ref count mechanism
158 
159 };      // class SvtPrintWarningOptions
160 
161 #endif // #ifndef INCLUDED_unotools_PRINTWARNINGOPTIONS_HXX
162