LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/cui/source/tabpages - tpline.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 1047 0.0 %
Date: 2013-07-09 Functions: 0 44 0.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10