xref: /aoo42x/main/sw/source/ui/config/viewopt.cxx (revision 5ba3629c)
1efeef26fSAndrew Rist /**************************************************************
2*5ba3629cSmseidel  *
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
10*5ba3629cSmseidel  *
11efeef26fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*5ba3629cSmseidel  *
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.
19*5ba3629cSmseidel  *
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 
IsEqualFlags(const SwViewOption & rOpt) const97cdf0e10cSrcweir 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 
DrawRect(OutputDevice * pOut,const SwRect & rRect,long nCol) const132cdf0e10cSrcweir 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 
DrawRectPrinter(OutputDevice * pOut,const SwRect & rRect) const151cdf0e10cSrcweir 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 
GetPostItsWidth(const OutputDevice * pOut) const167cdf0e10cSrcweir 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 
PaintPostIts(OutputDevice * pOut,const SwRect & rRect,sal_Bool bIsScript) const177cdf0e10cSrcweir 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 
SwViewOption()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*5ba3629cSmseidel     nCoreOptions =
227*5ba3629cSmseidel         VIEWOPT_1_HARDBLANK |
2284772d9afSArmin Le Grand         VIEWOPT_1_SOFTHYPH |
2294772d9afSArmin Le Grand         VIEWOPT_1_REF |
2304772d9afSArmin Le Grand         VIEWOPT_1_GRAPHIC |
231*5ba3629cSmseidel         VIEWOPT_1_TABLE |
232*5ba3629cSmseidel         VIEWOPT_1_DRAW |
2334772d9afSArmin Le Grand         VIEWOPT_1_CONTROL |
2344772d9afSArmin Le Grand         VIEWOPT_1_PAGEBACK |
2354772d9afSArmin Le Grand         VIEWOPT_1_POSTITS;
236*5ba3629cSmseidel 
237*5ba3629cSmseidel     nCore2Options =
238*5ba3629cSmseidel         VIEWOPT_CORE2_BLACKFONT |
2394772d9afSArmin Le Grand         VIEWOPT_CORE2_HIDDENPARA |
2404772d9afSArmin Le Grand         VIEWOPT_CORE2_BIGMARKHDL; // default is big handles
241*5ba3629cSmseidel 
242*5ba3629cSmseidel     nUIOptions =
243*5ba3629cSmseidel         VIEWOPT_2_MODIFIED |
2444772d9afSArmin Le Grand         VIEWOPT_2_GRFKEEPZOOM |
2454772d9afSArmin Le Grand         VIEWOPT_2_ANY_RULER;
246cdf0e10cSrcweir 
247cdf0e10cSrcweir 	if(MEASURE_METRIC != SvtSysLocale().GetLocaleData().getMeasurementSystemEnum())
248cdf0e10cSrcweir 		aSnapSize.Width() = aSnapSize.Height() = 720;	// 1/2"
249cdf0e10cSrcweir 	else
250cdf0e10cSrcweir 		aSnapSize.Width() = aSnapSize.Height() = 567;	// 1 cm
251cdf0e10cSrcweir 	nDivisionX = nDivisionY = 1;
252cdf0e10cSrcweir 
253cdf0e10cSrcweir     bSelectionInReadonly = SW_MOD()->GetAccessibilityOptions().IsSelectionInReadonly();
254cdf0e10cSrcweir 
255cdf0e10cSrcweir     bIdle = true;
256cdf0e10cSrcweir 
257cdf0e10cSrcweir #ifdef DBG_UTIL
258cdf0e10cSrcweir 	// korrespondieren zu den Angaben in ui/config/cfgvw.src
259cdf0e10cSrcweir 	bTest1 = bTest2 = bTest3 = bTest4 =
260cdf0e10cSrcweir 			 bTest5 = bTest6 = bTest7 = bTest8 = bTest10 = sal_False;
261cdf0e10cSrcweir #endif
262cdf0e10cSrcweir }
263cdf0e10cSrcweir 
SwViewOption(const SwViewOption & rVOpt)264cdf0e10cSrcweir SwViewOption::SwViewOption(const SwViewOption& rVOpt)
265cdf0e10cSrcweir {
266cdf0e10cSrcweir 	bReadonly = sal_False;
267cdf0e10cSrcweir     bSelectionInReadonly = sal_False;
268cdf0e10cSrcweir     // --> FME 2004-06-29 #114856# Formular view
269cdf0e10cSrcweir     mbFormView       = rVOpt.mbFormView;
270cdf0e10cSrcweir     // <--
271cdf0e10cSrcweir     nZoom           = rVOpt.nZoom       ;
272cdf0e10cSrcweir 	aSnapSize   	= rVOpt.aSnapSize   ;
273cdf0e10cSrcweir     mnViewLayoutColumns = rVOpt.mnViewLayoutColumns ;
274cdf0e10cSrcweir 	nDivisionX  	= rVOpt.nDivisionX  ;
275cdf0e10cSrcweir 	nDivisionY  	= rVOpt.nDivisionY  ;
276cdf0e10cSrcweir 	nPagePrevRow	= rVOpt.nPagePrevRow;
277cdf0e10cSrcweir 	nPagePrevCol	= rVOpt.nPagePrevCol;
278cdf0e10cSrcweir     bIsPagePreview  = rVOpt.bIsPagePreview;
279cdf0e10cSrcweir 	eZoom      		= rVOpt.eZoom       ;
280cdf0e10cSrcweir 	nTblDest    	= rVOpt.nTblDest    ;
281cdf0e10cSrcweir 	nUIOptions		= rVOpt.nUIOptions  ;
282cdf0e10cSrcweir 	nCoreOptions	= rVOpt.nCoreOptions  ;
283cdf0e10cSrcweir 	nCore2Options	= rVOpt.nCore2Options  ;
284cdf0e10cSrcweir 	aRetoucheColor	= rVOpt.GetRetoucheColor();
285cdf0e10cSrcweir 	sSymbolFont 	= rVOpt.sSymbolFont;
286cdf0e10cSrcweir 	nShdwCrsrFillMode = rVOpt.nShdwCrsrFillMode;
287cdf0e10cSrcweir 	bStarOneSetting = rVOpt.bStarOneSetting;
288cdf0e10cSrcweir 	mbBookView	    = rVOpt.mbBookView;
289cdf0e10cSrcweir 	mbBrowseMode	= rVOpt.mbBrowseMode;
290cdf0e10cSrcweir     mbViewLayoutBookMode = rVOpt.mbViewLayoutBookMode;
291cdf0e10cSrcweir     bShowPlaceHolderFields = rVOpt.bShowPlaceHolderFields;
292cdf0e10cSrcweir     bIdle           = rVOpt.bIdle;
293cdf0e10cSrcweir 
294cdf0e10cSrcweir #ifdef DBG_UTIL
295cdf0e10cSrcweir 	bTest1          = rVOpt.bTest1      ;
296cdf0e10cSrcweir 	bTest2          = rVOpt.bTest2      ;
297cdf0e10cSrcweir 	bTest3          = rVOpt.bTest3      ;
298cdf0e10cSrcweir 	bTest4          = rVOpt.bTest4      ;
299cdf0e10cSrcweir 	bTest5          = rVOpt.bTest5      ;
300cdf0e10cSrcweir 	bTest6          = rVOpt.bTest6      ;
301cdf0e10cSrcweir 	bTest7          = rVOpt.bTest7      ;
302cdf0e10cSrcweir 	bTest8          = rVOpt.bTest8      ;
303cdf0e10cSrcweir 	bTest10         = rVOpt.bTest10     ;
304cdf0e10cSrcweir #endif
305cdf0e10cSrcweir }
306cdf0e10cSrcweir 
307cdf0e10cSrcweir 
operator =(const SwViewOption & rVOpt)308cdf0e10cSrcweir SwViewOption& SwViewOption::operator=( const SwViewOption &rVOpt )
309cdf0e10cSrcweir {
310cdf0e10cSrcweir     // --> DVO FME 2004-06-29 #114856# Formular view
311cdf0e10cSrcweir     mbFormView       = rVOpt.mbFormView   ;
312cdf0e10cSrcweir     // <--
313cdf0e10cSrcweir 	nZoom   		= rVOpt.nZoom   	;
314cdf0e10cSrcweir 	aSnapSize   	= rVOpt.aSnapSize   ;
315cdf0e10cSrcweir     mnViewLayoutColumns = rVOpt.mnViewLayoutColumns ;
316cdf0e10cSrcweir 	nDivisionX  	= rVOpt.nDivisionX  ;
317cdf0e10cSrcweir 	nDivisionY  	= rVOpt.nDivisionY  ;
318cdf0e10cSrcweir 	nPagePrevRow	= rVOpt.nPagePrevRow;
319cdf0e10cSrcweir 	nPagePrevCol	= rVOpt.nPagePrevCol;
320cdf0e10cSrcweir     bIsPagePreview  = rVOpt.bIsPagePreview;
321cdf0e10cSrcweir 	eZoom      		= rVOpt.eZoom       ;
322cdf0e10cSrcweir 	nTblDest    	= rVOpt.nTblDest    ;
323cdf0e10cSrcweir 	nUIOptions		= rVOpt.nUIOptions  ;
324cdf0e10cSrcweir 	nCoreOptions	= rVOpt.nCoreOptions;
325cdf0e10cSrcweir 	nCore2Options	= rVOpt.nCore2Options;
326cdf0e10cSrcweir 	aRetoucheColor	= rVOpt.GetRetoucheColor();
327cdf0e10cSrcweir 	sSymbolFont 	= rVOpt.sSymbolFont;
328cdf0e10cSrcweir 	nShdwCrsrFillMode = rVOpt.nShdwCrsrFillMode;
329cdf0e10cSrcweir 	bStarOneSetting = rVOpt.bStarOneSetting;
330cdf0e10cSrcweir 	mbBookView	    = rVOpt.mbBookView;
331cdf0e10cSrcweir 	mbBrowseMode	= rVOpt.mbBrowseMode;
332cdf0e10cSrcweir     mbViewLayoutBookMode = rVOpt.mbViewLayoutBookMode;
333cdf0e10cSrcweir     bShowPlaceHolderFields = rVOpt.bShowPlaceHolderFields;
334cdf0e10cSrcweir     bIdle           = rVOpt.bIdle;
335cdf0e10cSrcweir 
336cdf0e10cSrcweir #ifdef DBG_UTIL
337cdf0e10cSrcweir 	bTest1          = rVOpt.bTest1      ;
338cdf0e10cSrcweir 	bTest2          = rVOpt.bTest2      ;
339cdf0e10cSrcweir 	bTest3          = rVOpt.bTest3      ;
340cdf0e10cSrcweir 	bTest4          = rVOpt.bTest4      ;
341cdf0e10cSrcweir 	bTest5          = rVOpt.bTest5      ;
342cdf0e10cSrcweir 	bTest6          = rVOpt.bTest6      ;
343cdf0e10cSrcweir 	bTest7          = rVOpt.bTest7      ;
344cdf0e10cSrcweir 	bTest8          = rVOpt.bTest8      ;
345cdf0e10cSrcweir 	bTest10         = rVOpt.bTest10     ;
346cdf0e10cSrcweir #endif
347cdf0e10cSrcweir 	return *this;
348cdf0e10cSrcweir }
349cdf0e10cSrcweir 
350cdf0e10cSrcweir 
~SwViewOption()351cdf0e10cSrcweir SwViewOption::~SwViewOption()
352cdf0e10cSrcweir {
353cdf0e10cSrcweir }
354cdf0e10cSrcweir 
355cdf0e10cSrcweir /*************************************************************************
356cdf0e10cSrcweir |*
357cdf0e10cSrcweir |*	ViewOption::Init()
358cdf0e10cSrcweir |*
359cdf0e10cSrcweir |*	Letzte Aenderung	MA 04. Aug. 93
360cdf0e10cSrcweir |*
361cdf0e10cSrcweir |*************************************************************************/
362cdf0e10cSrcweir 
Init(Window * pWin)363cdf0e10cSrcweir void SwViewOption::Init( Window *pWin )
364cdf0e10cSrcweir {
365cdf0e10cSrcweir 	if( !nPixelTwips && pWin )
366cdf0e10cSrcweir 	{
367cdf0e10cSrcweir 		nPixelTwips = (sal_uInt16)pWin->PixelToLogic( Size(1,1) ).Height();
368cdf0e10cSrcweir 	}
369cdf0e10cSrcweir }
370cdf0e10cSrcweir 
IsAutoCompleteWords() const371cdf0e10cSrcweir sal_Bool SwViewOption::IsAutoCompleteWords() const
372cdf0e10cSrcweir {
373cdf0e10cSrcweir 	const SvxSwAutoFmtFlags& rFlags = SvxAutoCorrCfg::Get()->GetAutoCorrect()->GetSwFlags();
374cdf0e10cSrcweir 	return /*rFlags.bAutoCompleteWords &&*/ rFlags.bAutoCmpltCollectWords;
375cdf0e10cSrcweir }
376cdf0e10cSrcweir 
377cdf0e10cSrcweir /*************************************************************************/
378cdf0e10cSrcweir /*                                                                       */
379cdf0e10cSrcweir /*************************************************************************/
380cdf0e10cSrcweir 
AuthorCharAttr()381cdf0e10cSrcweir AuthorCharAttr::AuthorCharAttr() :
382cdf0e10cSrcweir 	nItemId	(SID_ATTR_CHAR_UNDERLINE),
383cdf0e10cSrcweir 	nAttr	(UNDERLINE_SINGLE),
384cdf0e10cSrcweir 	nColor	(COL_TRANSPARENT)
385cdf0e10cSrcweir {
386cdf0e10cSrcweir }
387cdf0e10cSrcweir 
388cdf0e10cSrcweir /*-----------------07.01.97 13.50-------------------
389cdf0e10cSrcweir 
390cdf0e10cSrcweir --------------------------------------------------*/
391cdf0e10cSrcweir 
GetHtmlMode(const SwDocShell * pShell)392cdf0e10cSrcweir sal_uInt16		GetHtmlMode(const SwDocShell* pShell)
393cdf0e10cSrcweir {
394cdf0e10cSrcweir 	sal_uInt16 nRet = 0;
395cdf0e10cSrcweir 	if(!pShell || PTR_CAST(SwWebDocShell, pShell))
396cdf0e10cSrcweir 	{
397cdf0e10cSrcweir 		nRet = HTMLMODE_ON;
398cdf0e10cSrcweir 		SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get();
399cdf0e10cSrcweir 		switch ( pHtmlOpt->GetExportMode() )
400cdf0e10cSrcweir 		{
401cdf0e10cSrcweir 			case HTML_CFG_MSIE_40:
402cdf0e10cSrcweir 				nRet |= HTMLMODE_PARA_BORDER|HTMLMODE_SMALL_CAPS|
403cdf0e10cSrcweir 						HTMLMODE_SOME_STYLES|
404cdf0e10cSrcweir 						HTMLMODE_FULL_STYLES|HTMLMODE_GRAPH_POS|
405cdf0e10cSrcweir 						HTMLMODE_FULL_ABS_POS|HTMLMODE_SOME_ABS_POS;
406cdf0e10cSrcweir 			break;
407cdf0e10cSrcweir 			case HTML_CFG_NS40:
408cdf0e10cSrcweir 				nRet |= HTMLMODE_PARA_BORDER|HTMLMODE_SOME_STYLES|
409cdf0e10cSrcweir 						HTMLMODE_FRM_COLUMNS|HTMLMODE_BLINK|HTMLMODE_GRAPH_POS|
410cdf0e10cSrcweir 						HTMLMODE_SOME_ABS_POS;
411cdf0e10cSrcweir 			break;
412cdf0e10cSrcweir 			case HTML_CFG_WRITER:
413cdf0e10cSrcweir 				nRet |= HTMLMODE_PARA_BORDER|HTMLMODE_SMALL_CAPS|
414cdf0e10cSrcweir 						HTMLMODE_SOME_STYLES|
415cdf0e10cSrcweir 						HTMLMODE_FRM_COLUMNS|HTMLMODE_FULL_STYLES|
416cdf0e10cSrcweir 						HTMLMODE_BLINK|HTMLMODE_DROPCAPS|HTMLMODE_GRAPH_POS|
417cdf0e10cSrcweir 						HTMLMODE_FULL_ABS_POS|HTMLMODE_SOME_ABS_POS;
418cdf0e10cSrcweir 			break;
419cdf0e10cSrcweir 			case HTML_CFG_HTML32:
420cdf0e10cSrcweir 			break;
421cdf0e10cSrcweir 		}
422cdf0e10cSrcweir 	}
423cdf0e10cSrcweir 	return nRet;
424cdf0e10cSrcweir }
425cdf0e10cSrcweir /* -----------------------------24.04.2002 10:20------------------------------
426cdf0e10cSrcweir 
427cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
GetDocColor()428cdf0e10cSrcweir Color&   SwViewOption::GetDocColor()
429cdf0e10cSrcweir {
430cdf0e10cSrcweir     return aDocColor;
431cdf0e10cSrcweir }
432cdf0e10cSrcweir /* -----------------------------23.04.2002 17:18------------------------------
433cdf0e10cSrcweir 
434cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
GetDocBoundariesColor()435cdf0e10cSrcweir Color&   SwViewOption::GetDocBoundariesColor()
436cdf0e10cSrcweir {
437cdf0e10cSrcweir     return aDocBoundColor;
438cdf0e10cSrcweir }
439cdf0e10cSrcweir /* -----------------------------23.04.2002 17:53------------------------------
440cdf0e10cSrcweir 
441cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
GetObjectBoundariesColor()442cdf0e10cSrcweir Color&   SwViewOption::GetObjectBoundariesColor()
443cdf0e10cSrcweir {
444cdf0e10cSrcweir     return aObjectBoundColor;
445cdf0e10cSrcweir }
446cdf0e10cSrcweir /* -----------------------------24.04.2002 10:41------------------------------
447cdf0e10cSrcweir 
448cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
GetAppBackgroundColor()449cdf0e10cSrcweir Color& SwViewOption::GetAppBackgroundColor()
450cdf0e10cSrcweir {
451cdf0e10cSrcweir     return aAppBackgroundColor;
452cdf0e10cSrcweir }
453cdf0e10cSrcweir /*-- 24.04.2002 10:50:11---------------------------------------------------
454cdf0e10cSrcweir 
455cdf0e10cSrcweir   -----------------------------------------------------------------------*/
GetTableBoundariesColor()456cdf0e10cSrcweir Color&   SwViewOption::GetTableBoundariesColor()
457cdf0e10cSrcweir {
458cdf0e10cSrcweir     return aTableBoundColor;
459cdf0e10cSrcweir }
460cdf0e10cSrcweir /*-- 24.04.2002 10:50:12---------------------------------------------------
461cdf0e10cSrcweir 
462cdf0e10cSrcweir   -----------------------------------------------------------------------*/
GetIndexShadingsColor()463cdf0e10cSrcweir Color&   SwViewOption::GetIndexShadingsColor()
464cdf0e10cSrcweir {
465cdf0e10cSrcweir     return aIndexShadingsColor;
466cdf0e10cSrcweir }
467cdf0e10cSrcweir /*-- 24.04.2002 10:50:12---------------------------------------------------
468cdf0e10cSrcweir 
469cdf0e10cSrcweir   -----------------------------------------------------------------------*/
GetLinksColor()470cdf0e10cSrcweir Color&   SwViewOption::GetLinksColor()
471cdf0e10cSrcweir {
472cdf0e10cSrcweir     return aLinksColor;
473cdf0e10cSrcweir }
474cdf0e10cSrcweir /*-- 24.04.2002 10:50:13---------------------------------------------------
475cdf0e10cSrcweir 
476cdf0e10cSrcweir   -----------------------------------------------------------------------*/
GetVisitedLinksColor()477cdf0e10cSrcweir Color&   SwViewOption::GetVisitedLinksColor()
478cdf0e10cSrcweir {
479cdf0e10cSrcweir     return aVisitedLinksColor;
480cdf0e10cSrcweir }
481cdf0e10cSrcweir /*-- 24.04.2002 10:50:13---------------------------------------------------
482cdf0e10cSrcweir 
483cdf0e10cSrcweir   -----------------------------------------------------------------------*/
GetDirectCursorColor()484cdf0e10cSrcweir Color&   SwViewOption::GetDirectCursorColor()
485cdf0e10cSrcweir {
486cdf0e10cSrcweir     return aDirectCursorColor;
487cdf0e10cSrcweir }
488cdf0e10cSrcweir /*-- 24.04.2002 10:50:14---------------------------------------------------
489cdf0e10cSrcweir 
490cdf0e10cSrcweir   -----------------------------------------------------------------------*/
GetTextGridColor()491cdf0e10cSrcweir Color&   SwViewOption::GetTextGridColor()
492cdf0e10cSrcweir {
493cdf0e10cSrcweir     return aTextGridColor;
494cdf0e10cSrcweir }
495cdf0e10cSrcweir /*-- 24.04.2002 10:50:14---------------------------------------------------
496cdf0e10cSrcweir 
497cdf0e10cSrcweir   -----------------------------------------------------------------------*/
GetSpellColor()498cdf0e10cSrcweir Color&   SwViewOption::GetSpellColor()
499cdf0e10cSrcweir {
500cdf0e10cSrcweir     return aSpellColor;
501cdf0e10cSrcweir }
502cdf0e10cSrcweir /*-- 24.04.2007 10:50:14---------------------------------------------------
503cdf0e10cSrcweir 
504cdf0e10cSrcweir   -----------------------------------------------------------------------*/
GetSmarttagColor()505cdf0e10cSrcweir Color&   SwViewOption::GetSmarttagColor()
506cdf0e10cSrcweir {
507cdf0e10cSrcweir     return aSmarttagColor;
508cdf0e10cSrcweir }
509cdf0e10cSrcweir /*-- 06.12.2002 10:50:11---------------------------------------------------
510cdf0e10cSrcweir 
511cdf0e10cSrcweir   -----------------------------------------------------------------------*/
GetFontColor()512cdf0e10cSrcweir Color&   SwViewOption::GetFontColor()
513cdf0e10cSrcweir {
514cdf0e10cSrcweir     return aFontColor;
515cdf0e10cSrcweir }
516cdf0e10cSrcweir /*-- 24.04.2002 10:50:15---------------------------------------------------
517cdf0e10cSrcweir 
518cdf0e10cSrcweir   -----------------------------------------------------------------------*/
GetFieldShadingsColor()519cdf0e10cSrcweir Color&   SwViewOption::GetFieldShadingsColor()
520cdf0e10cSrcweir {
521cdf0e10cSrcweir     return aFieldShadingsColor;
522cdf0e10cSrcweir }
523cdf0e10cSrcweir /*-- 24.04.2002 10:50:15---------------------------------------------------
524cdf0e10cSrcweir 
525cdf0e10cSrcweir   -----------------------------------------------------------------------*/
GetSectionBoundColor()526cdf0e10cSrcweir Color&   SwViewOption::GetSectionBoundColor()
527cdf0e10cSrcweir {
528cdf0e10cSrcweir     return aSectionBoundColor;
529cdf0e10cSrcweir }
530cdf0e10cSrcweir /* -----------------------------2002/07/31 14:00------------------------------
531cdf0e10cSrcweir 
532cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
GetPageBreakColor()533cdf0e10cSrcweir Color& SwViewOption::GetPageBreakColor()
534cdf0e10cSrcweir {
535cdf0e10cSrcweir     return aPageBreakColor;
536cdf0e10cSrcweir }
537cdf0e10cSrcweir 
538cdf0e10cSrcweir /* -----------------------------23.04.2002 17:41------------------------------
539cdf0e10cSrcweir 
540cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
ApplyColorConfigValues(const svtools::ColorConfig & rConfig)541cdf0e10cSrcweir void SwViewOption::ApplyColorConfigValues(const svtools::ColorConfig& rConfig )
542cdf0e10cSrcweir {
543cdf0e10cSrcweir     aDocColor.SetColor(rConfig.GetColorValue(svtools::DOCCOLOR).nColor);
544cdf0e10cSrcweir 
545cdf0e10cSrcweir     svtools::ColorConfigValue aValue = rConfig.GetColorValue(svtools::DOCBOUNDARIES);
546cdf0e10cSrcweir     aDocBoundColor.SetColor(aValue.nColor);
547cdf0e10cSrcweir     nAppearanceFlags = 0;
548cdf0e10cSrcweir     if(aValue.bIsVisible)
549cdf0e10cSrcweir         nAppearanceFlags |= VIEWOPT_DOC_BOUNDARIES;
550cdf0e10cSrcweir 
551cdf0e10cSrcweir     aAppBackgroundColor.SetColor(rConfig.GetColorValue(svtools::APPBACKGROUND).nColor);
552cdf0e10cSrcweir 
553cdf0e10cSrcweir     aValue = rConfig.GetColorValue(svtools::OBJECTBOUNDARIES);
554cdf0e10cSrcweir     aObjectBoundColor.SetColor(aValue.nColor);
555cdf0e10cSrcweir     if(aValue.bIsVisible)
556cdf0e10cSrcweir         nAppearanceFlags |= VIEWOPT_OBJECT_BOUNDARIES;
557cdf0e10cSrcweir 
558cdf0e10cSrcweir     aValue = rConfig.GetColorValue(svtools::TABLEBOUNDARIES);
559cdf0e10cSrcweir     aTableBoundColor.SetColor(aValue.nColor);
560cdf0e10cSrcweir     if(aValue.bIsVisible)
561cdf0e10cSrcweir         nAppearanceFlags |= VIEWOPT_TABLE_BOUNDARIES;
562cdf0e10cSrcweir 
563cdf0e10cSrcweir     aValue = rConfig.GetColorValue(svtools::WRITERIDXSHADINGS);
564cdf0e10cSrcweir     aIndexShadingsColor.SetColor(aValue.nColor);
565cdf0e10cSrcweir     if(aValue.bIsVisible)
566cdf0e10cSrcweir         nAppearanceFlags |= VIEWOPT_INDEX_SHADINGS;
567cdf0e10cSrcweir 
568cdf0e10cSrcweir     aValue = rConfig.GetColorValue(svtools::LINKS);
569cdf0e10cSrcweir     aLinksColor.SetColor(aValue.nColor);
570cdf0e10cSrcweir     if(aValue.bIsVisible)
571cdf0e10cSrcweir         nAppearanceFlags |= VIEWOPT_LINKS;
572cdf0e10cSrcweir 
573cdf0e10cSrcweir     aValue = rConfig.GetColorValue(svtools::LINKSVISITED);
574cdf0e10cSrcweir     aVisitedLinksColor.SetColor(aValue.nColor);
575cdf0e10cSrcweir     if(aValue.bIsVisible)
576cdf0e10cSrcweir         nAppearanceFlags |= VIEWOPT_VISITED_LINKS;
577cdf0e10cSrcweir 
578cdf0e10cSrcweir     aDirectCursorColor.SetColor(rConfig.GetColorValue(svtools::WRITERDIRECTCURSOR).nColor);
579cdf0e10cSrcweir 
580cdf0e10cSrcweir     aTextGridColor.SetColor(rConfig.GetColorValue(svtools::WRITERTEXTGRID).nColor);
581cdf0e10cSrcweir 
582cdf0e10cSrcweir     aSpellColor.SetColor(rConfig.GetColorValue(svtools::SPELL).nColor);
583cdf0e10cSrcweir 
584cdf0e10cSrcweir     aSmarttagColor.SetColor(rConfig.GetColorValue(svtools::SMARTTAGS).nColor);
585cdf0e10cSrcweir 
586cdf0e10cSrcweir     aFontColor.SetColor(rConfig.GetColorValue(svtools::FONTCOLOR).nColor);
587cdf0e10cSrcweir 
588cdf0e10cSrcweir     aValue = rConfig.GetColorValue(svtools::WRITERFIELDSHADINGS);
589cdf0e10cSrcweir     aFieldShadingsColor.SetColor(aValue.nColor);
590cdf0e10cSrcweir     if(aValue.bIsVisible)
591cdf0e10cSrcweir         nAppearanceFlags |= VIEWOPT_FIELD_SHADINGS;
592cdf0e10cSrcweir 
593cdf0e10cSrcweir     aValue = rConfig.GetColorValue(svtools::WRITERSECTIONBOUNDARIES);
594cdf0e10cSrcweir     aSectionBoundColor.SetColor(aValue.nColor);
595cdf0e10cSrcweir     if(aValue.bIsVisible)
596cdf0e10cSrcweir         nAppearanceFlags |= VIEWOPT_SECTION_BOUNDARIES;
597cdf0e10cSrcweir 
598cdf0e10cSrcweir     aValue = rConfig.GetColorValue(svtools::WRITERPAGEBREAKS);
599cdf0e10cSrcweir     aPageBreakColor.SetColor(aValue.nColor);
600cdf0e10cSrcweir 
601cdf0e10cSrcweir     aScriptIndicatorColor.SetColor(rConfig.GetColorValue(svtools::WRITERSCRIPTINDICATOR).nColor);
602cdf0e10cSrcweir }
603cdf0e10cSrcweir /* -----------------------------23.04.2002 17:48------------------------------
604cdf0e10cSrcweir 
605cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
SetAppearanceFlag(sal_Int32 nFlag,sal_Bool bSet,sal_Bool bSaveInConfig)606cdf0e10cSrcweir void SwViewOption::SetAppearanceFlag(sal_Int32 nFlag, sal_Bool bSet, sal_Bool bSaveInConfig )
607cdf0e10cSrcweir {
608cdf0e10cSrcweir     if(bSet)
609cdf0e10cSrcweir         nAppearanceFlags |= nFlag;
610cdf0e10cSrcweir     else
611cdf0e10cSrcweir         nAppearanceFlags &= ~nFlag;
612cdf0e10cSrcweir     if(bSaveInConfig)
613cdf0e10cSrcweir     {
614cdf0e10cSrcweir         //create an editable svtools::ColorConfig and store the change
615cdf0e10cSrcweir         svtools::EditableColorConfig aEditableConfig;
616cdf0e10cSrcweir         struct FlagToConfig_Impl
617cdf0e10cSrcweir         {
618cdf0e10cSrcweir             sal_Int32               nFlag;
619cdf0e10cSrcweir             svtools::ColorConfigEntry   eEntry;
620cdf0e10cSrcweir         };
621cdf0e10cSrcweir         static const FlagToConfig_Impl aFlags[] =
622cdf0e10cSrcweir         {
623cdf0e10cSrcweir             { VIEWOPT_DOC_BOUNDARIES     ,   svtools::DOCBOUNDARIES },
624cdf0e10cSrcweir             { VIEWOPT_OBJECT_BOUNDARIES  ,   svtools::OBJECTBOUNDARIES },
625cdf0e10cSrcweir             { VIEWOPT_TABLE_BOUNDARIES   ,   svtools::TABLEBOUNDARIES },
626cdf0e10cSrcweir             { VIEWOPT_INDEX_SHADINGS     ,   svtools::WRITERIDXSHADINGS },
627cdf0e10cSrcweir             { VIEWOPT_LINKS              ,   svtools::LINKS },
628cdf0e10cSrcweir             { VIEWOPT_VISITED_LINKS      ,   svtools::LINKSVISITED },
629cdf0e10cSrcweir             { VIEWOPT_FIELD_SHADINGS     ,   svtools::WRITERFIELDSHADINGS },
630cdf0e10cSrcweir             { VIEWOPT_SECTION_BOUNDARIES ,   svtools::WRITERSECTIONBOUNDARIES },
631cdf0e10cSrcweir             { 0                          ,   svtools::ColorConfigEntryCount }
632cdf0e10cSrcweir         };
633cdf0e10cSrcweir         sal_uInt16 nPos = 0;
634cdf0e10cSrcweir         while(aFlags[nPos].nFlag)
635cdf0e10cSrcweir         {
636cdf0e10cSrcweir             if(0 != (nFlag&aFlags[nPos].nFlag))
637cdf0e10cSrcweir             {
638cdf0e10cSrcweir                 svtools::ColorConfigValue aValue = aEditableConfig.GetColorValue(aFlags[nPos].eEntry);
639cdf0e10cSrcweir                 aValue.bIsVisible = bSet;
640cdf0e10cSrcweir                 aEditableConfig.SetColorValue(aFlags[nPos].eEntry, aValue);
641cdf0e10cSrcweir             }
642cdf0e10cSrcweir             nPos++;
643cdf0e10cSrcweir         }
644cdf0e10cSrcweir     }
645cdf0e10cSrcweir }
646cdf0e10cSrcweir /* -----------------------------24.04.2002 10:42------------------------------
647cdf0e10cSrcweir 
648cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
IsAppearanceFlag(sal_Int32 nFlag)649cdf0e10cSrcweir sal_Bool SwViewOption::IsAppearanceFlag(sal_Int32 nFlag)
650cdf0e10cSrcweir {
651cdf0e10cSrcweir     return 0 != (nAppearanceFlags & nFlag);
652cdf0e10cSrcweir }
653cdf0e10cSrcweir 
654