LCOV - code coverage report
Current view: top level - libreoffice/cui/source/tabpages - tpline.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 1052 0.1 %
Date: 2012-12-17 Functions: 2 44 4.5 %
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 <editeng/sizeitem.hxx>
      21             : #include <tools/shl.hxx>
      22             : #include <tools/urlobj.hxx>
      23             : #include <sfx2/app.hxx>
      24             : #include <sfx2/module.hxx>
      25             : 
      26             : #define _SVX_TPLINE_CXX
      27             : 
      28             : #include <cuires.hrc>
      29             : #include "tabline.hrc"
      30             : #include "svx/xattr.hxx"
      31             : #include <svx/xpool.hxx>
      32             : #include <svx/xtable.hxx>
      33             : #include "svx/drawitem.hxx"
      34             : #include "cuitabline.hxx"
      35             : #include "dlgname.hxx"
      36             : #include <dialmgr.hxx>
      37             : #include "svx/dlgutil.hxx"
      38             : #include "svx/svxgrahicitem.hxx"
      39             : #include <sfx2/request.hxx>
      40             : #include "svx/ofaitem.hxx"
      41             : #include <svx/svdobj.hxx>
      42             : #include <svx/svdview.hxx>
      43             : #include <svx/svdmodel.hxx>
      44             : #include <svx/numvset.hxx>
      45             : #include <vcl/msgbox.hxx>
      46             : #include <editeng/numitem.hxx>
      47             : #include <editeng/svxenum.hxx>
      48             : #include <sfx2/objsh.hxx>
      49             : #include <editeng/brshitem.hxx>
      50             : #include <svx/gallery.hxx>
      51             : #include <svx/xbitmap.hxx>
      52             : #include <unotools/localfilehelper.hxx>
      53             : #include "paragrph.hrc"
      54             : #include "sfx2/opengrf.hxx"
      55             : #include <svx/dialmgr.hxx>
      56             : #include <svx/dialogs.hrc>
      57             : 
      58             : #define MAX_BMP_WIDTH   16
      59             : #define MAX_BMP_HEIGHT  16
      60             : 
      61             : // static ----------------------------------------------------------------
      62             : 
      63             : static sal_uInt16 pLineRanges[] =
      64             : {
      65             :     XATTR_LINETRANSPARENCE,
      66             :     XATTR_LINETRANSPARENCE,
      67             :     SID_ATTR_LINE_STYLE,
      68             :     SID_ATTR_LINE_ENDCENTER,
      69             :     0
      70             : };
      71             : 
      72           0 : SvxLineTabPage::SvxLineTabPage
      73             : (
      74             :     Window* pParent,
      75             :     const SfxItemSet& rInAttrs
      76             : ) :
      77           0 :     SvxTabPage          ( pParent, CUI_RES( RID_SVXPAGE_LINE ), rInAttrs ),
      78           0 :     aFlLine             ( this, CUI_RES( FL_LINE ) ),
      79           0 :     aFtLineStyle        ( this, CUI_RES( FT_LINE_STYLE ) ),
      80           0 :     aLbLineStyle        ( this, CUI_RES( LB_LINE_STYLE ) ),
      81           0 :     aFtColor            ( this, CUI_RES( FT_COLOR ) ),
      82           0 :     aLbColor            ( this, CUI_RES( LB_COLOR ) ),
      83           0 :     aFtLineWidth        ( this, CUI_RES( FT_LINE_WIDTH ) ),
      84           0 :     aMtrLineWidth       ( this, CUI_RES( MTR_FLD_LINE_WIDTH ) ),
      85           0 :     aFtTransparent      ( this, CUI_RES( FT_TRANSPARENT ) ),
      86           0 :     aMtrTransparent     ( this, CUI_RES( MTR_LINE_TRANSPARENT ) ),
      87           0 :     aFlLineEnds         ( this, CUI_RES( FL_LINE_ENDS ) ),
      88           0 :     aLbStartStyle       ( this, CUI_RES( LB_START_STYLE ) ),
      89           0 :     aMtrStartWidth      ( this, CUI_RES( MTR_FLD_START_WIDTH ) ),
      90           0 :     aTsbCenterStart     ( this, CUI_RES( TSB_CENTER_START ) ),
      91           0 :     aFtLineEndsStyle    ( this, CUI_RES( FT_LINE_ENDS_STYLE ) ),
      92           0 :     aLbEndStyle         ( this, CUI_RES( LB_END_STYLE ) ),
      93           0 :     aFtLineEndsWidth    ( this, CUI_RES( FT_LINE_ENDS_WIDTH ) ),
      94           0 :     aMtrEndWidth        ( this, CUI_RES( MTR_FLD_END_WIDTH ) ),
      95           0 :     aTsbCenterEnd       ( this, CUI_RES( TSB_CENTER_END ) ),
      96           0 :     aCbxSynchronize     ( this, CUI_RES( CBX_SYNCHRONIZE ) ),
      97           0 :     aFLSeparator        ( this, CUI_RES( FL_SEPARATOR ) ),
      98           0 :     aCtlPreview         ( this, CUI_RES( CTL_PREVIEW ) ),
      99             : 
     100             :     // #116827#
     101           0 :     maFLEdgeStyle       ( this, CUI_RES( FL_EDGE_STYLE ) ),
     102           0 :     maFTEdgeStyle       ( this, CUI_RES( FT_EDGE_STYLE ) ),
     103           0 :     maLBEdgeStyle       ( this, CUI_RES( LB_EDGE_STYLE ) ),
     104             : 
     105             :     // LineCaps
     106           0 :     maFTCapStyle        ( this, CUI_RES( FT_CAP_STYLE ) ),
     107           0 :     maLBCapStyle        ( this, CUI_RES( LB_CAP_STYLE ) ),
     108             : 
     109             :     pSymbolList(NULL),
     110             :     bNewSize(false),
     111             :     nNumMenuGalleryItems(0),
     112             :     nSymbolType(SVX_SYMBOLTYPE_UNKNOWN), // unknown respectively unchanged
     113             :     pSymbolAttr(NULL),
     114             :     //#58425# Symbols on a line (e.g. StarChart)
     115           0 :     aFlSymbol           ( this, CUI_RES(FL_SYMBOL_FORMAT)),
     116           0 :     aSymbolMB           ( this, CUI_RES(MB_SYMBOL_BITMAP)),
     117           0 :     aSymbolWidthFT      ( this, CUI_RES(FT_SYMBOL_WIDTH)),
     118           0 :     aSymbolWidthMF      ( this, CUI_RES(MF_SYMBOL_WIDTH)),
     119           0 :     aSymbolHeightFT     ( this, CUI_RES(FT_SYMBOL_HEIGHT)),
     120           0 :     aSymbolHeightMF     ( this, CUI_RES(MF_SYMBOL_HEIGHT)),
     121           0 :     aSymbolRatioCB      ( this, CUI_RES(CB_SYMBOL_RATIO)),
     122             : 
     123             :     bLastWidthModified(sal_False),
     124             :     aSymbolLastSize(Size(0,0)),
     125             :     bSymbols(sal_False),
     126             : 
     127             :     rOutAttrs           ( rInAttrs ),
     128             :     bObjSelected( sal_False ),
     129             : 
     130           0 :     pXPool              ( (XOutdevItemPool*) rInAttrs.GetPool() ),
     131             :     aXLStyle            ( XLINE_DASH ),
     132             :     aXWidth             ( 1 ),
     133             :     aXDash              ( String(), XDash( XDASH_RECT, 3, 7, 2, 40, 15 ) ),
     134             :     aXColor             ( String(), COL_LIGHTRED ),
     135             :     aXLineAttr          ( pXPool ),
     136           0 :     rXLSet              ( aXLineAttr.GetItemSet() ),
     137             :      pnLineEndListState( 0 ),
     138             :     pnDashListState( 0 ),
     139             :     pnColorListState( 0 ),
     140           0 :    nPageType           ( 0 )
     141             : {
     142           0 :     aLbEndStyle.SetAccessibleName(String(CUI_RES(STR_STYLE)));
     143           0 :     aLbStartStyle.SetAccessibleName(String(CUI_RES( STR_LB_START_STYLE ) ) );
     144           0 :     aMtrStartWidth.SetAccessibleName(String(CUI_RES( STR_MTR_FLD_START_WIDTH ) ) );
     145           0 :     aLbEndStyle.SetAccessibleName(String(CUI_RES( STR_LB_END_STYLE ) ) );
     146           0 :     aMtrEndWidth.SetAccessibleName(String(CUI_RES( STR_MTR_FLD_END_WIDTH ) ) );
     147           0 :     aTsbCenterStart.SetAccessibleName(String(CUI_RES( STR_CENTER_START ) ) );
     148           0 :     aTsbCenterEnd.SetAccessibleName(String(CUI_RES( STR_CENTER_END ) ) );
     149             : 
     150           0 :     FreeResource();
     151             : 
     152           0 :     aCtlPreview.SetAccessibleName(String(CUI_RES(STR_EXAMPLE)));
     153             : 
     154             :     // This Page requires ExchangeSupport
     155           0 :     SetExchangeSupport();
     156             : 
     157             :     // Metric set
     158           0 :     FieldUnit eFUnit = GetModuleFieldUnit( rInAttrs );
     159             : 
     160           0 :     switch ( eFUnit )
     161             :     {
     162             :         case FUNIT_M:
     163             :         case FUNIT_KM:
     164           0 :             eFUnit = FUNIT_MM;
     165             :             // no break -> we now have mm
     166             :         case FUNIT_MM:
     167           0 :             aMtrLineWidth.SetSpinSize( 50 );
     168           0 :             aMtrStartWidth.SetSpinSize( 50 );
     169           0 :             aMtrEndWidth.SetSpinSize( 50 );
     170           0 :             break;
     171             : 
     172             :             case FUNIT_INCH:
     173           0 :             aMtrLineWidth.SetSpinSize( 2 );
     174           0 :             aMtrStartWidth.SetSpinSize( 2 );
     175           0 :             aMtrEndWidth.SetSpinSize( 2 );
     176           0 :             break;
     177             :             default: ;// prevent warning
     178             :     }
     179           0 :     SetFieldUnit( aMtrLineWidth, eFUnit );
     180           0 :     SetFieldUnit( aMtrStartWidth, eFUnit );
     181           0 :     SetFieldUnit( aMtrEndWidth, eFUnit );
     182             : 
     183             :     // determine PoolUnit
     184           0 :     SfxItemPool* pPool = rOutAttrs.GetPool();
     185             :     DBG_ASSERT( pPool, "Where is the pool?" );
     186           0 :     ePoolUnit = pPool->GetMetric( SID_ATTR_LINE_WIDTH );
     187             : 
     188             :     aLbLineStyle.SetSelectHdl(
     189           0 :         LINK( this, SvxLineTabPage, ClickInvisibleHdl_Impl ) );
     190             :     aLbColor.SetSelectHdl(
     191           0 :         LINK( this, SvxLineTabPage, ChangePreviewHdl_Impl ) );
     192             :     aMtrLineWidth.SetModifyHdl(
     193           0 :         LINK( this, SvxLineTabPage, ChangePreviewHdl_Impl ) );
     194             :     aMtrTransparent.SetModifyHdl(
     195           0 :         LINK( this, SvxLineTabPage, ChangeTransparentHdl_Impl ) );
     196             : 
     197           0 :     Link aStart = LINK( this, SvxLineTabPage, ChangeStartHdl_Impl );
     198           0 :     Link aEnd = LINK( this, SvxLineTabPage, ChangeEndHdl_Impl );
     199           0 :     aLbStartStyle.SetSelectHdl( aStart );
     200           0 :     aLbEndStyle.SetSelectHdl( aEnd );
     201           0 :     aMtrStartWidth.SetModifyHdl( aStart );
     202           0 :     aMtrEndWidth.SetModifyHdl( aEnd );
     203           0 :     aTsbCenterStart.SetClickHdl( aStart );
     204           0 :     aTsbCenterEnd.SetClickHdl( aEnd );
     205             : 
     206             :     // #116827#
     207           0 :     Link aEdgeStyle = LINK( this, SvxLineTabPage, ChangeEdgeStyleHdl_Impl );
     208           0 :     maLBEdgeStyle.SetSelectHdl( aEdgeStyle );
     209             : 
     210             :     // LineCaps
     211           0 :     Link aCapStyle = LINK( this, SvxLineTabPage, ChangeCapStyleHdl_Impl );
     212           0 :     maLBCapStyle.SetSelectHdl( aCapStyle );
     213             : 
     214             :     // Symbols on a line (eg star charts), MB-handler set
     215           0 :     aSymbolMB.SetSelectHdl(LINK(this, SvxLineTabPage, GraphicHdl_Impl));
     216           0 :     aSymbolMB.SetActivateHdl(LINK(this, SvxLineTabPage, MenuCreateHdl_Impl));
     217           0 :     aSymbolWidthMF.SetModifyHdl(LINK(this, SvxLineTabPage, SizeHdl_Impl));
     218           0 :     aSymbolHeightMF.SetModifyHdl(LINK(this, SvxLineTabPage, SizeHdl_Impl));
     219           0 :     aSymbolRatioCB.SetClickHdl(LINK(this, SvxLineTabPage, RatioHdl_Impl));
     220             : 
     221           0 :     aSymbolRatioCB.Check(sal_True);
     222           0 :     ShowSymbolControls(sal_False);
     223             : 
     224           0 :     nActLineWidth = -1;
     225           0 : }
     226             : 
     227           0 : void SvxLineTabPage::ShowSymbolControls(sal_Bool bOn)
     228             : {
     229             :     // Symbols on a line (e.g. StarCharts), symbol-enable controls
     230             : 
     231           0 :     bSymbols=bOn;
     232           0 :     aSymbolWidthFT.Show(bOn);
     233           0 :     aSymbolWidthMF.Show(bOn);
     234           0 :     aSymbolHeightFT.Show(bOn);
     235           0 :     aSymbolHeightMF.Show(bOn);
     236           0 :     aFlSymbol.Show(bOn);
     237           0 :     aSymbolRatioCB.Show(bOn);
     238           0 :     aSymbolMB.Show(bOn);
     239           0 :     aCtlPreview.ShowSymbol(bOn);
     240           0 : }
     241             : 
     242           0 : SvxLineTabPage::~SvxLineTabPage()
     243             : {
     244             :     // Symbols on a line (e.g. StarCharts), dtor new!
     245             : 
     246           0 :     delete aSymbolMB.GetPopupMenu()->GetPopupMenu( MN_GALLERY );
     247             : 
     248           0 :     if(pSymbolList)
     249           0 :         delete aSymbolMB.GetPopupMenu()->GetPopupMenu( MN_SYMBOLS );
     250             : 
     251           0 :     for ( size_t i = 0, n = aGrfBrushItems.size(); i < n; ++i )
     252             :     {
     253           0 :         SvxBmpItemInfo* pInfo = aGrfBrushItems[ i ];
     254           0 :         delete pInfo->pBrushItem;
     255           0 :         delete pInfo;
     256             :     }
     257           0 : }
     258           0 : void SvxLineTabPage::Construct()
     259             : {
     260             :     // Color chart
     261           0 :     aLbColor.Fill( pColorList );
     262           0 :     FillListboxes();
     263           0 : }
     264             : 
     265           0 : void SvxLineTabPage::InitSymbols(MenuButton* pButton)
     266             : {
     267             :     // Initialize popup
     268           0 :     if(!pButton->GetPopupMenu()->GetPopupMenu( MN_GALLERY ))
     269             :     {
     270             :         // Get gallery entries
     271           0 :         GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames);
     272             : 
     273           0 :         PopupMenu* pPopup = new PopupMenu;
     274           0 :         OUString aEmptyStr;
     275           0 :         const OUString *pUIName = NULL;
     276           0 :         sal_uInt32 i = 0;
     277           0 :         nNumMenuGalleryItems = aGrfNames.size();
     278           0 :         for(std::vector<OUString>::iterator it = aGrfNames.begin(); it != aGrfNames.end(); ++it, ++i)
     279             :         {
     280           0 :             pUIName = &(*it);
     281             : 
     282             :             // Convert URL encodings to UI characters (e.g. %20 for spaces)
     283           0 :             OUString aPhysicalName;
     284           0 :             if (utl::LocalFileHelper::ConvertURLToPhysicalName(*it, aPhysicalName))
     285             :             {
     286           0 :                 pUIName = &aPhysicalName;
     287             :             }
     288             : 
     289           0 :             SvxBrushItem* pBrushItem = new SvxBrushItem(*it, aEmptyStr, GPOS_AREA, SID_ATTR_BRUSH);
     290           0 :             pBrushItem->SetDoneLink(STATIC_LINK(this, SvxLineTabPage, GraphicArrivedHdl_Impl));
     291             : 
     292           0 :             SvxBmpItemInfo* pInfo = new SvxBmpItemInfo();
     293           0 :             pInfo->pBrushItem = pBrushItem;
     294           0 :             pInfo->nItemId = (sal_uInt16)(MN_GALLERY_ENTRY + i);
     295           0 :             if ( i < aGrfBrushItems.size() ) {
     296           0 :                 aGrfBrushItems.insert( aGrfBrushItems.begin() + i, pInfo );
     297             :             } else {
     298           0 :                 aGrfBrushItems.push_back( pInfo );
     299             :             }
     300           0 :             const Graphic* pGraphic = pBrushItem->GetGraphic();
     301             : 
     302           0 :             if(pGraphic)
     303             :             {
     304           0 :                 Bitmap aBitmap(pGraphic->GetBitmap());
     305           0 :                 Size aSize(aBitmap.GetSizePixel());
     306           0 :                 if(aSize.Width()  > MAX_BMP_WIDTH ||
     307           0 :                    aSize.Height() > MAX_BMP_HEIGHT)
     308             :                 {
     309           0 :                     sal_Bool bWidth = aSize.Width() > aSize.Height();
     310             :                     double nScale = bWidth ?
     311           0 :                                         (double)MAX_BMP_WIDTH / (double)aSize.Width():
     312           0 :                                         (double)MAX_BMP_HEIGHT / (double)aSize.Height();
     313           0 :                     aBitmap.Scale(nScale, nScale);
     314             : 
     315             :                 }
     316           0 :                 Image aImage(aBitmap);
     317           0 :                 pPopup->InsertItem(pInfo->nItemId, *pUIName, aImage );
     318             :             }
     319             :             else
     320             :             {
     321           0 :                 Image aImage;
     322           0 :                 pPopup->InsertItem(pInfo->nItemId, *pUIName, aImage );
     323             :             }
     324           0 :         }
     325           0 :         aSymbolMB.GetPopupMenu()->SetPopupMenu( MN_GALLERY, pPopup );
     326             : 
     327           0 :         if(aGrfNames.empty())
     328           0 :             aSymbolMB.GetPopupMenu()->EnableItem(MN_GALLERY, sal_False);
     329             :     }
     330             : 
     331           0 :     if(!pButton->GetPopupMenu()->GetPopupMenu( MN_SYMBOLS ) && pSymbolList)
     332             :     {
     333           0 :         VirtualDevice aVDev;
     334           0 :         aVDev.SetMapMode(MapMode(MAP_100TH_MM));
     335           0 :         SdrModel* pModel = new SdrModel(NULL, NULL, LOADREFCOUNTS);
     336           0 :         pModel->GetItemPool().FreezeIdRanges();
     337             :         // Page
     338           0 :         SdrPage* pPage = new SdrPage( *pModel, sal_False );
     339           0 :         pPage->SetSize(Size(1000,1000));
     340           0 :         pModel->InsertPage( pPage, 0 );
     341             :         // 3D View
     342           0 :         SdrView* pView = new SdrView( pModel, &aVDev );
     343           0 :         pView->hideMarkHandles();
     344           0 :         pView->ShowSdrPage(pPage);
     345             : 
     346           0 :         PopupMenu* pPopup = new PopupMenu;
     347           0 :         OUString aEmptyStr;
     348             : 
     349             :         // Generate invisible square to give all symbols a
     350             :         // bitmap size, which is independent from specific glyph
     351           0 :         SdrObject *pInvisibleSquare=pSymbolList->GetObj(0);
     352           0 :         pInvisibleSquare=pInvisibleSquare->Clone();
     353           0 :         pPage->NbcInsertObject(pInvisibleSquare);
     354           0 :         pInvisibleSquare->SetMergedItem(XFillTransparenceItem(100));
     355           0 :         pInvisibleSquare->SetMergedItem(XLineTransparenceItem(100));
     356             : 
     357           0 :         for(long i=0;; ++i)
     358             :         {
     359           0 :             SdrObject *pObj=pSymbolList->GetObj(i);
     360           0 :             if(pObj==NULL)
     361             :                 break;
     362           0 :             pObj=pObj->Clone();
     363           0 :             aGrfNames.push_back(aEmptyStr);
     364           0 :             pPage->NbcInsertObject(pObj);
     365           0 :             if(pSymbolAttr)
     366             :             {
     367           0 :                 pObj->SetMergedItemSet(*pSymbolAttr);
     368             :             }
     369             :             else
     370             :             {
     371           0 :                 pObj->SetMergedItemSet(rOutAttrs);
     372             :             }
     373           0 :             pView->MarkAll();
     374           0 :             BitmapEx aBitmapEx(pView->GetMarkedObjBitmapEx());
     375           0 :             GDIMetaFile aMeta(pView->GetMarkedObjMetaFile());
     376           0 :             pView->UnmarkAll();
     377           0 :             pObj=pPage->RemoveObject(1);
     378           0 :             SdrObject::Free(pObj);
     379             : 
     380           0 :             SvxBrushItem* pBrushItem = new SvxBrushItem(Graphic(aMeta), GPOS_AREA, SID_ATTR_BRUSH);
     381           0 :             pBrushItem->SetDoneLink(STATIC_LINK(this, SvxLineTabPage, GraphicArrivedHdl_Impl));
     382             : 
     383           0 :             SvxBmpItemInfo* pInfo = new SvxBmpItemInfo();
     384           0 :             pInfo->pBrushItem = pBrushItem;
     385           0 :             pInfo->nItemId = (sal_uInt16)(MN_GALLERY_ENTRY + i + nNumMenuGalleryItems);
     386           0 :             if ( (size_t)(nNumMenuGalleryItems + i) < aGrfBrushItems.size() ) {
     387           0 :                 aGrfBrushItems.insert( aGrfBrushItems.begin() + nNumMenuGalleryItems + i, pInfo );
     388             :             } else {
     389           0 :                 aGrfBrushItems.push_back( pInfo );
     390             :             }
     391             : 
     392           0 :             Size aSize(aBitmapEx.GetSizePixel());
     393           0 :             if(aSize.Width() > MAX_BMP_WIDTH || aSize.Height() > MAX_BMP_HEIGHT)
     394             :             {
     395           0 :                 sal_Bool bWidth = aSize.Width() > aSize.Height();
     396             :                 double nScale = bWidth ?
     397           0 :                                     (double)MAX_BMP_WIDTH / (double)aSize.Width():
     398           0 :                                     (double)MAX_BMP_HEIGHT / (double)aSize.Height();
     399           0 :                 aBitmapEx.Scale(nScale, nScale);
     400             :             }
     401           0 :             Image aImage(aBitmapEx);
     402           0 :             pPopup->InsertItem(pInfo->nItemId,aEmptyStr,aImage);
     403           0 :         }
     404           0 :         pInvisibleSquare=pPage->RemoveObject(0);
     405           0 :         SdrObject::Free(pInvisibleSquare);
     406             : 
     407           0 :         aSymbolMB.GetPopupMenu()->SetPopupMenu( MN_SYMBOLS, pPopup );
     408             : 
     409           0 :         if(aGrfNames.empty())
     410           0 :             aSymbolMB.GetPopupMenu()->EnableItem(MN_SYMBOLS, sal_False);
     411             : 
     412           0 :         delete pView;
     413           0 :         delete pModel;
     414             :     }
     415           0 : }
     416             : 
     417           0 : void SvxLineTabPage::SymbolSelected(MenuButton* pButton)
     418             : {
     419           0 :     sal_uInt16 nItemId = pButton->GetCurItemId();
     420           0 :     const Graphic* pGraphic = 0;
     421           0 :     Graphic aGraphic;
     422           0 :     bool bResetSize = false;
     423           0 :     bool bEnable = true;
     424           0 :     long nPreviousSymbolType = nSymbolType;
     425             : 
     426           0 :     if(nItemId >= MN_GALLERY_ENTRY)
     427             :     {
     428           0 :         if( (nItemId-MN_GALLERY_ENTRY) >= nNumMenuGalleryItems)
     429             :         {
     430           0 :             nSymbolType=nItemId-MN_GALLERY_ENTRY-nNumMenuGalleryItems; // List's index
     431             :         }
     432             :         else
     433             :         {
     434           0 :             nSymbolType=SVX_SYMBOLTYPE_BRUSHITEM;
     435           0 :             bResetSize = true;
     436             :         }
     437           0 :         SvxBmpItemInfo* pInfo = aGrfBrushItems[ nItemId - MN_GALLERY_ENTRY ];
     438           0 :         pGraphic = pInfo->pBrushItem->GetGraphic();
     439             :     }
     440           0 :     else switch(nItemId)
     441             :     {
     442             :         case MN_SYMBOLS_AUTO:
     443             :         {
     444           0 :             pGraphic=&aAutoSymbolGraphic;
     445           0 :             aAutoSymbolGraphic.SetPrefSize( Size(253,253) );
     446           0 :             nSymbolType=SVX_SYMBOLTYPE_AUTO;
     447             :         }
     448           0 :         break;
     449             : 
     450             :         case MN_SYMBOLS_NONE:
     451             :         {
     452           0 :             nSymbolType=SVX_SYMBOLTYPE_NONE;
     453           0 :             pGraphic=NULL;
     454           0 :             bEnable = false;
     455             :         }
     456           0 :         break;
     457             :         default:
     458             :         {
     459           0 :             SvxOpenGraphicDialog aGrfDlg(CUI_RES(RID_STR_EDIT_GRAPHIC));
     460           0 :             aGrfDlg.EnableLink(false);
     461           0 :             aGrfDlg.AsLink(false);
     462           0 :             if( !aGrfDlg.Execute() )
     463             :             {
     464             :                 // Remember selected filters
     465           0 :                 if( !aGrfDlg.GetGraphic(aGraphic) )
     466             :                 {
     467           0 :                     nSymbolType=SVX_SYMBOLTYPE_BRUSHITEM;
     468           0 :                     pGraphic = &aGraphic;
     469           0 :                     bResetSize = true;
     470             :                 }
     471             :             }
     472           0 :             if( !pGraphic )
     473           0 :                 return;
     474             :         }
     475           0 :         break;
     476             :     }
     477             : 
     478           0 :     if(pGraphic)
     479             :     {
     480           0 :         Size aSize = SvxNumberFormat::GetGraphicSizeMM100(pGraphic);
     481           0 :         aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)ePoolUnit);
     482           0 :         aSymbolGraphic=*pGraphic;
     483           0 :         if( bResetSize )
     484             :         {
     485           0 :             aSymbolSize=aSize;
     486             :         }
     487           0 :         else if( nPreviousSymbolType == SVX_SYMBOLTYPE_BRUSHITEM )
     488             :         {   //#i31097# Data Point Symbol size changes when a different symbol is choosen(maoyg)
     489           0 :             if( aSymbolSize.Width() != aSymbolSize.Height() )
     490             :             {
     491           0 :                 aSize.setWidth( (long)( aSymbolSize.Width() + aSymbolSize.Height() )/2 );
     492           0 :                 aSize.setHeight( (long)( aSymbolSize.Width() + aSymbolSize.Height() )/2 );
     493           0 :                 aSymbolSize = aSize;
     494             :             }
     495             :         }
     496           0 :         aCtlPreview.SetSymbol(&aSymbolGraphic,aSymbolSize);
     497             :     }
     498             :     else
     499             :     {
     500           0 :         aSymbolGraphic=Graphic();
     501           0 :         aCtlPreview.SetSymbol(NULL,aSymbolSize);
     502           0 :         bEnable = false;
     503             :     }
     504           0 :     aSymbolLastSize=aSymbolSize;
     505           0 :     SetMetricValue(aSymbolWidthMF,  aSymbolSize.Width(), ePoolUnit);
     506           0 :     SetMetricValue(aSymbolHeightMF, aSymbolSize.Height(), ePoolUnit);
     507           0 :     aSymbolRatioCB.Enable(bEnable);
     508           0 :     aSymbolHeightFT.Enable(bEnable);
     509           0 :     aSymbolWidthFT.Enable(bEnable);
     510           0 :     aSymbolWidthMF.Enable(bEnable);
     511           0 :     aSymbolHeightMF.Enable(bEnable);
     512           0 :     aCtlPreview.Invalidate();
     513             : }
     514             : 
     515           0 : void SvxLineTabPage::FillListboxes()
     516             : {
     517             :     // Line styles
     518           0 :     sal_uInt16 nOldSelect = aLbLineStyle.GetSelectEntryPos();
     519           0 :     aLbLineStyle.FillStyles();
     520           0 :     aLbLineStyle.Fill( pDashList );
     521           0 :     aLbLineStyle.SelectEntryPos( nOldSelect );
     522             : 
     523             :     // Line end style
     524           0 :     String sNone( SVX_RES( RID_SVXSTR_NONE ) );
     525           0 :     nOldSelect = aLbStartStyle.GetSelectEntryPos();
     526           0 :     aLbStartStyle.Clear();
     527           0 :     aLbStartStyle.InsertEntry( sNone );
     528           0 :     aLbStartStyle.Fill( pLineEndList );
     529           0 :     aLbStartStyle.SelectEntryPos( nOldSelect );
     530           0 :     nOldSelect = aLbEndStyle.GetSelectEntryPos();
     531           0 :     aLbEndStyle.Clear();
     532           0 :     aLbEndStyle.InsertEntry( sNone );
     533           0 :     aLbEndStyle.Fill( pLineEndList, sal_False );
     534           0 :     aLbEndStyle.SelectEntryPos( nOldSelect );
     535           0 : }
     536             : 
     537             : // -----------------------------------------------------------------------
     538             : 
     539           0 : void SvxLineTabPage::ActivatePage( const SfxItemSet& rSet )
     540             : {
     541           0 :     SFX_ITEMSET_ARG (&rSet,pPageTypeItem,CntUInt16Item,SID_PAGE_TYPE,sal_False);
     542           0 :     if (pPageTypeItem)
     543           0 :         SetPageType(pPageTypeItem->GetValue());
     544           0 :     if( nDlgType == 0 && pDashList.is() )
     545             :     {
     546             :         sal_uInt16 nPos;
     547             :         sal_uInt16 nCount;
     548             : 
     549             :         // Dash list
     550           0 :         if( ( *pnDashListState & CT_MODIFIED ) ||
     551             :             ( *pnDashListState & CT_CHANGED ) )
     552             :         {
     553           0 :             if( *pnDashListState & CT_CHANGED )
     554           0 :                 pDashList = ( (SvxLineTabDialog*) GetParentDialog() )->
     555           0 :                                         GetNewDashList();
     556           0 :             *pnDashListState = CT_NONE;
     557             : 
     558             :             // Style list
     559           0 :             nPos = aLbLineStyle.GetSelectEntryPos();
     560             : 
     561           0 :             aLbLineStyle.Clear();
     562             :             aLbLineStyle.InsertEntry(
     563           0 :                 SVX_RESSTR( RID_SVXSTR_INVISIBLE ) );
     564             :             aLbLineStyle.InsertEntry(
     565           0 :                 SVX_RESSTR( RID_SVXSTR_SOLID ) );
     566           0 :             aLbLineStyle.Fill( pDashList );
     567           0 :             nCount = aLbLineStyle.GetEntryCount();
     568             : 
     569           0 :             if ( nCount == 0 )
     570             :                 ; // This case should never occur
     571           0 :             else if( nCount <= nPos )
     572           0 :                 aLbLineStyle.SelectEntryPos( 0 );
     573             :             else
     574           0 :                 aLbLineStyle.SelectEntryPos( nPos );
     575             :             // SelectStyleHdl_Impl( this );
     576             :         }
     577             : 
     578           0 :         INetURLObject   aDashURL( pDashList->GetPath() );
     579             : 
     580           0 :         aDashURL.Append( pDashList->GetName() );
     581             :         DBG_ASSERT( aDashURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
     582             :         // LineEnd list
     583           0 :         if( ( *pnLineEndListState & CT_MODIFIED ) ||
     584             :             ( *pnLineEndListState & CT_CHANGED ) )
     585             :         {
     586           0 :             if( *pnLineEndListState & CT_CHANGED )
     587           0 :                 pLineEndList = ( (SvxLineTabDialog*) GetParentDialog() )->
     588           0 :                                         GetNewLineEndList();
     589           0 :             *pnLineEndListState = CT_NONE;
     590             : 
     591           0 :             nPos = aLbLineStyle.GetSelectEntryPos();
     592           0 :             String sNone( SVX_RES( RID_SVXSTR_NONE ) );
     593           0 :             aLbStartStyle.Clear();
     594           0 :             aLbStartStyle.InsertEntry( sNone );
     595             : 
     596           0 :             aLbStartStyle.Fill( pLineEndList );
     597           0 :             nCount = aLbStartStyle.GetEntryCount();
     598           0 :             if( nCount == 0 )
     599             :                 ; // This case should never occur
     600           0 :             else if( nCount <= nPos )
     601           0 :                 aLbStartStyle.SelectEntryPos( 0 );
     602             :             else
     603           0 :                 aLbStartStyle.SelectEntryPos( nPos );
     604             : 
     605           0 :             aLbEndStyle.Clear();
     606           0 :             aLbEndStyle.InsertEntry( sNone );
     607             : 
     608           0 :             aLbEndStyle.Fill( pLineEndList, sal_False );
     609           0 :             nCount = aLbEndStyle.GetEntryCount();
     610             : 
     611           0 :             if( nCount == 0 )
     612             :                 ; // This case should never occur
     613           0 :             else if( nCount <= nPos )
     614           0 :                 aLbEndStyle.SelectEntryPos( 0 );
     615             :             else
     616           0 :                 aLbEndStyle.SelectEntryPos( nPos );
     617             :         }
     618           0 :         INetURLObject aLineURL( pLineEndList->GetPath() );
     619             : 
     620           0 :         aLineURL.Append( pLineEndList->GetName() );
     621             :         DBG_ASSERT( aLineURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
     622             :         // Evaluate if another TabPage set another fill type
     623           0 :         if( aLbLineStyle.GetSelectEntryPos() != 0 )
     624             :         {
     625           0 :             if( nPageType == 2 ) // 1
     626             :             {
     627           0 :                 aLbLineStyle.SelectEntryPos( *pPosDashLb + 2 ); // +2 due to SOLID and INVLISIBLE
     628           0 :                 ChangePreviewHdl_Impl( this );
     629             :             }
     630           0 :             if( nPageType == 3 )
     631             :             {
     632           0 :                 aLbStartStyle.SelectEntryPos( *pPosLineEndLb + 1 );// +1 due to SOLID
     633           0 :                 aLbEndStyle.SelectEntryPos( *pPosLineEndLb + 1 );// +1 due to SOLID
     634           0 :                 ChangePreviewHdl_Impl( this );
     635             :             }
     636             :         }
     637             : 
     638             :             // ColorList
     639           0 :             if( *pnColorListState )
     640             :             {
     641           0 :                 if( *pnColorListState & CT_CHANGED )
     642           0 :                     pColorList = ( (SvxLineTabDialog*) GetParentDialog() )->GetNewColorList();
     643             :                 // aLbColor
     644           0 :                 sal_uInt16 nColorPos = aLbColor.GetSelectEntryPos();
     645           0 :                 aLbColor.Clear();
     646           0 :                 aLbColor.Fill( pColorList );
     647           0 :                 nCount = aLbColor.GetEntryCount();
     648           0 :                 if( nCount == 0 )
     649             :                     ; // This case should never occur
     650           0 :                 else if( nCount <= nColorPos )
     651           0 :                     aLbColor.SelectEntryPos( 0 );
     652             :                 else
     653           0 :                     aLbColor.SelectEntryPos( nColorPos );
     654             : 
     655           0 :                 ChangePreviewHdl_Impl( this );
     656             :             }
     657             : 
     658           0 :         nPageType = 0;
     659             :     }
     660             :     // Page does not yet exist in the ctor, that's why we do it here!
     661             : 
     662           0 :     else if ( nDlgType == 1100 ||
     663             :               nDlgType == 1101 )
     664             :     {
     665           0 :         aFtLineEndsStyle.Hide();
     666           0 :         aFtLineEndsWidth.Hide();
     667           0 :         aLbStartStyle.Hide();
     668           0 :         aMtrStartWidth.Hide();
     669           0 :         aTsbCenterStart.Hide();
     670           0 :         aLbEndStyle.Hide();
     671           0 :         aMtrEndWidth.Hide();
     672           0 :         aTsbCenterEnd.Hide();
     673           0 :         aCbxSynchronize.Hide();
     674           0 :         aFlLineEnds.Hide();
     675             : 
     676             :         // #116827#
     677           0 :         maFLEdgeStyle.Hide();
     678           0 :         maFTEdgeStyle.Hide();
     679           0 :         maLBEdgeStyle.Hide();
     680             : 
     681             :         // LineCaps
     682           0 :         maFTCapStyle.Hide();
     683           0 :         maLBCapStyle.Hide();
     684             :     }
     685           0 : }
     686             : 
     687             : // -----------------------------------------------------------------------
     688             : 
     689           0 : int SvxLineTabPage::DeactivatePage( SfxItemSet* _pSet )
     690             : {
     691           0 :     if( nDlgType == 0 ) // Line dialog
     692             :     {
     693           0 :         nPageType = 1; // possibly for extensions
     694           0 :         *pPosDashLb = aLbLineStyle.GetSelectEntryPos() - 2;// First entry SOLID!!!
     695           0 :         sal_uInt16 nPos = aLbStartStyle.GetSelectEntryPos();
     696           0 :         if( nPos != LISTBOX_ENTRY_NOTFOUND )
     697           0 :             nPos--;
     698           0 :         *pPosLineEndLb = nPos;
     699             :     }
     700             : 
     701           0 :     if( _pSet )
     702           0 :         FillItemSet( *_pSet );
     703             : 
     704           0 :     return( LEAVE_PAGE );
     705             : }
     706             : 
     707             : // -----------------------------------------------------------------------
     708             : 
     709           0 : sal_Bool SvxLineTabPage::FillItemSet( SfxItemSet& rAttrs )
     710             : {
     711           0 :     const SfxPoolItem* pOld = NULL;
     712             :     sal_uInt16  nPos;
     713           0 :     sal_Bool    bModified = sal_False;
     714             : 
     715             :     // To prevent modifications to the list, we do not set other page's items.
     716           0 :     if( nDlgType != 0 || nPageType != 2 )
     717             :     {
     718           0 :         nPos = aLbLineStyle.GetSelectEntryPos();
     719           0 :         if( nPos != LISTBOX_ENTRY_NOTFOUND &&
     720           0 :             nPos != aLbLineStyle.GetSavedValue() )
     721             :         {
     722           0 :             XLineStyleItem* pStyleItem = NULL;
     723             : 
     724           0 :             if( nPos == 0 )
     725           0 :                 pStyleItem = new XLineStyleItem( XLINE_NONE );
     726           0 :             else if( nPos == 1 )
     727           0 :                 pStyleItem = new XLineStyleItem( XLINE_SOLID );
     728             :             else
     729             :             {
     730           0 :                 pStyleItem = new XLineStyleItem( XLINE_DASH );
     731             : 
     732             :                 // For added security
     733           0 :                 if( pDashList->Count() > (long) ( nPos - 2 ) )
     734             :                 {
     735             :                     XLineDashItem aDashItem( aLbLineStyle.GetSelectEntry(),
     736           0 :                                         pDashList->GetDash( nPos - 2 )->GetDash() );
     737           0 :                     pOld = GetOldItem( rAttrs, XATTR_LINEDASH );
     738           0 :                     if ( !pOld || !( *(const XLineDashItem*)pOld == aDashItem ) )
     739             :                     {
     740           0 :                         rAttrs.Put( aDashItem );
     741           0 :                         bModified = sal_True;
     742           0 :                     }
     743             :                 }
     744             :             }
     745           0 :             pOld = GetOldItem( rAttrs, XATTR_LINESTYLE );
     746           0 :             if ( !pOld || !( *(const XLineStyleItem*)pOld == *pStyleItem ) )
     747             :             {
     748           0 :                 rAttrs.Put( *pStyleItem );
     749           0 :                 bModified = sal_True;
     750             :             }
     751           0 :             delete pStyleItem;
     752             :         }
     753             :     }
     754             :     // Line width
     755             :     // GetSavedValue() returns String!
     756           0 :     if( aMtrLineWidth.GetText() != aMtrLineWidth.GetSavedValue() )
     757             :     {
     758           0 :         XLineWidthItem aItem( GetCoreValue( aMtrLineWidth, ePoolUnit ) );
     759           0 :         pOld = GetOldItem( rAttrs, XATTR_LINEWIDTH );
     760           0 :         if ( !pOld || !( *(const XLineWidthItem*)pOld == aItem ) )
     761             :         {
     762           0 :             rAttrs.Put( aItem );
     763           0 :             bModified = sal_True;
     764           0 :         }
     765             :     }
     766             :     // Width line start
     767           0 :     if( aMtrStartWidth.GetText() != aMtrStartWidth.GetSavedValue() )
     768             :     {
     769           0 :         XLineStartWidthItem aItem( GetCoreValue( aMtrStartWidth, ePoolUnit ) );
     770           0 :         pOld = GetOldItem( rAttrs, XATTR_LINESTARTWIDTH );
     771           0 :         if ( !pOld || !( *(const XLineStartWidthItem*)pOld == aItem ) )
     772             :         {
     773           0 :             rAttrs.Put( aItem );
     774           0 :             bModified = sal_True;
     775           0 :         }
     776             :     }
     777             :     // Width line end
     778           0 :     if( aMtrEndWidth.GetText() != aMtrEndWidth.GetSavedValue() )
     779             :     {
     780           0 :         XLineEndWidthItem aItem( GetCoreValue( aMtrEndWidth, ePoolUnit ) );
     781           0 :         pOld = GetOldItem( rAttrs, XATTR_LINEENDWIDTH );
     782           0 :         if ( !pOld || !( *(const XLineEndWidthItem*)pOld == aItem ) )
     783             :         {
     784           0 :             rAttrs.Put( aItem );
     785           0 :             bModified = sal_True;
     786           0 :         }
     787             :     }
     788             : 
     789             :     // Line color
     790           0 :     if( aLbColor.GetSelectEntryPos() != aLbColor.GetSavedValue() )
     791             :     {
     792             :         XLineColorItem aItem( aLbColor.GetSelectEntry(),
     793           0 :                               aLbColor.GetSelectEntryColor() );
     794           0 :         pOld = GetOldItem( rAttrs, XATTR_LINECOLOR );
     795           0 :         if ( !pOld || !( *(const XLineColorItem*)pOld == aItem ) )
     796             :         {
     797           0 :             rAttrs.Put( aItem );
     798           0 :             bModified = sal_True;
     799           0 :         }
     800             :     }
     801             : 
     802           0 :     if( nDlgType != 0 || nPageType != 3 )
     803             :     {
     804             :         // Line start
     805           0 :         nPos = aLbStartStyle.GetSelectEntryPos();
     806           0 :         if( nPos != LISTBOX_ENTRY_NOTFOUND &&
     807           0 :             nPos != aLbStartStyle.GetSavedValue() )
     808             :         {
     809           0 :             XLineStartItem* pItem = NULL;
     810           0 :             if( nPos == 0 )
     811           0 :                 pItem = new XLineStartItem();
     812           0 :             else if( pLineEndList->Count() > (long) ( nPos - 1 ) )
     813             :                 pItem = new XLineStartItem( aLbStartStyle.GetSelectEntry(),
     814           0 :                             pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() );
     815           0 :             pOld = GetOldItem( rAttrs, XATTR_LINESTART );
     816           0 :             if( pItem &&
     817           0 :                 ( !pOld || !( *(const XLineEndItem*)pOld == *pItem ) ) )
     818             :             {
     819           0 :                 rAttrs.Put( *pItem );
     820           0 :                 bModified = sal_True;
     821             :             }
     822           0 :             delete pItem;
     823             :         }
     824             :         // Line end
     825           0 :         nPos = aLbEndStyle.GetSelectEntryPos();
     826           0 :         if( nPos != LISTBOX_ENTRY_NOTFOUND &&
     827           0 :             nPos != aLbEndStyle.GetSavedValue() )
     828             :         {
     829           0 :             XLineEndItem* pItem = NULL;
     830           0 :             if( nPos == 0 )
     831           0 :                 pItem = new XLineEndItem();
     832           0 :             else if( pLineEndList->Count() > (long) ( nPos - 1 ) )
     833             :                 pItem = new XLineEndItem( aLbEndStyle.GetSelectEntry(),
     834           0 :                             pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() );
     835           0 :             pOld = GetOldItem( rAttrs, XATTR_LINEEND );
     836           0 :             if( pItem &&
     837           0 :                 ( !pOld || !( *(const XLineEndItem*)pOld == *pItem ) ) )
     838             :             {
     839           0 :                 rAttrs.Put( *pItem );
     840           0 :                 bModified = sal_True;
     841             :             }
     842           0 :             delete pItem;
     843             :         }
     844             :     }
     845             : 
     846             :     // Centered line end
     847           0 :     TriState eState = aTsbCenterStart.GetState();
     848           0 :     if( eState != aTsbCenterStart.GetSavedValue() )
     849             :     {
     850           0 :         XLineStartCenterItem aItem( sal::static_int_cast< sal_Bool >( eState ) );
     851           0 :         pOld = GetOldItem( rAttrs, XATTR_LINESTARTCENTER );
     852           0 :         if ( !pOld || !( *(const XLineStartCenterItem*)pOld == aItem ) )
     853             :         {
     854           0 :             rAttrs.Put( aItem );
     855           0 :             bModified = sal_True;
     856           0 :         }
     857             :     }
     858           0 :     eState = aTsbCenterEnd.GetState();
     859           0 :     if( eState != aTsbCenterEnd.GetSavedValue() )
     860             :     {
     861           0 :         XLineEndCenterItem aItem( sal::static_int_cast< sal_Bool >( eState ) );
     862           0 :         pOld = GetOldItem( rAttrs, XATTR_LINEENDCENTER );
     863           0 :         if ( !pOld || !( *(const XLineEndCenterItem*)pOld == aItem ) )
     864             :         {
     865           0 :             rAttrs.Put( aItem );
     866           0 :             bModified = sal_True;
     867           0 :         }
     868             :     }
     869             : 
     870             :     // Width line start
     871           0 :     if( aMtrStartWidth.GetText() != aMtrStartWidth.GetSavedValue() )
     872             :     {
     873           0 :         XLineStartWidthItem aItem( GetCoreValue( aMtrStartWidth, ePoolUnit ) );
     874           0 :         pOld = GetOldItem( rAttrs, XATTR_LINESTARTWIDTH );
     875           0 :         if ( !pOld || !( *(const XLineStartWidthItem*)pOld == aItem ) )
     876             :         {
     877           0 :             rAttrs.Put( aItem );
     878           0 :             bModified = sal_True;
     879           0 :         }
     880             :     }
     881             :     // Width line end
     882           0 :     if( aMtrEndWidth.GetText() != aMtrEndWidth.GetSavedValue() )
     883             :     {
     884           0 :         XLineEndWidthItem aItem( GetCoreValue( aMtrEndWidth, ePoolUnit ) );
     885           0 :         pOld = GetOldItem( rAttrs, XATTR_LINEENDWIDTH );
     886           0 :         if ( !pOld || !( *(const XLineEndWidthItem*)pOld == aItem ) )
     887             :         {
     888           0 :             rAttrs.Put( aItem );
     889           0 :             bModified = sal_True;
     890           0 :         }
     891             :     }
     892             : 
     893             :     // Transparency
     894           0 :     sal_uInt16 nVal = (sal_uInt16)aMtrTransparent.GetValue();
     895           0 :     if( nVal != (sal_uInt16)aMtrTransparent.GetSavedValue().ToInt32() )
     896             :     {
     897           0 :         XLineTransparenceItem aItem( nVal );
     898           0 :         pOld = GetOldItem( rAttrs, XATTR_LINETRANSPARENCE );
     899           0 :         if ( !pOld || !( *(const XLineTransparenceItem*)pOld == aItem ) )
     900             :         {
     901           0 :             rAttrs.Put( aItem );
     902           0 :             bModified = sal_True;
     903           0 :         }
     904             :     }
     905             : 
     906             :     // #116827#
     907           0 :     nPos = maLBEdgeStyle.GetSelectEntryPos();
     908           0 :     if( LISTBOX_ENTRY_NOTFOUND != nPos && nPos != maLBEdgeStyle.GetSavedValue() )
     909             :     {
     910           0 :         XLineJointItem* pNew = 0L;
     911             : 
     912           0 :         switch(nPos)
     913             :         {
     914             :             case 0: // Rounded, default
     915             :             {
     916           0 :                 pNew = new XLineJointItem(XLINEJOINT_ROUND);
     917           0 :                 break;
     918             :             }
     919             :             case 1: // - none -
     920             :             {
     921           0 :                 pNew = new XLineJointItem(XLINEJOINT_NONE);
     922           0 :                 break;
     923             :             }
     924             :             case 2: // Miter
     925             :             {
     926           0 :                 pNew = new XLineJointItem(XLINEJOINT_MITER);
     927           0 :                 break;
     928             :             }
     929             :             case 3: // Bevel
     930             :             {
     931           0 :                 pNew = new XLineJointItem(XLINEJOINT_BEVEL);
     932           0 :                 break;
     933             :             }
     934             :         }
     935             : 
     936           0 :         if(pNew)
     937             :         {
     938           0 :             pOld = GetOldItem( rAttrs, XATTR_LINEJOINT );
     939             : 
     940           0 :             if(!pOld || !(*(const XLineJointItem*)pOld == *pNew))
     941             :             {
     942           0 :                 rAttrs.Put( *pNew );
     943           0 :                 bModified = sal_True;
     944             :             }
     945             : 
     946           0 :             delete pNew;
     947             :         }
     948             :     }
     949             : 
     950             :     // LineCaps
     951           0 :     nPos = maLBCapStyle.GetSelectEntryPos();
     952           0 :     if( LISTBOX_ENTRY_NOTFOUND != nPos && nPos != maLBCapStyle.GetSavedValue() )
     953             :     {
     954           0 :         XLineCapItem* pNew = 0L;
     955             : 
     956           0 :         switch(nPos)
     957             :         {
     958             :             case 0: // Butt (=Flat), default
     959             :             {
     960           0 :                 pNew = new XLineCapItem(com::sun::star::drawing::LineCap_BUTT);
     961           0 :                 break;
     962             :             }
     963             :             case 1: // Round
     964             :             {
     965           0 :                 pNew = new XLineCapItem(com::sun::star::drawing::LineCap_ROUND);
     966           0 :                 break;
     967             :             }
     968             :             case 2: // Square
     969             :             {
     970           0 :                 pNew = new XLineCapItem(com::sun::star::drawing::LineCap_SQUARE);
     971           0 :                 break;
     972             :             }
     973             :         }
     974             : 
     975           0 :         if(pNew)
     976             :         {
     977           0 :             pOld = GetOldItem( rAttrs, XATTR_LINECAP );
     978             : 
     979           0 :             if(!pOld || !(*(const XLineCapItem*)pOld == *pNew))
     980             :             {
     981           0 :                 rAttrs.Put( *pNew );
     982           0 :                 bModified = sal_True;
     983             :             }
     984             : 
     985           0 :             delete pNew;
     986             :         }
     987             :     }
     988             : 
     989           0 :     if(nSymbolType!=SVX_SYMBOLTYPE_UNKNOWN || bNewSize)
     990             :     {
     991             :         // Was set by selection or the size is different
     992           0 :         SvxSizeItem  aSItem(rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLSIZE),aSymbolSize);
     993           0 :         const SfxPoolItem* pSOld = GetOldItem( rAttrs, rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLSIZE) );
     994           0 :         bNewSize  = pSOld ? *(const SvxSizeItem *)pSOld != aSItem : bNewSize ;
     995           0 :         if(bNewSize)
     996             :         {
     997           0 :             rAttrs.Put(aSItem);
     998           0 :             bModified=sal_True;
     999             :         }
    1000             : 
    1001           0 :         SfxInt32Item aTItem(rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLTYPE),nSymbolType);
    1002           0 :         const SfxPoolItem* pTOld = GetOldItem( rAttrs, rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLTYPE) );
    1003           0 :         bool bNewType = pTOld == NULL || *(const SfxInt32Item*)pTOld != aTItem;
    1004           0 :         if(bNewType && nSymbolType==SVX_SYMBOLTYPE_UNKNOWN)
    1005           0 :             bNewType=false; // a small fix, type wasn't set -> don't create a type item after all!
    1006           0 :         if(bNewType)
    1007             :         {
    1008           0 :             rAttrs.Put(aTItem);
    1009           0 :             bModified=sal_True;
    1010             :         }
    1011             : 
    1012           0 :         if(nSymbolType!=SVX_SYMBOLTYPE_NONE)
    1013             :         {
    1014           0 :             SvxBrushItem aBItem(aSymbolGraphic,GPOS_MM,rAttrs.GetPool()->GetWhich(SID_ATTR_BRUSH));
    1015           0 :             const SfxPoolItem* pBOld = GetOldItem( rAttrs, rAttrs.GetPool()->GetWhich(SID_ATTR_BRUSH) );
    1016             :             bool bNewBrush =
    1017           0 :                 pBOld == NULL || *(const SvxBrushItem*)pBOld != aBItem;
    1018           0 :             if(bNewBrush)
    1019             :             {
    1020           0 :                 rAttrs.Put(aBItem);
    1021           0 :                 bModified=sal_True;
    1022           0 :             }
    1023           0 :         }
    1024             :     }
    1025           0 :     rAttrs.Put (CntUInt16Item(SID_PAGE_TYPE,nPageType));
    1026           0 :     return( bModified );
    1027             : }
    1028             : 
    1029             : // -----------------------------------------------------------------------
    1030             : 
    1031           0 : sal_Bool SvxLineTabPage::FillXLSet_Impl()
    1032             : {
    1033             :     sal_uInt16 nPos;
    1034             : 
    1035           0 :     if( aLbLineStyle.GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND )
    1036             :     {
    1037           0 :         rXLSet.Put( XLineStyleItem( XLINE_NONE ) );
    1038             :     }
    1039           0 :     else if( aLbLineStyle.IsEntryPosSelected( 0 ) )
    1040           0 :         rXLSet.Put( XLineStyleItem( XLINE_NONE ) );
    1041           0 :     else if( aLbLineStyle.IsEntryPosSelected( 1 ) )
    1042           0 :         rXLSet.Put( XLineStyleItem( XLINE_SOLID ) );
    1043             :     else
    1044             :     {
    1045           0 :         rXLSet.Put( XLineStyleItem( XLINE_DASH ) );
    1046             : 
    1047           0 :         nPos = aLbLineStyle.GetSelectEntryPos();
    1048           0 :         if( nPos != LISTBOX_ENTRY_NOTFOUND )
    1049             :         {
    1050             :             rXLSet.Put( XLineDashItem( aLbLineStyle.GetSelectEntry(),
    1051           0 :                             pDashList->GetDash( nPos - 2 )->GetDash() ) );
    1052             :         }
    1053             :     }
    1054             : 
    1055           0 :     nPos = aLbStartStyle.GetSelectEntryPos();
    1056           0 :     if( nPos != LISTBOX_ENTRY_NOTFOUND )
    1057             :     {
    1058           0 :         if( nPos == 0 )
    1059           0 :             rXLSet.Put( XLineStartItem() );
    1060             :         else
    1061             :             rXLSet.Put( XLineStartItem( aLbStartStyle.GetSelectEntry(),
    1062           0 :                         pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ) );
    1063             :     }
    1064           0 :     nPos = aLbEndStyle.GetSelectEntryPos();
    1065           0 :     if( nPos != LISTBOX_ENTRY_NOTFOUND )
    1066             :     {
    1067           0 :         if( nPos == 0 )
    1068           0 :             rXLSet.Put( XLineEndItem() );
    1069             :         else
    1070             :             rXLSet.Put( XLineEndItem( aLbEndStyle.GetSelectEntry(),
    1071           0 :                         pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ) );
    1072             :     }
    1073             : 
    1074             :     // #116827#
    1075           0 :     nPos = maLBEdgeStyle.GetSelectEntryPos();
    1076           0 :     if(LISTBOX_ENTRY_NOTFOUND != nPos)
    1077             :     {
    1078           0 :         switch(nPos)
    1079             :         {
    1080             :             case 0: // Rounded, default
    1081             :             {
    1082           0 :                 rXLSet.Put(XLineJointItem(XLINEJOINT_ROUND));
    1083           0 :                 break;
    1084             :             }
    1085             :             case 1: // - none -
    1086             :             {
    1087           0 :                 rXLSet.Put(XLineJointItem(XLINEJOINT_NONE));
    1088           0 :                 break;
    1089             :             }
    1090             :             case 2: // Miter
    1091             :             {
    1092           0 :                 rXLSet.Put(XLineJointItem(XLINEJOINT_MITER));
    1093           0 :                 break;
    1094             :             }
    1095             :             case 3: // Bevel
    1096             :             {
    1097           0 :                 rXLSet.Put(XLineJointItem(XLINEJOINT_BEVEL));
    1098           0 :                 break;
    1099             :             }
    1100             :         }
    1101             :     }
    1102             : 
    1103             :     // LineCaps
    1104           0 :     nPos = maLBCapStyle.GetSelectEntryPos();
    1105           0 :     if(LISTBOX_ENTRY_NOTFOUND != nPos)
    1106             :     {
    1107           0 :         switch(nPos)
    1108             :         {
    1109             :             case 0: // Butt (=Flat), default
    1110             :             {
    1111           0 :                 rXLSet.Put(XLineCapItem(com::sun::star::drawing::LineCap_BUTT));
    1112           0 :                 break;
    1113             :             }
    1114             :             case 1: // Round
    1115             :             {
    1116           0 :                 rXLSet.Put(XLineCapItem(com::sun::star::drawing::LineCap_ROUND));
    1117           0 :                 break;
    1118             :             }
    1119             :             case 2: // Square
    1120             :             {
    1121           0 :                 rXLSet.Put(XLineCapItem(com::sun::star::drawing::LineCap_SQUARE));
    1122           0 :                 break;
    1123             :             }
    1124             :         }
    1125             :     }
    1126             : 
    1127           0 :     rXLSet.Put( XLineStartWidthItem( GetCoreValue( aMtrStartWidth, ePoolUnit ) ) );
    1128           0 :     rXLSet.Put( XLineEndWidthItem( GetCoreValue( aMtrEndWidth, ePoolUnit ) ) );
    1129             : 
    1130           0 :     rXLSet.Put( XLineWidthItem( GetCoreValue( aMtrLineWidth, ePoolUnit ) ) );
    1131             :     rXLSet.Put( XLineColorItem( aLbColor.GetSelectEntry(),
    1132           0 :                                     aLbColor.GetSelectEntryColor() ) );
    1133             : 
    1134             :     // Centered line end
    1135           0 :     if( aTsbCenterStart.GetState() == STATE_CHECK )
    1136           0 :         rXLSet.Put( XLineStartCenterItem( sal_True ) );
    1137           0 :     else if( aTsbCenterStart.GetState() == STATE_NOCHECK )
    1138           0 :         rXLSet.Put( XLineStartCenterItem( sal_False ) );
    1139             : 
    1140           0 :     if( aTsbCenterEnd.GetState() == STATE_CHECK )
    1141           0 :         rXLSet.Put( XLineEndCenterItem( sal_True ) );
    1142           0 :     else if( aTsbCenterEnd.GetState() == STATE_NOCHECK )
    1143           0 :         rXLSet.Put( XLineEndCenterItem( sal_False ) );
    1144             : 
    1145             :     // Transparency
    1146           0 :     sal_uInt16 nVal = (sal_uInt16)aMtrTransparent.GetValue();
    1147           0 :     rXLSet.Put( XLineTransparenceItem( nVal ) );
    1148             : 
    1149             :     // #116827#
    1150           0 :     aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet());
    1151             : 
    1152           0 :     return( sal_True );
    1153             : }
    1154             : 
    1155             : // -----------------------------------------------------------------------
    1156             : 
    1157           0 : void SvxLineTabPage::Reset( const SfxItemSet& rAttrs )
    1158             : {
    1159           0 :     String      aString;
    1160             :     XLineStyle  eXLS; // XLINE_NONE, XLINE_SOLID, XLINE_DASH
    1161             : 
    1162             :     // Line style
    1163             :     const SfxPoolItem *pPoolItem;
    1164           0 :     long nSymType=SVX_SYMBOLTYPE_UNKNOWN;
    1165           0 :     sal_Bool bPrevSym=sal_False;
    1166           0 :     sal_Bool bEnable=sal_True;
    1167           0 :     sal_Bool bIgnoreGraphic=sal_False;
    1168           0 :     sal_Bool bIgnoreSize=sal_False;
    1169           0 :     if(rAttrs.GetItemState(rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLTYPE),sal_True,&pPoolItem) == SFX_ITEM_SET)
    1170             :     {
    1171           0 :         nSymType=((const SfxInt32Item *)pPoolItem)->GetValue();
    1172             :     }
    1173             : 
    1174           0 :     if(nSymType == SVX_SYMBOLTYPE_AUTO)
    1175             :     {
    1176           0 :         aSymbolGraphic=aAutoSymbolGraphic;
    1177           0 :         aSymbolSize=aSymbolLastSize=aAutoSymbolGraphic.GetPrefSize();
    1178           0 :         bPrevSym=sal_True;
    1179             :     }
    1180           0 :     else if(nSymType == SVX_SYMBOLTYPE_NONE)
    1181             :     {
    1182           0 :         bEnable=sal_False;
    1183           0 :         bIgnoreGraphic=sal_True;
    1184           0 :         bIgnoreSize=sal_True;
    1185             :     }
    1186           0 :     else if(nSymType >= 0)
    1187             :     {
    1188           0 :         VirtualDevice aVDev;
    1189           0 :         aVDev.SetMapMode(MapMode(MAP_100TH_MM));
    1190             : 
    1191           0 :         SdrModel* pModel = new SdrModel(NULL, NULL, LOADREFCOUNTS);
    1192           0 :         pModel->GetItemPool().FreezeIdRanges();
    1193           0 :         SdrPage* pPage = new SdrPage( *pModel, sal_False );
    1194           0 :         pPage->SetSize(Size(1000,1000));
    1195           0 :         pModel->InsertPage( pPage, 0 );
    1196           0 :         SdrView* pView = new SdrView( pModel, &aVDev );
    1197           0 :         pView->hideMarkHandles();
    1198           0 :         pView->ShowSdrPage(pPage);
    1199           0 :         SdrObject *pObj=NULL;
    1200           0 :         long nSymTmp=nSymType;
    1201           0 :         if(pSymbolList)
    1202             :         {
    1203           0 :             if(pSymbolList->GetObjCount())
    1204             :             {
    1205           0 :                 nSymTmp=nSymTmp%pSymbolList->GetObjCount(); // Treat list as cyclic!
    1206           0 :                 pObj=pSymbolList->GetObj(nSymTmp);
    1207           0 :                 if(pObj)
    1208             :                 {
    1209           0 :                     pObj=pObj->Clone();
    1210           0 :                     if(pSymbolAttr)
    1211             :                     {
    1212           0 :                         pObj->SetMergedItemSet(*pSymbolAttr);
    1213             :                     }
    1214             :                     else
    1215             :                     {
    1216           0 :                         pObj->SetMergedItemSet(rOutAttrs);
    1217             :                     }
    1218             : 
    1219           0 :                     pPage->NbcInsertObject(pObj);
    1220             : 
    1221             :                     // Generate invisible square to give all symbol types a
    1222             :                     // bitmap size, which is indepedent from specific glyph
    1223           0 :                     SdrObject *pInvisibleSquare=pSymbolList->GetObj(0);
    1224           0 :                     pInvisibleSquare=pInvisibleSquare->Clone();
    1225           0 :                     pPage->NbcInsertObject(pInvisibleSquare);
    1226           0 :                     pInvisibleSquare->SetMergedItem(XFillTransparenceItem(100));
    1227           0 :                     pInvisibleSquare->SetMergedItem(XLineTransparenceItem(100));
    1228             : 
    1229           0 :                     pView->MarkAll();
    1230           0 :                     GDIMetaFile aMeta(pView->GetMarkedObjMetaFile());
    1231             : 
    1232           0 :                     aSymbolGraphic=Graphic(aMeta);
    1233           0 :                     aSymbolSize=pObj->GetSnapRect().GetSize();
    1234           0 :                     aSymbolGraphic.SetPrefSize(pInvisibleSquare->GetSnapRect().GetSize());
    1235           0 :                     aSymbolGraphic.SetPrefMapMode(MAP_100TH_MM);
    1236           0 :                     bPrevSym=sal_True;
    1237           0 :                     bEnable=sal_True;
    1238           0 :                     bIgnoreGraphic=sal_True;
    1239             : 
    1240           0 :                     pView->UnmarkAll();
    1241           0 :                     pInvisibleSquare=pPage->RemoveObject(1);
    1242           0 :                     SdrObject::Free( pInvisibleSquare);
    1243           0 :                     pObj=pPage->RemoveObject(0);
    1244           0 :                     SdrObject::Free( pObj );
    1245             :                 }
    1246             :             }
    1247             :         }
    1248           0 :         delete pView;
    1249           0 :         delete pModel;
    1250             :     }
    1251           0 :     if(rAttrs.GetItemState(rAttrs.GetPool()->GetWhich(SID_ATTR_BRUSH),sal_True,&pPoolItem) == SFX_ITEM_SET)
    1252             :     {
    1253           0 :         const Graphic* pGraphic = ((const SvxBrushItem *)pPoolItem)->GetGraphic();
    1254           0 :         if( pGraphic )
    1255             :         {
    1256           0 :             if(!bIgnoreGraphic)
    1257             :             {
    1258           0 :                 aSymbolGraphic=*pGraphic;
    1259             :             }
    1260           0 :             if(!bIgnoreSize)
    1261             :             {
    1262             :                 aSymbolSize=OutputDevice::LogicToLogic( pGraphic->GetPrefSize(),
    1263             :                                                         pGraphic->GetPrefMapMode(),
    1264           0 :                                                         MAP_100TH_MM );
    1265             :             }
    1266           0 :             bPrevSym=sal_True;
    1267             :         }
    1268             :     }
    1269             : 
    1270           0 :     if(rAttrs.GetItemState(rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLSIZE),sal_True,&pPoolItem) == SFX_ITEM_SET)
    1271             :     {
    1272           0 :         aSymbolSize = ((const SvxSizeItem *)pPoolItem)->GetSize();
    1273             :     }
    1274             : 
    1275           0 :     aSymbolRatioCB.Enable(bEnable);
    1276           0 :     aSymbolHeightFT.Enable(bEnable);
    1277           0 :     aSymbolWidthFT.Enable(bEnable);
    1278           0 :     aSymbolWidthMF.Enable(bEnable);
    1279           0 :     aSymbolHeightMF.Enable(bEnable);
    1280           0 :     if(bPrevSym)
    1281             :     {
    1282           0 :         SetMetricValue(aSymbolWidthMF,  aSymbolSize.Width(), ePoolUnit);
    1283           0 :         SetMetricValue(aSymbolHeightMF, aSymbolSize.Height(),ePoolUnit);
    1284           0 :         aCtlPreview.SetSymbol(&aSymbolGraphic,aSymbolSize);
    1285           0 :         aSymbolLastSize=aSymbolSize;
    1286             :     }
    1287             : 
    1288           0 :     if( rAttrs.GetItemState( XATTR_LINESTYLE ) != SFX_ITEM_DONTCARE )
    1289             :     {
    1290           0 :         eXLS = (XLineStyle) ( ( const XLineStyleItem& ) rAttrs.Get( XATTR_LINESTYLE ) ).GetValue();
    1291             : 
    1292           0 :         switch( eXLS )
    1293             :         {
    1294             :             case XLINE_NONE:
    1295           0 :                 aLbLineStyle.SelectEntryPos( 0 );
    1296           0 :                 break;
    1297             :             case XLINE_SOLID:
    1298           0 :                 aLbLineStyle.SelectEntryPos( 1 );
    1299           0 :                 break;
    1300             : 
    1301             :             case XLINE_DASH:
    1302           0 :                 aLbLineStyle.SetNoSelection();
    1303             :                 aLbLineStyle.SelectEntry( ( ( const XLineDashItem& ) rAttrs.
    1304           0 :                                 Get( XATTR_LINEDASH ) ).GetName() );
    1305           0 :                 break;
    1306             : 
    1307             :             default:
    1308           0 :                 break;
    1309             :         }
    1310             :     }
    1311             :     else
    1312             :     {
    1313           0 :         aLbLineStyle.SetNoSelection();
    1314             :     }
    1315             : 
    1316             :     // Line strength
    1317           0 :     if( rAttrs.GetItemState( XATTR_LINEWIDTH ) != SFX_ITEM_DONTCARE )
    1318             :     {
    1319             :         SetMetricValue( aMtrLineWidth, ( ( const XLineWidthItem& ) rAttrs.
    1320           0 :                             Get( XATTR_LINEWIDTH ) ).GetValue(), ePoolUnit );
    1321             :     }
    1322             :     else
    1323           0 :         aMtrLineWidth.SetText( String() );
    1324             : 
    1325             :     // Line color
    1326           0 :     aLbColor.SetNoSelection();
    1327             : 
    1328           0 :     if ( rAttrs.GetItemState( XATTR_LINECOLOR ) != SFX_ITEM_DONTCARE )
    1329             :     {
    1330           0 :         Color aCol = ( ( const XLineColorItem& ) rAttrs.Get( XATTR_LINECOLOR ) ).GetColorValue();
    1331           0 :         aLbColor.SelectEntry( aCol );
    1332           0 :         if( aLbColor.GetSelectEntryCount() == 0 )
    1333             :         {
    1334           0 :             aLbColor.InsertEntry( aCol, String() );
    1335           0 :             aLbColor.SelectEntry( aCol );
    1336             :         }
    1337             :     }
    1338             : 
    1339             :     // Line start
    1340           0 :     if( bObjSelected &&
    1341           0 :         rAttrs.GetItemState( XATTR_LINESTART ) == SFX_ITEM_DEFAULT )
    1342             :     {
    1343           0 :         aLbStartStyle.Disable();
    1344             :     }
    1345           0 :     else if( rAttrs.GetItemState( XATTR_LINESTART ) != SFX_ITEM_DONTCARE )
    1346             :     {
    1347             :         // #86265# select entry using list and polygon, not string
    1348           0 :         sal_Bool bSelected(sal_False);
    1349           0 :         const basegfx::B2DPolyPolygon& rItemPolygon = ((const XLineStartItem&)rAttrs.Get(XATTR_LINESTART)).GetLineStartValue();
    1350             : 
    1351           0 :         for(sal_Int32 a(0);!bSelected &&  a < pLineEndList->Count(); a++)
    1352             :         {
    1353           0 :             XLineEndEntry* pEntry = pLineEndList->GetLineEnd(a);
    1354           0 :             const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd();
    1355             : 
    1356           0 :             if(rItemPolygon == rEntryPolygon)
    1357             :             {
    1358             :                 // select this entry
    1359           0 :                 aLbStartStyle.SelectEntryPos((sal_uInt16)a + 1);
    1360           0 :                 bSelected = sal_True;
    1361             :             }
    1362             :         }
    1363             : 
    1364           0 :         if(!bSelected)
    1365           0 :             aLbStartStyle.SelectEntryPos( 0 );
    1366             :     }
    1367             :     else
    1368             :     {
    1369           0 :         aLbStartStyle.SetNoSelection();
    1370             :     }
    1371             : 
    1372             :     // Line end
    1373           0 :     if( bObjSelected &&
    1374           0 :         rAttrs.GetItemState( XATTR_LINEEND ) == SFX_ITEM_DEFAULT )
    1375             :     {
    1376           0 :         aLbEndStyle.Disable();
    1377             :     }
    1378           0 :     else if( rAttrs.GetItemState( XATTR_LINEEND ) != SFX_ITEM_DONTCARE )
    1379             :     {
    1380             :         // #86265# select entry using list and polygon, not string
    1381           0 :         sal_Bool bSelected(sal_False);
    1382           0 :         const basegfx::B2DPolyPolygon& rItemPolygon = ((const XLineEndItem&)rAttrs.Get(XATTR_LINEEND)).GetLineEndValue();
    1383             : 
    1384           0 :         for(sal_Int32 a(0);!bSelected &&  a < pLineEndList->Count(); a++)
    1385             :         {
    1386           0 :             XLineEndEntry* pEntry = pLineEndList->GetLineEnd(a);
    1387           0 :             const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd();
    1388             : 
    1389           0 :             if(rItemPolygon == rEntryPolygon)
    1390             :             {
    1391             :                 // select this entry
    1392           0 :                 aLbEndStyle.SelectEntryPos((sal_uInt16)a + 1);
    1393           0 :                 bSelected = sal_True;
    1394             :             }
    1395             :         }
    1396             : 
    1397           0 :         if(!bSelected)
    1398           0 :             aLbEndStyle.SelectEntryPos( 0 );
    1399             :     }
    1400             :     else
    1401             :     {
    1402           0 :         aLbEndStyle.SetNoSelection();
    1403             :     }
    1404             : 
    1405             :     // Line start strength
    1406           0 :     if( bObjSelected &&
    1407           0 :         rAttrs.GetItemState( XATTR_LINESTARTWIDTH ) == SFX_ITEM_DEFAULT )
    1408             :     {
    1409           0 :         aMtrStartWidth.Disable();
    1410             :     }
    1411           0 :     else if( rAttrs.GetItemState( XATTR_LINESTARTWIDTH ) != SFX_ITEM_DONTCARE )
    1412             :     {
    1413             :         SetMetricValue( aMtrStartWidth, ( ( const XLineStartWidthItem& ) rAttrs.
    1414           0 :                             Get( XATTR_LINESTARTWIDTH ) ).GetValue(), ePoolUnit );
    1415             :     }
    1416             :     else
    1417           0 :         aMtrStartWidth.SetText( String() );
    1418             : 
    1419             :     // Line end strength
    1420           0 :     if( bObjSelected &&
    1421           0 :         rAttrs.GetItemState( XATTR_LINEENDWIDTH ) == SFX_ITEM_DEFAULT )
    1422             :     {
    1423           0 :         aMtrEndWidth.Disable();
    1424             :     }
    1425           0 :     else if( rAttrs.GetItemState( XATTR_LINEENDWIDTH ) != SFX_ITEM_DONTCARE )
    1426             :     {
    1427             :         SetMetricValue( aMtrEndWidth, ( ( const XLineEndWidthItem& ) rAttrs.
    1428           0 :                             Get( XATTR_LINEENDWIDTH ) ).GetValue(), ePoolUnit );
    1429             :     }
    1430             :     else
    1431           0 :         aMtrEndWidth.SetText( String() );
    1432             : 
    1433             :     // Centered line end (start)
    1434           0 :     if( bObjSelected &&
    1435           0 :         rAttrs.GetItemState( XATTR_LINESTARTCENTER ) == SFX_ITEM_DEFAULT )
    1436             :     {
    1437           0 :         aTsbCenterStart.Disable();
    1438             :     }
    1439           0 :     else if( rAttrs.GetItemState( XATTR_LINESTARTCENTER ) != SFX_ITEM_DONTCARE )
    1440             :     {
    1441           0 :         aTsbCenterStart.EnableTriState( sal_False );
    1442             : 
    1443           0 :         if( ( ( const XLineStartCenterItem& ) rAttrs.Get( XATTR_LINESTARTCENTER ) ).GetValue() )
    1444           0 :             aTsbCenterStart.SetState( STATE_CHECK );
    1445             :         else
    1446           0 :             aTsbCenterStart.SetState( STATE_NOCHECK );
    1447             :     }
    1448             :     else
    1449             :     {
    1450           0 :         aTsbCenterStart.SetState( STATE_DONTKNOW );
    1451             :     }
    1452             : 
    1453             :     // Centered line end (end)
    1454           0 :     if( bObjSelected &&
    1455           0 :         rAttrs.GetItemState( XATTR_LINEENDCENTER ) == SFX_ITEM_DEFAULT )
    1456             :     {
    1457           0 :         aTsbCenterEnd.Disable();
    1458             :     }
    1459           0 :     else if( rAttrs.GetItemState( XATTR_LINEENDCENTER ) != SFX_ITEM_DONTCARE )
    1460             :     {
    1461           0 :         aTsbCenterEnd.EnableTriState( sal_False );
    1462             : 
    1463           0 :         if( ( ( const XLineEndCenterItem& ) rAttrs.Get( XATTR_LINEENDCENTER ) ).GetValue() )
    1464           0 :             aTsbCenterEnd.SetState( STATE_CHECK );
    1465             :         else
    1466           0 :             aTsbCenterEnd.SetState( STATE_NOCHECK );
    1467             :     }
    1468             :     else
    1469             :     {
    1470           0 :         aTsbCenterEnd.SetState( STATE_DONTKNOW );
    1471             :     }
    1472             : 
    1473             :     // Transparency
    1474           0 :     if( rAttrs.GetItemState( XATTR_LINETRANSPARENCE ) != SFX_ITEM_DONTCARE )
    1475             :     {
    1476             :         sal_uInt16 nTransp = ( ( const XLineTransparenceItem& ) rAttrs.
    1477           0 :                                 Get( XATTR_LINETRANSPARENCE ) ).GetValue();
    1478           0 :         aMtrTransparent.SetValue( nTransp );
    1479           0 :         ChangeTransparentHdl_Impl( NULL );
    1480             :     }
    1481             :     else
    1482           0 :         aMtrTransparent.SetText( String() );
    1483             : 
    1484           0 :     if( !aLbStartStyle.IsEnabled()  &&
    1485           0 :         !aLbEndStyle.IsEnabled()    &&
    1486           0 :         !aMtrStartWidth.IsEnabled() &&
    1487           0 :         !aMtrEndWidth.IsEnabled()   &&
    1488           0 :         !aTsbCenterStart.IsEnabled()&&
    1489           0 :         !aTsbCenterEnd.IsEnabled() )
    1490             :     {
    1491           0 :         aCbxSynchronize.Disable();
    1492           0 :         aFtLineEndsStyle.Disable();
    1493           0 :         aFtLineEndsWidth.Disable();
    1494           0 :         aFlLineEnds.Disable();
    1495             :     }
    1496             : 
    1497             :     // Synchronize
    1498             :     // We get the value from the INI file now
    1499           0 :     String aStr = GetUserData();
    1500           0 :     aCbxSynchronize.Check( (sal_Bool)aStr.ToInt32() );
    1501             : 
    1502             :     // #116827#
    1503           0 :     if(bObjSelected && SFX_ITEM_DEFAULT == rAttrs.GetItemState(XATTR_LINEJOINT))
    1504             :     {
    1505           0 :         maFTEdgeStyle.Disable();
    1506           0 :         maLBEdgeStyle.Disable();
    1507             :     }
    1508           0 :     else if(SFX_ITEM_DONTCARE != rAttrs.GetItemState(XATTR_LINEJOINT))
    1509             :     {
    1510           0 :         XLineJoint eLineJoint = ((const XLineJointItem&)(rAttrs.Get(XATTR_LINEJOINT))).GetValue();
    1511             : 
    1512           0 :         switch(eLineJoint)
    1513             :         {
    1514           0 :             case XLINEJOINT_ROUND : maLBEdgeStyle.SelectEntryPos(0); break;
    1515           0 :             case XLINEJOINT_NONE : maLBEdgeStyle.SelectEntryPos(1); break;
    1516           0 :             case XLINEJOINT_MITER : maLBEdgeStyle.SelectEntryPos(2); break;
    1517           0 :             case XLINEJOINT_BEVEL : maLBEdgeStyle.SelectEntryPos(3); break;
    1518           0 :             case XLINEJOINT_MIDDLE : break;
    1519             :         }
    1520             :     }
    1521             :     else
    1522             :     {
    1523           0 :         maLBEdgeStyle.SetNoSelection();
    1524             :     }
    1525             : 
    1526             :     // fdo#43209
    1527           0 :     if(bObjSelected && SFX_ITEM_DEFAULT == rAttrs.GetItemState(XATTR_LINECAP))
    1528             :     {
    1529           0 :         maFTCapStyle.Disable();
    1530           0 :         maLBCapStyle.Disable();
    1531             :     }
    1532           0 :     else if(SFX_ITEM_DONTCARE != rAttrs.GetItemState(XATTR_LINECAP))
    1533             :     {
    1534           0 :         const com::sun::star::drawing::LineCap eLineCap(((const XLineCapItem&)(rAttrs.Get(XATTR_LINECAP))).GetValue());
    1535             : 
    1536           0 :         switch(eLineCap)
    1537             :         {
    1538           0 :             case com::sun::star::drawing::LineCap_ROUND: maLBCapStyle.SelectEntryPos(1); break;
    1539           0 :             case com::sun::star::drawing::LineCap_SQUARE : maLBCapStyle.SelectEntryPos(2); break;
    1540           0 :             default /*com::sun::star::drawing::LineCap_BUTT*/: maLBCapStyle.SelectEntryPos(0); break;
    1541             :         }
    1542             :     }
    1543             :     else
    1544             :     {
    1545           0 :         maLBCapStyle.SetNoSelection();
    1546             :     }
    1547             : 
    1548             :     // Save values
    1549           0 :     aLbLineStyle.SaveValue();
    1550           0 :     aMtrLineWidth.SaveValue();
    1551           0 :     aLbColor.SaveValue();
    1552           0 :     aLbStartStyle.SaveValue();
    1553           0 :     aLbEndStyle.SaveValue();
    1554           0 :     aMtrStartWidth.SaveValue();
    1555           0 :     aMtrEndWidth.SaveValue();
    1556           0 :     aTsbCenterStart.SaveValue();
    1557           0 :     aTsbCenterEnd.SaveValue();
    1558           0 :     aMtrTransparent.SaveValue();
    1559             : 
    1560             :     // #116827#
    1561           0 :     maLBEdgeStyle.SaveValue();
    1562             : 
    1563             :     // LineCaps
    1564           0 :     maLBCapStyle.SaveValue();
    1565             : 
    1566           0 :     ClickInvisibleHdl_Impl( this );
    1567             : 
    1568           0 :     ChangePreviewHdl_Impl( NULL );
    1569           0 : }
    1570             : 
    1571             : // -----------------------------------------------------------------------
    1572             : 
    1573           0 : SfxTabPage* SvxLineTabPage::Create( Window* pWindow,
    1574             :                 const SfxItemSet& rAttrs )
    1575             : {
    1576           0 :     return( new SvxLineTabPage( pWindow, rAttrs ) );
    1577             : }
    1578             : 
    1579             : //------------------------------------------------------------------------
    1580             : 
    1581           0 : sal_uInt16* SvxLineTabPage::GetRanges()
    1582             : {
    1583           0 :     return pLineRanges;
    1584             : }
    1585             : 
    1586             : //------------------------------------------------------------------------
    1587             : 
    1588           0 : IMPL_LINK( SvxLineTabPage, ChangePreviewHdl_Impl, void *, pCntrl )
    1589             : {
    1590           0 :     if(pCntrl == &aMtrLineWidth)
    1591             :     {
    1592             :         // Line width and start end width
    1593           0 :         sal_Int32 nNewLineWidth = GetCoreValue( aMtrLineWidth, ePoolUnit );
    1594           0 :         if(nActLineWidth == -1)
    1595             :         {
    1596             :             // Don't initialize yet, get the start value
    1597           0 :             const SfxPoolItem* pOld = GetOldItem( rXLSet, XATTR_LINEWIDTH );
    1598           0 :             sal_Int32 nStartLineWidth = 0;
    1599           0 :             if(pOld)
    1600           0 :                 nStartLineWidth = (( const XLineWidthItem *)pOld)->GetValue();
    1601           0 :             nActLineWidth = nStartLineWidth;
    1602             :         }
    1603             : 
    1604           0 :         if(nActLineWidth != nNewLineWidth)
    1605             :         {
    1606             :             // Adapt start/end width
    1607           0 :             sal_Int32 nValAct = GetCoreValue( aMtrStartWidth, ePoolUnit );
    1608           0 :             sal_Int32 nValNew = nValAct + (((nNewLineWidth - nActLineWidth) * 15) / 10);
    1609           0 :             if(nValNew < 0)
    1610           0 :                 nValNew = 0;
    1611           0 :             SetMetricValue( aMtrStartWidth, nValNew, ePoolUnit );
    1612             : 
    1613           0 :             nValAct = GetCoreValue( aMtrEndWidth, ePoolUnit );
    1614           0 :             nValNew = nValAct + (((nNewLineWidth - nActLineWidth) * 15) / 10);
    1615           0 :             if(nValNew < 0)
    1616           0 :                 nValNew = 0;
    1617           0 :             SetMetricValue( aMtrEndWidth, nValNew, ePoolUnit );
    1618             :         }
    1619             : 
    1620             :         // Remember current value
    1621           0 :         nActLineWidth = nNewLineWidth;
    1622             :     }
    1623             : 
    1624           0 :     FillXLSet_Impl();
    1625           0 :     aCtlPreview.Invalidate();
    1626             : 
    1627             :     // Make transparency accessible accordingly
    1628           0 :     if( aLbLineStyle.GetSelectEntryPos() == 0 ) // invisible
    1629             :     {
    1630           0 :         aFtTransparent.Disable();
    1631           0 :         aMtrTransparent.Disable();
    1632             :     }
    1633             :     else
    1634             :     {
    1635           0 :         aFtTransparent.Enable();
    1636           0 :         aMtrTransparent.Enable();
    1637             :     }
    1638             : 
    1639           0 :     const bool bHasLineStart = aLbStartStyle.GetSelectEntryPos() != 0;
    1640           0 :     const bool bHasLineEnd = aLbEndStyle.GetSelectEntryPos() != 0;
    1641             : 
    1642           0 :     aFtLineEndsWidth.Enable( bHasLineStart || bHasLineEnd );
    1643           0 :     aMtrStartWidth.Enable( bHasLineStart );
    1644           0 :     aTsbCenterStart.Enable( bHasLineStart );
    1645           0 :     aMtrEndWidth.Enable( bHasLineEnd );
    1646           0 :     aTsbCenterEnd.Enable( bHasLineEnd );
    1647             : 
    1648           0 :     return( 0L );
    1649             : }
    1650             : 
    1651             : //------------------------------------------------------------------------
    1652             : 
    1653           0 : IMPL_LINK( SvxLineTabPage, ChangeStartHdl_Impl, void *, p )
    1654             : {
    1655           0 :     if( aCbxSynchronize.IsChecked() )
    1656             :     {
    1657           0 :         if( p == &aMtrStartWidth )
    1658           0 :             aMtrEndWidth.SetValue( aMtrStartWidth.GetValue() );
    1659           0 :         if( p == &aLbStartStyle )
    1660           0 :             aLbEndStyle.SelectEntryPos( aLbStartStyle.GetSelectEntryPos() );
    1661           0 :         if( p == &aTsbCenterStart )
    1662           0 :             aTsbCenterEnd.SetState( aTsbCenterStart.GetState() );
    1663             :     }
    1664             : 
    1665           0 :     ChangePreviewHdl_Impl( this );
    1666             : 
    1667           0 :     return( 0L );
    1668             : }
    1669             : 
    1670             : //------------------------------------------------------------------------
    1671             : // #116827#
    1672             : 
    1673           0 : IMPL_LINK_NOARG(SvxLineTabPage, ChangeEdgeStyleHdl_Impl)
    1674             : {
    1675           0 :     ChangePreviewHdl_Impl( this );
    1676             : 
    1677           0 :     return( 0L );
    1678             : }
    1679             : 
    1680             : //------------------------------------------------------------------------
    1681             : // fdo#43209
    1682             : 
    1683           0 : IMPL_LINK( SvxLineTabPage, ChangeCapStyleHdl_Impl, void *, EMPTYARG )
    1684             : {
    1685           0 :     ChangePreviewHdl_Impl( this );
    1686             : 
    1687           0 :     return( 0L );
    1688             : }
    1689             : //------------------------------------------------------------------------
    1690             : 
    1691           0 : IMPL_LINK_NOARG(SvxLineTabPage, ClickInvisibleHdl_Impl)
    1692             : {
    1693           0 :     if( aLbLineStyle.GetSelectEntryPos() == 0 ) // invisible
    1694             :     {
    1695           0 :         aFtColor.Disable();
    1696           0 :         if(!bSymbols)
    1697           0 :             aLbColor.Disable();
    1698           0 :         aFtLineWidth.Disable();
    1699           0 :         aMtrLineWidth.Disable();
    1700             : 
    1701           0 :         if( aFlLineEnds.IsEnabled() )
    1702             :         {
    1703           0 :             aFtLineEndsStyle.Disable();
    1704           0 :             aFtLineEndsWidth.Disable();
    1705           0 :             aLbStartStyle.Disable();
    1706           0 :             aMtrStartWidth.Disable();
    1707           0 :             aTsbCenterStart.Disable();
    1708           0 :             aLbEndStyle.Disable();
    1709           0 :             aMtrEndWidth.Disable();
    1710           0 :             aTsbCenterEnd.Disable();
    1711           0 :             aCbxSynchronize.Disable();
    1712             : 
    1713             :             // #116827#
    1714           0 :             maFTEdgeStyle.Disable();
    1715           0 :             maLBEdgeStyle.Disable();
    1716             : 
    1717             :             // LineCaps
    1718           0 :             maFTCapStyle.Disable();
    1719           0 :             maLBCapStyle.Disable();
    1720             :         }
    1721             :     }
    1722             :     else
    1723             :     {
    1724           0 :         aFtColor.Enable();
    1725           0 :         aLbColor.Enable();
    1726           0 :         aFtLineWidth.Enable();
    1727           0 :         aMtrLineWidth.Enable();
    1728             : 
    1729           0 :         if( aFlLineEnds.IsEnabled() )
    1730             :         {
    1731           0 :             aFtLineEndsStyle.Enable();
    1732           0 :             aFtLineEndsWidth.Enable();
    1733           0 :             aLbStartStyle.Enable();
    1734           0 :             aMtrStartWidth.Enable();
    1735           0 :             aTsbCenterStart.Enable();
    1736           0 :             aLbEndStyle.Enable();
    1737           0 :             aMtrEndWidth.Enable();
    1738           0 :             aTsbCenterEnd.Enable();
    1739           0 :             aCbxSynchronize.Enable();
    1740             : 
    1741             :             // #116827#
    1742           0 :             maFTEdgeStyle.Enable();
    1743           0 :             maLBEdgeStyle.Enable();
    1744             : 
    1745             :             // LineCaps
    1746           0 :             maFTCapStyle.Enable();
    1747           0 :             maLBCapStyle.Enable();
    1748             :         }
    1749             :     }
    1750           0 :     ChangePreviewHdl_Impl( NULL );
    1751             : 
    1752           0 :     return( 0L );
    1753             : }
    1754             : 
    1755             : //------------------------------------------------------------------------
    1756             : 
    1757           0 : IMPL_LINK( SvxLineTabPage, ChangeEndHdl_Impl, void *, p )
    1758             : {
    1759           0 :     if( aCbxSynchronize.IsChecked() )
    1760             :     {
    1761           0 :         if( p == &aMtrEndWidth )
    1762           0 :             aMtrStartWidth.SetValue( aMtrEndWidth.GetValue() );
    1763           0 :         if( p == &aLbEndStyle )
    1764           0 :             aLbStartStyle.SelectEntryPos( aLbEndStyle.GetSelectEntryPos() );
    1765           0 :         if( p == &aTsbCenterEnd )
    1766           0 :             aTsbCenterStart.SetState( aTsbCenterEnd.GetState() );
    1767             :     }
    1768             : 
    1769           0 :     ChangePreviewHdl_Impl( this );
    1770             : 
    1771           0 :     return( 0L );
    1772             : }
    1773             : 
    1774             : //------------------------------------------------------------------------
    1775             : 
    1776           0 : IMPL_LINK_NOARG(SvxLineTabPage, ChangeTransparentHdl_Impl)
    1777             : {
    1778           0 :     sal_uInt16 nVal = (sal_uInt16)aMtrTransparent.GetValue();
    1779           0 :     XLineTransparenceItem aItem( nVal );
    1780             : 
    1781           0 :     rXLSet.Put( XLineTransparenceItem( aItem ) );
    1782             : 
    1783             :     // #116827#
    1784           0 :     FillXLSet_Impl();
    1785             : 
    1786           0 :     aCtlPreview.Invalidate();
    1787             : 
    1788           0 :     return( 0L );
    1789             : }
    1790             : 
    1791             : //------------------------------------------------------------------------
    1792             : 
    1793           0 : void SvxLineTabPage::PointChanged( Window*, RECT_POINT eRcPt )
    1794             : {
    1795           0 :     eRP = eRcPt;
    1796           0 : }
    1797             : 
    1798             : //------------------------------------------------------------------------
    1799             : 
    1800           0 : void SvxLineTabPage::FillUserData()
    1801             : {
    1802             :     // Write the synched value to the INI file
    1803           0 :     OUString aStrUserData = OUString::valueOf( (sal_Int32) aCbxSynchronize.IsChecked() );
    1804           0 :     SetUserData( aStrUserData );
    1805           0 : }
    1806             : 
    1807             : 
    1808             : // #58425# Symbols on a list (e.g. StarChart)
    1809             : // Handler for the symbol selection's popup menu (NumMenueButton)
    1810             : // The following link originates from SvxNumOptionsTabPage
    1811           0 : IMPL_LINK( SvxLineTabPage, MenuCreateHdl_Impl, MenuButton *, pButton )
    1812             : {
    1813           0 :     InitSymbols(pButton);
    1814           0 :     return 0;
    1815             : }
    1816             : // #58425# Symbols on a list (e.g. StarChart)
    1817             : // Handler for the symbol selection's popup menu (NumMenueButton)
    1818             : // The following link originates from SvxNumOptionsTabPage
    1819           0 : IMPL_STATIC_LINK(SvxLineTabPage, GraphicArrivedHdl_Impl, SvxBrushItem*, pItem)
    1820             : {
    1821           0 :     PopupMenu* pPopup = pThis->aSymbolMB.GetPopupMenu()->GetPopupMenu( MN_GALLERY );
    1822             : 
    1823           0 :     SvxBmpItemInfo* pBmpInfo = 0;
    1824           0 :     for ( size_t i = 0; i < pThis->aGrfBrushItems.size(); i++ )
    1825             :     {
    1826           0 :         SvxBmpItemInfo* pInfo = pThis->aGrfBrushItems[ i ];
    1827           0 :         if( pInfo->pBrushItem == pItem )
    1828             :         {
    1829           0 :             pBmpInfo = pInfo; break;
    1830             :         }
    1831             :     }
    1832           0 :     if( pBmpInfo )
    1833             :     {
    1834           0 :         if( pItem->GetGraphic() )
    1835             :         {
    1836           0 :             Bitmap aBitmap(pItem->GetGraphic()->GetBitmap());
    1837           0 :             Size aSize(aBitmap.GetSizePixel());
    1838           0 :             if(aSize.Width()  > MAX_BMP_WIDTH ||
    1839           0 :                aSize.Height() > MAX_BMP_HEIGHT)
    1840             :             {
    1841           0 :                 sal_Bool bWidth = aSize.Width() > aSize.Height();
    1842             :                 double nScale = bWidth ?
    1843           0 :                     (double)MAX_BMP_WIDTH / (double)aSize.Width():
    1844           0 :                     (double)MAX_BMP_HEIGHT / (double)aSize.Height();
    1845           0 :                 aBitmap.Scale(nScale, nScale);
    1846             :             }
    1847           0 :             Image aImage(aBitmap);
    1848           0 :             pPopup->SetItemImage( pBmpInfo->nItemId, aImage );
    1849             :         }
    1850             :     }
    1851             : 
    1852           0 :     return 0;
    1853             : }
    1854             : 
    1855             : // #58425# Symbols on a list (e.g. StarChart)
    1856             : // Handler for menu button
    1857           0 : IMPL_LINK( SvxLineTabPage, GraphicHdl_Impl, MenuButton *, pButton )
    1858             : {
    1859           0 :     SymbolSelected(pButton);
    1860           0 :     return 0;
    1861             : }
    1862           0 : IMPL_LINK( SvxLineTabPage, SizeHdl_Impl, MetricField *, pField)
    1863             : {
    1864           0 :     bNewSize=true;
    1865           0 :     sal_Bool bWidth = (sal_Bool)(pField == &aSymbolWidthMF);
    1866           0 :     bLastWidthModified = bWidth;
    1867           0 :     sal_Bool bRatio = aSymbolRatioCB.IsChecked();
    1868           0 :     long nWidthVal = static_cast<long>(aSymbolWidthMF.Denormalize(aSymbolWidthMF.GetValue(FUNIT_100TH_MM)));
    1869           0 :     long nHeightVal= static_cast<long>(aSymbolHeightMF.Denormalize(aSymbolHeightMF.GetValue(FUNIT_100TH_MM)));
    1870           0 :     nWidthVal = OutputDevice::LogicToLogic(nWidthVal,MAP_100TH_MM,(MapUnit)ePoolUnit );
    1871           0 :     nHeightVal = OutputDevice::LogicToLogic(nHeightVal,MAP_100TH_MM,(MapUnit)ePoolUnit);
    1872           0 :     aSymbolSize=Size(nWidthVal,nHeightVal);
    1873           0 :     double  fSizeRatio = (double)1;
    1874             : 
    1875           0 :     if(bRatio)
    1876             :     {
    1877           0 :         if (aSymbolLastSize.Height() && aSymbolLastSize.Width())
    1878           0 :             fSizeRatio = (double)aSymbolLastSize.Width() / aSymbolLastSize.Height();
    1879             :     }
    1880             : 
    1881             :     //Size aSymbolSize(aSymbolLastSize);
    1882             : 
    1883           0 :     if(bWidth)
    1884             :     {
    1885           0 :         long nDelta = nWidthVal - aSymbolLastSize.Width();
    1886           0 :         aSymbolSize.Width() = nWidthVal;
    1887           0 :         if (bRatio)
    1888             :         {
    1889           0 :             aSymbolSize.Height() = aSymbolLastSize.Height() + (long)((double)nDelta / fSizeRatio);
    1890           0 :             aSymbolSize.Height() = OutputDevice::LogicToLogic( aSymbolSize.Height(),(MapUnit)ePoolUnit, MAP_100TH_MM );
    1891           0 :             aSymbolHeightMF.SetUserValue(aSymbolHeightMF.Normalize(aSymbolSize.Height()), FUNIT_100TH_MM);
    1892             :         }
    1893             :     }
    1894             :     else
    1895             :     {
    1896           0 :         long nDelta = nHeightVal - aSymbolLastSize.Height();
    1897           0 :         aSymbolSize.Height() = nHeightVal;
    1898           0 :         if (bRatio)
    1899             :         {
    1900           0 :             aSymbolSize.Width() = aSymbolLastSize.Width() + (long)((double)nDelta * fSizeRatio);
    1901           0 :             aSymbolSize.Width() = OutputDevice::LogicToLogic( aSymbolSize.Width(),
    1902           0 :                                 (MapUnit)ePoolUnit, MAP_100TH_MM );
    1903           0 :             aSymbolWidthMF.SetUserValue(aSymbolWidthMF.Normalize(aSymbolSize.Width()), FUNIT_100TH_MM);
    1904             :         }
    1905             :     }
    1906           0 :     aCtlPreview.ResizeSymbol(aSymbolSize);
    1907           0 :     aSymbolLastSize=aSymbolSize;
    1908           0 :     return 0;
    1909             : }
    1910           0 : IMPL_LINK( SvxLineTabPage, RatioHdl_Impl, CheckBox *, pBox )
    1911             : {
    1912           0 :     if (pBox->IsChecked())
    1913             :     {
    1914           0 :         if (bLastWidthModified)
    1915           0 :             SizeHdl_Impl(&aSymbolWidthMF);
    1916             :         else
    1917           0 :             SizeHdl_Impl(&aSymbolHeightMF);
    1918             :     }
    1919           0 :     return 0;
    1920             : }
    1921             : 
    1922             : 
    1923           0 : void SvxLineTabPage::DataChanged( const DataChangedEvent& rDCEvt )
    1924             : {
    1925           0 :     SvxTabPage::DataChanged( rDCEvt );
    1926             : 
    1927           0 :     if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
    1928             :     {
    1929           0 :         FillListboxes();
    1930             :     }
    1931           0 : }
    1932             : 
    1933           0 : void SvxLineTabPage::PageCreated (SfxAllItemSet aSet)
    1934             : {
    1935           0 :     SFX_ITEMSET_ARG (&aSet,pColorListItem,SvxColorListItem,SID_COLOR_TABLE,sal_False);
    1936           0 :     SFX_ITEMSET_ARG (&aSet,pDashListItem,SvxDashListItem,SID_DASH_LIST,sal_False);
    1937           0 :     SFX_ITEMSET_ARG (&aSet,pLineEndListItem,SvxLineEndListItem,SID_LINEEND_LIST,sal_False);
    1938           0 :     SFX_ITEMSET_ARG (&aSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False);
    1939           0 :     SFX_ITEMSET_ARG (&aSet,pDlgTypeItem,SfxUInt16Item,SID_DLG_TYPE,sal_False);
    1940           0 :     SFX_ITEMSET_ARG (&aSet,pSdrObjListItem,OfaPtrItem,SID_OBJECT_LIST,sal_False);
    1941           0 :     SFX_ITEMSET_ARG (&aSet,pSymbolAttrItem,SfxTabDialogItem,SID_ATTR_SET,sal_False);
    1942           0 :     SFX_ITEMSET_ARG (&aSet,pGraphicItem,SvxGraphicItem,SID_GRAPHIC,sal_False);
    1943             : 
    1944           0 :     if (pColorListItem)
    1945           0 :         SetColorList(pColorListItem->GetColorList());
    1946           0 :     if (pDashListItem)
    1947           0 :         SetDashList(pDashListItem->GetDashList());
    1948           0 :     if (pLineEndListItem)
    1949           0 :         SetLineEndList(pLineEndListItem->GetLineEndList());
    1950           0 :     if (pPageTypeItem)
    1951           0 :         SetPageType(pPageTypeItem->GetValue());
    1952           0 :     if (pDlgTypeItem)
    1953           0 :         SetDlgType(pDlgTypeItem->GetValue());
    1954           0 :     Construct();
    1955             : 
    1956           0 :     if(pSdrObjListItem) //symbols
    1957             :     {
    1958           0 :         ShowSymbolControls(sal_True);
    1959           0 :         pSymbolList = static_cast<SdrObjList*>(pSdrObjListItem->GetValue());
    1960           0 :         if (pSymbolAttrItem)
    1961           0 :             pSymbolAttr = new SfxItemSet(pSymbolAttrItem->GetItemSet());
    1962           0 :         if(pGraphicItem)
    1963           0 :             aAutoSymbolGraphic = pGraphicItem->GetGraphic();
    1964             :     }
    1965           6 : }
    1966             : 
    1967             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10