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