LCOV - code coverage report
Current view: top level - sw/source/ui/config - optpage.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 0 1405 0.0 %
Date: 2014-04-11 Functions: 0 92 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <optpage.hxx>
      21             : #include <doc.hxx>
      22             : #include <hintids.hxx>
      23             : #include <cmdid.h>
      24             : #include <fmtcol.hxx>
      25             : #include <charatr.hxx>
      26             : #include <swtypes.hxx>
      27             : #include <view.hxx>
      28             : #include <docsh.hxx>
      29             : #include <IDocumentDeviceAccess.hxx>
      30             : #include <swmodule.hxx>
      31             : #include <wrtsh.hxx>
      32             : #include <uitool.hxx>
      33             : #include <cfgitems.hxx>
      34             : #include <poolfmt.hxx>
      35             : #include <uiitems.hxx>
      36             : #include <initui.hxx>
      37             : #include <printdata.hxx>
      38             : #include <modcfg.hxx>
      39             : #include <srcview.hxx>
      40             : #include <crstate.hxx>
      41             : #include <viewopt.hxx>
      42             : #include <globals.hrc>
      43             : #include <config.hrc>
      44             : #include <optdlg.hrc>
      45             : #include <swwrtshitem.hxx>
      46             : #include <unomid.h>
      47             : 
      48             : #include <editeng/fhgtitem.hxx>
      49             : #include <editeng/fontitem.hxx>
      50             : #include <editeng/langitem.hxx>
      51             : #include <editeng/svxenum.hxx>
      52             : #include <sfx2/dialoghelper.hxx>
      53             : #include <sfx2/request.hxx>
      54             : #include <sfx2/printer.hxx>
      55             : #include <sfx2/bindings.hxx>
      56             : #include <svl/slstitm.hxx>
      57             : #include <svl/ctloptions.hxx>
      58             : #include <svl/eitem.hxx>
      59             : #include <svl/cjkoptions.hxx>
      60             : #include <svtools/ctrltool.hxx>
      61             : #include <sfx2/htmlmode.hxx>
      62             : #include <svx/xtable.hxx>
      63             : #include <svx/dlgutil.hxx>
      64             : #include <svx/strarray.hxx>
      65             : 
      66             : #include <vcl/settings.hxx>
      67             : #include <vcl/svapp.hxx>
      68             : 
      69             : using namespace ::com::sun::star;
      70             : 
      71             : /*--------------------------------------------------------
      72             :  Tools->Options->Writer->View
      73             :  Tools->Options->Writer/Web->View
      74             : --------------------------------------------------------- */
      75           0 : SwContentOptPage::SwContentOptPage( Window* pParent,
      76             :                                       const SfxItemSet& rCoreSet ) :
      77             :     SfxTabPage(pParent, "ViewOptionsPage",
      78           0 :                "modules/swriter/ui/viewoptionspage.ui", rCoreSet)
      79             : {
      80           0 :     get (m_pCrossCB, "helplines");
      81             : 
      82           0 :     get (m_pHScrollBox, "hscrollbar");
      83           0 :     get (m_pVScrollBox, "vscrollbar");
      84           0 :     get (m_pAnyRulerCB, "ruler");
      85           0 :     get (m_pHRulerCBox, "hruler");
      86           0 :     get (m_pHMetric, "hrulercombobox");
      87           0 :     get (m_pVRulerCBox, "vruler");
      88           0 :     get (m_pVRulerRightCBox, "vrulerright");
      89           0 :     get (m_pVMetric, "vrulercombobox");
      90           0 :     get (m_pSmoothCBox, "smoothscroll");
      91             : 
      92           0 :     get (m_pGrfCB, "graphics");
      93           0 :     get (m_pTblCB, "tables");
      94           0 :     get (m_pDrwCB, "drawings");
      95           0 :     get (m_pFldNameCB, "fieldcodes");
      96           0 :     get (m_pPostItCB, "comments");
      97             : 
      98           0 :     get (m_pSettingsFrame, "settingsframe");
      99           0 :     get (m_pSettingsLabel, "settingslabel");
     100           0 :     get (m_pMetricLabel, "measureunitlabel");
     101           0 :     get (m_pMetricLB, "measureunit");
     102             : 
     103             :     /* This part is visible only with Writer/Web->View dialogue. */
     104             :     const SfxPoolItem* pItem;
     105           0 :     if (! (SFX_ITEM_SET == rCoreSet.GetItemState(SID_HTML_MODE, false, &pItem )
     106           0 :            && ((SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON))
     107             :     {
     108           0 :         m_pSettingsFrame->Hide();
     109           0 :         m_pSettingsLabel->Hide();
     110           0 :         m_pMetricLabel->Hide();
     111           0 :         m_pMetricLB->Hide();
     112             :     }
     113             : 
     114           0 :     SvtCJKOptions aCJKOptions;
     115           0 :     if(!aCJKOptions.IsVerticalTextEnabled() )
     116           0 :         m_pVRulerRightCBox->Hide();
     117           0 :     m_pVRulerCBox->SetClickHdl(LINK(this, SwContentOptPage, VertRulerHdl ));
     118           0 :     m_pAnyRulerCB->SetClickHdl(LINK(this, SwContentOptPage, AnyRulerHdl));
     119             : 
     120           0 :     SvxStringArray aMetricArr( SW_RES( STR_ARR_METRIC ) );
     121           0 :     for ( size_t i = 0; i < aMetricArr.Count(); ++i )
     122             :     {
     123           0 :         OUString sMetric = aMetricArr.GetStringByPos( i );
     124           0 :         FieldUnit eFUnit = (FieldUnit)aMetricArr.GetValue( i );
     125             : 
     126           0 :         switch ( eFUnit )
     127             :         {
     128             :             case FUNIT_MM:
     129             :             case FUNIT_CM:
     130             :             case FUNIT_POINT:
     131             :             case FUNIT_PICA:
     132             :             case FUNIT_INCH:
     133             :             case FUNIT_CHAR:    // add two units , 'character' and 'line' , their ticks are not fixed
     134             :             case FUNIT_LINE:
     135             :             {
     136             :                 // only use these metrics
     137             :                 // a horizontal ruler has not the 'line' unit
     138             :                 // there isn't 'line' unit in HTML format
     139           0 :                 if ( eFUnit != FUNIT_LINE )
     140             :                 {
     141           0 :                    sal_Int32 nPos = m_pMetricLB->InsertEntry( sMetric );
     142           0 :                    m_pMetricLB->SetEntryData( nPos, (void*)(sal_IntPtr)eFUnit );
     143           0 :                    m_pHMetric->InsertEntry( sMetric );
     144           0 :                    m_pHMetric->SetEntryData( nPos, (void*)(sal_IntPtr)eFUnit );
     145             :                 }
     146             :                 // a vertical ruler has not the 'character' unit
     147           0 :                 if ( eFUnit != FUNIT_CHAR )
     148             :                 {
     149           0 :                    sal_Int32 nPos = m_pVMetric->InsertEntry( sMetric );
     150           0 :                    m_pVMetric->SetEntryData( nPos, (void*)(sal_IntPtr)eFUnit );
     151             :                 }
     152             :             }
     153             :             default:;//prevent warning
     154             :         }
     155           0 :     }
     156           0 : }
     157             : 
     158           0 : SwContentOptPage::~SwContentOptPage()
     159             : {
     160           0 : }
     161             : 
     162           0 : SfxTabPage* SwContentOptPage::Create( Window* pParent,
     163             :                                 const SfxItemSet& rAttrSet)
     164             : {
     165           0 :     return new SwContentOptPage(pParent, rAttrSet);
     166             : }
     167             : 
     168           0 : static void lcl_SelectMetricLB(ListBox* rMetric, sal_uInt16 nSID, const SfxItemSet& rSet)
     169             : {
     170             :     const SfxPoolItem* pItem;
     171           0 :     if( rSet.GetItemState( nSID, false, &pItem ) >= SFX_ITEM_AVAILABLE )
     172             :     {
     173           0 :         FieldUnit eFieldUnit = (FieldUnit)((SfxUInt16Item*)pItem)->GetValue();
     174           0 :         for ( sal_Int32 i = 0; i < rMetric->GetEntryCount(); ++i )
     175             :         {
     176           0 :             if ( (int)(sal_IntPtr)rMetric->GetEntryData( i ) == (int)eFieldUnit )
     177             :             {
     178           0 :                 rMetric->SelectEntryPos( i );
     179           0 :                 break;
     180             :             }
     181             :         }
     182             :     }
     183           0 :     rMetric->SaveValue();
     184           0 : }
     185             : 
     186           0 : void SwContentOptPage::Reset(const SfxItemSet& rSet)
     187             : {
     188           0 :     const SwElemItem* pElemAttr = 0;
     189             : 
     190             :     rSet.GetItemState( FN_PARAM_ELEM , false,
     191           0 :                                     (const SfxPoolItem**)&pElemAttr );
     192           0 :     if(pElemAttr)
     193             :     {
     194           0 :         m_pTblCB->Check (pElemAttr->bTable);
     195           0 :         m_pGrfCB->Check (pElemAttr->bGraphic);
     196           0 :         m_pDrwCB->Check (pElemAttr->bDrawing);
     197           0 :         m_pFldNameCB->Check (pElemAttr->bFieldName);
     198           0 :         m_pPostItCB->Check (pElemAttr->bNotes);
     199           0 :         m_pCrossCB->Check (pElemAttr->bCrosshair);
     200           0 :         m_pHScrollBox->Check (pElemAttr->bHorzScrollbar);
     201           0 :         m_pVScrollBox->Check (pElemAttr->bVertScrollbar);
     202           0 :         m_pAnyRulerCB->Check (pElemAttr->bAnyRuler);
     203           0 :         m_pHRulerCBox->Check (pElemAttr->bHorzRuler);
     204           0 :         m_pVRulerCBox->Check (pElemAttr->bVertRuler);
     205           0 :         m_pVRulerRightCBox->Check (pElemAttr->bVertRulerRight);
     206           0 :         m_pSmoothCBox->Check (pElemAttr->bSmoothScroll);
     207             :     }
     208           0 :     m_pMetricLB->SetNoSelection();
     209           0 :     lcl_SelectMetricLB(m_pMetricLB, SID_ATTR_METRIC, rSet);
     210           0 :     lcl_SelectMetricLB(m_pHMetric, FN_HSCROLL_METRIC, rSet);
     211           0 :     lcl_SelectMetricLB(m_pVMetric, FN_VSCROLL_METRIC, rSet);
     212           0 :     AnyRulerHdl(m_pAnyRulerCB);
     213           0 : }
     214             : 
     215           0 : bool SwContentOptPage::FillItemSet(SfxItemSet& rSet)
     216             : {
     217             :     const SwElemItem*   pOldAttr = (const SwElemItem*)
     218           0 :                         GetOldItem(GetItemSet(), FN_PARAM_ELEM);
     219             : 
     220           0 :     SwElemItem aElem;
     221           0 :     if(pOldAttr)
     222           0 :         aElem = *pOldAttr;
     223           0 :     aElem.bTable                = m_pTblCB->IsChecked();
     224           0 :     aElem.bGraphic              = m_pGrfCB->IsChecked();
     225           0 :     aElem.bDrawing              = m_pDrwCB->IsChecked();
     226           0 :     aElem.bFieldName            = m_pFldNameCB->IsChecked();
     227           0 :     aElem.bNotes                = m_pPostItCB->IsChecked();
     228           0 :     aElem.bCrosshair            = m_pCrossCB->IsChecked();
     229           0 :     aElem.bHorzScrollbar        = m_pHScrollBox->IsChecked();
     230           0 :     aElem.bVertScrollbar        = m_pVScrollBox->IsChecked();
     231           0 :     aElem.bAnyRuler             = m_pAnyRulerCB->IsChecked();
     232           0 :     aElem.bHorzRuler            = m_pHRulerCBox->IsChecked();
     233           0 :     aElem.bVertRuler            = m_pVRulerCBox->IsChecked();
     234           0 :     aElem.bVertRulerRight       = m_pVRulerRightCBox->IsChecked();
     235           0 :     aElem.bSmoothScroll         = m_pSmoothCBox->IsChecked();
     236             : 
     237           0 :     sal_Bool bRet = !pOldAttr || aElem != *pOldAttr;
     238           0 :     if(bRet)
     239           0 :         bRet = 0 != rSet.Put(aElem);
     240             : 
     241           0 :     sal_Int32 nMPos = m_pMetricLB->GetSelectEntryPos();
     242           0 :     sal_Int32 nGlobalMetricPos = nMPos;
     243           0 :     if ( nMPos != m_pMetricLB->GetSavedValue() )
     244             :     {
     245             :         // Double-Cast for VA3.0
     246           0 :         sal_uInt16 nFieldUnit = (sal_uInt16)(sal_IntPtr)m_pMetricLB->GetEntryData( nMPos );
     247           0 :         rSet.Put( SfxUInt16Item( SID_ATTR_METRIC, (sal_uInt16)nFieldUnit ) );
     248           0 :         bRet = sal_True;
     249             :     }
     250             : 
     251           0 :     nMPos = m_pHMetric->GetSelectEntryPos();
     252           0 :     if ( nMPos != m_pHMetric->GetSavedValue() || nMPos != nGlobalMetricPos )
     253             :     {
     254             :         // Double-Cast for VA3.0
     255           0 :         sal_uInt16 nFieldUnit = (sal_uInt16)(sal_IntPtr)m_pHMetric->GetEntryData( nMPos );
     256           0 :         rSet.Put( SfxUInt16Item( FN_HSCROLL_METRIC, (sal_uInt16)nFieldUnit ) );
     257           0 :         bRet = sal_True;
     258             :     }
     259           0 :     nMPos = m_pVMetric->GetSelectEntryPos();
     260           0 :     if ( nMPos != m_pVMetric->GetSavedValue() || nMPos != nGlobalMetricPos )
     261             :     {
     262             :         // Double-Cast for VA3.0
     263           0 :         sal_uInt16 nFieldUnit = (sal_uInt16)(sal_IntPtr)m_pVMetric->GetEntryData( nMPos );
     264           0 :         rSet.Put( SfxUInt16Item( FN_VSCROLL_METRIC, (sal_uInt16)nFieldUnit ) );
     265           0 :         bRet = sal_True;
     266             :     }
     267           0 :     return bRet;
     268             : }
     269             : 
     270           0 : IMPL_LINK(SwContentOptPage, VertRulerHdl, CheckBox*, pBox)
     271             : {
     272           0 :     m_pVRulerRightCBox->Enable(pBox->IsEnabled() && pBox->IsChecked());
     273           0 :     return 0;
     274             : }
     275             : 
     276           0 : IMPL_LINK( SwContentOptPage, AnyRulerHdl, CheckBox*, pBox)
     277             : {
     278           0 :     sal_Bool bChecked = pBox->IsChecked();
     279           0 :     m_pHRulerCBox->Enable(bChecked);
     280           0 :     m_pHMetric->Enable(bChecked);
     281           0 :     m_pVRulerCBox->Enable(bChecked);
     282           0 :     m_pVMetric->Enable(bChecked);
     283           0 :     VertRulerHdl(m_pVRulerCBox);
     284           0 :     return 0;
     285             : }
     286             : /*------------------------------------------------------
     287             :  TabPage Printer additional settings
     288             : -------------------------------------------------------*/
     289           0 : SwAddPrinterTabPage::SwAddPrinterTabPage(Window* pParent,
     290             :     const SfxItemSet& rCoreSet)
     291             :     : SfxTabPage(pParent, "PrintOptionsPage",
     292             :         "modules/swriter/ui/printoptionspage.ui", rCoreSet)
     293             :     , sNone(SW_RESSTR(SW_STR_NONE))
     294             :     , bAttrModified(sal_False)
     295           0 :     , bPreview(sal_False)
     296             : {
     297           0 :     get(m_pGrfCB, "graphics");
     298           0 :     get(m_pCtrlFldCB, "formcontrols");
     299           0 :     get(m_pBackgroundCB, "background");
     300           0 :     get(m_pBlackFontCB, "inblack");
     301           0 :     get(m_pPrintHiddenTextCB, "hiddentext");
     302           0 :     get(m_pPrintTextPlaceholderCB, "textplaceholder");
     303             : 
     304           0 :     get(m_pPagesFrame, "pagesframe");
     305           0 :     get(m_pLeftPageCB, "leftpages");
     306           0 :     get(m_pRightPageCB, "rightpages");
     307           0 :     get(m_pProspectCB, "brochure");
     308           0 :     get(m_pProspectCB_RTL, "rtl");
     309             : 
     310           0 :     get(m_pCommentsFrame, "commentsframe");
     311           0 :     get(m_pNoRB, "none");
     312           0 :     get(m_pOnlyRB, "only");
     313           0 :     get(m_pEndRB, "end");
     314           0 :     get(m_pEndPageRB, "endpage");
     315           0 :     get(m_pPrintEmptyPagesCB, "blankpages");
     316           0 :     get(m_pPaperFromSetupCB, "papertray");
     317           0 :     get(m_pFaxLB, "fax");
     318             : 
     319           0 :     Init();
     320             : 
     321           0 :     Link aLk = LINK( this, SwAddPrinterTabPage, AutoClickHdl);
     322           0 :     m_pGrfCB->SetClickHdl( aLk );
     323           0 :     m_pRightPageCB->SetClickHdl( aLk );
     324           0 :     m_pLeftPageCB->SetClickHdl( aLk );
     325           0 :     m_pCtrlFldCB->SetClickHdl( aLk );
     326           0 :     m_pBackgroundCB->SetClickHdl( aLk );
     327           0 :     m_pBlackFontCB->SetClickHdl( aLk );
     328           0 :     m_pPrintHiddenTextCB->SetClickHdl( aLk );
     329           0 :     m_pPrintTextPlaceholderCB->SetClickHdl( aLk );
     330           0 :     m_pProspectCB->SetClickHdl( aLk );
     331           0 :     m_pProspectCB_RTL->SetClickHdl( aLk );
     332           0 :     m_pPaperFromSetupCB->SetClickHdl( aLk );
     333           0 :     m_pPrintEmptyPagesCB->SetClickHdl( aLk );
     334           0 :     m_pEndPageRB->SetClickHdl( aLk );
     335           0 :     m_pEndRB->SetClickHdl( aLk );
     336           0 :     m_pOnlyRB->SetClickHdl( aLk );
     337           0 :     m_pNoRB->SetClickHdl( aLk );
     338           0 :     m_pFaxLB->SetSelectHdl( LINK( this, SwAddPrinterTabPage, SelectHdl ) );
     339             : 
     340             :     const SfxPoolItem* pItem;
     341           0 :     if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_HTML_MODE, false, &pItem )
     342           0 :         && ((SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON)
     343             :     {
     344           0 :         m_pLeftPageCB->Hide();
     345           0 :         m_pRightPageCB->Hide();
     346           0 :         m_pPrintHiddenTextCB->Hide();
     347           0 :         m_pPrintTextPlaceholderCB->Hide();
     348             : 
     349             :         // hide m_pPrintEmptyPagesCB
     350           0 :         m_pPrintEmptyPagesCB->Hide();
     351             :     }
     352           0 :     m_pProspectCB_RTL->Disable();
     353           0 :     SvtCTLOptions aCTLOptions;
     354           0 :     m_pProspectCB_RTL->Show(aCTLOptions.IsCTLFontEnabled());
     355           0 : }
     356             : 
     357           0 : void SwAddPrinterTabPage::SetPreview(sal_Bool bPrev)
     358             : {
     359           0 :     bPreview = bPrev;
     360           0 :     m_pCommentsFrame->Enable(!bPreview);
     361           0 :     m_pPagesFrame->Enable(!bPreview);
     362           0 : }
     363             : 
     364           0 : SfxTabPage* SwAddPrinterTabPage::Create( Window* pParent,
     365             :                                        const SfxItemSet& rAttrSet )
     366             : {
     367           0 :     return ( new SwAddPrinterTabPage( pParent, rAttrSet ) );
     368             : }
     369             : 
     370           0 : bool    SwAddPrinterTabPage::FillItemSet( SfxItemSet& rCoreSet )
     371             : {
     372           0 :     if ( bAttrModified )
     373             :     {
     374           0 :         SwAddPrinterItem aAddPrinterAttr (FN_PARAM_ADDPRINTER);
     375           0 :         aAddPrinterAttr.bPrintGraphic   = m_pGrfCB->IsChecked();
     376           0 :         aAddPrinterAttr.bPrintTable     = sal_True; // always enabled since CWS printerpullgpages /*aTabCB.IsChecked();*/
     377           0 :         aAddPrinterAttr.bPrintDraw      = m_pGrfCB->IsChecked(); // UI merged with m_pGrfCB in CWS printerpullgpages
     378           0 :         aAddPrinterAttr.bPrintControl   = m_pCtrlFldCB->IsChecked();
     379           0 :         aAddPrinterAttr.bPrintPageBackground = m_pBackgroundCB->IsChecked();
     380           0 :         aAddPrinterAttr.bPrintBlackFont = m_pBlackFontCB->IsChecked();
     381           0 :         aAddPrinterAttr.bPrintHiddenText = m_pPrintHiddenTextCB->IsChecked();
     382           0 :         aAddPrinterAttr.bPrintTextPlaceholder = m_pPrintTextPlaceholderCB->IsChecked();
     383             : 
     384           0 :         aAddPrinterAttr.bPrintLeftPages     = m_pLeftPageCB->IsChecked();
     385           0 :         aAddPrinterAttr.bPrintRightPages    = m_pRightPageCB->IsChecked();
     386           0 :         aAddPrinterAttr.bPrintReverse       = sal_False; // handled by vcl itself since CWS printerpullpages /*aReverseCB.IsChecked()*/;
     387           0 :         aAddPrinterAttr.bPrintProspect      = m_pProspectCB->IsChecked();
     388           0 :         aAddPrinterAttr.bPrintProspectRTL   = m_pProspectCB_RTL->IsChecked();
     389           0 :         aAddPrinterAttr.bPaperFromSetup     = m_pPaperFromSetupCB->IsChecked();
     390           0 :         aAddPrinterAttr.bPrintEmptyPages    = m_pPrintEmptyPagesCB->IsChecked();
     391           0 :         aAddPrinterAttr.bPrintSingleJobs    = sal_True; // handled by vcl in new print dialog since CWS printerpullpages /*aSingleJobsCB.IsChecked()*/;
     392             : 
     393           0 :         if (m_pNoRB->IsChecked())  aAddPrinterAttr.nPrintPostIts =
     394           0 :                                                         POSTITS_NONE;
     395           0 :         if (m_pOnlyRB->IsChecked()) aAddPrinterAttr.nPrintPostIts =
     396           0 :                                                         POSTITS_ONLY;
     397           0 :         if (m_pEndRB->IsChecked()) aAddPrinterAttr.nPrintPostIts =
     398           0 :                                                         POSTITS_ENDDOC;
     399           0 :         if (m_pEndPageRB->IsChecked()) aAddPrinterAttr.nPrintPostIts =
     400           0 :                                                         POSTITS_ENDPAGE;
     401             : 
     402           0 :         OUString sFax = m_pFaxLB->GetSelectEntry();
     403           0 :         aAddPrinterAttr.sFaxName = sNone == sFax ? aEmptyOUStr : sFax;
     404           0 :         rCoreSet.Put(aAddPrinterAttr);
     405             :     }
     406           0 :     return bAttrModified;
     407             : }
     408             : 
     409           0 : void    SwAddPrinterTabPage::Reset( const SfxItemSet&  )
     410             : {
     411           0 :     const   SfxItemSet&         rSet = GetItemSet();
     412           0 :     const   SwAddPrinterItem*   pAddPrinterAttr = 0;
     413             : 
     414           0 :     if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_ADDPRINTER , false,
     415           0 :                                     (const SfxPoolItem**)&pAddPrinterAttr ))
     416             :     {
     417           0 :         m_pGrfCB->Check(pAddPrinterAttr->bPrintGraphic || pAddPrinterAttr->bPrintDraw);
     418           0 :         m_pCtrlFldCB->Check(       pAddPrinterAttr->bPrintControl);
     419           0 :         m_pBackgroundCB->Check(    pAddPrinterAttr->bPrintPageBackground);
     420           0 :         m_pBlackFontCB->Check(     pAddPrinterAttr->bPrintBlackFont);
     421           0 :         m_pPrintHiddenTextCB->Check( pAddPrinterAttr->bPrintHiddenText);
     422           0 :         m_pPrintTextPlaceholderCB->Check(pAddPrinterAttr->bPrintTextPlaceholder);
     423           0 :         m_pLeftPageCB->Check(      pAddPrinterAttr->bPrintLeftPages);
     424           0 :         m_pRightPageCB->Check(     pAddPrinterAttr->bPrintRightPages);
     425           0 :         m_pPaperFromSetupCB->Check(pAddPrinterAttr->bPaperFromSetup);
     426           0 :         m_pPrintEmptyPagesCB->Check(pAddPrinterAttr->bPrintEmptyPages);
     427           0 :         m_pProspectCB->Check(      pAddPrinterAttr->bPrintProspect);
     428           0 :         m_pProspectCB_RTL->Check(      pAddPrinterAttr->bPrintProspectRTL);
     429             : 
     430           0 :         m_pNoRB->Check (pAddPrinterAttr->nPrintPostIts== POSTITS_NONE ) ;
     431           0 :         m_pOnlyRB->Check (pAddPrinterAttr->nPrintPostIts== POSTITS_ONLY ) ;
     432           0 :         m_pEndRB->Check (pAddPrinterAttr->nPrintPostIts== POSTITS_ENDDOC ) ;
     433           0 :         m_pEndPageRB->Check (pAddPrinterAttr->nPrintPostIts== POSTITS_ENDPAGE ) ;
     434           0 :         m_pFaxLB->SelectEntry( pAddPrinterAttr->sFaxName );
     435             :     }
     436           0 :     if (m_pProspectCB->IsChecked())
     437             :     {
     438           0 :         m_pProspectCB_RTL->Enable(true);
     439           0 :         m_pNoRB->Enable( false );
     440           0 :         m_pOnlyRB->Enable( false );
     441           0 :         m_pEndRB->Enable( false );
     442           0 :         m_pEndPageRB->Enable( false );
     443             :     }
     444             :     else
     445           0 :         m_pProspectCB_RTL->Enable( false );
     446           0 : }
     447             : 
     448           0 : void    SwAddPrinterTabPage::Init()
     449             : {
     450             : 
     451           0 : }
     452             : 
     453           0 : IMPL_LINK_NOARG_INLINE_START(SwAddPrinterTabPage, AutoClickHdl)
     454             : {
     455           0 :     bAttrModified = sal_True;
     456           0 :     bool bIsProspect = m_pProspectCB->IsChecked();
     457           0 :     if (!bIsProspect)
     458           0 :         m_pProspectCB_RTL->Check( false );
     459           0 :     m_pProspectCB_RTL->Enable( bIsProspect );
     460           0 :     m_pNoRB->Enable( !bIsProspect );
     461           0 :     m_pOnlyRB->Enable( !bIsProspect );
     462           0 :     m_pEndRB->Enable( !bIsProspect );
     463           0 :     m_pEndPageRB->Enable( !bIsProspect );
     464           0 :     return 0;
     465             : }
     466           0 : IMPL_LINK_NOARG_INLINE_END(SwAddPrinterTabPage, AutoClickHdl)
     467             : 
     468           0 : void  SwAddPrinterTabPage::SetFax( const std::vector<OUString>& rFaxLst )
     469             : {
     470           0 :     m_pFaxLB->InsertEntry(sNone);
     471           0 :     for(size_t i = 0; i < rFaxLst.size(); ++i)
     472             :     {
     473           0 :         m_pFaxLB->InsertEntry(rFaxLst[i]);
     474             :     }
     475           0 :     m_pFaxLB->SelectEntryPos(0);
     476           0 : }
     477             : 
     478           0 : IMPL_LINK_NOARG_INLINE_START(SwAddPrinterTabPage, SelectHdl)
     479             : {
     480           0 :     bAttrModified=sal_True;
     481           0 :     return 0;
     482             : }
     483           0 : IMPL_LINK_NOARG_INLINE_END(SwAddPrinterTabPage, SelectHdl)
     484             : 
     485           0 : void SwAddPrinterTabPage::PageCreated (SfxAllItemSet aSet)
     486             : {
     487           0 :     SFX_ITEMSET_ARG (&aSet,pListItem,SfxBoolItem,SID_FAX_LIST,false);
     488           0 :     SFX_ITEMSET_ARG (&aSet,pPreviewItem,SfxBoolItem,SID_PREVIEWFLAG_TYPE,false);
     489           0 :     if (pPreviewItem)
     490             :     {
     491           0 :         SetPreview(pPreviewItem->GetValue());
     492           0 :         Reset(aSet);
     493             :     }
     494           0 :     if (pListItem && pListItem->GetValue())
     495             :     {
     496           0 :         std::vector<OUString> aFaxList;
     497           0 :         const std::vector<OUString>& rPrinters = Printer::GetPrinterQueues();
     498           0 :         for (unsigned int i = 0; i < rPrinters.size(); ++i)
     499           0 :             aFaxList.insert(aFaxList.begin(), rPrinters[i]);
     500           0 :         SetFax( aFaxList );
     501             :     }
     502           0 : }
     503             : 
     504             : /*--------------------------------------------------
     505             :     Tabpage Standardfonts
     506             : --------------------------------------------------*/
     507           0 : SwStdFontTabPage::SwStdFontTabPage( Window* pParent,
     508             :                                        const SfxItemSet& rSet ) :
     509             :     SfxTabPage( pParent, "OptFontTabPage" , "modules/swriter/ui/optfonttabpage.ui" , rSet),
     510             :     pPrt(0),
     511             :     pFontList(0),
     512             :     pFontConfig(0),
     513             :     pWrtShell(0),
     514           0 :     eLanguage( GetAppLanguage() ),
     515             : 
     516             :     bListDefault(sal_False),
     517             :     bSetListDefault(sal_True),
     518             :     bLabelDefault(sal_False),
     519             :     bSetLabelDefault(sal_True),
     520             :     bIdxDefault(sal_False),
     521             :     bSetIdxDefault(sal_True),
     522             :     bDeletePrinter(sal_False),
     523             : 
     524             :     bListHeightDefault    (sal_False),
     525             :     bSetListHeightDefault (sal_False),
     526             :     bLabelHeightDefault   (sal_False),
     527             :     bSetLabelHeightDefault(sal_False),
     528             :     bIndexHeightDefault     (sal_False),
     529             :     bSetIndexHeightDefault  (sal_False),
     530             : 
     531             :     nFontGroup(FONT_GROUP_DEFAULT),
     532             : 
     533             :     sScriptWestern(SW_RES(ST_SCRIPT_WESTERN)),
     534             :     sScriptAsian(SW_RES(ST_SCRIPT_ASIAN)),
     535           0 :     sScriptComplex(SW_RES(ST_SCRIPT_CTL))
     536             : {
     537           0 :     get(pLabelFT,"label1");
     538           0 :     get(pStandardBox,"standardbox");
     539           0 :     pStandardBox->SetStyle(pStandardBox->GetStyle() |  WB_SORT);
     540           0 :     get(pStandardHeightLB,"standardheight");
     541           0 :     get(pTitleBox,"titlebox");
     542           0 :     pTitleBox->SetStyle(pTitleBox->GetStyle() |  WB_SORT);
     543           0 :     get(pTitleHeightLB,"titleheight");
     544           0 :     get(pListBox,"listbox");
     545           0 :     pListBox->SetStyle(pListBox->GetStyle() |  WB_SORT);
     546           0 :     get(pListHeightLB,"listheight");
     547           0 :     get(pLabelBox,"labelbox");
     548           0 :     pLabelBox->SetStyle(pLabelBox->GetStyle() |  WB_SORT);
     549           0 :     get(pLabelHeightLB,"labelheight");
     550           0 :     get(pIdxBox,"idxbox");
     551           0 :     pIdxBox->SetStyle(pIdxBox->GetStyle() |  WB_SORT);
     552           0 :     get(pIndexHeightLB,"indexheight");
     553             : 
     554           0 :     get(pDocOnlyCB,"doconly");
     555           0 :     get(pStandardPB,"standard");
     556             : 
     557           0 :     pStandardPB->SetClickHdl(LINK(this, SwStdFontTabPage, StandardHdl));
     558           0 :     pStandardBox->SetModifyHdl( LINK(this, SwStdFontTabPage, ModifyHdl));
     559           0 :     pListBox    ->SetModifyHdl( LINK(this, SwStdFontTabPage, ModifyHdl));
     560           0 :     pLabelBox   ->SetModifyHdl( LINK(this, SwStdFontTabPage, ModifyHdl));
     561           0 :     pIdxBox     ->SetModifyHdl( LINK(this, SwStdFontTabPage, ModifyHdl));
     562           0 :     Link aFocusLink = LINK( this, SwStdFontTabPage, LoseFocusHdl);
     563           0 :     pStandardBox->SetLoseFocusHdl( aFocusLink );
     564           0 :     pTitleBox   ->SetLoseFocusHdl( aFocusLink );
     565           0 :     pListBox    ->SetLoseFocusHdl( aFocusLink );
     566           0 :     pLabelBox   ->SetLoseFocusHdl( aFocusLink );
     567           0 :     pIdxBox     ->SetLoseFocusHdl( aFocusLink );
     568             : 
     569           0 :     Link aModifyHeightLink( LINK( this, SwStdFontTabPage, ModifyHeightHdl));
     570           0 :     pStandardHeightLB->SetModifyHdl( aModifyHeightLink );
     571           0 :     pTitleHeightLB->   SetModifyHdl( aModifyHeightLink );
     572           0 :     pListHeightLB->    SetModifyHdl( aModifyHeightLink );
     573           0 :     pLabelHeightLB->   SetModifyHdl( aModifyHeightLink );
     574           0 :     pIndexHeightLB->   SetModifyHdl( aModifyHeightLink );
     575             : 
     576           0 :     pDocOnlyCB->Check(SW_MOD()->GetModuleConfig()->IsDefaultFontInCurrDocOnly());
     577           0 : }
     578             : 
     579           0 : SwStdFontTabPage::~SwStdFontTabPage()
     580             : {
     581           0 :     delete pFontList;
     582           0 :     if (bDeletePrinter)
     583             :     {
     584           0 :         delete pPrt;
     585             :     }
     586           0 : }
     587             : 
     588           0 : SfxTabPage* SwStdFontTabPage::Create( Window* pParent,
     589             :                                 const SfxItemSet& rAttrSet )
     590             : {
     591           0 :     return new SwStdFontTabPage(pParent, rAttrSet);
     592             : }
     593             : 
     594           0 : static void lcl_SetColl(SwWrtShell* pWrtShell, sal_uInt16 nType,
     595             :                     SfxPrinter* pPrt, const OUString& rStyle,
     596             :                     sal_uInt16 nFontWhich)
     597             : {
     598           0 :     Font aFont( rStyle, Size( 0, 10 ) );
     599           0 :     if( pPrt )
     600           0 :         aFont = pPrt->GetFontMetric( aFont );
     601           0 :     SwTxtFmtColl *pColl = pWrtShell->GetTxtCollFromPool(nType);
     602           0 :     pColl->SetFmtAttr(SvxFontItem(aFont.GetFamily(), aFont.GetName(),
     603           0 :                 aEmptyOUStr, aFont.GetPitch(), aFont.GetCharSet(), nFontWhich));
     604           0 : }
     605             : 
     606           0 : static void lcl_SetColl(SwWrtShell* pWrtShell, sal_uInt16 nType,
     607             :                     sal_Int32 nHeight, sal_uInt16 nFontHeightWhich)
     608             : {
     609           0 :     float fSize = (float)nHeight / 10;
     610           0 :     nHeight = CalcToUnit( fSize, SFX_MAPUNIT_TWIP );
     611           0 :     SwTxtFmtColl *pColl = pWrtShell->GetTxtCollFromPool(nType);
     612           0 :     pColl->SetFmtAttr(SvxFontHeightItem(nHeight, 100, nFontHeightWhich));
     613           0 : }
     614             : 
     615           0 : bool SwStdFontTabPage::FillItemSet( SfxItemSet& )
     616             : {
     617           0 :     sal_Bool bNotDocOnly = !pDocOnlyCB->IsChecked();
     618           0 :     SW_MOD()->GetModuleConfig()->SetDefaultFontInCurrDocOnly(!bNotDocOnly);
     619             : 
     620           0 :     OUString sStandard    = pStandardBox->GetText();
     621           0 :     OUString sTitle       = pTitleBox->GetText();
     622           0 :     OUString sList        = pListBox->GetText();
     623           0 :     OUString sLabel       = pLabelBox->GetText();
     624           0 :     OUString sIdx         = pIdxBox->GetText();
     625             : 
     626           0 :     bool bStandardHeightChanged = pStandardHeightLB->GetSavedValue() != pStandardHeightLB->GetText();
     627           0 :     bool bTitleHeightChanged = pTitleHeightLB->GetSavedValue() != pTitleHeightLB->GetText();
     628           0 :     bool bListHeightChanged = pListHeightLB->GetSavedValue() != pListHeightLB->GetText() && (!bListHeightDefault || !bSetListHeightDefault );
     629           0 :     bool bLabelHeightChanged = pLabelHeightLB->GetSavedValue() != pLabelHeightLB->GetText() && (!bLabelHeightDefault || !bSetLabelHeightDefault );
     630           0 :     bool bIndexHeightChanged = pIndexHeightLB->GetSavedValue() != pIndexHeightLB->GetText() && (!bIndexHeightDefault || !bSetIndexHeightDefault );
     631           0 :     if(bNotDocOnly)
     632             :     {
     633           0 :         pFontConfig->SetFontStandard(sStandard, nFontGroup);
     634           0 :         pFontConfig->SetFontOutline(sTitle, nFontGroup);
     635           0 :         pFontConfig->SetFontList(sList, nFontGroup);
     636           0 :         pFontConfig->SetFontCaption(sLabel, nFontGroup);
     637           0 :         pFontConfig->SetFontIndex(sIdx, nFontGroup);
     638           0 :         if(bStandardHeightChanged)
     639             :         {
     640           0 :             float fSize = (float)pStandardHeightLB->GetValue() / 10;
     641           0 :             pFontConfig->SetFontHeight( CalcToUnit( fSize, SFX_MAPUNIT_TWIP ), FONT_STANDARD, nFontGroup );
     642             :         }
     643           0 :         if(bTitleHeightChanged)
     644             :         {
     645           0 :             float fSize = (float)pTitleHeightLB->GetValue() / 10;
     646           0 :             pFontConfig->SetFontHeight( CalcToUnit( fSize, SFX_MAPUNIT_TWIP ), FONT_OUTLINE, nFontGroup );
     647             :         }
     648           0 :         if(bListHeightChanged)
     649             :         {
     650           0 :             float fSize = (float)pListHeightLB->GetValue() / 10;
     651           0 :             pFontConfig->SetFontHeight( CalcToUnit( fSize, SFX_MAPUNIT_TWIP ), FONT_LIST, nFontGroup );
     652             :         }
     653           0 :         if(bLabelHeightChanged)
     654             :         {
     655           0 :             float fSize = (float)pLabelHeightLB->GetValue() / 10;
     656           0 :             pFontConfig->SetFontHeight( CalcToUnit( fSize, SFX_MAPUNIT_TWIP ), FONT_CAPTION, nFontGroup );
     657             :         }
     658           0 :         if(bIndexHeightChanged)
     659             :         {
     660           0 :             float fSize = (float)pIndexHeightLB->GetValue() / 10;
     661           0 :             pFontConfig->SetFontHeight( CalcToUnit( fSize, SFX_MAPUNIT_TWIP ), FONT_INDEX, nFontGroup );
     662             :         }
     663             :     }
     664           0 :     if(pWrtShell)
     665             :     {
     666           0 :         pWrtShell->StartAllAction();
     667           0 :         SfxPrinter* pPrinter = pWrtShell->getIDocumentDeviceAccess()->getPrinter( false );
     668           0 :         bool bMod = false;
     669             :         sal_uInt16 nFontWhich = sal::static_int_cast< sal_uInt16, RES_CHRATR >(
     670           0 :             nFontGroup == FONT_GROUP_DEFAULT  ? RES_CHRATR_FONT :
     671           0 :             FONT_GROUP_CJK == nFontGroup ? RES_CHRATR_CJK_FONT : RES_CHRATR_CTL_FONT);
     672             :         sal_uInt16 nFontHeightWhich = sal::static_int_cast< sal_uInt16, RES_CHRATR >(
     673           0 :             nFontGroup == FONT_GROUP_DEFAULT  ? RES_CHRATR_FONTSIZE :
     674           0 :             FONT_GROUP_CJK == nFontGroup ? RES_CHRATR_CJK_FONTSIZE : RES_CHRATR_CTL_FONTSIZE);
     675           0 :         if(sStandard != sShellStd)
     676             :         {
     677           0 :             Font aFont( sStandard, Size( 0, 10 ) );
     678           0 :             if( pPrinter )
     679           0 :                 aFont = pPrinter->GetFontMetric( aFont );
     680           0 :             pWrtShell->SetDefault(SvxFontItem(aFont.GetFamily(), aFont.GetName(),
     681           0 :                                   aEmptyOUStr, aFont.GetPitch(), aFont.GetCharSet(), nFontWhich));
     682           0 :             SwTxtFmtColl *pColl = pWrtShell->GetTxtCollFromPool(RES_POOLCOLL_STANDARD);
     683           0 :             pColl->ResetFmtAttr(nFontWhich);
     684           0 :             bMod = true;
     685             :         }
     686           0 :         if(bStandardHeightChanged)
     687             :         {
     688           0 :             float fSize = (float)pStandardHeightLB->GetValue() / 10;
     689           0 :             pWrtShell->SetDefault(SvxFontHeightItem( CalcToUnit( fSize, SFX_MAPUNIT_TWIP ), 100, nFontHeightWhich ) );
     690           0 :             SwTxtFmtColl *pColl = pWrtShell->GetTxtCollFromPool(RES_POOLCOLL_STANDARD);
     691           0 :             pColl->ResetFmtAttr(nFontHeightWhich);
     692           0 :             bMod = true;
     693             :         }
     694             : 
     695           0 :         if(sTitle != sShellTitle )
     696             :         {
     697           0 :             lcl_SetColl(pWrtShell, RES_POOLCOLL_HEADLINE_BASE, pPrinter, sTitle, nFontWhich);
     698           0 :             bMod = true;
     699             :         }
     700           0 :         if(bTitleHeightChanged)
     701             :         {
     702             :             lcl_SetColl(pWrtShell, RES_POOLCOLL_HEADLINE_BASE,
     703           0 :                 sal::static_int_cast< sal_uInt16, sal_Int64 >(pTitleHeightLB->GetValue()), nFontHeightWhich);
     704           0 :             bMod = true;
     705             :         }
     706           0 :         if(sList != sShellList && (!bListDefault || !bSetListDefault ))
     707             :         {
     708           0 :             lcl_SetColl(pWrtShell, RES_POOLCOLL_NUMBUL_BASE, pPrinter, sList, nFontWhich);
     709           0 :             bMod = true;
     710             :         }
     711           0 :         if(bListHeightChanged)
     712             :         {
     713             :             lcl_SetColl(pWrtShell, RES_POOLCOLL_NUMBUL_BASE,
     714           0 :                 sal::static_int_cast< sal_uInt16, sal_Int64 >(pListHeightLB->GetValue()), nFontHeightWhich);
     715           0 :             bMod = true;
     716             :         }
     717           0 :         if(sLabel != sShellLabel && (!bLabelDefault || !bSetLabelDefault))
     718             :         {
     719           0 :             lcl_SetColl(pWrtShell, RES_POOLCOLL_LABEL, pPrinter, sLabel, nFontWhich);
     720           0 :             bMod = true;
     721             :         }
     722           0 :         if(bLabelHeightChanged)
     723             :         {
     724             :             lcl_SetColl(pWrtShell, RES_POOLCOLL_LABEL,
     725           0 :                 sal::static_int_cast< sal_uInt16, sal_Int64 >(pLabelHeightLB->GetValue()), nFontHeightWhich);
     726           0 :             bMod = true;
     727             :         }
     728           0 :         if(sIdx != sShellIndex && (!bIdxDefault || !bSetIdxDefault))
     729             :         {
     730           0 :             lcl_SetColl(pWrtShell, RES_POOLCOLL_REGISTER_BASE, pPrinter, sIdx, nFontWhich);
     731           0 :             bMod = true;
     732             :         }
     733           0 :         if(bIndexHeightChanged)
     734             :         {
     735             :             lcl_SetColl(pWrtShell, RES_POOLCOLL_REGISTER_BASE,
     736           0 :                 sal::static_int_cast< sal_uInt16, sal_Int64 >(pIndexHeightLB->GetValue()), nFontHeightWhich);
     737           0 :             bMod = true;
     738             :         }
     739           0 :         if ( bMod )
     740           0 :             pWrtShell->SetModified();
     741           0 :         pWrtShell->EndAllAction();
     742             :     }
     743           0 :     return false;
     744             : }
     745             : 
     746           0 : void SwStdFontTabPage::Reset( const SfxItemSet& rSet)
     747             : {
     748             :     const SfxPoolItem* pLang;
     749           0 :     sal_uInt16 nLangSlot = nFontGroup == FONT_GROUP_DEFAULT  ? SID_ATTR_LANGUAGE :
     750           0 :         FONT_GROUP_CJK == nFontGroup ? SID_ATTR_CHAR_CJK_LANGUAGE : SID_ATTR_CHAR_CTL_LANGUAGE;
     751             : 
     752           0 :     if( SFX_ITEM_SET == rSet.GetItemState(nLangSlot, false, &pLang))
     753           0 :         eLanguage = ((const SvxLanguageItem*)pLang)->GetValue();
     754             : 
     755           0 :     OUString sTmp = pLabelFT->GetText();
     756           0 :     OUString sToReplace = sScriptWestern;
     757           0 :     if(FONT_GROUP_CJK == nFontGroup )
     758           0 :         sToReplace = sScriptAsian;
     759           0 :     else if(FONT_GROUP_CTL == nFontGroup )
     760           0 :         sToReplace = sScriptComplex;
     761           0 :     pLabelFT->SetText(sTmp.replaceFirst("%1", sToReplace));
     762             : 
     763             :     const SfxPoolItem* pItem;
     764             : 
     765           0 :     if (bDeletePrinter)
     766             :     {
     767           0 :         delete pPrt;
     768             :     }
     769             : 
     770           0 :     if(SFX_ITEM_SET == rSet.GetItemState(FN_PARAM_PRINTER, false, &pItem))
     771             :     {
     772           0 :         pPrt = (SfxPrinter*)((const SwPtrItem*)pItem)->GetValue();
     773             :     }
     774             :     else
     775             :     {
     776             :         SfxItemSet* pPrinterSet = new SfxItemSet( *rSet.GetPool(),
     777             :                     SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
     778             :                     SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
     779           0 :                     0 );
     780           0 :         pPrt = new SfxPrinter(pPrinterSet);
     781             :     }
     782           0 :     delete pFontList;
     783           0 :     pFontList = new FontList( pPrt );
     784             :     // #i94536# prevent duplication of font entries when 'reset' button is pressed
     785           0 :     if( !pStandardBox->GetEntryCount() )
     786             :     {
     787             :         // get the set of disctinct available family names
     788           0 :         std::set< OUString > aFontNames;
     789           0 :         int nFontNames = pPrt->GetDevFontCount();
     790           0 :         for( int i = 0; i < nFontNames; i++ )
     791             :         {
     792           0 :             FontInfo aInf( pPrt->GetDevFont( i ) );
     793           0 :             aFontNames.insert( aInf.GetName() );
     794           0 :         }
     795             : 
     796             :         // insert to listboxes
     797           0 :         for( std::set< OUString >::const_iterator it = aFontNames.begin();
     798           0 :              it != aFontNames.end(); ++it )
     799             :         {
     800           0 :             pStandardBox->InsertEntry( *it );
     801           0 :             pTitleBox->InsertEntry( *it );
     802           0 :             pListBox->InsertEntry( *it );
     803           0 :             pLabelBox->InsertEntry( *it );
     804           0 :             pIdxBox->InsertEntry( *it );
     805           0 :         }
     806             :     }
     807           0 :     if(SFX_ITEM_SET == rSet.GetItemState(FN_PARAM_STDFONTS, false, &pItem))
     808             :     {
     809           0 :          pFontConfig = (SwStdFontConfig*)((const SwPtrItem*)pItem)->GetValue();
     810             :     }
     811             : 
     812           0 :     if(SFX_ITEM_SET == rSet.GetItemState(FN_PARAM_WRTSHELL, false, &pItem))
     813             :     {
     814           0 :         pWrtShell = (SwWrtShell*)((const SwPtrItem*)pItem)->GetValue();
     815             :     }
     816           0 :     OUString sStdBackup;
     817           0 :     OUString sOutBackup;
     818           0 :     OUString sListBackup;
     819           0 :     OUString sCapBackup;
     820           0 :     OUString sIdxBackup;
     821           0 :     sal_Int32 nStandardHeight = -1;
     822           0 :     sal_Int32 nTitleHeight = -1;
     823           0 :     sal_Int32 nListHeight = -1;
     824           0 :     sal_Int32 nLabelHeight = -1;
     825           0 :     sal_Int32 nIndexHeight = -1;
     826             : 
     827           0 :     if(!pWrtShell)
     828             :     {
     829           0 :         sStdBackup = pFontConfig->GetFontStandard(nFontGroup);
     830           0 :         sOutBackup = pFontConfig->GetFontOutline(nFontGroup);
     831           0 :         sListBackup= pFontConfig->GetFontList(nFontGroup);
     832           0 :         sCapBackup = pFontConfig->GetFontCaption(nFontGroup);
     833           0 :         sIdxBackup = pFontConfig->GetFontIndex(nFontGroup);
     834           0 :         nStandardHeight = pFontConfig->GetFontHeight( FONT_STANDARD, nFontGroup, eLanguage );
     835           0 :         nTitleHeight =    pFontConfig->GetFontHeight( FONT_OUTLINE , nFontGroup, eLanguage );
     836           0 :         nListHeight =     pFontConfig->GetFontHeight( FONT_LIST    , nFontGroup, eLanguage );
     837           0 :         nLabelHeight =    pFontConfig->GetFontHeight( FONT_CAPTION , nFontGroup, eLanguage );
     838           0 :         nIndexHeight =    pFontConfig->GetFontHeight( FONT_INDEX   , nFontGroup, eLanguage );
     839           0 :         if( nStandardHeight <= 0)
     840           0 :             nStandardHeight = pFontConfig->GetDefaultHeightFor( FONT_STANDARD + nFontGroup * FONT_PER_GROUP, eLanguage);
     841           0 :         if( nTitleHeight <= 0)
     842           0 :             nTitleHeight = pFontConfig->GetDefaultHeightFor( FONT_OUTLINE + nFontGroup * FONT_PER_GROUP, eLanguage);
     843           0 :         if( nListHeight <= 0)
     844           0 :             nListHeight = pFontConfig->GetDefaultHeightFor( FONT_LIST + nFontGroup * FONT_PER_GROUP, eLanguage);
     845           0 :         if( nLabelHeight <= 0)
     846           0 :             nLabelHeight = pFontConfig->GetDefaultHeightFor( FONT_CAPTION + nFontGroup * FONT_PER_GROUP, eLanguage);
     847           0 :         if( nIndexHeight <= 0)
     848           0 :             nIndexHeight = pFontConfig->GetDefaultHeightFor( FONT_INDEX + nFontGroup * FONT_PER_GROUP, eLanguage);
     849             : 
     850           0 :        pDocOnlyCB->Enable(false);
     851             :     }
     852             :     else
     853             :     {
     854           0 :         SwTxtFmtColl *pColl = pWrtShell->GetTxtCollFromPool(RES_POOLCOLL_STANDARD);
     855           0 :         const SvxFontItem& rFont = !nFontGroup ? pColl->GetFont() :
     856           0 :                 FONT_GROUP_CJK == nFontGroup ? pColl->GetCJKFont() : pColl->GetCTLFont();
     857           0 :         sShellStd = sStdBackup =  rFont.GetFamilyName();
     858             : 
     859             :         sal_uInt16 nFontHeightWhich = sal::static_int_cast< sal_uInt16, RES_CHRATR >(
     860           0 :             nFontGroup == FONT_GROUP_DEFAULT  ? RES_CHRATR_FONTSIZE :
     861           0 :             FONT_GROUP_CJK == nFontGroup ? RES_CHRATR_CJK_FONTSIZE : RES_CHRATR_CTL_FONTSIZE );
     862           0 :         const SvxFontHeightItem& rFontHeightStandard = (const SvxFontHeightItem& )pColl->GetFmtAttr(nFontHeightWhich);
     863           0 :         nStandardHeight = (sal_Int32)rFontHeightStandard.GetHeight();
     864             : 
     865           0 :         pColl = pWrtShell->GetTxtCollFromPool(RES_POOLCOLL_HEADLINE_BASE);
     866           0 :         const SvxFontItem& rFontHL = !nFontGroup ? pColl->GetFont() :
     867           0 :                 FONT_GROUP_CJK == nFontGroup ? pColl->GetCJKFont() : pColl->GetCTLFont();
     868           0 :         sShellTitle = sOutBackup = rFontHL.GetFamilyName();
     869             : 
     870           0 :         const SvxFontHeightItem& rFontHeightTitle = (const SvxFontHeightItem&)pColl->GetFmtAttr( nFontHeightWhich, sal_True );
     871           0 :         nTitleHeight = (sal_Int32)rFontHeightTitle.GetHeight();
     872             : 
     873             :         sal_uInt16 nFontWhich = sal::static_int_cast< sal_uInt16, RES_CHRATR >(
     874           0 :             nFontGroup == FONT_GROUP_DEFAULT  ? RES_CHRATR_FONT :
     875           0 :             FONT_GROUP_CJK == nFontGroup ? RES_CHRATR_CJK_FONT : RES_CHRATR_CTL_FONT);
     876           0 :         pColl = pWrtShell->GetTxtCollFromPool(RES_POOLCOLL_NUMBUL_BASE);
     877           0 :         const SvxFontItem& rFontLS = !nFontGroup ? pColl->GetFont() :
     878           0 :                 FONT_GROUP_CJK == nFontGroup ? pColl->GetCJKFont() : pColl->GetCTLFont();
     879           0 :         bListDefault = SFX_ITEM_DEFAULT == pColl->GetAttrSet().GetItemState(nFontWhich, false);
     880           0 :         sShellList = sListBackup = rFontLS.GetFamilyName();
     881             : 
     882           0 :         const SvxFontHeightItem& rFontHeightList = (const SvxFontHeightItem&)pColl->GetFmtAttr(nFontHeightWhich, sal_True);
     883           0 :         nListHeight = (sal_Int32)rFontHeightList.GetHeight();
     884           0 :         bListHeightDefault = SFX_ITEM_DEFAULT == pColl->GetAttrSet().GetItemState(nFontWhich, false);
     885             : 
     886           0 :         pColl = pWrtShell->GetTxtCollFromPool(RES_POOLCOLL_LABEL);
     887           0 :         bLabelDefault = SFX_ITEM_DEFAULT == pColl->GetAttrSet().GetItemState(nFontWhich, false);
     888           0 :         const SvxFontItem& rFontCP = !nFontGroup ? pColl->GetFont() :
     889           0 :                 FONT_GROUP_CJK == nFontGroup ? pColl->GetCJKFont() : pColl->GetCTLFont();
     890           0 :         sShellLabel = sCapBackup = rFontCP.GetFamilyName();
     891           0 :         const SvxFontHeightItem& rFontHeightLabel = (const SvxFontHeightItem&)pColl->GetFmtAttr(nFontHeightWhich, sal_True);
     892           0 :         nLabelHeight = (sal_Int32)rFontHeightLabel.GetHeight();
     893           0 :         bLabelHeightDefault = SFX_ITEM_DEFAULT == pColl->GetAttrSet().GetItemState(nFontWhich, false);
     894             : 
     895           0 :         pColl = pWrtShell->GetTxtCollFromPool(RES_POOLCOLL_REGISTER_BASE);
     896           0 :         bIdxDefault = SFX_ITEM_DEFAULT == pColl->GetAttrSet().GetItemState(nFontWhich, false);
     897           0 :         const SvxFontItem& rFontIDX = !nFontGroup ? pColl->GetFont() :
     898           0 :                 FONT_GROUP_CJK == nFontGroup ? pColl->GetCJKFont() : pColl->GetCTLFont();
     899           0 :         sShellIndex = sIdxBackup = rFontIDX.GetFamilyName();
     900           0 :         const SvxFontHeightItem& rFontHeightIndex = (const SvxFontHeightItem&)pColl->GetFmtAttr(nFontHeightWhich, sal_True);
     901           0 :         nIndexHeight = (sal_Int32)rFontHeightIndex.GetHeight();
     902           0 :         bIndexHeightDefault = SFX_ITEM_DEFAULT == pColl->GetAttrSet().GetItemState(nFontWhich, false);
     903             :     }
     904           0 :     pStandardBox->SetText(sStdBackup );
     905           0 :     pTitleBox->SetText(sOutBackup );
     906           0 :     pListBox->SetText(sListBackup);
     907           0 :     pLabelBox->SetText(sCapBackup );
     908           0 :     pIdxBox->SetText(sIdxBackup );
     909             : 
     910           0 :     FontInfo aFontInfo( pFontList->Get(sStdBackup, sStdBackup) );
     911           0 :     pStandardHeightLB->Fill( &aFontInfo, pFontList );
     912           0 :     aFontInfo = pFontList->Get(sOutBackup, sOutBackup );
     913           0 :     pTitleHeightLB->Fill( &aFontInfo, pFontList );
     914           0 :     aFontInfo = pFontList->Get(sListBackup,sListBackup);
     915           0 :     pListHeightLB->Fill( &aFontInfo, pFontList );
     916           0 :     aFontInfo = pFontList->Get(sCapBackup, sCapBackup );
     917           0 :     pLabelHeightLB->Fill( &aFontInfo, pFontList );
     918           0 :     aFontInfo = pFontList->Get(sIdxBackup, sIdxBackup );
     919           0 :     pIndexHeightLB->Fill( &aFontInfo, pFontList );
     920             : 
     921           0 :     pStandardHeightLB->SetValue( CalcToPoint( nStandardHeight, SFX_MAPUNIT_TWIP, 10 ) );
     922           0 :     pTitleHeightLB->   SetValue( CalcToPoint( nTitleHeight   , SFX_MAPUNIT_TWIP, 10 ) );
     923           0 :     pListHeightLB->    SetValue( CalcToPoint( nListHeight    , SFX_MAPUNIT_TWIP, 10 ) );
     924           0 :     pLabelHeightLB->   SetValue( CalcToPoint( nLabelHeight   , SFX_MAPUNIT_TWIP, 10 ));
     925           0 :     pIndexHeightLB->   SetValue( CalcToPoint( nIndexHeight   , SFX_MAPUNIT_TWIP, 10 ));
     926             : 
     927           0 :     pStandardBox->SaveValue();
     928           0 :     pTitleBox->SaveValue();
     929           0 :     pListBox->SaveValue();
     930           0 :     pLabelBox->SaveValue();
     931           0 :     pIdxBox->SaveValue();
     932             : 
     933           0 :     pStandardHeightLB->SaveValue();
     934           0 :     pTitleHeightLB->SaveValue();
     935           0 :     pListHeightLB->SaveValue();
     936           0 :     pLabelHeightLB->SaveValue();
     937           0 :     pIndexHeightLB->SaveValue();
     938           0 : }
     939             : 
     940           0 : IMPL_LINK_NOARG(SwStdFontTabPage, StandardHdl)
     941             : {
     942           0 :     sal_uInt8 nFontOffset = nFontGroup * FONT_PER_GROUP;
     943           0 :     pStandardBox->SetText(SwStdFontConfig::GetDefaultFor(FONT_STANDARD + nFontOffset, eLanguage));
     944           0 :     pTitleBox   ->SetText(SwStdFontConfig::GetDefaultFor(FONT_OUTLINE  + nFontOffset, eLanguage));
     945           0 :     pListBox    ->SetText(SwStdFontConfig::GetDefaultFor(FONT_LIST     + nFontOffset, eLanguage));
     946           0 :     pLabelBox   ->SetText(SwStdFontConfig::GetDefaultFor(FONT_CAPTION  + nFontOffset, eLanguage));
     947           0 :     pIdxBox     ->SetText(SwStdFontConfig::GetDefaultFor(FONT_INDEX    + nFontOffset, eLanguage));
     948             : 
     949           0 :     pStandardBox->SaveValue();
     950           0 :     pTitleBox->SaveValue();
     951           0 :     pListBox->SaveValue();
     952           0 :     pLabelBox->SaveValue();
     953           0 :     pIdxBox->SaveValue();
     954             : 
     955             :     pStandardHeightLB->SetValue( CalcToPoint(
     956             :         SwStdFontConfig::GetDefaultHeightFor(FONT_STANDARD + nFontOffset, eLanguage),
     957           0 :             SFX_MAPUNIT_TWIP, 10 ) );
     958             :     pTitleHeightLB   ->SetValue(CalcToPoint(
     959             :         SwStdFontConfig::GetDefaultHeightFor(FONT_OUTLINE  +
     960           0 :             nFontOffset, eLanguage), SFX_MAPUNIT_TWIP, 10 ));
     961             :     pListHeightLB    ->SetValue(CalcToPoint(
     962             :         SwStdFontConfig::GetDefaultHeightFor(FONT_LIST + nFontOffset, eLanguage),
     963           0 :             SFX_MAPUNIT_TWIP, 10 ));
     964             :     pLabelHeightLB   ->SetValue(CalcToPoint(
     965             :         SwStdFontConfig::GetDefaultHeightFor(FONT_CAPTION  + nFontOffset, eLanguage),
     966           0 :             SFX_MAPUNIT_TWIP, 10 ));
     967             :     pIndexHeightLB   ->SetValue(CalcToPoint(
     968             :         SwStdFontConfig::GetDefaultHeightFor(FONT_INDEX    + nFontOffset, eLanguage),
     969           0 :             SFX_MAPUNIT_TWIP, 10 ));
     970           0 :     return 0;
     971             : }
     972             : 
     973           0 : IMPL_LINK( SwStdFontTabPage, ModifyHdl, ComboBox*, pBox )
     974             : {
     975           0 :     if(pBox == pStandardBox)
     976             :     {
     977           0 :         OUString sEntry = pBox->GetText();
     978           0 :         if(bSetListDefault && bListDefault)
     979           0 :             pListBox->SetText(sEntry);
     980           0 :         if(bSetLabelDefault && bLabelDefault)
     981           0 :             pLabelBox->SetText(sEntry);
     982           0 :         if(bSetIdxDefault && bIdxDefault)
     983           0 :             pIdxBox->SetText(sEntry);
     984             :     }
     985           0 :     else if(pBox == pListBox)
     986             :     {
     987           0 :         bSetListDefault = sal_False;
     988             :     }
     989           0 :     else if(pBox == pLabelBox)
     990             :     {
     991           0 :         bSetLabelDefault = sal_False;
     992             :     }
     993           0 :     else if(pBox == pIdxBox)
     994             :     {
     995           0 :         bSetIdxDefault = sal_False;
     996             :     }
     997           0 :     return 0;
     998             : }
     999             : 
    1000           0 : IMPL_LINK( SwStdFontTabPage, ModifyHeightHdl, FontSizeBox*, pBox )
    1001             : {
    1002           0 :     if(pBox == pStandardHeightLB)
    1003             :     {
    1004           0 :         sal_Int64 nValue = pBox->GetValue(FUNIT_TWIP);
    1005           0 :         if(bSetListHeightDefault && bListHeightDefault)
    1006           0 :             pListHeightLB->SetValue(nValue, FUNIT_TWIP);
    1007           0 :         if(bSetLabelHeightDefault && bLabelHeightDefault)
    1008           0 :             pLabelHeightLB->SetValue(nValue, FUNIT_TWIP);
    1009           0 :         if(bSetIndexHeightDefault && bIndexHeightDefault)
    1010           0 :             pIndexHeightLB->SetValue(nValue, FUNIT_TWIP);
    1011             :     }
    1012           0 :     else if(pBox == pListHeightLB)
    1013             :     {
    1014           0 :         bSetListHeightDefault = sal_False;
    1015             :     }
    1016           0 :     else if(pBox == pLabelHeightLB)
    1017             :     {
    1018           0 :         bSetLabelHeightDefault = sal_False;
    1019             :     }
    1020           0 :     else if(pBox == pIndexHeightLB)
    1021             :     {
    1022           0 :         bSetIndexHeightDefault = sal_False;
    1023             :     }
    1024           0 :     return 0;
    1025             : }
    1026             : 
    1027           0 : IMPL_LINK( SwStdFontTabPage, LoseFocusHdl, ComboBox*, pBox )
    1028             : {
    1029           0 :     FontSizeBox* pHeightLB = 0;
    1030           0 :     OUString sEntry = pBox->GetText();
    1031           0 :     if(pBox == pStandardBox)
    1032             :     {
    1033           0 :         pHeightLB = pStandardHeightLB;
    1034             :     }
    1035           0 :     else if(pBox == pTitleBox)
    1036             :     {
    1037           0 :         pHeightLB = pTitleHeightLB;
    1038             :     }
    1039           0 :     else if(pBox == pListBox)
    1040             :     {
    1041           0 :         pHeightLB = pListHeightLB;
    1042             :     }
    1043           0 :     else if(pBox == pLabelBox)
    1044             :     {
    1045           0 :         pHeightLB = pLabelHeightLB;
    1046             :     }
    1047             :     else /*if(pBox == pIdxBox)*/
    1048             :     {
    1049           0 :         pHeightLB = pIndexHeightLB;
    1050             :     }
    1051           0 :     FontInfo aFontInfo( pFontList->Get(sEntry, sEntry) );
    1052           0 :     pHeightLB->Fill( &aFontInfo, pFontList );
    1053           0 :     return 0;
    1054             : }
    1055             : 
    1056           0 : void SwStdFontTabPage::PageCreated (SfxAllItemSet aSet)
    1057             : {
    1058           0 :     SFX_ITEMSET_ARG (&aSet,pFlagItem,SfxUInt16Item, SID_FONTMODE_TYPE, false);
    1059           0 :     if (pFlagItem)
    1060           0 :         SetFontMode(sal::static_int_cast< sal_uInt8, sal_uInt16>( pFlagItem->GetValue()));
    1061           0 : }
    1062             : 
    1063           0 : SwTableOptionsTabPage::SwTableOptionsTabPage( Window* pParent, const SfxItemSet& rSet ) :
    1064             :     SfxTabPage(pParent, "OptTablePage", "modules/swriter/ui/opttablepage.ui", rSet),
    1065             :     pWrtShell(0),
    1066           0 :     bHTMLMode(sal_False)
    1067             : {
    1068           0 :     get(pHeaderCB,"header");
    1069           0 :     get(pRepeatHeaderCB,"repeatheader");
    1070           0 :     get(pDontSplitCB,"dontsplit");
    1071           0 :     get(pBorderCB,"border");
    1072           0 :     get(pNumFormattingCB,"numformatting");
    1073           0 :     get(pNumFmtFormattingCB,"numfmtformatting");
    1074           0 :     get(pNumAlignmentCB,"numalignment");
    1075           0 :     get(pRowMoveMF,"rowmove");
    1076           0 :     get(pColMoveMF,"colmove");
    1077           0 :     get(pRowInsertMF,"rowinsert");
    1078           0 :     get(pColInsertMF,"colinsert");
    1079           0 :     get(pFixRB,"fix");
    1080           0 :     get(pFixPropRB,"fixprop");
    1081           0 :     get(pVarRB,"var");
    1082             : 
    1083           0 :     Link aLnk(LINK(this, SwTableOptionsTabPage, CheckBoxHdl));
    1084           0 :     pNumFormattingCB->SetClickHdl(aLnk);
    1085           0 :     pNumFmtFormattingCB->SetClickHdl(aLnk);
    1086           0 :     pHeaderCB->SetClickHdl(aLnk);
    1087           0 : }
    1088             : 
    1089           0 : SwTableOptionsTabPage::~SwTableOptionsTabPage()
    1090             : {
    1091           0 : }
    1092             : 
    1093           0 : SfxTabPage* SwTableOptionsTabPage::Create( Window* pParent,
    1094             :                                 const SfxItemSet& rAttrSet )
    1095             : {
    1096           0 :     return new SwTableOptionsTabPage(pParent, rAttrSet );
    1097             : }
    1098             : 
    1099           0 : bool SwTableOptionsTabPage::FillItemSet( SfxItemSet& )
    1100             : {
    1101           0 :     sal_Bool bRet = sal_False;
    1102           0 :     SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
    1103             : 
    1104           0 :     if(pRowMoveMF->IsModified())
    1105           0 :         pModOpt->SetTblHMove( (sal_uInt16)pRowMoveMF->Denormalize( pRowMoveMF->GetValue(FUNIT_TWIP)));
    1106             : 
    1107           0 :     if(pColMoveMF->IsModified())
    1108           0 :         pModOpt->SetTblVMove( (sal_uInt16)pColMoveMF->Denormalize( pColMoveMF->GetValue(FUNIT_TWIP)));
    1109             : 
    1110           0 :     if(pRowInsertMF->IsModified())
    1111           0 :         pModOpt->SetTblHInsert((sal_uInt16)pRowInsertMF->Denormalize( pRowInsertMF->GetValue(FUNIT_TWIP)));
    1112             : 
    1113           0 :     if(pColInsertMF->IsModified())
    1114           0 :         pModOpt->SetTblVInsert((sal_uInt16)pColInsertMF->Denormalize( pColInsertMF->GetValue(FUNIT_TWIP)));
    1115             : 
    1116             :     TblChgMode eMode;
    1117           0 :     if(pFixRB->IsChecked())
    1118           0 :         eMode = TBLFIX_CHGABS;
    1119           0 :     else if(pFixPropRB->IsChecked())
    1120           0 :         eMode = TBLFIX_CHGPROP;
    1121             :     else
    1122           0 :         eMode = TBLVAR_CHGABS;
    1123           0 :     if(eMode != pModOpt->GetTblMode())
    1124             :     {
    1125           0 :         pModOpt->SetTblMode(eMode);
    1126             :         // the table-keyboard-mode has changed, now the current
    1127             :         // table should know about that too.
    1128           0 :         if(pWrtShell && nsSelectionType::SEL_TBL & pWrtShell->GetSelectionType())
    1129             :         {
    1130           0 :             pWrtShell->SetTblChgMode(eMode);
    1131             :             static sal_uInt16 aInva[] =
    1132             :                                 {   FN_TABLE_MODE_FIX,
    1133             :                                     FN_TABLE_MODE_FIX_PROP,
    1134             :                                     FN_TABLE_MODE_VARIABLE,
    1135             :                                     0
    1136             :                                 };
    1137           0 :             pWrtShell->GetView().GetViewFrame()->GetBindings().Invalidate( aInva );
    1138             :         }
    1139             : 
    1140           0 :         bRet = sal_True;
    1141             :     }
    1142             : 
    1143           0 :     SwInsertTableOptions aInsOpts( 0, 0 );
    1144             : 
    1145           0 :     if (pHeaderCB->IsChecked())
    1146           0 :         aInsOpts.mnInsMode |= tabopts::HEADLINE;
    1147             : 
    1148           0 :     if (pRepeatHeaderCB->IsEnabled() )
    1149           0 :         aInsOpts.mnRowsToRepeat = pRepeatHeaderCB->IsChecked()? 1 : 0;
    1150             : 
    1151           0 :     if (!pDontSplitCB->IsChecked())
    1152           0 :         aInsOpts.mnInsMode |= tabopts::SPLIT_LAYOUT;
    1153             : 
    1154           0 :     if (pBorderCB->IsChecked())
    1155           0 :         aInsOpts.mnInsMode |= tabopts::DEFAULT_BORDER;
    1156             : 
    1157           0 :     if (pHeaderCB->GetSavedValue() != pHeaderCB->GetState() ||
    1158           0 :         pRepeatHeaderCB->GetSavedValue() != pRepeatHeaderCB->GetState() ||
    1159           0 :         pDontSplitCB->GetSavedValue() != pDontSplitCB->GetState() ||
    1160           0 :         pBorderCB->GetSavedValue() != pBorderCB->GetState())
    1161             :     {
    1162           0 :         pModOpt->SetInsTblFlags(bHTMLMode, aInsOpts);
    1163             :     }
    1164             : 
    1165           0 :     if (pNumFormattingCB->GetSavedValue() != pNumFormattingCB->GetState())
    1166             :     {
    1167           0 :         pModOpt->SetInsTblFormatNum(bHTMLMode, pNumFormattingCB->IsChecked());
    1168           0 :         bRet = sal_True;
    1169             :     }
    1170             : 
    1171           0 :     if (pNumFmtFormattingCB->GetSavedValue() != pNumFmtFormattingCB->GetState())
    1172             :     {
    1173           0 :         pModOpt->SetInsTblChangeNumFormat(bHTMLMode, pNumFmtFormattingCB->IsChecked());
    1174           0 :         bRet = sal_True;
    1175             :     }
    1176             : 
    1177           0 :     if (pNumAlignmentCB->GetSavedValue() != pNumAlignmentCB->GetState())
    1178             :     {
    1179           0 :         pModOpt->SetInsTblAlignNum(bHTMLMode, pNumAlignmentCB->IsChecked());
    1180           0 :         bRet = sal_True;
    1181             :     }
    1182             : 
    1183           0 :     return bRet;
    1184             : }
    1185             : 
    1186           0 : void SwTableOptionsTabPage::Reset( const SfxItemSet& rSet)
    1187             : {
    1188           0 :     const SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
    1189           0 :     if ( rSet.GetItemState( SID_ATTR_METRIC ) >= SFX_ITEM_AVAILABLE )
    1190             :     {
    1191           0 :         const SfxUInt16Item& rItem = (SfxUInt16Item&)rSet.Get( SID_ATTR_METRIC );
    1192           0 :         FieldUnit eFieldUnit = (FieldUnit)rItem.GetValue();
    1193           0 :         ::SetFieldUnit( *pRowMoveMF, eFieldUnit );
    1194           0 :         ::SetFieldUnit( *pColMoveMF, eFieldUnit );
    1195           0 :         ::SetFieldUnit( *pRowInsertMF, eFieldUnit );
    1196           0 :         ::SetFieldUnit( *pColInsertMF, eFieldUnit );
    1197             :     }
    1198             : 
    1199           0 :     pRowMoveMF->SetValue(pRowMoveMF->Normalize(pModOpt->GetTblHMove()), FUNIT_TWIP);
    1200           0 :     pColMoveMF->SetValue(pColMoveMF->Normalize(pModOpt->GetTblVMove()), FUNIT_TWIP);
    1201           0 :     pRowInsertMF->SetValue(pRowInsertMF->Normalize(pModOpt->GetTblHInsert()), FUNIT_TWIP);
    1202           0 :     pColInsertMF->SetValue(pColInsertMF->Normalize(pModOpt->GetTblVInsert()), FUNIT_TWIP);
    1203             : 
    1204           0 :     switch(pModOpt->GetTblMode())
    1205             :     {
    1206           0 :         case TBLFIX_CHGABS:     pFixRB->Check();     break;
    1207           0 :         case TBLFIX_CHGPROP:    pFixPropRB->Check(); break;
    1208           0 :         case TBLVAR_CHGABS:     pVarRB->Check(); break;
    1209             :     }
    1210             :     const SfxPoolItem* pItem;
    1211           0 :     if(SFX_ITEM_SET == rSet.GetItemState(SID_HTML_MODE, false, &pItem))
    1212             :     {
    1213           0 :         bHTMLMode = 0 != (((const SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON);
    1214             :     }
    1215             : 
    1216             :     // hide certain controls for html
    1217           0 :     if(bHTMLMode)
    1218             :     {
    1219           0 :         pRepeatHeaderCB->Hide();
    1220           0 :         pDontSplitCB->Hide();
    1221             :     }
    1222             : 
    1223           0 :     SwInsertTableOptions aInsOpts = pModOpt->GetInsTblFlags(bHTMLMode);
    1224           0 :     sal_uInt16 nInsTblFlags = aInsOpts.mnInsMode;
    1225             : 
    1226           0 :     pHeaderCB->Check(0 != (nInsTblFlags & tabopts::HEADLINE));
    1227           0 :     pRepeatHeaderCB->Check((!bHTMLMode) && (aInsOpts.mnRowsToRepeat > 0));
    1228           0 :     pDontSplitCB->Check(!(nInsTblFlags & tabopts::SPLIT_LAYOUT));
    1229           0 :     pBorderCB->Check(0 != (nInsTblFlags & tabopts::DEFAULT_BORDER));
    1230             : 
    1231           0 :     pNumFormattingCB->Check(pModOpt->IsInsTblFormatNum(bHTMLMode));
    1232           0 :     pNumFmtFormattingCB->Check(pModOpt->IsInsTblChangeNumFormat(bHTMLMode));
    1233           0 :     pNumAlignmentCB->Check(pModOpt->IsInsTblAlignNum(bHTMLMode));
    1234             : 
    1235           0 :     pHeaderCB->SaveValue();
    1236           0 :     pRepeatHeaderCB->SaveValue();
    1237           0 :     pDontSplitCB->SaveValue();
    1238           0 :     pBorderCB->SaveValue();
    1239           0 :     pNumFormattingCB->SaveValue();
    1240           0 :     pNumFmtFormattingCB->SaveValue();
    1241           0 :     pNumAlignmentCB->SaveValue();
    1242             : 
    1243           0 :     CheckBoxHdl(0);
    1244           0 : }
    1245             : 
    1246           0 : IMPL_LINK_NOARG(SwTableOptionsTabPage, CheckBoxHdl)
    1247             : {
    1248           0 :     pNumFmtFormattingCB->Enable(pNumFormattingCB->IsChecked());
    1249           0 :     pNumAlignmentCB->Enable(pNumFormattingCB->IsChecked());
    1250           0 :     pRepeatHeaderCB->Enable(pHeaderCB->IsChecked());
    1251           0 :     return 0;
    1252             : }
    1253             : 
    1254           0 : void SwTableOptionsTabPage::PageCreated (SfxAllItemSet aSet)
    1255             : {
    1256           0 :     SFX_ITEMSET_ARG (&aSet,pWrtSh,SwWrtShellItem,SID_WRT_SHELL,false);
    1257           0 :     if (pWrtSh)
    1258           0 :         SetWrtShell(pWrtSh->GetValue());
    1259           0 : }
    1260             : 
    1261           0 : SwShdwCrsrOptionsTabPage::SwShdwCrsrOptionsTabPage( Window* pParent,
    1262             :                                                     const SfxItemSet& rSet )
    1263             :    : SfxTabPage(pParent, "OptFormatAidsPage",
    1264             :                 "modules/swriter/ui/optformataidspage.ui", rSet),
    1265           0 :     m_pWrtShell( NULL )
    1266             : {
    1267           0 :     get(m_pParaCB, "paragraph");
    1268           0 :     get(m_pSHyphCB, "hyphens");
    1269           0 :     get(m_pSpacesCB, "spaces");
    1270           0 :     get(m_pHSpacesCB, "nonbreak");
    1271           0 :     get(m_pTabCB, "tabs");
    1272           0 :     get(m_pBreakCB, "break");
    1273           0 :     get(m_pCharHiddenCB, "hiddentext");
    1274           0 :     get(m_pFldHiddenCB, "hiddentextfield");
    1275           0 :     get(m_pFldHiddenParaCB, "hiddenparafield");
    1276             : 
    1277           0 :     get(m_pDirectCursorFrame, "directcrsrframe");
    1278           0 :     get(m_pOnOffCB, "cursoronoff");
    1279             : 
    1280           0 :     get(m_pFillMarginRB, "fillmargin");
    1281           0 :     get(m_pFillIndentRB, "fillindent");
    1282           0 :     get(m_pFillTabRB, "filltab");
    1283           0 :     get(m_pFillSpaceRB, "fillspace");
    1284             : 
    1285           0 :     get(m_pCursorProtFrame, "crsrprotframe");
    1286           0 :     get(m_pCrsrInProtCB, "cursorinprot");
    1287             : 
    1288           0 :     get(m_pMathBaselineAlignmentCB, "mathbaseline");
    1289             : 
    1290           0 :     const SfxPoolItem* pItem = 0;
    1291             : 
    1292           0 :     SwShadowCursorItem aOpt;
    1293           0 :     if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_SHADOWCURSOR, false, &pItem ))
    1294           0 :         aOpt = *(SwShadowCursorItem*)pItem;
    1295           0 :     m_pOnOffCB->Check( aOpt.IsOn() );
    1296             : 
    1297           0 :     sal_uInt8 eMode = aOpt.GetMode();
    1298           0 :     m_pFillIndentRB->Check( FILL_INDENT == eMode );
    1299           0 :     m_pFillMarginRB->Check( FILL_MARGIN == eMode );
    1300           0 :     m_pFillTabRB->Check( FILL_TAB == eMode );
    1301           0 :     m_pFillSpaceRB->Check( FILL_SPACE == eMode );
    1302             : 
    1303           0 :     if(SFX_ITEM_SET == rSet.GetItemState(SID_HTML_MODE, false, &pItem )
    1304           0 :         && ((SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON)
    1305             :     {
    1306           0 :         m_pTabCB->Hide();
    1307           0 :         m_pCharHiddenCB->Hide();
    1308           0 :         m_pFldHiddenCB->Hide();
    1309           0 :         m_pFldHiddenParaCB->Hide();
    1310             : 
    1311           0 :         m_pDirectCursorFrame->Hide();
    1312           0 :         m_pOnOffCB->Hide();
    1313           0 :         m_pFillMarginRB->Hide();
    1314           0 :         m_pFillIndentRB->Hide();
    1315           0 :         m_pFillTabRB->Hide();
    1316           0 :         m_pFillSpaceRB->Hide();
    1317             : 
    1318           0 :         m_pCursorProtFrame->Hide();
    1319           0 :         m_pCrsrInProtCB->Hide();
    1320           0 :     }
    1321           0 : }
    1322             : 
    1323           0 : SwShdwCrsrOptionsTabPage::~SwShdwCrsrOptionsTabPage()
    1324             : {
    1325           0 : }
    1326             : 
    1327           0 : SfxTabPage* SwShdwCrsrOptionsTabPage::Create( Window* pParent, const SfxItemSet& rSet )
    1328             : {
    1329           0 :     return new SwShdwCrsrOptionsTabPage( pParent, rSet );
    1330             : }
    1331             : 
    1332           0 : void SwShdwCrsrOptionsTabPage::PageCreated( SfxAllItemSet aSet )
    1333             : {
    1334           0 :     SFX_ITEMSET_ARG (&aSet,pWrtSh,SwWrtShellItem,SID_WRT_SHELL,false);
    1335           0 :     if (pWrtSh)
    1336           0 :         SetWrtShell(pWrtSh->GetValue());
    1337           0 : }
    1338             : 
    1339           0 : bool SwShdwCrsrOptionsTabPage::FillItemSet( SfxItemSet& rSet )
    1340             : {
    1341           0 :     SwShadowCursorItem aOpt;
    1342           0 :     aOpt.SetOn( m_pOnOffCB->IsChecked() );
    1343             : 
    1344             :     sal_uInt8 eMode;
    1345           0 :     if( m_pFillIndentRB->IsChecked() )
    1346           0 :         eMode= FILL_INDENT;
    1347           0 :     else if( m_pFillMarginRB->IsChecked() )
    1348           0 :         eMode = FILL_MARGIN;
    1349           0 :     else if( m_pFillTabRB->IsChecked() )
    1350           0 :         eMode = FILL_TAB;
    1351             :     else
    1352           0 :         eMode = FILL_SPACE;
    1353           0 :     aOpt.SetMode( eMode );
    1354             : 
    1355           0 :     bool bRet = false;
    1356           0 :     const SfxPoolItem* pItem = 0;
    1357           0 :     if( SFX_ITEM_SET != rSet.GetItemState( FN_PARAM_SHADOWCURSOR, false, &pItem )
    1358           0 :         ||  ((SwShadowCursorItem&)*pItem) != aOpt )
    1359             :     {
    1360           0 :         rSet.Put( aOpt );
    1361           0 :         bRet = true;
    1362             :     }
    1363             : 
    1364           0 :     if (m_pWrtShell) {
    1365           0 :         m_pWrtShell->GetDoc()->set( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT,
    1366           0 :                                     m_pMathBaselineAlignmentCB->IsChecked() );
    1367           0 :         bRet |= TriState(m_pMathBaselineAlignmentCB->IsChecked()) != m_pMathBaselineAlignmentCB->GetSavedValue();
    1368             :     }
    1369             : 
    1370           0 :     if( TriState(m_pCrsrInProtCB->IsChecked()) != m_pCrsrInProtCB->GetSavedValue())
    1371             :     {
    1372           0 :         rSet.Put(SfxBoolItem(FN_PARAM_CRSR_IN_PROTECTED, m_pCrsrInProtCB->IsChecked()));
    1373           0 :         bRet = true;
    1374             :     }
    1375             : 
    1376             :     const SwDocDisplayItem* pOldAttr = (const SwDocDisplayItem*)
    1377           0 :                         GetOldItem(GetItemSet(), FN_PARAM_DOCDISP);
    1378             : 
    1379           0 :     SwDocDisplayItem aDisp;
    1380           0 :     if(pOldAttr)
    1381           0 :         aDisp = *pOldAttr;
    1382             : 
    1383           0 :     aDisp.bParagraphEnd         = m_pParaCB->IsChecked();
    1384           0 :     aDisp.bTab                  = m_pTabCB->IsChecked();
    1385           0 :     aDisp.bSpace                = m_pSpacesCB->IsChecked();
    1386           0 :     aDisp.bNonbreakingSpace     = m_pHSpacesCB->IsChecked();
    1387           0 :     aDisp.bSoftHyphen           = m_pSHyphCB->IsChecked();
    1388           0 :     aDisp.bFldHiddenText        = m_pFldHiddenCB->IsChecked();
    1389           0 :     aDisp.bCharHiddenText       = m_pCharHiddenCB->IsChecked();
    1390           0 :     aDisp.bShowHiddenPara       = m_pFldHiddenParaCB->IsChecked();
    1391           0 :     aDisp.bManualBreak          = m_pBreakCB->IsChecked();
    1392             : 
    1393           0 :     bRet |= (!pOldAttr || aDisp != *pOldAttr);
    1394           0 :     if(bRet)
    1395           0 :         bRet = 0 != rSet.Put(aDisp);
    1396             : 
    1397           0 :     return bRet;
    1398             : }
    1399             : 
    1400           0 : void SwShdwCrsrOptionsTabPage::Reset( const SfxItemSet& rSet )
    1401             : {
    1402           0 :     const SfxPoolItem* pItem = 0;
    1403             : 
    1404           0 :     SwShadowCursorItem aOpt;
    1405           0 :     if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_SHADOWCURSOR, false, &pItem ))
    1406           0 :         aOpt = *(SwShadowCursorItem*)pItem;
    1407           0 :     m_pOnOffCB->Check( aOpt.IsOn() );
    1408             : 
    1409           0 :     sal_uInt8 eMode = aOpt.GetMode();
    1410           0 :     m_pFillIndentRB->Check( FILL_INDENT == eMode );
    1411           0 :     m_pFillMarginRB->Check( FILL_MARGIN == eMode );
    1412           0 :     m_pFillTabRB->Check( FILL_TAB == eMode );
    1413           0 :     m_pFillSpaceRB->Check( FILL_SPACE == eMode );
    1414             : 
    1415           0 :     if (m_pWrtShell) {
    1416           0 :        m_pMathBaselineAlignmentCB->Check( m_pWrtShell->GetDoc()->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT ) );
    1417           0 :        m_pMathBaselineAlignmentCB->SaveValue();
    1418             :     } else {
    1419           0 :         m_pMathBaselineAlignmentCB->Hide();
    1420             :     }
    1421             : 
    1422           0 :     if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_CRSR_IN_PROTECTED, false, &pItem ))
    1423           0 :         m_pCrsrInProtCB->Check(((const SfxBoolItem*)pItem)->GetValue());
    1424           0 :     m_pCrsrInProtCB->SaveValue();
    1425             : 
    1426           0 :     const SwDocDisplayItem* pDocDisplayAttr = 0;
    1427             : 
    1428             :     rSet.GetItemState( FN_PARAM_DOCDISP, false,
    1429           0 :                                     (const SfxPoolItem**)&pDocDisplayAttr );
    1430           0 :     if(pDocDisplayAttr)
    1431             :     {
    1432           0 :         m_pParaCB->Check  ( pDocDisplayAttr->bParagraphEnd );
    1433           0 :         m_pTabCB->Check  ( pDocDisplayAttr->bTab );
    1434           0 :         m_pSpacesCB->Check  ( pDocDisplayAttr->bSpace );
    1435           0 :         m_pHSpacesCB->Check  ( pDocDisplayAttr->bNonbreakingSpace );
    1436           0 :         m_pSHyphCB->Check  ( pDocDisplayAttr->bSoftHyphen );
    1437           0 :         m_pCharHiddenCB->Check ( pDocDisplayAttr->bCharHiddenText );
    1438           0 :         m_pFldHiddenCB->Check  ( pDocDisplayAttr->bFldHiddenText );
    1439           0 :         m_pFldHiddenParaCB->Check ( pDocDisplayAttr->bShowHiddenPara );
    1440           0 :         m_pBreakCB->Check  ( pDocDisplayAttr->bManualBreak );
    1441           0 :     }
    1442           0 : }
    1443             : 
    1444             : /*--------------------------------------------------
    1445             :  TabPage for Redlining
    1446             : --------------------------------------------------*/
    1447             : struct CharAttr
    1448             : {
    1449             :     sal_uInt16 nItemId;
    1450             :     sal_uInt16 nAttr;
    1451             : };
    1452             : 
    1453             : // Edit corresponds to Paste-attributes
    1454             : static CharAttr aRedlineAttr[] =
    1455             : {
    1456             :     { SID_ATTR_CHAR_CASEMAP,        SVX_CASEMAP_NOT_MAPPED },
    1457             :     { SID_ATTR_CHAR_WEIGHT,         WEIGHT_BOLD },
    1458             :     { SID_ATTR_CHAR_POSTURE,        ITALIC_NORMAL },
    1459             :     { SID_ATTR_CHAR_UNDERLINE,      UNDERLINE_SINGLE },
    1460             :     { SID_ATTR_CHAR_UNDERLINE,      UNDERLINE_DOUBLE },
    1461             :     { SID_ATTR_CHAR_STRIKEOUT,      STRIKEOUT_SINGLE },
    1462             :     { SID_ATTR_CHAR_CASEMAP,        SVX_CASEMAP_VERSALIEN },
    1463             :     { SID_ATTR_CHAR_CASEMAP,        SVX_CASEMAP_GEMEINE },
    1464             :     { SID_ATTR_CHAR_CASEMAP,        SVX_CASEMAP_KAPITAELCHEN },
    1465             :     { SID_ATTR_CHAR_CASEMAP,        SVX_CASEMAP_TITEL },
    1466             :     { SID_ATTR_BRUSH,               0 }
    1467             : };
    1468             : // Items from aRedlineAttr relevant for InsertAttr: strikethrough is
    1469             : // not used
    1470             : static sal_uInt16 aInsertAttrMap[] = { 0, 1, 2, 3, 4, 6, 7, 8, 9, 10 };
    1471             : 
    1472             : // Items from aRedlineAttr relevant for DeleteAttr: underline and
    1473             : // double underline is not used
    1474             : static sal_uInt16 aDeletedAttrMap[] = { 0, 1, 2, 5, 6, 7, 8, 9, 10 };
    1475             : 
    1476             : // Items from aRedlineAttr relevant for ChangeAttr: strikethrough is
    1477             : // not used
    1478             : static sal_uInt16 aChangedAttrMap[] = { 0, 1, 2, 3, 4, 6, 7, 8, 9, 10 };
    1479             : 
    1480             : /*-----------------------------------------------------------------------
    1481             :     Description: Preview of selection
    1482             :  -----------------------------------------------------------------------*/
    1483           0 : SwMarkPreview::SwMarkPreview( Window *pParent, WinBits nWinBits ) :
    1484             : 
    1485             :     Window(pParent, nWinBits),
    1486             :     m_aTransCol( COL_TRANSPARENT ),
    1487             :     m_aMarkCol( COL_LIGHTRED ),
    1488           0 :     nMarkPos(0)
    1489             : 
    1490             : {
    1491           0 :     m_aInitialSize = getPreviewOptionsSize(this);
    1492           0 :     InitColors();
    1493           0 :     SetMapMode(MAP_PIXEL);
    1494           0 : }
    1495             : 
    1496           0 : extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSwMarkPreview(Window *pParent, VclBuilder::stringmap &)
    1497             : {
    1498           0 :     return new SwMarkPreview(pParent, 0);
    1499             : }
    1500             : 
    1501           0 : SwMarkPreview::~SwMarkPreview()
    1502             : {
    1503           0 : }
    1504             : 
    1505           0 : void SwMarkPreview::InitColors( void )
    1506             : {
    1507             :     // m_aTransCol and m_aMarkCol are _not_ changed because they are set from outside!
    1508             : 
    1509           0 :     const StyleSettings& rSettings = GetSettings().GetStyleSettings();
    1510           0 :     m_aBgCol = Color( rSettings.GetWindowColor() );
    1511             : 
    1512           0 :     sal_Bool bHC = rSettings.GetHighContrastMode();
    1513           0 :     m_aLineCol = bHC? SwViewOption::GetFontColor() : Color( COL_BLACK );
    1514           0 :     m_aShadowCol = bHC? m_aBgCol : rSettings.GetShadowColor();
    1515           0 :     m_aTxtCol = bHC? SwViewOption::GetFontColor() : Color( COL_GRAY );
    1516           0 :     m_aPrintAreaCol = m_aTxtCol;
    1517           0 : }
    1518             : 
    1519           0 : void SwMarkPreview::DataChanged( const DataChangedEvent& rDCEvt )
    1520             : {
    1521           0 :     Window::DataChanged( rDCEvt );
    1522             : 
    1523           0 :     if( rDCEvt.GetType() == DATACHANGED_SETTINGS && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
    1524           0 :         InitColors();
    1525           0 : }
    1526             : 
    1527           0 : void SwMarkPreview::Paint(const Rectangle &/*rRect*/)
    1528             : {
    1529           0 :     const Size aSz(GetOutputSizePixel());
    1530             : 
    1531             :     // Page
    1532           0 :     aPage.SetSize(Size(aSz.Width() - 3, aSz.Height() - 3));
    1533             : 
    1534           0 :     sal_uLong nOutWPix = aPage.GetWidth();
    1535           0 :     sal_uLong nOutHPix = aPage.GetHeight();
    1536             : 
    1537             :     // PrintArea
    1538           0 :     sal_uLong nLBorder = 8;
    1539           0 :     sal_uLong nRBorder = 8;
    1540           0 :     sal_uLong nTBorder = 4;
    1541           0 :     sal_uLong nBBorder = 4;
    1542             : 
    1543           0 :     aLeftPagePrtArea = Rectangle(Point(nLBorder, nTBorder), Point((nOutWPix - 1) - nRBorder, (nOutHPix - 1) - nBBorder));
    1544           0 :     sal_uInt16 nWidth = (sal_uInt16)aLeftPagePrtArea.GetWidth();
    1545           0 :     sal_uInt16 nKorr = (nWidth & 1) != 0 ? 0 : 1;
    1546           0 :     aLeftPagePrtArea.SetSize(Size(nWidth / 2 - (nLBorder + nRBorder) / 2 + nKorr, aLeftPagePrtArea.GetHeight()));
    1547             : 
    1548           0 :     aRightPagePrtArea = aLeftPagePrtArea;
    1549           0 :     aRightPagePrtArea.Move(aLeftPagePrtArea.GetWidth() + nLBorder + nRBorder + 1, 0);
    1550             : 
    1551             :     // draw shadow
    1552           0 :     Rectangle aShadow(aPage);
    1553           0 :     aShadow += Point(3, 3);
    1554           0 :     DrawRect( aShadow, m_aShadowCol, m_aTransCol );
    1555             : 
    1556             :     // draw page
    1557           0 :     DrawRect( aPage, m_aBgCol, m_aLineCol );
    1558             : 
    1559             :     // draw separator
    1560           0 :     Rectangle aPageSeparator(aPage);
    1561           0 :     aPageSeparator.SetSize(Size(2, aPageSeparator.GetHeight()));
    1562           0 :     aPageSeparator.Move(aPage.GetWidth() / 2 - 1, 0);
    1563           0 :     DrawRect( aPageSeparator, m_aLineCol, m_aTransCol );
    1564             : 
    1565           0 :     PaintPage(aLeftPagePrtArea);
    1566           0 :     PaintPage(aRightPagePrtArea);
    1567             : 
    1568           0 :     Rectangle aLeftMark(Point(aPage.Left() + 2, aLeftPagePrtArea.Top() + 4), Size(aLeftPagePrtArea.Left() - 4, 2));
    1569           0 :     Rectangle aRightMark(Point(aRightPagePrtArea.Right() + 2, aRightPagePrtArea.Bottom() - 6), Size(aLeftPagePrtArea.Left() - 4, 2));
    1570             : 
    1571           0 :     switch (nMarkPos)
    1572             :     {
    1573             :         case 1:     // left
    1574           0 :             aRightMark.SetPos(Point(aRightPagePrtArea.Left() - 2 - aRightMark.GetWidth(), aRightMark.Top()));
    1575           0 :             break;
    1576             : 
    1577             :         case 2:     // right
    1578           0 :             aLeftMark.SetPos(Point(aLeftPagePrtArea.Right() + 2, aLeftMark.Top()));
    1579           0 :             break;
    1580             : 
    1581             :         case 3:     // outside
    1582           0 :             break;
    1583             : 
    1584             :         case 4:     // inside
    1585           0 :             aLeftMark.SetPos(Point(aLeftPagePrtArea.Right() + 2, aLeftMark.Top()));
    1586           0 :             aRightMark.SetPos(Point(aRightPagePrtArea.Left() - 2 - aRightMark.GetWidth(), aRightMark.Top()));
    1587           0 :             break;
    1588             : 
    1589             :         case 0:     // none
    1590             :         default:
    1591           0 :             return;
    1592             :     }
    1593           0 :     DrawRect( aLeftMark, m_aMarkCol, m_aTransCol );
    1594           0 :     DrawRect( aRightMark, m_aMarkCol, m_aTransCol );
    1595             : }
    1596             : 
    1597           0 : void SwMarkPreview::PaintPage(const Rectangle &rRect)
    1598             : {
    1599             :     // draw PrintArea
    1600           0 :     DrawRect(rRect, m_aTransCol, m_aPrintAreaCol );
    1601             : 
    1602             :     // draw Testparagraph
    1603           0 :     sal_uLong nLTxtBorder = 4;
    1604           0 :     sal_uLong nRTxtBorder = 4;
    1605           0 :     sal_uLong nTTxtBorder = 4;
    1606             : 
    1607           0 :     Rectangle aTextLine = rRect;
    1608           0 :     aTextLine.SetSize(Size(aTextLine.GetWidth(), 2));
    1609           0 :     aTextLine.Left()    += nLTxtBorder;
    1610           0 :     aTextLine.Right()   -= nRTxtBorder;
    1611           0 :     aTextLine.Move(0, nTTxtBorder);
    1612             : 
    1613             :     sal_Int32 nStep;
    1614             :     sal_uInt16 nLines;
    1615             : 
    1616           0 :     nStep = aTextLine.GetHeight() + 2;
    1617           0 :     nLines = (sal_uInt16)(rRect.GetHeight() / (aTextLine.GetHeight() + 2)) - 1;
    1618             : 
    1619             :     // simulate text
    1620           0 :     for (sal_uInt16 i = 0; i < nLines; ++i)
    1621             :     {
    1622           0 :         if (i == (nLines - 1))
    1623           0 :             aTextLine.SetSize(Size(aTextLine.GetWidth() / 2, aTextLine.GetHeight()));
    1624             : 
    1625           0 :         if (aPage.IsInside(aTextLine))
    1626           0 :             DrawRect(aTextLine, m_aTxtCol, m_aTransCol );
    1627             : 
    1628           0 :         aTextLine.Move(0, nStep);
    1629             :     }
    1630           0 :     aTextLine.Move(0, -nStep);
    1631           0 : }
    1632             : 
    1633           0 : void SwMarkPreview::DrawRect(const Rectangle &rRect, const Color &rFillColor, const Color &rLineColor)
    1634             : {
    1635           0 :     SetFillColor(rFillColor);
    1636           0 :     SetLineColor(rLineColor);
    1637           0 :     Window::DrawRect(rRect);
    1638           0 : }
    1639             : 
    1640           0 : Size SwMarkPreview::GetOptimalSize() const
    1641             : {
    1642           0 :     return m_aInitialSize;
    1643             : }
    1644             : 
    1645             : namespace
    1646             : {
    1647           0 :     void lcl_FillRedlineAttrListBox(
    1648             :             ListBox& rLB, const AuthorCharAttr& rAttrToSelect,
    1649             :             const sal_uInt16* pAttrMap, const sal_uInt16 nAttrMapSize)
    1650             :     {
    1651           0 :         for (sal_uInt16 i = 0; i != nAttrMapSize; ++i)
    1652             :         {
    1653           0 :             CharAttr& rAttr(aRedlineAttr[pAttrMap[i]]);
    1654           0 :             rLB.SetEntryData(i, &rAttr);
    1655           0 :             if (rAttr.nItemId == rAttrToSelect.nItemId &&
    1656           0 :                 rAttr.nAttr == rAttrToSelect.nAttr)
    1657           0 :                 rLB.SelectEntryPos(i);
    1658             :         }
    1659           0 :     }
    1660             : }
    1661             : 
    1662           0 : SwRedlineOptionsTabPage::SwRedlineOptionsTabPage( Window* pParent,
    1663             :                                                     const SfxItemSet& rSet )
    1664             :     : SfxTabPage(pParent, "OptRedLinePage",
    1665             :         "modules/swriter/ui/optredlinepage.ui" , rSet)
    1666           0 :     , sNone(SW_RESSTR(SW_STR_NONE))
    1667             : {
    1668           0 :     Size aPreviewSize(getPreviewOptionsSize(this));
    1669             : 
    1670           0 :     get(pInsertLB,"insert");
    1671           0 :     get(pInsertColorLB,"insertcolor");
    1672           0 :     get(pInsertedPreviewWN,"insertedpreview");
    1673             : 
    1674           0 :     get(pDeletedLB,"deleted");
    1675           0 :     get(pDeletedColorLB,"deletedcolor");
    1676           0 :     get(pDeletedPreviewWN,"deletedpreview");
    1677             : 
    1678           0 :     get(pChangedLB,"changed");
    1679           0 :     get(pChangedColorLB,"changedcolor");
    1680           0 :     get(pChangedPreviewWN,"changedpreview");
    1681             : 
    1682           0 :     get(pMarkPosLB,"markpos");
    1683           0 :     get(pMarkColorLB,"markcolor");
    1684           0 :     get(pMarkPreviewWN,"markpreview");
    1685             : 
    1686           0 :     pInsertedPreviewWN->set_height_request(aPreviewSize.Height());
    1687           0 :     pDeletedPreviewWN->set_height_request(aPreviewSize.Height());
    1688           0 :     pChangedPreviewWN->set_height_request(aPreviewSize.Height());
    1689           0 :     pMarkPreviewWN->set_height_request(aPreviewSize.Height());
    1690             : 
    1691           0 :     pInsertedPreviewWN->set_width_request(aPreviewSize.Width());
    1692           0 :     pDeletedPreviewWN->set_width_request(aPreviewSize.Width());
    1693           0 :     pChangedPreviewWN->set_width_request(aPreviewSize.Width());
    1694           0 :     pMarkPreviewWN->set_width_request(aPreviewSize.Width());
    1695             : 
    1696           0 :     sAuthor = get<Window>("byauthor")->GetText();
    1697             : 
    1698           0 :     for (sal_Int32 i = 0; i < pInsertLB->GetEntryCount(); ++i)
    1699             :     {
    1700           0 :         OUString sEntry(pInsertLB->GetEntry(i));
    1701           0 :         pDeletedLB->InsertEntry(sEntry);
    1702           0 :         pChangedLB->InsertEntry(sEntry);
    1703           0 :     };
    1704             : 
    1705             :     // remove strikethrough from insert and change and underline + double
    1706             :     // underline from delete
    1707           0 :     pInsertLB->RemoveEntry(5);
    1708           0 :     pChangedLB->RemoveEntry(5);
    1709           0 :     pDeletedLB->RemoveEntry(4);
    1710           0 :     pDeletedLB->RemoveEntry(3);
    1711             : 
    1712           0 :     Link aLk = LINK(this, SwRedlineOptionsTabPage, AttribHdl);
    1713           0 :     pInsertLB->SetSelectHdl( aLk );
    1714           0 :     pDeletedLB->SetSelectHdl( aLk );
    1715           0 :     pChangedLB->SetSelectHdl( aLk );
    1716             : 
    1717           0 :     aLk = LINK(this, SwRedlineOptionsTabPage, ColorHdl);
    1718           0 :     pInsertColorLB->SetSelectHdl( aLk );
    1719           0 :     pDeletedColorLB->SetSelectHdl( aLk );
    1720           0 :     pChangedColorLB->SetSelectHdl( aLk );
    1721             : 
    1722           0 :     aLk = LINK(this, SwRedlineOptionsTabPage, ChangedMaskPrevHdl);
    1723           0 :     pMarkPosLB->SetSelectHdl( aLk );
    1724           0 :     pMarkColorLB->SetSelectHdl( aLk );
    1725             : /*
    1726             :     //solution: set different accessible name of four color box
    1727             :     pInsertColorLB->SetAccessibleName(OUString( aInsertFT.GetDisplayText()) + OUString(aInsertColorFT.GetDisplayText()));
    1728             :     pDeletedColorLB->SetAccessibleName(OUString( aDeletedFT.GetDisplayText()) + OUString( aDeletedColorFT.GetDisplayText()));
    1729             :     pChangedColorLB->SetAccessibleName(OUString( aChangedFT.GetDisplayText()) + OUString( aChangedColorFT.GetDisplayText()));
    1730             :     pMarkColorLB->SetAccessibleName(OUString( aMarkPosFT.GetDisplayText()) + OUString( aMarkColorFT.GetDisplayText()));*/
    1731           0 : }
    1732             : 
    1733           0 : SwRedlineOptionsTabPage::~SwRedlineOptionsTabPage()
    1734             : {
    1735           0 : }
    1736             : 
    1737           0 : SfxTabPage* SwRedlineOptionsTabPage::Create( Window* pParent, const SfxItemSet& rSet)
    1738             : {
    1739           0 :     return new SwRedlineOptionsTabPage( pParent, rSet );
    1740             : }
    1741             : 
    1742           0 : bool SwRedlineOptionsTabPage::FillItemSet( SfxItemSet& )
    1743             : {
    1744             :     CharAttr *pAttr;
    1745           0 :     SwModuleOptions *pOpt = SW_MOD()->GetModuleConfig();
    1746             : 
    1747           0 :     AuthorCharAttr aInsertedAttr;
    1748           0 :     AuthorCharAttr aDeletedAttr;
    1749           0 :     AuthorCharAttr aChangedAttr;
    1750             : 
    1751           0 :     AuthorCharAttr aOldInsertAttr(pOpt->GetInsertAuthorAttr());
    1752           0 :     AuthorCharAttr aOldDeletedAttr(pOpt->GetDeletedAuthorAttr());
    1753           0 :     AuthorCharAttr aOldChangedAttr(pOpt->GetFormatAuthorAttr());
    1754             : 
    1755           0 :     ColorData nOldMarkColor = pOpt->GetMarkAlignColor().GetColor();
    1756           0 :     sal_uInt16 nOldMarkMode = pOpt->GetMarkAlignMode();
    1757             : 
    1758           0 :     sal_Int32 nPos = pInsertLB->GetSelectEntryPos();
    1759           0 :     if (nPos != LISTBOX_ENTRY_NOTFOUND)
    1760             :     {
    1761           0 :         pAttr = (CharAttr *)pInsertLB->GetEntryData(nPos);
    1762           0 :         aInsertedAttr.nItemId = pAttr->nItemId;
    1763           0 :         aInsertedAttr.nAttr = pAttr->nAttr;
    1764             : 
    1765           0 :         nPos = pInsertColorLB->GetSelectEntryPos();
    1766             : 
    1767           0 :         switch (nPos)
    1768             :         {
    1769             :             case 0:
    1770           0 :                 aInsertedAttr.nColor = COL_NONE;
    1771           0 :                 break;
    1772             :             case 1:
    1773             :             case LISTBOX_ENTRY_NOTFOUND:
    1774           0 :                 aInsertedAttr.nColor = COL_TRANSPARENT;
    1775           0 :                 break;
    1776             :             default:
    1777           0 :                 aInsertedAttr.nColor = pInsertColorLB->GetEntryColor(nPos).GetColor();
    1778           0 :                 break;
    1779             :         }
    1780             : 
    1781           0 :         pOpt->SetInsertAuthorAttr(aInsertedAttr);
    1782             :     }
    1783             : 
    1784           0 :     nPos = pDeletedLB->GetSelectEntryPos();
    1785           0 :     if (nPos != LISTBOX_ENTRY_NOTFOUND)
    1786             :     {
    1787           0 :         pAttr = (CharAttr *)pDeletedLB->GetEntryData(nPos);
    1788           0 :         aDeletedAttr.nItemId = pAttr->nItemId;
    1789           0 :         aDeletedAttr.nAttr = pAttr->nAttr;
    1790             : 
    1791           0 :         nPos = pDeletedColorLB->GetSelectEntryPos();
    1792             : 
    1793           0 :         switch (nPos)
    1794             :         {
    1795             :             case 0:
    1796           0 :                 aDeletedAttr.nColor = COL_NONE;
    1797           0 :                 break;
    1798             :             case 1:
    1799             :             case LISTBOX_ENTRY_NOTFOUND:
    1800           0 :                 aDeletedAttr.nColor = COL_TRANSPARENT;
    1801           0 :                 break;
    1802             :             default:
    1803           0 :                 aDeletedAttr.nColor = pDeletedColorLB->GetEntryColor(nPos).GetColor();
    1804           0 :                 break;
    1805             :         }
    1806             : 
    1807           0 :         pOpt->SetDeletedAuthorAttr(aDeletedAttr);
    1808             :     }
    1809             : 
    1810           0 :     nPos = pChangedLB->GetSelectEntryPos();
    1811           0 :     if (nPos != LISTBOX_ENTRY_NOTFOUND)
    1812             :     {
    1813           0 :         pAttr = (CharAttr *)pChangedLB->GetEntryData(nPos);
    1814           0 :         aChangedAttr.nItemId = pAttr->nItemId;
    1815           0 :         aChangedAttr.nAttr = pAttr->nAttr;
    1816             : 
    1817           0 :         nPos = pChangedColorLB->GetSelectEntryPos();
    1818             : 
    1819           0 :         switch (nPos)
    1820             :         {
    1821             :             case 0:
    1822           0 :                 aChangedAttr.nColor = COL_NONE;
    1823           0 :                 break;
    1824             :             case 1:
    1825             :             case LISTBOX_ENTRY_NOTFOUND:
    1826           0 :                 aChangedAttr.nColor = COL_TRANSPARENT;
    1827           0 :                 break;
    1828             :             default:
    1829           0 :                 aChangedAttr.nColor = pChangedColorLB->GetEntryColor(nPos).GetColor();
    1830           0 :                 break;
    1831             :         }
    1832             : 
    1833           0 :         pOpt->SetFormatAuthorAttr(aChangedAttr);
    1834             :     }
    1835             : 
    1836           0 :     nPos = 0;
    1837           0 :     switch (pMarkPosLB->GetSelectEntryPos())
    1838             :     {
    1839           0 :         case 0: nPos = text::HoriOrientation::NONE;       break;
    1840           0 :         case 1: nPos = text::HoriOrientation::LEFT;       break;
    1841           0 :         case 2: nPos = text::HoriOrientation::RIGHT;      break;
    1842           0 :         case 3: nPos = text::HoriOrientation::OUTSIDE;    break;
    1843           0 :         case 4: nPos = text::HoriOrientation::INSIDE;     break;
    1844             :     }
    1845           0 :     pOpt->SetMarkAlignMode(nPos);
    1846             : 
    1847           0 :     pOpt->SetMarkAlignColor(pMarkColorLB->GetSelectEntryColor());
    1848             : 
    1849           0 :     if (!(aInsertedAttr == aOldInsertAttr) ||
    1850           0 :         !(aDeletedAttr == aOldDeletedAttr) ||
    1851           0 :         !(aChangedAttr == aOldChangedAttr) ||
    1852           0 :        nOldMarkColor != pOpt->GetMarkAlignColor().GetColor() ||
    1853           0 :        nOldMarkMode != pOpt->GetMarkAlignMode())
    1854             :     {
    1855             :         // update all documents
    1856           0 :         TypeId aType(TYPE(SwDocShell));
    1857           0 :         SwDocShell* pDocShell = (SwDocShell*)SfxObjectShell::GetFirst(&aType);
    1858             : 
    1859           0 :         while( pDocShell )
    1860             :         {
    1861           0 :             pDocShell->GetWrtShell()->UpdateRedlineAttr();
    1862           0 :             pDocShell = (SwDocShell*)SfxObjectShell::GetNext(*pDocShell, &aType);
    1863             :         }
    1864             :     }
    1865             : 
    1866           0 :     return false;
    1867             : }
    1868             : 
    1869           0 : void SwRedlineOptionsTabPage::Reset( const SfxItemSet&  )
    1870             : {
    1871           0 :     const SwModuleOptions *pOpt = SW_MOD()->GetModuleConfig();
    1872             : 
    1873           0 :     const AuthorCharAttr &rInsertAttr = pOpt->GetInsertAuthorAttr();
    1874           0 :     const AuthorCharAttr &rDeletedAttr = pOpt->GetDeletedAuthorAttr();
    1875           0 :     const AuthorCharAttr &rChangedAttr = pOpt->GetFormatAuthorAttr();
    1876             : 
    1877             :     // initialise preview
    1878           0 :     InitFontStyle(*pInsertedPreviewWN);
    1879           0 :     InitFontStyle(*pDeletedPreviewWN);
    1880           0 :     InitFontStyle(*pChangedPreviewWN);
    1881             : 
    1882             :     // initialise colour list box
    1883           0 :     pInsertColorLB->SetUpdateMode(false);
    1884           0 :     pDeletedColorLB->SetUpdateMode(false);
    1885           0 :     pChangedColorLB->SetUpdateMode(false);
    1886           0 :     pMarkColorLB->SetUpdateMode(false);
    1887           0 :     pInsertColorLB->InsertEntry(sNone);
    1888           0 :     pDeletedColorLB->InsertEntry(sNone);
    1889           0 :     pChangedColorLB->InsertEntry(sNone);
    1890             : 
    1891           0 :     pInsertColorLB->InsertEntry(sAuthor);
    1892           0 :     pDeletedColorLB->InsertEntry(sAuthor);
    1893           0 :     pChangedColorLB->InsertEntry(sAuthor);
    1894             : 
    1895           0 :     XColorListRef pColorLst = XColorList::GetStdColorList();
    1896           0 :     for( sal_Int32 i = 0; i < pColorLst->Count(); ++i )
    1897             :     {
    1898           0 :         XColorEntry* pEntry = pColorLst->GetColor( i );
    1899           0 :         Color aColor = pEntry->GetColor();
    1900           0 :         OUString sName = pEntry->GetName();
    1901             : 
    1902           0 :         pInsertColorLB->InsertEntry( aColor, sName );
    1903           0 :         pDeletedColorLB->InsertEntry( aColor, sName );
    1904           0 :         pChangedColorLB->InsertEntry( aColor, sName );
    1905           0 :         pMarkColorLB->InsertEntry( aColor, sName );
    1906           0 :     }
    1907           0 :     pInsertColorLB->SetUpdateMode( true );
    1908           0 :     pDeletedColorLB->SetUpdateMode( true );
    1909           0 :     pChangedColorLB->SetUpdateMode( true );
    1910           0 :     pMarkColorLB->SetUpdateMode( true );
    1911             : 
    1912           0 :     ColorData nColor = rInsertAttr.nColor;
    1913             : 
    1914           0 :     switch (nColor)
    1915             :     {
    1916             :         case COL_TRANSPARENT:
    1917           0 :             pInsertColorLB->SelectEntryPos(1);
    1918           0 :             break;
    1919             :         case COL_NONE:
    1920           0 :             pInsertColorLB->SelectEntryPos(0);
    1921           0 :             break;
    1922             :         default:
    1923           0 :             pInsertColorLB->SelectEntry(Color(nColor));
    1924             :     }
    1925             : 
    1926           0 :     nColor = rDeletedAttr.nColor;
    1927             : 
    1928           0 :     switch (nColor)
    1929             :     {
    1930             :         case COL_TRANSPARENT:
    1931           0 :             pDeletedColorLB->SelectEntryPos(1);
    1932           0 :             break;
    1933             :         case COL_NONE:
    1934           0 :             pDeletedColorLB->SelectEntryPos(0);
    1935           0 :             break;
    1936             :         default:
    1937           0 :             pDeletedColorLB->SelectEntry(Color(nColor));
    1938             :     }
    1939             : 
    1940           0 :     nColor = rChangedAttr.nColor;
    1941             : 
    1942           0 :     switch (nColor)
    1943             :     {
    1944             :         case COL_TRANSPARENT:
    1945           0 :             pChangedColorLB->SelectEntryPos(1);
    1946           0 :             break;
    1947             :         case COL_NONE:
    1948           0 :             pChangedColorLB->SelectEntryPos(0);
    1949           0 :             break;
    1950             :         default:
    1951           0 :             pChangedColorLB->SelectEntry(Color(nColor));
    1952             :     }
    1953             : 
    1954           0 :     pMarkColorLB->SelectEntry(pOpt->GetMarkAlignColor());
    1955             : 
    1956           0 :     pInsertLB->SelectEntryPos(0);
    1957           0 :     pDeletedLB->SelectEntryPos(0);
    1958           0 :     pChangedLB->SelectEntryPos(0);
    1959             : 
    1960             :     lcl_FillRedlineAttrListBox(*pInsertLB, rInsertAttr, aInsertAttrMap,
    1961           0 :             sizeof(aInsertAttrMap) / sizeof(sal_uInt16));
    1962             :     lcl_FillRedlineAttrListBox(*pDeletedLB, rDeletedAttr, aDeletedAttrMap,
    1963           0 :             sizeof(aDeletedAttrMap) / sizeof(sal_uInt16));
    1964             :     lcl_FillRedlineAttrListBox(*pChangedLB, rChangedAttr, aChangedAttrMap,
    1965           0 :             sizeof(aChangedAttrMap) / sizeof(sal_uInt16));
    1966             : 
    1967           0 :     sal_Int32 nPos = 0;
    1968           0 :     switch (pOpt->GetMarkAlignMode())
    1969             :     {
    1970           0 :         case text::HoriOrientation::NONE:     nPos = 0;   break;
    1971           0 :         case text::HoriOrientation::LEFT:     nPos = 1;   break;
    1972           0 :         case text::HoriOrientation::RIGHT:    nPos = 2;   break;
    1973           0 :         case text::HoriOrientation::OUTSIDE:  nPos = 3;   break;
    1974           0 :         case text::HoriOrientation::INSIDE:   nPos = 4;   break;
    1975             :     }
    1976           0 :     pMarkPosLB->SelectEntryPos(nPos);
    1977             : 
    1978             :     // show settings in preview
    1979           0 :     AttribHdl(pInsertLB);
    1980           0 :     ColorHdl(pInsertColorLB);
    1981           0 :     AttribHdl(pDeletedLB);
    1982           0 :     ColorHdl(pInsertColorLB);
    1983           0 :     AttribHdl(pChangedLB);
    1984           0 :     ColorHdl(pChangedColorLB);
    1985             : 
    1986           0 :     ChangedMaskPrevHdl();
    1987           0 : }
    1988             : 
    1989           0 : IMPL_LINK( SwRedlineOptionsTabPage, AttribHdl, ListBox *, pLB )
    1990             : {
    1991           0 :     SvxFontPrevWindow *pPrev = 0;
    1992             :     ColorListBox *pColorLB;
    1993             : 
    1994           0 :     if (pLB == pInsertLB)
    1995             :     {
    1996           0 :         pColorLB = pInsertColorLB;
    1997           0 :         pPrev = pInsertedPreviewWN;
    1998             :     }
    1999           0 :     else if (pLB == pDeletedLB)
    2000             :     {
    2001           0 :         pColorLB = pDeletedColorLB;
    2002           0 :         pPrev = pDeletedPreviewWN;
    2003             :     }
    2004             :     else
    2005             :     {
    2006           0 :         pColorLB = pChangedColorLB;
    2007           0 :         pPrev = pChangedPreviewWN;
    2008             :     }
    2009             : 
    2010           0 :     SvxFont&    rFont = pPrev->GetFont();
    2011           0 :     SvxFont&    rCJKFont = pPrev->GetCJKFont();
    2012             : 
    2013           0 :     rFont.SetWeight(WEIGHT_NORMAL);
    2014           0 :     rCJKFont.SetWeight(WEIGHT_NORMAL);
    2015           0 :     rFont.SetItalic(ITALIC_NONE);
    2016           0 :     rCJKFont.SetItalic(ITALIC_NONE);
    2017           0 :     rFont.SetUnderline(UNDERLINE_NONE);
    2018           0 :     rCJKFont.SetUnderline(UNDERLINE_NONE);
    2019           0 :     rFont.SetStrikeout(STRIKEOUT_NONE);
    2020           0 :     rCJKFont.SetStrikeout(STRIKEOUT_NONE);
    2021           0 :     rFont.SetCaseMap(SVX_CASEMAP_NOT_MAPPED);
    2022           0 :     rCJKFont.SetCaseMap(SVX_CASEMAP_NOT_MAPPED);
    2023             : 
    2024           0 :     sal_Int32      nPos = pColorLB->GetSelectEntryPos();
    2025             : 
    2026           0 :     switch( nPos )
    2027             :     {
    2028             :         case 0:
    2029           0 :             rFont.SetColor( Color( COL_BLACK ) );
    2030           0 :             rCJKFont.SetColor( Color( COL_BLACK ) );
    2031           0 :             break;
    2032             :         case 1:
    2033             :         case LISTBOX_ENTRY_NOTFOUND:
    2034           0 :             rFont.SetColor( Color( COL_RED ) );
    2035           0 :             rCJKFont.SetColor( Color( COL_RED ) );
    2036           0 :             break;
    2037             :         default:
    2038           0 :             rFont.SetColor( pColorLB->GetEntryColor( nPos ) );
    2039           0 :             rCJKFont.SetColor( pColorLB->GetEntryColor( nPos ) );
    2040           0 :             break;
    2041             :     }
    2042             : 
    2043           0 :     nPos = pLB->GetSelectEntryPos();
    2044           0 :     if( nPos == LISTBOX_ENTRY_NOTFOUND )
    2045           0 :         nPos = 0;
    2046             : 
    2047           0 :     CharAttr*   pAttr = ( CharAttr* ) pLB->GetEntryData( nPos );
    2048             :     //switch off preview background color
    2049           0 :     pPrev->ResetColor();
    2050           0 :     switch (pAttr->nItemId)
    2051             :     {
    2052             :         case SID_ATTR_CHAR_WEIGHT:
    2053           0 :             rFont.SetWeight( ( FontWeight ) pAttr->nAttr );
    2054           0 :             rCJKFont.SetWeight( ( FontWeight ) pAttr->nAttr );
    2055           0 :             break;
    2056             : 
    2057             :         case SID_ATTR_CHAR_POSTURE:
    2058           0 :             rFont.SetItalic( ( FontItalic ) pAttr->nAttr );
    2059           0 :             rCJKFont.SetItalic( ( FontItalic ) pAttr->nAttr );
    2060           0 :             break;
    2061             : 
    2062             :         case SID_ATTR_CHAR_UNDERLINE:
    2063           0 :             rFont.SetUnderline( ( FontUnderline ) pAttr->nAttr );
    2064           0 :             rCJKFont.SetUnderline( ( FontUnderline ) pAttr->nAttr );
    2065           0 :             break;
    2066             : 
    2067             :         case SID_ATTR_CHAR_STRIKEOUT:
    2068           0 :             rFont.SetStrikeout( ( FontStrikeout ) pAttr->nAttr );
    2069           0 :             rCJKFont.SetStrikeout( ( FontStrikeout ) pAttr->nAttr );
    2070           0 :             break;
    2071             : 
    2072             :         case SID_ATTR_CHAR_CASEMAP:
    2073           0 :             rFont.SetCaseMap( ( SvxCaseMap ) pAttr->nAttr );
    2074           0 :             rCJKFont.SetCaseMap( ( SvxCaseMap ) pAttr->nAttr );
    2075           0 :             break;
    2076             : 
    2077             :         case SID_ATTR_BRUSH:
    2078             :         {
    2079           0 :             nPos = pColorLB->GetSelectEntryPos();
    2080           0 :             if( nPos )
    2081           0 :                 pPrev->SetColor( pColorLB->GetSelectEntryColor() );
    2082             :             else
    2083           0 :                 pPrev->SetColor( Color( COL_LIGHTGRAY ) );
    2084             : 
    2085           0 :             rFont.SetColor( Color( COL_BLACK ) );
    2086           0 :             rCJKFont.SetColor( Color( COL_BLACK ) );
    2087             :         }
    2088           0 :         break;
    2089             :     }
    2090             : 
    2091           0 :     pPrev->Invalidate();
    2092             : 
    2093           0 :     return 0;
    2094             : }
    2095             : 
    2096           0 : IMPL_LINK( SwRedlineOptionsTabPage, ColorHdl, ColorListBox *, pColorLB )
    2097             : {
    2098           0 :     SvxFontPrevWindow *pPrev = 0;
    2099             :     ListBox* pLB;
    2100             : 
    2101           0 :     if (pColorLB == pInsertColorLB)
    2102             :     {
    2103           0 :         pLB = pInsertLB;
    2104           0 :         pPrev = pInsertedPreviewWN;
    2105             :     }
    2106           0 :     else if (pColorLB == pDeletedColorLB)
    2107             :     {
    2108           0 :         pLB = pDeletedLB;
    2109           0 :         pPrev = pDeletedPreviewWN;
    2110             :     }
    2111             :     else
    2112             :     {
    2113           0 :         pLB = pChangedLB;
    2114           0 :         pPrev = pChangedPreviewWN;
    2115             :     }
    2116             : 
    2117           0 :     SvxFont&    rFont = pPrev->GetFont();
    2118           0 :     SvxFont&    rCJKFont = pPrev->GetCJKFont();
    2119           0 :     sal_Int32      nPos = pLB->GetSelectEntryPos();
    2120           0 :     if( nPos == LISTBOX_ENTRY_NOTFOUND )
    2121           0 :         nPos = 0;
    2122             : 
    2123           0 :     CharAttr*   pAttr = ( CharAttr* ) pLB->GetEntryData( nPos );
    2124             : 
    2125           0 :     if( pAttr->nItemId == SID_ATTR_BRUSH )
    2126             :     {
    2127           0 :         rFont.SetColor( Color( COL_BLACK ) );
    2128           0 :         rCJKFont.SetColor( Color( COL_BLACK ) );
    2129           0 :         nPos = pColorLB->GetSelectEntryPos();
    2130           0 :         if( nPos && nPos != LISTBOX_ENTRY_NOTFOUND )
    2131           0 :             pPrev->SetColor( pColorLB->GetSelectEntryColor() );
    2132             :         else
    2133           0 :             pPrev->SetColor( Color( COL_LIGHTGRAY ) );
    2134             :     }
    2135             :     else
    2136             :     {
    2137           0 :         nPos = pColorLB->GetSelectEntryPos();
    2138             : 
    2139           0 :         switch( nPos )
    2140             :         {
    2141             :             case 0:
    2142           0 :                 rFont.SetColor( Color( COL_BLACK ) );
    2143           0 :                 rCJKFont.SetColor( Color( COL_BLACK ) );
    2144           0 :                 break;
    2145             :             case 1:
    2146             :             case LISTBOX_ENTRY_NOTFOUND:
    2147           0 :                 rFont.SetColor( Color( COL_RED ) );
    2148           0 :                 rCJKFont.SetColor( Color( COL_RED ) );
    2149           0 :                 break;
    2150             :             default:
    2151           0 :                 rFont.SetColor( pColorLB->GetEntryColor( nPos ) );
    2152           0 :                 rCJKFont.SetColor( pColorLB->GetEntryColor( nPos ) );
    2153           0 :                 break;
    2154             :         }
    2155             :     }
    2156             : 
    2157           0 :     pPrev->Invalidate();
    2158             : 
    2159           0 :     return 0;
    2160             : }
    2161             : 
    2162           0 : IMPL_LINK_NOARG(SwRedlineOptionsTabPage, ChangedMaskPrevHdl)
    2163             : {
    2164           0 :     pMarkPreviewWN->SetMarkPos(pMarkPosLB->GetSelectEntryPos());
    2165           0 :     pMarkPreviewWN->SetColor(pMarkColorLB->GetSelectEntryColor().GetColor());
    2166             : 
    2167           0 :     pMarkPreviewWN->Invalidate();
    2168             : 
    2169           0 :     return 0;
    2170             : }
    2171             : 
    2172           0 : void SwRedlineOptionsTabPage::InitFontStyle(SvxFontPrevWindow& rExampleWin)
    2173             : {
    2174           0 :     const AllSettings&  rAllSettings = Application::GetSettings();
    2175           0 :     LanguageType        eLangType = rAllSettings.GetUILanguageTag().getLanguageType();
    2176           0 :     Color               aBackCol( rAllSettings.GetStyleSettings().GetWindowColor() );
    2177           0 :     SvxFont&            rFont = rExampleWin.GetFont();
    2178           0 :     SvxFont&            rCJKFont = rExampleWin.GetCJKFont();
    2179           0 :     SvxFont&            rCTLFont = rExampleWin.GetCTLFont();
    2180             : 
    2181             :     Font                aFont( OutputDevice::GetDefaultFont( DEFAULTFONT_SERIF, eLangType,
    2182           0 :                                                         DEFAULTFONT_FLAGS_ONLYONE, &rExampleWin ) );
    2183             :     Font                aCJKFont( OutputDevice::GetDefaultFont( DEFAULTFONT_CJK_TEXT, eLangType,
    2184           0 :                                                         DEFAULTFONT_FLAGS_ONLYONE, &rExampleWin ) );
    2185             :     Font                aCTLFont( OutputDevice::GetDefaultFont( DEFAULTFONT_CTL_TEXT, eLangType,
    2186           0 :                                                         DEFAULTFONT_FLAGS_ONLYONE, &rExampleWin ) );
    2187           0 :     const Size          aDefSize( 0, 12 );
    2188           0 :     aFont.SetSize( aDefSize );
    2189           0 :     aCJKFont.SetSize( aDefSize );
    2190           0 :     aCTLFont.SetSize( aDefSize );
    2191             : 
    2192           0 :     aFont.SetFillColor( aBackCol );
    2193           0 :     aCJKFont.SetFillColor( aBackCol );
    2194           0 :     aCTLFont.SetFillColor( aBackCol );
    2195             : 
    2196           0 :     aFont.SetWeight( WEIGHT_NORMAL );
    2197           0 :     aCJKFont.SetWeight( WEIGHT_NORMAL );
    2198           0 :     aCTLFont.SetWeight( WEIGHT_NORMAL );
    2199             : 
    2200           0 :     rFont = aFont;
    2201           0 :     rCJKFont = aCJKFont;
    2202           0 :     rCTLFont = aCTLFont;
    2203             : 
    2204           0 :     const Size          aNewSize( 0, rExampleWin.GetOutputSize().Height() * 2 / 3 );
    2205           0 :     rFont.SetSize( aNewSize );
    2206           0 :     rCJKFont.SetSize( aNewSize );
    2207             : 
    2208           0 :     rExampleWin.SetFont( rFont, rCJKFont,rCTLFont );
    2209             : 
    2210           0 :     rExampleWin.UseResourceText();
    2211             : 
    2212           0 :     Wallpaper           aWall( aBackCol );
    2213           0 :     rExampleWin.SetBackground( aWall );
    2214           0 :     rExampleWin.Invalidate();
    2215           0 : }
    2216             : 
    2217           0 : SwCompareOptionsTabPage::SwCompareOptionsTabPage(  Window* pParent, const SfxItemSet& rSet )
    2218           0 :     : SfxTabPage( pParent,"OptComparison","modules/swriter/ui/optcomparison.ui", rSet )
    2219             : {
    2220           0 :     get(m_pAutoRB,"auto");
    2221           0 :     get(m_pWordRB, "byword");
    2222           0 :     get(m_pCharRB, "bycharacter");
    2223             : 
    2224           0 :     get(m_pRsidCB, "useRSID");
    2225           0 :     get(m_pIgnoreCB, "ignore");
    2226           0 :     get(m_pLenNF, "ignorelen");
    2227             : 
    2228           0 :     Link aLnk( LINK( this, SwCompareOptionsTabPage, ComparisonHdl ) );
    2229           0 :     m_pAutoRB->SetClickHdl( aLnk );
    2230           0 :     m_pWordRB->SetClickHdl( aLnk );
    2231           0 :     m_pCharRB->SetClickHdl( aLnk );
    2232             : 
    2233           0 :     m_pIgnoreCB->SetClickHdl( LINK( this, SwCompareOptionsTabPage, IgnoreHdl) );
    2234           0 : }
    2235             : 
    2236           0 : SwCompareOptionsTabPage::~SwCompareOptionsTabPage()
    2237             : {
    2238           0 : }
    2239             : 
    2240           0 : SfxTabPage* SwCompareOptionsTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
    2241             : {
    2242           0 :     return new SwCompareOptionsTabPage( pParent, rAttrSet );
    2243             : }
    2244             : 
    2245           0 : bool SwCompareOptionsTabPage::FillItemSet( SfxItemSet& )
    2246             : {
    2247           0 :     sal_Bool bRet = sal_False;
    2248           0 :     SwModuleOptions *pOpt = SW_MOD()->GetModuleConfig();
    2249             : 
    2250           0 :     if( m_pAutoRB->IsChecked() != m_pAutoRB->GetSavedValue() ||
    2251           0 :         m_pWordRB->IsChecked() != m_pWordRB->GetSavedValue() ||
    2252           0 :         m_pCharRB->IsChecked() != m_pCharRB->GetSavedValue() )
    2253             :     {
    2254           0 :         SvxCompareMode eCmpMode = SVX_CMP_AUTO;
    2255             : 
    2256           0 :         if ( m_pAutoRB->IsChecked() ) eCmpMode = SVX_CMP_AUTO;
    2257           0 :         if ( m_pWordRB->IsChecked() ) eCmpMode = SVX_CMP_BY_WORD;
    2258           0 :         if ( m_pCharRB->IsChecked() ) eCmpMode = SVX_CMP_BY_CHAR;
    2259             : 
    2260           0 :         pOpt->SetCompareMode( eCmpMode );
    2261           0 :         bRet = sal_True;
    2262             :     }
    2263             : 
    2264           0 :     if( TriState(m_pRsidCB->IsChecked()) != m_pRsidCB->GetSavedValue() )
    2265             :     {
    2266           0 :         pOpt->SetUseRsid( m_pRsidCB->IsChecked() );
    2267           0 :         bRet = sal_True;
    2268             :     }
    2269             : 
    2270           0 :     if( TriState(m_pIgnoreCB->IsChecked()) != m_pIgnoreCB->GetSavedValue() )
    2271             :     {
    2272           0 :         pOpt->SetIgnorePieces( m_pIgnoreCB->IsChecked() );
    2273           0 :         bRet = sal_True;
    2274             :     }
    2275             : 
    2276           0 :     if( m_pLenNF->IsModified() )
    2277             :     {
    2278           0 :         pOpt->SetPieceLen( m_pLenNF->GetValue() );
    2279           0 :         bRet = sal_True;
    2280             :     }
    2281             : 
    2282           0 :     return bRet;
    2283             : }
    2284             : 
    2285           0 : void SwCompareOptionsTabPage::Reset( const SfxItemSet& )
    2286             : {
    2287           0 :     SwModuleOptions *pOpt = SW_MOD()->GetModuleConfig();
    2288             : 
    2289           0 :     SvxCompareMode eCmpMode = pOpt->GetCompareMode();
    2290           0 :     if( eCmpMode == SVX_CMP_AUTO )
    2291             :     {
    2292           0 :         m_pAutoRB->Check();
    2293           0 :         m_pRsidCB->Disable();
    2294           0 :         m_pIgnoreCB->Disable();
    2295           0 :         m_pLenNF->Disable();
    2296             :     }
    2297           0 :     else if( eCmpMode == SVX_CMP_BY_WORD )
    2298             :     {
    2299           0 :         m_pWordRB->Check();
    2300           0 :         m_pRsidCB->Enable();
    2301           0 :         m_pIgnoreCB->Enable();
    2302           0 :         m_pLenNF->Enable();
    2303             :     }
    2304           0 :     else if( eCmpMode == SVX_CMP_BY_CHAR)
    2305             :     {
    2306           0 :         m_pCharRB->Check();
    2307           0 :         m_pRsidCB->Enable();
    2308           0 :         m_pIgnoreCB->Enable();
    2309           0 :         m_pLenNF->Enable();
    2310             :     }
    2311           0 :     m_pAutoRB->SaveValue();
    2312           0 :     m_pWordRB->SaveValue();
    2313           0 :     m_pCharRB->SaveValue();
    2314             : 
    2315           0 :     m_pRsidCB->Check( pOpt->IsUseRsid() );
    2316           0 :     m_pRsidCB->SaveValue();
    2317             : 
    2318           0 :     m_pIgnoreCB->Check( pOpt->IsIgnorePieces() );
    2319           0 :     m_pIgnoreCB->SaveValue();
    2320             : 
    2321           0 :     m_pLenNF->Enable( m_pIgnoreCB->IsChecked() && eCmpMode );
    2322             : 
    2323           0 :     m_pLenNF->SetValue( pOpt->GetPieceLen() );
    2324           0 :     m_pLenNF->SaveValue();
    2325           0 : }
    2326             : 
    2327           0 : IMPL_LINK_NOARG(SwCompareOptionsTabPage, ComparisonHdl)
    2328             : {
    2329           0 :     bool bChecked = !m_pAutoRB->IsChecked();
    2330           0 :     m_pRsidCB->Enable( bChecked );
    2331           0 :     m_pIgnoreCB->Enable( bChecked );
    2332           0 :     m_pLenNF->Enable( bChecked && m_pIgnoreCB->IsChecked() );
    2333             : 
    2334           0 :     return 0;
    2335             : }
    2336             : 
    2337           0 : IMPL_LINK_NOARG(SwCompareOptionsTabPage, IgnoreHdl)
    2338             : {
    2339           0 :     m_pLenNF->Enable( m_pIgnoreCB->IsChecked() );
    2340           0 :     return 0;
    2341           0 : }
    2342             : 
    2343             : #ifdef DBG_UTIL
    2344             : 
    2345             : SwTestTabPage::SwTestTabPage(Window* pParent, const SfxItemSet& rCoreSet)
    2346             :     : SfxTabPage( pParent, "OptTestPage", "modules/swriter/ui/opttestpage.ui", rCoreSet)
    2347             :     , bAttrModified( sal_False )
    2348             : {
    2349             :     get(m_pTest1CBox, "unused");
    2350             :     get(m_pTest2CBox, "dynamic");
    2351             :     get(m_pTest3CBox, "nocalm");
    2352             :     get(m_pTest4CBox, "wysiwygdbg");
    2353             :     get(m_pTest5CBox, "noidle");
    2354             :     get(m_pTest6CBox, "noscreenadj");
    2355             :     get(m_pTest7CBox, "winformat");
    2356             :     get(m_pTest8CBox, "noscroll");
    2357             :     get(m_pTest9CBox, "DrawingLayerNotLoading");
    2358             :     get(m_pTest10CBox, "AutoFormatByInput");
    2359             : 
    2360             :     Init();
    2361             : 
    2362             : }
    2363             : 
    2364             : SfxTabPage* SwTestTabPage::Create( Window* pParent,
    2365             :                                        const SfxItemSet& rAttrSet )
    2366             : {
    2367             :     return new SwTestTabPage(pParent, rAttrSet);
    2368             : }
    2369             : 
    2370             : bool    SwTestTabPage::FillItemSet( SfxItemSet& rCoreSet )
    2371             : {
    2372             : 
    2373             :     if ( bAttrModified )
    2374             :     {
    2375             :         SwTestItem aTestItem(FN_PARAM_SWTEST);
    2376             :         aTestItem.bTest1=m_pTest1CBox->IsChecked();
    2377             :         aTestItem.bTest2=m_pTest2CBox->IsChecked();
    2378             :         aTestItem.bTest3=m_pTest3CBox->IsChecked();
    2379             :         aTestItem.bTest4=m_pTest4CBox->IsChecked();
    2380             :         aTestItem.bTest5=m_pTest5CBox->IsChecked();
    2381             :         aTestItem.bTest6=m_pTest6CBox->IsChecked();
    2382             :         aTestItem.bTest7=m_pTest7CBox->IsChecked();
    2383             :         aTestItem.bTest8=m_pTest8CBox->IsChecked();
    2384             :         aTestItem.bTest9=m_pTest9CBox->IsChecked();
    2385             :         aTestItem.bTest10=m_pTest10CBox->IsChecked();
    2386             :         rCoreSet.Put(aTestItem);
    2387             :     }
    2388             :     return bAttrModified;
    2389             : }
    2390             : 
    2391             : void SwTestTabPage::Reset( const SfxItemSet& )
    2392             : {
    2393             :     const SfxItemSet& rSet = GetItemSet();
    2394             :     const SwTestItem* pTestAttr = 0;
    2395             : 
    2396             :     if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_SWTEST , false,
    2397             :                                     (const SfxPoolItem**)&pTestAttr ))
    2398             :     {
    2399             :         m_pTest1CBox->Check(pTestAttr->bTest1);
    2400             :         m_pTest2CBox->Check(pTestAttr->bTest2);
    2401             :         m_pTest3CBox->Check(pTestAttr->bTest3);
    2402             :         m_pTest4CBox->Check(pTestAttr->bTest4);
    2403             :         m_pTest5CBox->Check(pTestAttr->bTest5);
    2404             :         m_pTest6CBox->Check(pTestAttr->bTest6);
    2405             :         m_pTest7CBox->Check(pTestAttr->bTest7);
    2406             :         m_pTest8CBox->Check(pTestAttr->bTest8);
    2407             :         m_pTest9CBox->Check(pTestAttr->bTest9);
    2408             :         m_pTest10CBox->Check(pTestAttr->bTest10);
    2409             :     }
    2410             : }
    2411             : 
    2412             : void SwTestTabPage::Init()
    2413             : {
    2414             :     // handler
    2415             :     Link aLk = LINK( this, SwTestTabPage, AutoClickHdl );
    2416             :     m_pTest1CBox->SetClickHdl( aLk );
    2417             :     m_pTest2CBox->SetClickHdl( aLk );
    2418             :     m_pTest3CBox->SetClickHdl( aLk );
    2419             :     m_pTest4CBox->SetClickHdl( aLk );
    2420             :     m_pTest5CBox->SetClickHdl( aLk );
    2421             :     m_pTest6CBox->SetClickHdl( aLk );
    2422             :     m_pTest7CBox->SetClickHdl( aLk );
    2423             :     m_pTest8CBox->SetClickHdl( aLk );
    2424             :     m_pTest9CBox->SetClickHdl( aLk );
    2425             :     m_pTest10CBox->SetClickHdl( aLk );
    2426             : }
    2427             : 
    2428             : IMPL_LINK_NOARG_INLINE_START(SwTestTabPage, AutoClickHdl)
    2429             : {
    2430             :     bAttrModified = sal_True;
    2431             :     return 0;
    2432             : }
    2433             : IMPL_LINK_NOARG_INLINE_END(SwTestTabPage, AutoClickHdl)
    2434             : 
    2435             : #endif
    2436             : 
    2437             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10