xref: /AOO41X/main/sw/source/ui/config/viewopt.cxx (revision 4772d9af2982d09413f91b3bb1d641db3b938dc3)
1efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3efeef26fSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4efeef26fSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5efeef26fSAndrew Rist  * distributed with this work for additional information
6efeef26fSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7efeef26fSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8efeef26fSAndrew Rist  * "License"); you may not use this file except in compliance
9efeef26fSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11efeef26fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13efeef26fSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14efeef26fSAndrew Rist  * software distributed under the License is distributed on an
15efeef26fSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16efeef26fSAndrew Rist  * KIND, either express or implied.  See the License for the
17efeef26fSAndrew Rist  * specific language governing permissions and limitations
18efeef26fSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20efeef26fSAndrew Rist  *************************************************************/
21efeef26fSAndrew Rist 
22efeef26fSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include <svx/htmlmode.hxx>
29cdf0e10cSrcweir #include <svtools/htmlcfg.hxx>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #ifndef _SVX_SVXIDS_HRC //autogen
32cdf0e10cSrcweir #include <svx/svxids.hrc>
33cdf0e10cSrcweir #endif
34cdf0e10cSrcweir #include <editeng/svxenum.hxx>
35cdf0e10cSrcweir #include <editeng/svxacorr.hxx>
36cdf0e10cSrcweir #include <unotools/localedatawrapper.hxx>
37cdf0e10cSrcweir #ifndef _REGION_HXX //autogen
38cdf0e10cSrcweir #include <vcl/region.hxx>
39cdf0e10cSrcweir #endif
40cdf0e10cSrcweir #ifndef _OUTDEV_HXX //autogen
41cdf0e10cSrcweir #include <vcl/outdev.hxx>
42cdf0e10cSrcweir #endif
43cdf0e10cSrcweir #include <vcl/window.hxx>
44cdf0e10cSrcweir #include <swmodule.hxx>
45cdf0e10cSrcweir #include <swtypes.hxx>
46cdf0e10cSrcweir #include <viewopt.hxx>
47cdf0e10cSrcweir #ifndef _WDOCSH_HXX
48cdf0e10cSrcweir #include <wdocsh.hxx>
49cdf0e10cSrcweir #endif
50cdf0e10cSrcweir #include <swrect.hxx>
51cdf0e10cSrcweir #include <crstate.hxx>
52cdf0e10cSrcweir #include <svtools/colorcfg.hxx>
53cdf0e10cSrcweir #include <svtools/accessibilityoptions.hxx>
54cdf0e10cSrcweir #include <unotools/syslocale.hxx>
55cdf0e10cSrcweir 
56cdf0e10cSrcweir #include <editeng/acorrcfg.hxx>
57cdf0e10cSrcweir 
58cdf0e10cSrcweir #ifdef DBG_UTIL
59cdf0e10cSrcweir sal_Bool   SwViewOption::bTest9 = sal_False;		//DrawingLayerNotLoading
60cdf0e10cSrcweir #endif
61cdf0e10cSrcweir Color SwViewOption::aDocBoundColor(COL_LIGHTGRAY);
62cdf0e10cSrcweir Color SwViewOption::aObjectBoundColor(COL_LIGHTGRAY);
63cdf0e10cSrcweir Color SwViewOption::aDocColor(COL_LIGHTGRAY);
64cdf0e10cSrcweir Color SwViewOption::aAppBackgroundColor(COL_LIGHTGRAY);
65cdf0e10cSrcweir Color SwViewOption::aTableBoundColor(COL_LIGHTGRAY);
66cdf0e10cSrcweir Color SwViewOption::aIndexShadingsColor(COL_LIGHTGRAY);
67cdf0e10cSrcweir Color SwViewOption::aLinksColor(COL_BLUE);
68cdf0e10cSrcweir Color SwViewOption::aVisitedLinksColor(COL_RED);
69cdf0e10cSrcweir Color SwViewOption::aDirectCursorColor(COL_BLUE);
70cdf0e10cSrcweir Color SwViewOption::aTextGridColor(COL_LIGHTGRAY);
71cdf0e10cSrcweir Color SwViewOption::aSpellColor(COL_LIGHTRED);
72cdf0e10cSrcweir Color SwViewOption::aSmarttagColor(COL_LIGHTMAGENTA);
73cdf0e10cSrcweir Color SwViewOption::aFontColor(COL_BLACK);
74cdf0e10cSrcweir Color SwViewOption::aFieldShadingsColor(COL_LIGHTGRAY);
75cdf0e10cSrcweir Color SwViewOption::aSectionBoundColor(COL_LIGHTGRAY);
76cdf0e10cSrcweir Color SwViewOption::aPageBreakColor(COL_BLUE);
77cdf0e10cSrcweir Color SwViewOption::aScriptIndicatorColor(COL_GREEN);
78cdf0e10cSrcweir 
79cdf0e10cSrcweir sal_Int32 SwViewOption::nAppearanceFlags = VIEWOPT_DOC_BOUNDARIES|VIEWOPT_OBJECT_BOUNDARIES;
80cdf0e10cSrcweir sal_uInt16 SwViewOption::nPixelTwips = 0;   //ein Pixel auf dem Bildschirm
81cdf0e10cSrcweir 
82cdf0e10cSrcweir 
83cdf0e10cSrcweir #define LINEBREAK_SIZE 12, 8
84cdf0e10cSrcweir #define TAB_SIZE 12, 6
85cdf0e10cSrcweir 
86cdf0e10cSrcweir #define MIN_BLANKWIDTH		 40
87cdf0e10cSrcweir #define MIN_BLANKHEIGHT 	 40
88cdf0e10cSrcweir #define MIN_TABWIDTH		120
89cdf0e10cSrcweir #define MIN_TABHEIGHT		200
90cdf0e10cSrcweir 
91cdf0e10cSrcweir static const char __FAR_DATA aPostItStr[] = "  ";
92cdf0e10cSrcweir 
93cdf0e10cSrcweir /*************************************************************************
94cdf0e10cSrcweir  *					  SwViewOption::IsEqualFlags()
95cdf0e10cSrcweir  *************************************************************************/
96cdf0e10cSrcweir 
97cdf0e10cSrcweir sal_Bool SwViewOption::IsEqualFlags( const SwViewOption &rOpt ) const
98cdf0e10cSrcweir {
99cdf0e10cSrcweir 	return	nCoreOptions == rOpt.nCoreOptions
100cdf0e10cSrcweir 			&& nCore2Options == rOpt.nCore2Options
101cdf0e10cSrcweir 			&& aSnapSize	== rOpt.aSnapSize
102cdf0e10cSrcweir             && mnViewLayoutColumns == rOpt.mnViewLayoutColumns
103cdf0e10cSrcweir 			&& nDivisionX	== rOpt.GetDivisionX()
104cdf0e10cSrcweir 			&& nDivisionY	== rOpt.GetDivisionY()
105cdf0e10cSrcweir 			&& nPagePrevRow == rOpt.GetPagePrevRow()
106cdf0e10cSrcweir 			&& nPagePrevCol == rOpt.GetPagePrevCol()
107cdf0e10cSrcweir 			&& aRetoucheColor == rOpt.GetRetoucheColor()
108cdf0e10cSrcweir             && mbFormView == rOpt.IsFormView()
109cdf0e10cSrcweir             && mbBrowseMode == rOpt.getBrowseMode()
110cdf0e10cSrcweir             && mbViewLayoutBookMode == rOpt.mbViewLayoutBookMode
111cdf0e10cSrcweir             && bShowPlaceHolderFields == rOpt.bShowPlaceHolderFields
112cdf0e10cSrcweir             && bIdle == rOpt.bIdle
113cdf0e10cSrcweir #ifdef DBG_UTIL
114cdf0e10cSrcweir 			// korrespondieren zu den Angaben in ui/config/cfgvw.src
115cdf0e10cSrcweir 			&& bTest1 == rOpt.IsTest1()
116cdf0e10cSrcweir 			&& bTest2 == rOpt.IsTest2()
117cdf0e10cSrcweir 			&& bTest3 == rOpt.IsTest3()
118cdf0e10cSrcweir 			&& bTest4 == rOpt.IsTest4()
119cdf0e10cSrcweir 			&& bTest5 == rOpt.IsTest5()
120cdf0e10cSrcweir 			&& bTest6 == rOpt.IsTest6()
121cdf0e10cSrcweir 			&& bTest7 == rOpt.IsTest7()
122cdf0e10cSrcweir 			&& bTest8 == rOpt.IsTest8()
123cdf0e10cSrcweir 			&& bTest10 == rOpt.IsTest10()
124cdf0e10cSrcweir #endif
125cdf0e10cSrcweir 			;
126cdf0e10cSrcweir }
127cdf0e10cSrcweir 
128cdf0e10cSrcweir /*************************************************************************
129cdf0e10cSrcweir  *					  SwViewOption::DrawRect()
130cdf0e10cSrcweir  *************************************************************************/
131cdf0e10cSrcweir 
132cdf0e10cSrcweir void SwViewOption::DrawRect( OutputDevice *pOut,
133cdf0e10cSrcweir 							 const SwRect &rRect, long nCol ) const
134cdf0e10cSrcweir {
135cdf0e10cSrcweir 	if ( pOut->GetOutDevType() != OUTDEV_PRINTER )
136cdf0e10cSrcweir 	{
137cdf0e10cSrcweir 		const Color aCol( nCol );
138cdf0e10cSrcweir 		const Color aOldColor( pOut->GetFillColor() );
139cdf0e10cSrcweir 		pOut->SetFillColor( aCol );
140cdf0e10cSrcweir 		pOut->DrawRect( rRect.SVRect() );
141cdf0e10cSrcweir 		pOut->SetFillColor( aOldColor );
142cdf0e10cSrcweir 	}
143cdf0e10cSrcweir 	else
144cdf0e10cSrcweir 		DrawRectPrinter( pOut, rRect );
145cdf0e10cSrcweir }
146cdf0e10cSrcweir 
147cdf0e10cSrcweir /*************************************************************************
148cdf0e10cSrcweir  *					  SwViewOption::DrawRectPrinter()
149cdf0e10cSrcweir  *************************************************************************/
150cdf0e10cSrcweir 
151cdf0e10cSrcweir void SwViewOption::DrawRectPrinter( OutputDevice *pOut,
152cdf0e10cSrcweir 									const SwRect &rRect ) const
153cdf0e10cSrcweir {
154cdf0e10cSrcweir 	Color aOldColor(pOut->GetLineColor());
155cdf0e10cSrcweir 	Color aOldFillColor( pOut->GetFillColor() );
156cdf0e10cSrcweir 	pOut->SetLineColor( Color(COL_BLACK) );
157cdf0e10cSrcweir 	pOut->SetFillColor( Color(COL_TRANSPARENT ));
158cdf0e10cSrcweir 	pOut->DrawRect( rRect.SVRect() );
159cdf0e10cSrcweir 	pOut->SetFillColor( aOldFillColor );
160cdf0e10cSrcweir 	pOut->SetLineColor( aOldColor );
161cdf0e10cSrcweir }
162cdf0e10cSrcweir 
163cdf0e10cSrcweir /*************************************************************************
164cdf0e10cSrcweir  *					  SwViewOption::GetPostItsWidth()
165cdf0e10cSrcweir  *************************************************************************/
166cdf0e10cSrcweir 
167cdf0e10cSrcweir sal_uInt16 SwViewOption::GetPostItsWidth( const OutputDevice *pOut ) const
168cdf0e10cSrcweir {
169cdf0e10cSrcweir 	ASSERT( pOut, "no Outdev" );
170cdf0e10cSrcweir 	return sal_uInt16(pOut->GetTextWidth( String::CreateFromAscii(aPostItStr )));
171cdf0e10cSrcweir }
172cdf0e10cSrcweir 
173cdf0e10cSrcweir /*************************************************************************
174cdf0e10cSrcweir  *					  SwViewOption::PaintPostIts()
175cdf0e10cSrcweir  *************************************************************************/
176cdf0e10cSrcweir 
177cdf0e10cSrcweir void SwViewOption::PaintPostIts( OutputDevice *pOut, const SwRect &rRect, sal_Bool bIsScript ) const
178cdf0e10cSrcweir {
179cdf0e10cSrcweir 	if( pOut && bIsScript )
180cdf0e10cSrcweir 	{
181cdf0e10cSrcweir         	Color aOldLineColor( pOut->GetLineColor() );
182cdf0e10cSrcweir 		pOut->SetLineColor( Color(COL_GRAY ) );
183cdf0e10cSrcweir 		// Wir ziehen ueberall zwei Pixel ab, damit es schick aussieht
184cdf0e10cSrcweir 		sal_uInt16 nPix = GetPixelTwips() * 2;
185cdf0e10cSrcweir 		if( rRect.Width() <= 2 * nPix || rRect.Height() <= 2 * nPix )
186cdf0e10cSrcweir 			nPix = 0;
187cdf0e10cSrcweir 		const Point aTopLeft(  rRect.Left()  + nPix, rRect.Top()	+ nPix );
188cdf0e10cSrcweir 		const Point aBotRight( rRect.Right() - nPix, rRect.Bottom() - nPix );
189cdf0e10cSrcweir 		const SwRect aRect( aTopLeft, aBotRight );
190cdf0e10cSrcweir         DrawRect( pOut, aRect, aScriptIndicatorColor.GetColor() );
191cdf0e10cSrcweir 	pOut->SetLineColor( aOldLineColor );
192cdf0e10cSrcweir 	}
193cdf0e10cSrcweir }
194cdf0e10cSrcweir 
195cdf0e10cSrcweir 
196cdf0e10cSrcweir /*************************************************************************
197cdf0e10cSrcweir |*
198cdf0e10cSrcweir |*	ViewOption::ViewOption()
199cdf0e10cSrcweir |*
200cdf0e10cSrcweir |*	Letzte Aenderung	MA 04. Aug. 93
201cdf0e10cSrcweir |*
202cdf0e10cSrcweir |*************************************************************************/
203cdf0e10cSrcweir 
204cdf0e10cSrcweir SwViewOption::SwViewOption() :
205cdf0e10cSrcweir     aRetoucheColor( COL_TRANSPARENT ),
206cdf0e10cSrcweir     mnViewLayoutColumns( 0 ),
207cdf0e10cSrcweir     nPagePrevRow( 1 ),
208cdf0e10cSrcweir     nPagePrevCol( 2 ),
209cdf0e10cSrcweir     nShdwCrsrFillMode( FILL_TAB ),
210cdf0e10cSrcweir     bReadonly(sal_False),
211cdf0e10cSrcweir     bStarOneSetting(sal_False),
212cdf0e10cSrcweir     bIsPagePreview(sal_False),
213cdf0e10cSrcweir     bSelectionInReadonly(sal_False),
214cdf0e10cSrcweir     mbFormView(sal_False),
215cdf0e10cSrcweir 	mbBrowseMode(sal_False),
216cdf0e10cSrcweir     mbBookView(sal_False),
217cdf0e10cSrcweir     mbViewLayoutBookMode(sal_False),
218cdf0e10cSrcweir     bShowPlaceHolderFields( sal_True ),
219cdf0e10cSrcweir 
220cdf0e10cSrcweir     nZoom( 100 ),
221cdf0e10cSrcweir     eZoom( SVX_ZOOM_PERCENT ),
222cdf0e10cSrcweir     nTblDest(TBL_DEST_CELL)
223cdf0e10cSrcweir {
224cdf0e10cSrcweir 	// Initialisierung ist jetzt etwas einfacher
225cdf0e10cSrcweir 	// alle Bits auf 0
226*4772d9afSArmin Le Grand     nCoreOptions =
227*4772d9afSArmin Le Grand         VIEWOPT_1_HARDBLANK |
228*4772d9afSArmin Le Grand         VIEWOPT_1_SOFTHYPH |
229cdf0e10cSrcweir         VIEWOPT_1_REF |
230cdf0e10cSrcweir         VIEWOPT_1_GRAPHIC |
231*4772d9afSArmin Le Grand         VIEWOPT_1_TABLE |
232*4772d9afSArmin Le Grand         VIEWOPT_1_DRAW |
233*4772d9afSArmin Le Grand         VIEWOPT_1_CONTROL |
234cdf0e10cSrcweir         VIEWOPT_1_PAGEBACK |
235*4772d9afSArmin Le Grand         VIEWOPT_1_SOLIDMARKHDL | // default is enhanced handles
236*4772d9afSArmin Le Grand         VIEWOPT_1_POSTITS;
237*4772d9afSArmin Le Grand 
238*4772d9afSArmin Le Grand     nCore2Options =
239*4772d9afSArmin Le Grand         VIEWOPT_CORE2_BLACKFONT |
240*4772d9afSArmin Le Grand         VIEWOPT_CORE2_HIDDENPARA |
241*4772d9afSArmin Le Grand         VIEWOPT_CORE2_BIGMARKHDL; // default is big handles
242*4772d9afSArmin Le Grand 
243*4772d9afSArmin Le Grand     nUIOptions =
244*4772d9afSArmin Le Grand         VIEWOPT_2_MODIFIED |
245*4772d9afSArmin Le Grand         VIEWOPT_2_GRFKEEPZOOM |
246*4772d9afSArmin Le Grand         VIEWOPT_2_ANY_RULER;
247cdf0e10cSrcweir 
248cdf0e10cSrcweir 	if(MEASURE_METRIC != SvtSysLocale().GetLocaleData().getMeasurementSystemEnum())
249cdf0e10cSrcweir 		aSnapSize.Width() = aSnapSize.Height() = 720;	// 1/2"
250cdf0e10cSrcweir 	else
251cdf0e10cSrcweir 		aSnapSize.Width() = aSnapSize.Height() = 567;	// 1 cm
252cdf0e10cSrcweir 	nDivisionX = nDivisionY = 1;
253cdf0e10cSrcweir 
254cdf0e10cSrcweir     bSelectionInReadonly = SW_MOD()->GetAccessibilityOptions().IsSelectionInReadonly();
255cdf0e10cSrcweir 
256cdf0e10cSrcweir     bIdle = true;
257cdf0e10cSrcweir 
258cdf0e10cSrcweir #ifdef DBG_UTIL
259cdf0e10cSrcweir 	// korrespondieren zu den Angaben in ui/config/cfgvw.src
260cdf0e10cSrcweir 	bTest1 = bTest2 = bTest3 = bTest4 =
261cdf0e10cSrcweir 			 bTest5 = bTest6 = bTest7 = bTest8 = bTest10 = sal_False;
262cdf0e10cSrcweir #endif
263cdf0e10cSrcweir }
264cdf0e10cSrcweir 
265cdf0e10cSrcweir SwViewOption::SwViewOption(const SwViewOption& rVOpt)
266cdf0e10cSrcweir {
267cdf0e10cSrcweir 	bReadonly = sal_False;
268cdf0e10cSrcweir     bSelectionInReadonly = sal_False;
269cdf0e10cSrcweir     // --> FME 2004-06-29 #114856# Formular view
270cdf0e10cSrcweir     mbFormView       = rVOpt.mbFormView;
271cdf0e10cSrcweir     // <--
272cdf0e10cSrcweir     nZoom           = rVOpt.nZoom       ;
273cdf0e10cSrcweir 	aSnapSize   	= rVOpt.aSnapSize   ;
274cdf0e10cSrcweir     mnViewLayoutColumns = rVOpt.mnViewLayoutColumns ;
275cdf0e10cSrcweir 	nDivisionX  	= rVOpt.nDivisionX  ;
276cdf0e10cSrcweir 	nDivisionY  	= rVOpt.nDivisionY  ;
277cdf0e10cSrcweir 	nPagePrevRow	= rVOpt.nPagePrevRow;
278cdf0e10cSrcweir 	nPagePrevCol	= rVOpt.nPagePrevCol;
279cdf0e10cSrcweir     bIsPagePreview  = rVOpt.bIsPagePreview;
280cdf0e10cSrcweir 	eZoom      		= rVOpt.eZoom       ;
281cdf0e10cSrcweir 	nTblDest    	= rVOpt.nTblDest    ;
282cdf0e10cSrcweir 	nUIOptions		= rVOpt.nUIOptions  ;
283cdf0e10cSrcweir 	nCoreOptions	= rVOpt.nCoreOptions  ;
284cdf0e10cSrcweir 	nCore2Options	= rVOpt.nCore2Options  ;
285cdf0e10cSrcweir 	aRetoucheColor	= rVOpt.GetRetoucheColor();
286cdf0e10cSrcweir 	sSymbolFont 	= rVOpt.sSymbolFont;
287cdf0e10cSrcweir 	nShdwCrsrFillMode = rVOpt.nShdwCrsrFillMode;
288cdf0e10cSrcweir 	bStarOneSetting = rVOpt.bStarOneSetting;
289cdf0e10cSrcweir 	mbBookView	    = rVOpt.mbBookView;
290cdf0e10cSrcweir 	mbBrowseMode	= rVOpt.mbBrowseMode;
291cdf0e10cSrcweir     mbViewLayoutBookMode = rVOpt.mbViewLayoutBookMode;
292cdf0e10cSrcweir     bShowPlaceHolderFields = rVOpt.bShowPlaceHolderFields;
293cdf0e10cSrcweir     bIdle           = rVOpt.bIdle;
294cdf0e10cSrcweir 
295cdf0e10cSrcweir #ifdef DBG_UTIL
296cdf0e10cSrcweir 	bTest1          = rVOpt.bTest1      ;
297cdf0e10cSrcweir 	bTest2          = rVOpt.bTest2      ;
298cdf0e10cSrcweir 	bTest3          = rVOpt.bTest3      ;
299cdf0e10cSrcweir 	bTest4          = rVOpt.bTest4      ;
300cdf0e10cSrcweir 	bTest5          = rVOpt.bTest5      ;
301cdf0e10cSrcweir 	bTest6          = rVOpt.bTest6      ;
302cdf0e10cSrcweir 	bTest7          = rVOpt.bTest7      ;
303cdf0e10cSrcweir 	bTest8          = rVOpt.bTest8      ;
304cdf0e10cSrcweir 	bTest10         = rVOpt.bTest10     ;
305cdf0e10cSrcweir #endif
306cdf0e10cSrcweir }
307cdf0e10cSrcweir 
308cdf0e10cSrcweir 
309cdf0e10cSrcweir SwViewOption& SwViewOption::operator=( const SwViewOption &rVOpt )
310cdf0e10cSrcweir {
311cdf0e10cSrcweir     // --> DVO FME 2004-06-29 #114856# Formular view
312cdf0e10cSrcweir     mbFormView       = rVOpt.mbFormView   ;
313cdf0e10cSrcweir     // <--
314cdf0e10cSrcweir 	nZoom   		= rVOpt.nZoom   	;
315cdf0e10cSrcweir 	aSnapSize   	= rVOpt.aSnapSize   ;
316cdf0e10cSrcweir     mnViewLayoutColumns = rVOpt.mnViewLayoutColumns ;
317cdf0e10cSrcweir 	nDivisionX  	= rVOpt.nDivisionX  ;
318cdf0e10cSrcweir 	nDivisionY  	= rVOpt.nDivisionY  ;
319cdf0e10cSrcweir 	nPagePrevRow	= rVOpt.nPagePrevRow;
320cdf0e10cSrcweir 	nPagePrevCol	= rVOpt.nPagePrevCol;
321cdf0e10cSrcweir     bIsPagePreview  = rVOpt.bIsPagePreview;
322cdf0e10cSrcweir 	eZoom      		= rVOpt.eZoom       ;
323cdf0e10cSrcweir 	nTblDest    	= rVOpt.nTblDest    ;
324cdf0e10cSrcweir 	nUIOptions		= rVOpt.nUIOptions  ;
325cdf0e10cSrcweir 	nCoreOptions	= rVOpt.nCoreOptions;
326cdf0e10cSrcweir 	nCore2Options	= rVOpt.nCore2Options;
327cdf0e10cSrcweir 	aRetoucheColor	= rVOpt.GetRetoucheColor();
328cdf0e10cSrcweir 	sSymbolFont 	= rVOpt.sSymbolFont;
329cdf0e10cSrcweir 	nShdwCrsrFillMode = rVOpt.nShdwCrsrFillMode;
330cdf0e10cSrcweir 	bStarOneSetting = rVOpt.bStarOneSetting;
331cdf0e10cSrcweir 	mbBookView	    = rVOpt.mbBookView;
332cdf0e10cSrcweir 	mbBrowseMode	= rVOpt.mbBrowseMode;
333cdf0e10cSrcweir     mbViewLayoutBookMode = rVOpt.mbViewLayoutBookMode;
334cdf0e10cSrcweir     bShowPlaceHolderFields = rVOpt.bShowPlaceHolderFields;
335cdf0e10cSrcweir     bIdle           = rVOpt.bIdle;
336cdf0e10cSrcweir 
337cdf0e10cSrcweir #ifdef DBG_UTIL
338cdf0e10cSrcweir 	bTest1          = rVOpt.bTest1      ;
339cdf0e10cSrcweir 	bTest2          = rVOpt.bTest2      ;
340cdf0e10cSrcweir 	bTest3          = rVOpt.bTest3      ;
341cdf0e10cSrcweir 	bTest4          = rVOpt.bTest4      ;
342cdf0e10cSrcweir 	bTest5          = rVOpt.bTest5      ;
343cdf0e10cSrcweir 	bTest6          = rVOpt.bTest6      ;
344cdf0e10cSrcweir 	bTest7          = rVOpt.bTest7      ;
345cdf0e10cSrcweir 	bTest8          = rVOpt.bTest8      ;
346cdf0e10cSrcweir 	bTest10         = rVOpt.bTest10     ;
347cdf0e10cSrcweir #endif
348cdf0e10cSrcweir 	return *this;
349cdf0e10cSrcweir }
350cdf0e10cSrcweir 
351cdf0e10cSrcweir 
352cdf0e10cSrcweir SwViewOption::~SwViewOption()
353cdf0e10cSrcweir {
354cdf0e10cSrcweir }
355cdf0e10cSrcweir 
356cdf0e10cSrcweir /*************************************************************************
357cdf0e10cSrcweir |*
358cdf0e10cSrcweir |*	ViewOption::Init()
359cdf0e10cSrcweir |*
360cdf0e10cSrcweir |*	Letzte Aenderung	MA 04. Aug. 93
361cdf0e10cSrcweir |*
362cdf0e10cSrcweir |*************************************************************************/
363cdf0e10cSrcweir 
364cdf0e10cSrcweir void SwViewOption::Init( Window *pWin )
365cdf0e10cSrcweir {
366cdf0e10cSrcweir 	if( !nPixelTwips && pWin )
367cdf0e10cSrcweir 	{
368cdf0e10cSrcweir 		nPixelTwips = (sal_uInt16)pWin->PixelToLogic( Size(1,1) ).Height();
369cdf0e10cSrcweir 	}
370cdf0e10cSrcweir }
371cdf0e10cSrcweir 
372cdf0e10cSrcweir sal_Bool SwViewOption::IsAutoCompleteWords() const
373cdf0e10cSrcweir {
374cdf0e10cSrcweir 	const SvxSwAutoFmtFlags& rFlags = SvxAutoCorrCfg::Get()->GetAutoCorrect()->GetSwFlags();
375cdf0e10cSrcweir 	return /*rFlags.bAutoCompleteWords &&*/ rFlags.bAutoCmpltCollectWords;
376cdf0e10cSrcweir }
377cdf0e10cSrcweir 
378cdf0e10cSrcweir /*************************************************************************/
379cdf0e10cSrcweir /*                                                                       */
380cdf0e10cSrcweir /*************************************************************************/
381cdf0e10cSrcweir 
382cdf0e10cSrcweir AuthorCharAttr::AuthorCharAttr() :
383cdf0e10cSrcweir 	nItemId	(SID_ATTR_CHAR_UNDERLINE),
384cdf0e10cSrcweir 	nAttr	(UNDERLINE_SINGLE),
385cdf0e10cSrcweir 	nColor	(COL_TRANSPARENT)
386cdf0e10cSrcweir {
387cdf0e10cSrcweir }
388cdf0e10cSrcweir 
389cdf0e10cSrcweir /*-----------------07.01.97 13.50-------------------
390cdf0e10cSrcweir 
391cdf0e10cSrcweir --------------------------------------------------*/
392cdf0e10cSrcweir 
393cdf0e10cSrcweir sal_uInt16		GetHtmlMode(const SwDocShell* pShell)
394cdf0e10cSrcweir {
395cdf0e10cSrcweir 	sal_uInt16 nRet = 0;
396cdf0e10cSrcweir 	if(!pShell || PTR_CAST(SwWebDocShell, pShell))
397cdf0e10cSrcweir 	{
398cdf0e10cSrcweir 		nRet = HTMLMODE_ON;
399cdf0e10cSrcweir 		SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get();
400cdf0e10cSrcweir 		switch ( pHtmlOpt->GetExportMode() )
401cdf0e10cSrcweir 		{
402cdf0e10cSrcweir 			case HTML_CFG_MSIE_40:
403cdf0e10cSrcweir 				nRet |= HTMLMODE_PARA_BORDER|HTMLMODE_SMALL_CAPS|
404cdf0e10cSrcweir 						HTMLMODE_SOME_STYLES|
405cdf0e10cSrcweir 						HTMLMODE_FULL_STYLES|HTMLMODE_GRAPH_POS|
406cdf0e10cSrcweir 						HTMLMODE_FULL_ABS_POS|HTMLMODE_SOME_ABS_POS;
407cdf0e10cSrcweir 			break;
408cdf0e10cSrcweir 			case HTML_CFG_NS40:
409cdf0e10cSrcweir 				nRet |= HTMLMODE_PARA_BORDER|HTMLMODE_SOME_STYLES|
410cdf0e10cSrcweir 						HTMLMODE_FRM_COLUMNS|HTMLMODE_BLINK|HTMLMODE_GRAPH_POS|
411cdf0e10cSrcweir 						HTMLMODE_SOME_ABS_POS;
412cdf0e10cSrcweir 			break;
413cdf0e10cSrcweir 			case HTML_CFG_WRITER:
414cdf0e10cSrcweir 				nRet |= HTMLMODE_PARA_BORDER|HTMLMODE_SMALL_CAPS|
415cdf0e10cSrcweir 						HTMLMODE_SOME_STYLES|
416cdf0e10cSrcweir 						HTMLMODE_FRM_COLUMNS|HTMLMODE_FULL_STYLES|
417cdf0e10cSrcweir 						HTMLMODE_BLINK|HTMLMODE_DROPCAPS|HTMLMODE_GRAPH_POS|
418cdf0e10cSrcweir 						HTMLMODE_FULL_ABS_POS|HTMLMODE_SOME_ABS_POS;
419cdf0e10cSrcweir 			break;
420cdf0e10cSrcweir 			case HTML_CFG_HTML32:
421cdf0e10cSrcweir 			break;
422cdf0e10cSrcweir 		}
423cdf0e10cSrcweir 	}
424cdf0e10cSrcweir 	return nRet;
425cdf0e10cSrcweir }
426cdf0e10cSrcweir /* -----------------------------24.04.2002 10:20------------------------------
427cdf0e10cSrcweir 
428cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
429cdf0e10cSrcweir Color&   SwViewOption::GetDocColor()
430cdf0e10cSrcweir {
431cdf0e10cSrcweir     return aDocColor;
432cdf0e10cSrcweir }
433cdf0e10cSrcweir /* -----------------------------23.04.2002 17:18------------------------------
434cdf0e10cSrcweir 
435cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
436cdf0e10cSrcweir Color&   SwViewOption::GetDocBoundariesColor()
437cdf0e10cSrcweir {
438cdf0e10cSrcweir     return aDocBoundColor;
439cdf0e10cSrcweir }
440cdf0e10cSrcweir /* -----------------------------23.04.2002 17:53------------------------------
441cdf0e10cSrcweir 
442cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
443cdf0e10cSrcweir Color&   SwViewOption::GetObjectBoundariesColor()
444cdf0e10cSrcweir {
445cdf0e10cSrcweir     return aObjectBoundColor;
446cdf0e10cSrcweir }
447cdf0e10cSrcweir /* -----------------------------24.04.2002 10:41------------------------------
448cdf0e10cSrcweir 
449cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
450cdf0e10cSrcweir Color& SwViewOption::GetAppBackgroundColor()
451cdf0e10cSrcweir {
452cdf0e10cSrcweir     return aAppBackgroundColor;
453cdf0e10cSrcweir }
454cdf0e10cSrcweir /*-- 24.04.2002 10:50:11---------------------------------------------------
455cdf0e10cSrcweir 
456cdf0e10cSrcweir   -----------------------------------------------------------------------*/
457cdf0e10cSrcweir Color&   SwViewOption::GetTableBoundariesColor()
458cdf0e10cSrcweir {
459cdf0e10cSrcweir     return aTableBoundColor;
460cdf0e10cSrcweir }
461cdf0e10cSrcweir /*-- 24.04.2002 10:50:12---------------------------------------------------
462cdf0e10cSrcweir 
463cdf0e10cSrcweir   -----------------------------------------------------------------------*/
464cdf0e10cSrcweir Color&   SwViewOption::GetIndexShadingsColor()
465cdf0e10cSrcweir {
466cdf0e10cSrcweir     return aIndexShadingsColor;
467cdf0e10cSrcweir }
468cdf0e10cSrcweir /*-- 24.04.2002 10:50:12---------------------------------------------------
469cdf0e10cSrcweir 
470cdf0e10cSrcweir   -----------------------------------------------------------------------*/
471cdf0e10cSrcweir Color&   SwViewOption::GetLinksColor()
472cdf0e10cSrcweir {
473cdf0e10cSrcweir     return aLinksColor;
474cdf0e10cSrcweir }
475cdf0e10cSrcweir /*-- 24.04.2002 10:50:13---------------------------------------------------
476cdf0e10cSrcweir 
477cdf0e10cSrcweir   -----------------------------------------------------------------------*/
478cdf0e10cSrcweir Color&   SwViewOption::GetVisitedLinksColor()
479cdf0e10cSrcweir {
480cdf0e10cSrcweir     return aVisitedLinksColor;
481cdf0e10cSrcweir }
482cdf0e10cSrcweir /*-- 24.04.2002 10:50:13---------------------------------------------------
483cdf0e10cSrcweir 
484cdf0e10cSrcweir   -----------------------------------------------------------------------*/
485cdf0e10cSrcweir Color&   SwViewOption::GetDirectCursorColor()
486cdf0e10cSrcweir {
487cdf0e10cSrcweir     return aDirectCursorColor;
488cdf0e10cSrcweir }
489cdf0e10cSrcweir /*-- 24.04.2002 10:50:14---------------------------------------------------
490cdf0e10cSrcweir 
491cdf0e10cSrcweir   -----------------------------------------------------------------------*/
492cdf0e10cSrcweir Color&   SwViewOption::GetTextGridColor()
493cdf0e10cSrcweir {
494cdf0e10cSrcweir     return aTextGridColor;
495cdf0e10cSrcweir }
496cdf0e10cSrcweir /*-- 24.04.2002 10:50:14---------------------------------------------------
497cdf0e10cSrcweir 
498cdf0e10cSrcweir   -----------------------------------------------------------------------*/
499cdf0e10cSrcweir Color&   SwViewOption::GetSpellColor()
500cdf0e10cSrcweir {
501cdf0e10cSrcweir     return aSpellColor;
502cdf0e10cSrcweir }
503cdf0e10cSrcweir /*-- 24.04.2007 10:50:14---------------------------------------------------
504cdf0e10cSrcweir 
505cdf0e10cSrcweir   -----------------------------------------------------------------------*/
506cdf0e10cSrcweir Color&   SwViewOption::GetSmarttagColor()
507cdf0e10cSrcweir {
508cdf0e10cSrcweir     return aSmarttagColor;
509cdf0e10cSrcweir }
510cdf0e10cSrcweir /*-- 06.12.2002 10:50:11---------------------------------------------------
511cdf0e10cSrcweir 
512cdf0e10cSrcweir   -----------------------------------------------------------------------*/
513cdf0e10cSrcweir Color&   SwViewOption::GetFontColor()
514cdf0e10cSrcweir {
515cdf0e10cSrcweir     return aFontColor;
516cdf0e10cSrcweir }
517cdf0e10cSrcweir /*-- 24.04.2002 10:50:15---------------------------------------------------
518cdf0e10cSrcweir 
519cdf0e10cSrcweir   -----------------------------------------------------------------------*/
520cdf0e10cSrcweir Color&   SwViewOption::GetFieldShadingsColor()
521cdf0e10cSrcweir {
522cdf0e10cSrcweir     return aFieldShadingsColor;
523cdf0e10cSrcweir }
524cdf0e10cSrcweir /*-- 24.04.2002 10:50:15---------------------------------------------------
525cdf0e10cSrcweir 
526cdf0e10cSrcweir   -----------------------------------------------------------------------*/
527cdf0e10cSrcweir Color&   SwViewOption::GetSectionBoundColor()
528cdf0e10cSrcweir {
529cdf0e10cSrcweir     return aSectionBoundColor;
530cdf0e10cSrcweir }
531cdf0e10cSrcweir /* -----------------------------2002/07/31 14:00------------------------------
532cdf0e10cSrcweir 
533cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
534cdf0e10cSrcweir Color& SwViewOption::GetPageBreakColor()
535cdf0e10cSrcweir {
536cdf0e10cSrcweir     return aPageBreakColor;
537cdf0e10cSrcweir }
538cdf0e10cSrcweir 
539cdf0e10cSrcweir /* -----------------------------23.04.2002 17:41------------------------------
540cdf0e10cSrcweir 
541cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
542cdf0e10cSrcweir void SwViewOption::ApplyColorConfigValues(const svtools::ColorConfig& rConfig )
543cdf0e10cSrcweir {
544cdf0e10cSrcweir     aDocColor.SetColor(rConfig.GetColorValue(svtools::DOCCOLOR).nColor);
545cdf0e10cSrcweir 
546cdf0e10cSrcweir     svtools::ColorConfigValue aValue = rConfig.GetColorValue(svtools::DOCBOUNDARIES);
547cdf0e10cSrcweir     aDocBoundColor.SetColor(aValue.nColor);
548cdf0e10cSrcweir     nAppearanceFlags = 0;
549cdf0e10cSrcweir     if(aValue.bIsVisible)
550cdf0e10cSrcweir         nAppearanceFlags |= VIEWOPT_DOC_BOUNDARIES;
551cdf0e10cSrcweir 
552cdf0e10cSrcweir     aAppBackgroundColor.SetColor(rConfig.GetColorValue(svtools::APPBACKGROUND).nColor);
553cdf0e10cSrcweir 
554cdf0e10cSrcweir     aValue = rConfig.GetColorValue(svtools::OBJECTBOUNDARIES);
555cdf0e10cSrcweir     aObjectBoundColor.SetColor(aValue.nColor);
556cdf0e10cSrcweir     if(aValue.bIsVisible)
557cdf0e10cSrcweir         nAppearanceFlags |= VIEWOPT_OBJECT_BOUNDARIES;
558cdf0e10cSrcweir 
559cdf0e10cSrcweir     aValue = rConfig.GetColorValue(svtools::TABLEBOUNDARIES);
560cdf0e10cSrcweir     aTableBoundColor.SetColor(aValue.nColor);
561cdf0e10cSrcweir     if(aValue.bIsVisible)
562cdf0e10cSrcweir         nAppearanceFlags |= VIEWOPT_TABLE_BOUNDARIES;
563cdf0e10cSrcweir 
564cdf0e10cSrcweir     aValue = rConfig.GetColorValue(svtools::WRITERIDXSHADINGS);
565cdf0e10cSrcweir     aIndexShadingsColor.SetColor(aValue.nColor);
566cdf0e10cSrcweir     if(aValue.bIsVisible)
567cdf0e10cSrcweir         nAppearanceFlags |= VIEWOPT_INDEX_SHADINGS;
568cdf0e10cSrcweir 
569cdf0e10cSrcweir     aValue = rConfig.GetColorValue(svtools::LINKS);
570cdf0e10cSrcweir     aLinksColor.SetColor(aValue.nColor);
571cdf0e10cSrcweir     if(aValue.bIsVisible)
572cdf0e10cSrcweir         nAppearanceFlags |= VIEWOPT_LINKS;
573cdf0e10cSrcweir 
574cdf0e10cSrcweir     aValue = rConfig.GetColorValue(svtools::LINKSVISITED);
575cdf0e10cSrcweir     aVisitedLinksColor.SetColor(aValue.nColor);
576cdf0e10cSrcweir     if(aValue.bIsVisible)
577cdf0e10cSrcweir         nAppearanceFlags |= VIEWOPT_VISITED_LINKS;
578cdf0e10cSrcweir 
579cdf0e10cSrcweir     aDirectCursorColor.SetColor(rConfig.GetColorValue(svtools::WRITERDIRECTCURSOR).nColor);
580cdf0e10cSrcweir 
581cdf0e10cSrcweir     aTextGridColor.SetColor(rConfig.GetColorValue(svtools::WRITERTEXTGRID).nColor);
582cdf0e10cSrcweir 
583cdf0e10cSrcweir     aSpellColor.SetColor(rConfig.GetColorValue(svtools::SPELL).nColor);
584cdf0e10cSrcweir 
585cdf0e10cSrcweir     aSmarttagColor.SetColor(rConfig.GetColorValue(svtools::SMARTTAGS).nColor);
586cdf0e10cSrcweir 
587cdf0e10cSrcweir     aFontColor.SetColor(rConfig.GetColorValue(svtools::FONTCOLOR).nColor);
588cdf0e10cSrcweir 
589cdf0e10cSrcweir     aValue = rConfig.GetColorValue(svtools::WRITERFIELDSHADINGS);
590cdf0e10cSrcweir     aFieldShadingsColor.SetColor(aValue.nColor);
591cdf0e10cSrcweir     if(aValue.bIsVisible)
592cdf0e10cSrcweir         nAppearanceFlags |= VIEWOPT_FIELD_SHADINGS;
593cdf0e10cSrcweir 
594cdf0e10cSrcweir     aValue = rConfig.GetColorValue(svtools::WRITERSECTIONBOUNDARIES);
595cdf0e10cSrcweir     aSectionBoundColor.SetColor(aValue.nColor);
596cdf0e10cSrcweir     if(aValue.bIsVisible)
597cdf0e10cSrcweir         nAppearanceFlags |= VIEWOPT_SECTION_BOUNDARIES;
598cdf0e10cSrcweir 
599cdf0e10cSrcweir     aValue = rConfig.GetColorValue(svtools::WRITERPAGEBREAKS);
600cdf0e10cSrcweir     aPageBreakColor.SetColor(aValue.nColor);
601cdf0e10cSrcweir 
602cdf0e10cSrcweir     aScriptIndicatorColor.SetColor(rConfig.GetColorValue(svtools::WRITERSCRIPTINDICATOR).nColor);
603cdf0e10cSrcweir }
604cdf0e10cSrcweir /* -----------------------------23.04.2002 17:48------------------------------
605cdf0e10cSrcweir 
606cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
607cdf0e10cSrcweir void SwViewOption::SetAppearanceFlag(sal_Int32 nFlag, sal_Bool bSet, sal_Bool bSaveInConfig )
608cdf0e10cSrcweir {
609cdf0e10cSrcweir     if(bSet)
610cdf0e10cSrcweir         nAppearanceFlags |= nFlag;
611cdf0e10cSrcweir     else
612cdf0e10cSrcweir         nAppearanceFlags &= ~nFlag;
613cdf0e10cSrcweir     if(bSaveInConfig)
614cdf0e10cSrcweir     {
615cdf0e10cSrcweir         //create an editable svtools::ColorConfig and store the change
616cdf0e10cSrcweir         svtools::EditableColorConfig aEditableConfig;
617cdf0e10cSrcweir         struct FlagToConfig_Impl
618cdf0e10cSrcweir         {
619cdf0e10cSrcweir             sal_Int32               nFlag;
620cdf0e10cSrcweir             svtools::ColorConfigEntry   eEntry;
621cdf0e10cSrcweir         };
622cdf0e10cSrcweir         static const FlagToConfig_Impl aFlags[] =
623cdf0e10cSrcweir         {
624cdf0e10cSrcweir             { VIEWOPT_DOC_BOUNDARIES     ,   svtools::DOCBOUNDARIES },
625cdf0e10cSrcweir             { VIEWOPT_OBJECT_BOUNDARIES  ,   svtools::OBJECTBOUNDARIES },
626cdf0e10cSrcweir             { VIEWOPT_TABLE_BOUNDARIES   ,   svtools::TABLEBOUNDARIES },
627cdf0e10cSrcweir             { VIEWOPT_INDEX_SHADINGS     ,   svtools::WRITERIDXSHADINGS },
628cdf0e10cSrcweir             { VIEWOPT_LINKS              ,   svtools::LINKS },
629cdf0e10cSrcweir             { VIEWOPT_VISITED_LINKS      ,   svtools::LINKSVISITED },
630cdf0e10cSrcweir             { VIEWOPT_FIELD_SHADINGS     ,   svtools::WRITERFIELDSHADINGS },
631cdf0e10cSrcweir             { VIEWOPT_SECTION_BOUNDARIES ,   svtools::WRITERSECTIONBOUNDARIES },
632cdf0e10cSrcweir             { 0                          ,   svtools::ColorConfigEntryCount }
633cdf0e10cSrcweir         };
634cdf0e10cSrcweir         sal_uInt16 nPos = 0;
635cdf0e10cSrcweir         while(aFlags[nPos].nFlag)
636cdf0e10cSrcweir         {
637cdf0e10cSrcweir             if(0 != (nFlag&aFlags[nPos].nFlag))
638cdf0e10cSrcweir             {
639cdf0e10cSrcweir                 svtools::ColorConfigValue aValue = aEditableConfig.GetColorValue(aFlags[nPos].eEntry);
640cdf0e10cSrcweir                 aValue.bIsVisible = bSet;
641cdf0e10cSrcweir                 aEditableConfig.SetColorValue(aFlags[nPos].eEntry, aValue);
642cdf0e10cSrcweir             }
643cdf0e10cSrcweir             nPos++;
644cdf0e10cSrcweir         }
645cdf0e10cSrcweir     }
646cdf0e10cSrcweir }
647cdf0e10cSrcweir /* -----------------------------24.04.2002 10:42------------------------------
648cdf0e10cSrcweir 
649cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
650cdf0e10cSrcweir sal_Bool SwViewOption::IsAppearanceFlag(sal_Int32 nFlag)
651cdf0e10cSrcweir {
652cdf0e10cSrcweir     return 0 != (nAppearanceFlags & nFlag);
653cdf0e10cSrcweir }
654cdf0e10cSrcweir 
655