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_SVTOOLS_OPTIONSDRAWINGLAYER_HXX
29 #define INCLUDED_SVTOOLS_OPTIONSDRAWINGLAYER_HXX
30 
31 //_________________________________________________________________________________________________________________
32 //	includes
33 //_________________________________________________________________________________________________________________
34 
35 #include "svtools/svtdllapi.h"
36 #include <sal/types.h>
37 #include <osl/mutex.hxx>
38 #include <rtl/ustring.hxx>
39 #include <tools/color.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 SvtOptionsDrawinglayer_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 SVT_DLLPUBLIC SvtOptionsDrawinglayer
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          SvtOptionsDrawinglayer();
97         ~SvtOptionsDrawinglayer();
98 
99 		//---------------------------------------------------------------------------------------------------------
100 		//	interface
101 		//---------------------------------------------------------------------------------------------------------
102 
103 		/*-****************************************************************************************************//**
104 			@short		interface methods to get and set value of config key "org.openoffice.Office.Common/Drawinglayer/..."
105 			@descr      These options describe internal states to enable/disable features of installed office.
106 
107 						IsOverlayBuffer()
108 						SetOverlayBuffer()		=>	Activate this field for letting Overlay use a buffer
109 
110 						IsPaintBuffer()
111 						SetPaintBuffer()		=>	Activate this field for letting Paint use a prerender buffer
112 
113 						GetStripeColorA()
114 						SetStripeColorA()		=>	Set first of two colors which overlay uses to draw stripes
115 
116 						GetStripeColorB()
117 						SetStripeColorB()		=>	Set second of two colors which overlay uses to draw stripes
118 
119 						GetStripeLength()
120 						SetStripeLength()		=>	Set length of a single stripe in pixels
121 
122 			@seealso	configuration package "org.openoffice.Office.Common/Drawinglayer"
123 		*//*-*****************************************************************************************************/
124 
125 		sal_Bool	IsOverlayBuffer() const;
126 		sal_Bool	IsPaintBuffer() const;
127 		Color		GetStripeColorA() const;
128 		Color		GetStripeColorB() const;
129 		sal_uInt16	GetStripeLength() const;
130 
131 		void		SetOverlayBuffer( sal_Bool bState );
132 		void		SetPaintBuffer( sal_Bool bState );
133 		void		SetStripeColorA( Color aColor );
134 		void		SetStripeColorB( Color aColor );
135 		void		SetStripeLength( sal_uInt16 nLength );
136 
137 		// #i73602#
138 		sal_Bool	IsOverlayBuffer_Calc() const;
139 		sal_Bool	IsOverlayBuffer_Writer() const;
140 		sal_Bool	IsOverlayBuffer_DrawImpress() const;
141 		void		SetOverlayBuffer_Calc( sal_Bool bState );
142 		void		SetOverlayBuffer_Writer( sal_Bool bState );
143 		void		SetOverlayBuffer_DrawImpress( sal_Bool bState );
144 
145 		// #i74769#, #i75172#
146 		sal_Bool	IsPaintBuffer_Calc() const;
147 		sal_Bool	IsPaintBuffer_Writer() const;
148 		sal_Bool	IsPaintBuffer_DrawImpress() const;
149 		void		SetPaintBuffer_Calc( sal_Bool bState );
150 		void		SetPaintBuffer_Writer( sal_Bool bState );
151 		void		SetPaintBuffer_DrawImpress( sal_Bool bState );
152 
153 		// #i4219#
154 		sal_uInt32 GetMaximumPaperWidth() const;
155 		sal_uInt32 GetMaximumPaperHeight() const;
156 		sal_uInt32 GetMaximumPaperLeftMargin() const;
157 		sal_uInt32 GetMaximumPaperRightMargin() const;
158 		sal_uInt32 GetMaximumPaperTopMargin() const;
159 		sal_uInt32 GetMaximumPaperBottomMargin() const;
160 
161 		void SetMaximumPaperWidth(sal_uInt32 nNew);
162 		void SetMaximumPaperHeight(sal_uInt32 nNew);
163 		void SetMaximumPaperLeftMargin(sal_uInt32 nNew);
164 		void SetMaximumPaperRightMargin(sal_uInt32 nNew);
165 		void SetMaximumPaperTopMargin(sal_uInt32 nNew);
166 		void SetMaximumPaperBottomMargin(sal_uInt32 nNew);
167 
168 		// #i95644# helper to check if AA is allowed on this system. Currently, for WIN its disabled
169 		// and OutDevSupport_TransparentRect is checked (this  hits XRenderExtension, e.g.
170 		// currently for SunRay as long as not supported there)
171 		sal_Bool IsAAPossibleOnThisSystem() const;
172 
173 		// primitives
174 		sal_Bool	IsAntiAliasing() const;
175 		sal_Bool	IsSnapHorVerLinesToDiscrete() const;
176 		sal_Bool	IsSolidDragCreate() const;
177 		sal_Bool	IsRenderDecoratedTextDirect() const;
178 		sal_Bool	IsRenderSimpleTextDirect() const;
179 		sal_uInt32  GetQuadratic3DRenderLimit() const;
180 		sal_uInt32  GetQuadraticFormControlRenderLimit() const;
181 
182         void		SetAntiAliasing( sal_Bool bState );
183         void		SetSnapHorVerLinesToDiscrete( sal_Bool bState );
184 		void		SetSolidDragCreate( sal_Bool bState );
185         void		SetRenderDecoratedTextDirect( sal_Bool bState );
186         void		SetRenderSimpleTextDirect( sal_Bool bState );
187    		void        SetQuadratic3DRenderLimit(sal_uInt32 nNew);
188    		void        SetQuadraticFormControlRenderLimit(sal_uInt32 nNew);
189 
190 		// #i97672# selection settings
191 		sal_Bool	IsTransparentSelection() const;
192 		sal_uInt16	GetTransparentSelectionPercent() const;
193         sal_uInt16	GetSelectionMaximumLuminancePercent() const;
194 
195 		void		SetTransparentSelection( sal_Bool bState );
196 		void		SetTransparentSelectionPercent( sal_uInt16 nPercent );
197 		void		SetSelectionMaximumLuminancePercent( sal_uInt16 nPercent );
198 
199 	//-------------------------------------------------------------------------------------------------------------
200 	//	private methods
201 	//-------------------------------------------------------------------------------------------------------------
202 
203     private:
204 
205 		/*-****************************************************************************************************//**
206 			@short		return a reference to a static mutex
207 			@descr		These class use his own static mutex to be threadsafe.
208 						We create a static mutex only for one ime and use at different times.
209 
210 			@seealso	-
211 
212 			@param		-
213 			@return		A reference to a static mutex member.
214 
215 			@onerror	-
216 		*//*-*****************************************************************************************************/
217 		SVT_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex();
218 
219 	//-------------------------------------------------------------------------------------------------------------
220 	//	private member
221 	//-------------------------------------------------------------------------------------------------------------
222 
223 	private:
224 
225 		/*Attention
226 
227 			Don't initialize these static member in these header!
228 			a) Double dfined symbols will be detected ...
229 			b) and unresolved externals exist at linking time.
230 			Do it in your source only.
231 		 */
232 
233     	static SvtOptionsDrawinglayer_Impl*		m_pDataContainer	;	/// impl. data container as dynamic pointer for smaller memory requirements!
234 		static sal_Int32						m_nRefCount			;	/// internal ref count mechanism
235 
236 };		// class SvtOptionsDrawinglayer
237 
238 #endif	// #ifndef INCLUDED_SVTOOLS_OPTIONSDRAWINGLAYER_HXX
239