LCOV - code coverage report
Current view: top level - sd/source/core - drawdoc4.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 596 696 85.6 %
Date: 2014-11-03 Functions: 27 30 90.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 <sal/config.h>
      21             : 
      22             : #include <com/sun/star/style/XStyle.hpp>
      23             : #include <com/sun/star/container/XNameAccess.hpp>
      24             : #include <i18nlangtag/mslangid.hxx>
      25             : #include <sfx2/docfile.hxx>
      26             : #include <sfx2/dispatch.hxx>
      27             : #include "Outliner.hxx"
      28             : #include <comphelper/processfactory.hxx>
      29             : #include <editeng/outliner.hxx>
      30             : 
      31             : #include "../ui/inc/DrawDocShell.hxx"
      32             : #include <editeng/eeitem.hxx>
      33             : 
      34             : #include <vcl/settings.hxx>
      35             : #include <vcl/svapp.hxx>
      36             : 
      37             : #include <editeng/autokernitem.hxx>
      38             : 
      39             : #include <svx/svxids.hrc>
      40             : #include <svl/srchitem.hxx>
      41             : #include <editeng/lrspitem.hxx>
      42             : #include <editeng/ulspitem.hxx>
      43             : #include <editeng/lspcitem.hxx>
      44             : #include <editeng/adjustitem.hxx>
      45             : #include <editeng/numdef.hxx>
      46             : #include <svx/dialogs.hrc>
      47             : #include <svx/dialmgr.hxx>
      48             : #include <editeng/bulletitem.hxx>
      49             : #include <svx/xtable.hxx>
      50             : #include <svx/sxmsuitm.hxx>
      51             : #include <editeng/borderline.hxx>
      52             : #include <editeng/boxitem.hxx>
      53             : #include <svx/xit.hxx>
      54             : #include <svx/xlineit0.hxx>
      55             : #include <svx/sdshitm.hxx>
      56             : #include <svx/svdotext.hxx>
      57             : #include <svx/xfillit0.hxx>
      58             : #include <svx/sdshcitm.hxx>
      59             : #include <editeng/editstat.hxx>
      60             : #include <editeng/colritem.hxx>
      61             : #include <editeng/fhgtitem.hxx>
      62             : #include <editeng/wghtitem.hxx>
      63             : #include <editeng/postitem.hxx>
      64             : #include <editeng/crossedoutitem.hxx>
      65             : #include <editeng/udlnitem.hxx>
      66             : #include <editeng/contouritem.hxx>
      67             : #include <editeng/emphasismarkitem.hxx>
      68             : #include <editeng/fontitem.hxx>
      69             : #include <editeng/shdditem.hxx>
      70             : #include <editeng/cmapitem.hxx>
      71             : #include <svx/xbtmpit.hxx>
      72             : #include <svx/xflhtit.hxx>
      73             : #include <svx/xflgrit.hxx>
      74             : #include <svx/xflclit.hxx>
      75             : #include <svx/xlnedcit.hxx>
      76             : #include <svx/xlnstcit.hxx>
      77             : #include <svx/xlnedwit.hxx>
      78             : #include <svx/xlnstwit.hxx>
      79             : #include <svx/xlnedit.hxx>
      80             : #include <editeng/charreliefitem.hxx>
      81             : #include <svx/xlnstit.hxx>
      82             : #include <svx/xlndsit.hxx>
      83             : #include <svx/xlnwtit.hxx>
      84             : #include <svx/xlnclit.hxx>
      85             : #include <svx/svditer.hxx>
      86             : #include <svx/svdogrp.hxx>
      87             : #include <tools/shl.hxx>
      88             : #include <editeng/numitem.hxx>
      89             : #include <editeng/editeng.hxx>
      90             : #include <editeng/unolingu.hxx>
      91             : #include <com/sun/star/linguistic2/XHyphenator.hpp>
      92             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      93             : #include <svl/itempool.hxx>
      94             : #include <editeng/outlobj.hxx>
      95             : #include <sfx2/viewfrm.hxx>
      96             : #include <editeng/langitem.hxx>
      97             : #include <editeng/frmdiritem.hxx>
      98             : 
      99             : #include "sdresid.hxx"
     100             : #include "drawdoc.hxx"
     101             : #include "sdpage.hxx"
     102             : #include "glob.hrc"
     103             : #include "glob.hxx"
     104             : #include "stlpool.hxx"
     105             : #include "helpids.h"
     106             : #include "sdiocmpt.hxx"
     107             : #include "shapelist.hxx"
     108             : #include <basegfx/point/b2dpoint.hxx>
     109             : #include <basegfx/polygon/b2dpolygon.hxx>
     110             : #include <svl/itemset.hxx>
     111             : #include "app.hrc"
     112             : 
     113             : using namespace ::com::sun::star;
     114             : using namespace ::com::sun::star::uno;
     115             : using namespace ::com::sun::star::lang;
     116             : using namespace ::com::sun::star::style;
     117             : using namespace ::com::sun::star::container;
     118             : using namespace ::com::sun::star::linguistic2;
     119             : using namespace ::sd;
     120             : 
     121             : // CreateLayoutTemplates
     122             : // At the moment (31.03.1995), the StyleSheetPool only saves styleheets that
     123             : // have an ItemSet. To save all stylesheets, we force the creation of an ItemSet
     124             : // with a GetItemSet call.
     125             : // We can remove this behavior once the pool saves styleheets even without an ItemSet
     126         364 : void SdDrawDocument::CreateLayoutTemplates()
     127             : {
     128         364 :     SdStyleSheetPool*       pSSPool = (SdStyleSheetPool*)GetStyleSheetPool();
     129         364 :     SfxStyleSheetBase*      pSheet = NULL;
     130         364 :     OUString                aHelpFile;
     131         728 :     OUString                aStdName(SD_RESSTR(STR_STANDARD_STYLESHEET_NAME));
     132             : 
     133             :     // Default style
     134             : 
     135         364 :     sal_uInt16 nMask = SFXSTYLEBIT_AUTO;
     136             : 
     137         728 :     OUString aName(aStdName);
     138         364 :     pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
     139         364 :     pSheet->SetHelpId( aHelpFile, HID_STANDARD_STYLESHEET_NAME );
     140         364 :     SfxItemSet& rISet = pSheet->GetItemSet();
     141         364 :     SfxItemPool* pPool = rISet.GetPool();
     142             : 
     143         728 :     ::basegfx::B2DPolyPolygon aNullPolyPolygon;
     144         364 :     Color    aNullCol(RGB_Color(COL_DEFAULT_SHAPE_STROKE));
     145             : 
     146         364 :     XDash     aNullDash;
     147         364 :     XGradient aNullGrad(aNullCol,RGB_Color(COL_WHITE));
     148         364 :               aNullGrad.SetStartIntens( 100 );
     149         364 :               aNullGrad.SetEndIntens( 100 );
     150         364 :     XHatch    aNullHatch(aNullCol);
     151             : 
     152             :                     // Line attributes (Extended OutputDevice)
     153         364 :     rISet.Put(XLineStyleItem(XLINE_SOLID));
     154         364 :     rISet.Put(XLineColorItem(OUString(), RGB_Color(COL_DEFAULT_SHAPE_STROKE)));
     155         364 :     rISet.Put(XLineWidthItem(0));
     156         364 :     rISet.Put(XLineDashItem(pPool,aNullDash));
     157         364 :     rISet.Put(XLineStartItem(pPool,aNullPolyPolygon));
     158         364 :     rISet.Put(XLineEndItem(pPool,aNullPolyPolygon));
     159         364 :     rISet.Put(XLineStartWidthItem(200));
     160         364 :     rISet.Put(XLineEndWidthItem(200));
     161         364 :     rISet.Put(XLineStartCenterItem());
     162         364 :     rISet.Put(XLineEndCenterItem());
     163         364 :     rISet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_BLOCK));
     164             : 
     165             :                     // Fill attributes (Extended OutputDevice)
     166         364 :     rISet.Put(XFillStyleItem(drawing::FillStyle_SOLID));
     167         364 :     rISet.Put(XFillColorItem(OUString(), RGB_Color(COL_DEFAULT_SHAPE_FILLING)));
     168             : 
     169         364 :     rISet.Put( XFillGradientItem( aNullGrad) );
     170         364 :     rISet.Put(XFillHatchItem(pPool,aNullHatch));
     171         364 :     Size    aNullSize( 32, 32 );
     172         364 :     Color   aNullColor( COL_WHITE );
     173         728 :     Bitmap  aNullBmp( aNullSize, 8 );
     174         364 :     aNullBmp.Erase( aNullColor );
     175         364 :     rISet.Put(XFillBitmapItem(pPool, Graphic(aNullBmp)));
     176             : 
     177             :                     // Shadow attributes (Drawing Engine)
     178         364 :     rISet.Put(makeSdrShadowItem(false));
     179         364 :     rISet.Put(makeSdrShadowColorItem(RGB_Color(COL_GRAY)));
     180         364 :     rISet.Put(makeSdrShadowXDistItem(200));         // 3 mm Shadow distance
     181         364 :     rISet.Put(makeSdrShadowYDistItem(200));
     182             : 
     183         728 :     vcl::Font aLatinFont, aCJKFont, aCTLFont;
     184             : 
     185         364 :     getDefaultFonts( aLatinFont, aCJKFont, aCTLFont );
     186             : 
     187         364 :     SvxFontItem aSvxFontItem( aLatinFont.GetFamily(), aLatinFont.GetName(), aLatinFont.GetStyleName(), aLatinFont.GetPitch(),
     188        1092 :                               aLatinFont.GetCharSet(), EE_CHAR_FONTINFO );
     189             : 
     190         364 :     SvxFontItem aSvxFontItemCJK( aCJKFont.GetFamily(), aCJKFont.GetName(), aCJKFont.GetStyleName(), aCJKFont.GetPitch(),
     191        1092 :                                  aCJKFont.GetCharSet(), EE_CHAR_FONTINFO_CJK );
     192             : 
     193         364 :     SvxFontItem aSvxFontItemCTL( aCTLFont.GetFamily(), aCTLFont.GetName(), aCTLFont.GetStyleName(), aCTLFont.GetPitch(),
     194        1092 :                                  aCTLFont.GetCharSet(), EE_CHAR_FONTINFO_CTL );
     195             : 
     196         364 :     rISet.Put( aSvxFontItem );
     197         364 :     rISet.Put( aSvxFontItemCJK );
     198         364 :     rISet.Put( aSvxFontItemCTL );
     199             : 
     200         364 :     rISet.Put( SvxFontHeightItem( 635, 100, EE_CHAR_FONTHEIGHT ) );     // sj: (i33745) changed default from 24 to 18 pt
     201         364 :     rISet.Put( SvxFontHeightItem( 635, 100, EE_CHAR_FONTHEIGHT_CJK ) ); // 18 pt
     202         364 :     rISet.Put( SvxFontHeightItem( convertFontHeightToCTL( 635 ), 100, EE_CHAR_FONTHEIGHT_CTL ) ); // 18 pt
     203             : 
     204         364 :     rISet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
     205         364 :     rISet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ) );
     206         364 :     rISet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ) );
     207             : 
     208         364 :     rISet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ) );
     209         364 :     rISet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ) );
     210         364 :     rISet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ) );
     211             : 
     212         364 :     rISet.Put(SvxContourItem(false, EE_CHAR_OUTLINE ));
     213         364 :     rISet.Put(SvxShadowedItem(false, EE_CHAR_SHADOW ));
     214         364 :     rISet.Put(SvxUnderlineItem(UNDERLINE_NONE, EE_CHAR_UNDERLINE));
     215         364 :     rISet.Put(SvxOverlineItem(UNDERLINE_NONE, EE_CHAR_OVERLINE));
     216         364 :     rISet.Put(SvxCrossedOutItem(STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ));
     217         364 :     rISet.Put(SvxCaseMapItem(SVX_CASEMAP_NOT_MAPPED, EE_CHAR_CASEMAP ));
     218         364 :     rISet.Put(SvxEmphasisMarkItem(EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK));
     219         364 :     rISet.Put(SvxCharReliefItem(RELIEF_NONE, EE_CHAR_RELIEF));
     220         364 :     rISet.Put(SvxColorItem(Color(COL_AUTO), EE_CHAR_COLOR ));
     221             : 
     222             :     // Paragraph attributes (Edit Engine)
     223         364 :     rISet.Put(SvxLRSpaceItem(EE_PARA_LRSPACE));
     224         364 :     rISet.Put(SvxULSpaceItem(EE_PARA_ULSPACE));
     225             : 
     226         364 :     rISet.Put( makeSdrTextLeftDistItem( 250 ) );    // sj: (i33745) using text frame distances seems to be a better default
     227         364 :     rISet.Put( makeSdrTextRightDistItem( 250 ) );
     228         364 :     rISet.Put( makeSdrTextUpperDistItem( 125 ) );
     229         364 :     rISet.Put( makeSdrTextLowerDistItem( 125 ) );
     230             : 
     231         364 :     rISet.Put( SvxLineSpacingItem( LINE_SPACE_DEFAULT_HEIGHT, EE_PARA_SBL ) );
     232             : 
     233             :     // #i16874# enable kerning by default but only for new documents
     234         364 :     rISet.Put( SvxAutoKernItem( true, EE_CHAR_PAIRKERNING ) );
     235             : 
     236             :     // Bullet
     237             :     // BulletItem and BulletFont for title and outline
     238         728 :     SvxBulletItem aBulletItem(EE_PARA_BULLET);
     239             :                             // Identical in all layers
     240         364 :     aBulletItem.SetStyle(BS_BULLET);
     241         364 :     aBulletItem.SetStart(1);
     242         364 :     aBulletItem.SetScale(45);           // In percent
     243             : 
     244         728 :     vcl::Font aBulletFont( SdStyleSheetPool::GetBulletFont() );
     245             : 
     246         364 :     aBulletFont.SetSize(Size(0,635));   // sj: (i33745) changed default from 24 to 18 pt
     247             : 
     248         364 :     aBulletItem.SetFont(aBulletFont);
     249         364 :     aBulletItem.SetSymbol( 0x25CF );                    // In points
     250         364 :     rISet.Put(aBulletItem);
     251             : 
     252             :     // New BulletItem
     253         364 :     SdStyleSheetPool::PutNumBulletItem( pSheet, aBulletFont );
     254             : 
     255         364 :     SfxItemSet* pISet = NULL;
     256             : 
     257             :     // Object with arrowhead
     258         364 :     aName = SD_RESSTR(STR_POOLSHEET_OBJWITHARROW);
     259         364 :     pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
     260         364 :     pSheet->SetParent(aStdName);
     261         364 :     pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_OBJWITHARROW );
     262         364 :     pISet = &pSheet->GetItemSet();
     263             : 
     264         364 :     pISet->Put(XLineStyleItem(XLINE_SOLID));
     265         364 :     pISet->Put(XLineColorItem(OUString(), RGB_Color(COL_BLACK)));
     266         364 :     pISet->Put(XLineWidthItem(150));
     267             : 
     268         728 :     ::basegfx::B2DPolygon aArrow;
     269         364 :     aArrow.append(::basegfx::B2DPoint(10.0, 0.0));
     270         364 :     aArrow.append(::basegfx::B2DPoint(0.0, 30.0));
     271         364 :     aArrow.append(::basegfx::B2DPoint(20.0, 30.0));
     272         364 :     aArrow.setClosed(true);
     273         364 :     pISet->Put(XLineStartItem(SVX_RESSTR(RID_SVXSTR_ARROW),::basegfx::B2DPolyPolygon(aArrow)));
     274             : 
     275         364 :     pISet->Put(XLineStartWidthItem(700));
     276         364 :     pISet->Put(XLineEndWidthItem(300));
     277         364 :     pISet->Put(XLineStartCenterItem(true));
     278             : 
     279             :     // Object with Shadow
     280         364 :     aName = SD_RESSTR(STR_POOLSHEET_OBJWITHSHADOW);
     281         364 :     pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
     282         364 :     pSheet->SetParent(aStdName);
     283         364 :     pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_OBJWITHSHADOW );
     284         364 :     pISet = &pSheet->GetItemSet();
     285             : 
     286         364 :     pISet->Put(makeSdrShadowItem(true));
     287         364 :     pISet->Put(makeSdrShadowColorItem(RGB_Color(COL_GRAY)));
     288         364 :     pISet->Put(makeSdrShadowXDistItem(200));        // 3 mm shadow distance
     289         364 :     pISet->Put(makeSdrShadowYDistItem(200));
     290             : 
     291             :     // Object without fillung
     292         364 :     aName = SD_RESSTR(STR_POOLSHEET_OBJWITHOUTFILL);
     293         364 :     pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
     294         364 :     pSheet->SetParent(aStdName);
     295         364 :     pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_OBJWITHOUTFILL );
     296         364 :     pISet = &pSheet->GetItemSet();
     297             : 
     298         364 :     pISet->Put(XFillStyleItem(drawing::FillStyle_NONE));
     299         364 :     pISet->Put(XLineColorItem(OUString(), RGB_Color(COL_BLACK)));
     300             : 
     301             :     // Object no fill no line
     302             : 
     303         364 :     aName = SD_RESSTR(STR_POOLSHEET_OBJNOLINENOFILL);
     304         364 :     pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
     305         364 :     pSheet->SetParent(aStdName);
     306         364 :     pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_OBJNOLINENOFILL );
     307         364 :     pISet = &pSheet->GetItemSet();
     308             : 
     309         364 :     pISet->Put(XFillStyleItem(drawing::FillStyle_NONE));
     310         364 :     pISet->Put(XLineStyleItem(XLINE_NONE));
     311             : 
     312             :     // Text
     313             : 
     314         364 :     aName = SD_RESSTR(STR_POOLSHEET_TEXT);
     315         364 :     pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
     316         364 :     pSheet->SetParent(aStdName);
     317         364 :     pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_TEXT );
     318         364 :     pISet = &pSheet->GetItemSet();
     319             : 
     320         364 :     pISet->Put(XLineStyleItem(XLINE_NONE));
     321         364 :     pISet->Put(XFillStyleItem(drawing::FillStyle_NONE));
     322             : 
     323             :     // Text body
     324         364 :     aName = SD_RESSTR(STR_POOLSHEET_TEXTBODY);
     325         364 :     pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
     326         364 :     pSheet->SetParent(aStdName);
     327         364 :     pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_TEXTBODY );
     328         364 :     pISet = &pSheet->GetItemSet();
     329             : 
     330         364 :     pISet->Put(XLineStyleItem(XLINE_NONE));
     331         364 :     pISet->Put(XFillStyleItem(drawing::FillStyle_NONE));
     332             : 
     333         364 :     pISet->Put(SvxFontHeightItem(564, 100, EE_CHAR_FONTHEIGHT));        // 16 pt
     334             : 
     335             :     // Text body, justified
     336         364 :     aName = SD_RESSTR(STR_POOLSHEET_TEXTBODY_JUSTIFY);
     337         364 :     pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
     338         364 :     pSheet->SetParent(aStdName);
     339         364 :     pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_TEXTBODY_JUSTIFY );
     340         364 :     pISet = &pSheet->GetItemSet();
     341             : 
     342         364 :     pISet->Put(XLineStyleItem(XLINE_NONE));
     343         364 :     pISet->Put(XFillStyleItem(drawing::FillStyle_NONE));
     344             : 
     345         364 :     pISet->Put(SvxAdjustItem(SVX_ADJUST_BLOCK, EE_PARA_JUST ));
     346             : 
     347             :     // Text body, indented
     348         364 :     aName = SD_RESSTR(STR_POOLSHEET_TEXTBODY_INDENT);
     349         364 :     pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
     350         364 :     pSheet->SetParent(aStdName);
     351         364 :     pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_TEXTBODY_INDENT );
     352         364 :     pISet = &pSheet->GetItemSet();
     353             : 
     354         364 :     pISet->Put(XLineStyleItem(XLINE_NONE));
     355         364 :     pISet->Put(XFillStyleItem(drawing::FillStyle_NONE));
     356             : 
     357         728 :     SvxLRSpaceItem aLRSpaceItem( EE_PARA_LRSPACE );
     358         364 :     aLRSpaceItem.SetTxtFirstLineOfst(600);      // Indentation of first line: 6mm; right: 0
     359         364 :     pISet->Put(aLRSpaceItem);
     360             : 
     361             :     // Title
     362             : 
     363         364 :     aName = SD_RESSTR(STR_POOLSHEET_TITLE);
     364         364 :     pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
     365         364 :     pSheet->SetParent(aStdName);
     366         364 :     pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_TITLE );
     367         364 :     pISet = &pSheet->GetItemSet();
     368             : 
     369         364 :     pISet->Put(XLineStyleItem(XLINE_NONE));
     370         364 :     pISet->Put(XFillStyleItem(drawing::FillStyle_NONE));
     371             : 
     372         364 :     pISet->Put(SvxFontHeightItem(1551, 100, EE_CHAR_FONTHEIGHT ));      // 44 pt
     373             : 
     374             :     // Title1
     375         364 :     aName = SD_RESSTR(STR_POOLSHEET_TITLE1);
     376         364 :     pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
     377         364 :     pSheet->SetParent(aStdName);
     378         364 :     pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_TITLE1 );
     379         364 :     pISet = &pSheet->GetItemSet();
     380             : 
     381         364 :     pISet->Put(XLineStyleItem(XLINE_NONE));
     382         364 :     pISet->Put(XFillStyleItem(drawing::FillStyle_SOLID));
     383         364 :     pISet->Put(XFillColorItem(OUString(), RGB_Color(COL_CYAN)));
     384             : 
     385         364 :     pISet->Put(makeSdrShadowItem(true));
     386         364 :     pISet->Put(makeSdrShadowColorItem(RGB_Color(COL_GRAY)));
     387         364 :     pISet->Put(makeSdrShadowXDistItem(200));        // 2 mm shadow distance
     388         364 :     pISet->Put(makeSdrShadowYDistItem(200));
     389             : 
     390         364 :     pISet->Put(SvxFontHeightItem(846, 100, EE_CHAR_FONTHEIGHT ));       // 24 pt
     391             : 
     392         364 :     pISet->Put(SvxAdjustItem(SVX_ADJUST_CENTER, EE_PARA_JUST ));
     393             : 
     394             :     // Title2
     395             : 
     396         364 :     aName = SD_RESSTR(STR_POOLSHEET_TITLE2);
     397         364 :     pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
     398         364 :     pSheet->SetParent(aStdName);
     399         364 :     pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_TITLE2 );
     400         364 :     pISet = &pSheet->GetItemSet();
     401             : 
     402         364 :     pISet->Put(XLineWidthItem(50));
     403             : 
     404             :     // Don't get color from the color table, because the color might have been
     405             :     // deleted or changed there
     406         364 :     Color aOrange4(255, 204, 153);
     407         364 :     pISet->Put(XFillColorItem(OUString(), aOrange4));
     408             : 
     409         364 :     pISet->Put(makeSdrShadowItem(true));
     410         364 :     pISet->Put(makeSdrShadowColorItem(RGB_Color(COL_GRAY)));
     411         364 :     pISet->Put(makeSdrShadowXDistItem(200));        // 2 mm shadow distance
     412         364 :     pISet->Put(makeSdrShadowYDistItem(200));
     413             : 
     414         364 :     pISet->Put(SvxFontHeightItem(1270, 100, EE_CHAR_FONTHEIGHT ));      // 36 pt
     415             : 
     416         728 :     SvxLRSpaceItem aLRSpItem( 200, 200, 0, 0, EE_PARA_LRSPACE);
     417         364 :     pISet->Put( aLRSpItem );    // Indentation of first line: 0 mm; left and right: 2 mm
     418             : 
     419         364 :     pISet->Put(SvxULSpaceItem(100, 100, EE_PARA_ULSPACE ));      // Paragraph margin above/below: 1 mm
     420             : 
     421         364 :     pISet->Put(SvxAdjustItem(SVX_ADJUST_CENTER, EE_PARA_JUST ));
     422             : 
     423             :     // Headline
     424             : 
     425         364 :     aName = SD_RESSTR(STR_POOLSHEET_HEADLINE);
     426         364 :     pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
     427         364 :     pSheet->SetParent(aStdName);
     428         364 :     pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_HEADLINE );
     429         364 :     pISet = &pSheet->GetItemSet();
     430             : 
     431         364 :     pISet->Put(XLineStyleItem(XLINE_NONE));
     432         364 :     pISet->Put(XFillStyleItem(drawing::FillStyle_NONE));
     433             : 
     434         364 :     pISet->Put(SvxFontHeightItem(846, 100, EE_CHAR_FONTHEIGHT ));        // 24 pt
     435             : 
     436         364 :     pISet->Put(SvxULSpaceItem(420, 210, EE_PARA_ULSPACE ));      // Paragraph margin above: 4,2 mm,
     437             :                                                 // Paragraph margin below: 2,1 mm
     438             : 
     439             :     // Headline1
     440         364 :     aName = SD_RESSTR(STR_POOLSHEET_HEADLINE1);
     441         364 :     pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
     442         364 :     pSheet->SetParent(aStdName);
     443         364 :     pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_HEADLINE1 );
     444         364 :     pISet = &pSheet->GetItemSet();
     445             : 
     446         364 :     pISet->Put(XLineStyleItem(XLINE_NONE));
     447         364 :     pISet->Put(XFillStyleItem(drawing::FillStyle_NONE));
     448             : 
     449         364 :     pISet->Put(SvxWeightItem(WEIGHT_BOLD, EE_CHAR_WEIGHT ));
     450             : 
     451         364 :     pISet->Put(SvxFontHeightItem(635, 100, EE_CHAR_FONTHEIGHT ));       // 18 pt
     452             : 
     453         364 :     pISet->Put(SvxULSpaceItem(420, 210, EE_PARA_ULSPACE ));      // Paragraph margin above: 4,2 mm,
     454             :                                                 // Paragraph margin below: 2,1 mm
     455             : 
     456             :     // Headline2
     457         364 :     aName = SD_RESSTR(STR_POOLSHEET_HEADLINE2);
     458         364 :     pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
     459         364 :     pSheet->SetParent(aStdName);
     460         364 :     pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_HEADLINE2 );
     461         364 :     pISet = &pSheet->GetItemSet();
     462             : 
     463         364 :     pISet->Put(XLineStyleItem(XLINE_NONE));
     464         364 :     pISet->Put(XFillStyleItem(drawing::FillStyle_NONE));
     465             : 
     466         364 :     pISet->Put(SvxPostureItem(ITALIC_NORMAL, EE_CHAR_ITALIC ));
     467         364 :     pISet->Put(SvxWeightItem(WEIGHT_BOLD, EE_CHAR_WEIGHT));
     468             : 
     469         364 :     pISet->Put(SvxFontHeightItem(494, 100, EE_CHAR_FONTHEIGHT ));        // 14 pt
     470             : 
     471         364 :     pISet->Put(SvxULSpaceItem(420, 210, EE_PARA_ULSPACE ));      // Paragraph margin above: 4,2 mm,
     472             :                                                 // Paragraph margin below: 2,1 mm
     473             : 
     474             :     // Measurements
     475         364 :     aName = SD_RESSTR(STR_POOLSHEET_MEASURE);
     476         364 :     pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
     477         364 :     pSheet->SetParent(aStdName);
     478         364 :     pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_MEASURE );
     479         364 :     pISet = &pSheet->GetItemSet();
     480             : 
     481         364 :     pISet->Put(XFillStyleItem(drawing::FillStyle_NONE));
     482         364 :     pISet->Put(XLineColorItem(OUString(), RGB_Color(COL_BLACK)));
     483             : 
     484         364 :     pISet->Put(SvxFontHeightItem(423, 100, EE_CHAR_FONTHEIGHT ));         // 12 pt
     485             : 
     486         364 :     pISet->Put(XLineStartItem(SVX_RESSTR(RID_SVXSTR_ARROW),::basegfx::B2DPolyPolygon(aArrow)));
     487         364 :     pISet->Put(XLineStartWidthItem(200));
     488         364 :     pISet->Put(XLineEndItem(SVX_RESSTR(RID_SVXSTR_ARROW),::basegfx::B2DPolyPolygon(aArrow)));
     489         364 :     pISet->Put(XLineEndWidthItem(200));
     490         364 :     pISet->Put(XLineStyleItem(XLINE_SOLID));
     491         364 :     pISet->Put(makeSdrMeasureShowUnitItem(true));
     492             : 
     493             :     // Generate presentation templates for default layout.
     494         728 :     OUString aPrefix = SD_RESSTR(STR_LAYOUT_DEFAULT_NAME);
     495         728 :     pSSPool->CreateLayoutStyleSheets(aPrefix);
     496         364 : }
     497             : 
     498       12012 : static Any implMakeSolidCellStyle( SdStyleSheetPool* pSSPool, const OUString& rName, const OUString& rParent, const Color& rColor )
     499             : {
     500       12012 :     SfxStyleSheetBase* pSheet = &(pSSPool->Make(rName, SD_STYLE_FAMILY_CELL, SFXSTYLEBIT_AUTO));
     501       12012 :     pSheet->SetParent(rParent);
     502       12012 :     SfxItemSet* pISet = &pSheet->GetItemSet();
     503       12012 :     pISet->Put(XFillStyleItem(drawing::FillStyle_SOLID));
     504       12012 :     pISet->Put(XFillColorItem(OUString(), rColor));
     505             : 
     506       12012 :     return Any( Reference< XStyle >( static_cast< XWeak* >( pSheet ), UNO_QUERY ) );
     507             : }
     508             : 
     509        4004 : static void implCreateTableTemplate( const Reference< XNameContainer >& xTableFamily, const OUString& rName, const Any& rBody, const Any& rHeading, const Any& rBanding )
     510             : {
     511        4004 :     if( xTableFamily.is() ) try
     512             :     {
     513        4004 :         if( !xTableFamily->hasByName( OUString( rName ) ) )
     514             :         {
     515        3960 :             Reference< XSingleServiceFactory > xFactory( xTableFamily, UNO_QUERY_THROW );
     516        7920 :             Reference< XNameReplace > xDefaultTableStyle( xFactory->createInstance(), UNO_QUERY_THROW );
     517        3960 :             xTableFamily->insertByName( OUString( rName ), Any( xDefaultTableStyle ) );
     518             : 
     519        3960 :             xDefaultTableStyle->replaceByName( "body", rBody  );
     520        3960 :             xDefaultTableStyle->replaceByName( "odd-rows" , rBanding );
     521        3960 :             xDefaultTableStyle->replaceByName( "odd-columns" , rBanding );
     522        3960 :             xDefaultTableStyle->replaceByName( "first-row" , rHeading );
     523        3960 :             xDefaultTableStyle->replaceByName( "first-column" , rHeading );
     524        3960 :             xDefaultTableStyle->replaceByName( "last-row" , rHeading );
     525        7920 :             xDefaultTableStyle->replaceByName( "last-column" , rHeading );
     526             :         }
     527             :     }
     528           0 :     catch( Exception& )
     529             :     {
     530             :         OSL_FAIL("sd::implCreateTableTemplate(), exception caught!");
     531             :     }
     532        4004 : }
     533             : 
     534         364 : void SdDrawDocument::CreateDefaultCellStyles()
     535             : {
     536         364 :     SdStyleSheetPool*       pSSPool = static_cast< SdStyleSheetPool* >(GetStyleSheetPool());
     537         364 :     SfxStyleSheetBase*      pSheet = NULL;
     538         364 :     OUString                aHelpFile;
     539             : 
     540         728 :     Reference< XNameContainer > xTableFamily( pSSPool->getByName( "table" ), UNO_QUERY );
     541             : 
     542             :     // ---- Default -----------------------------------------------
     543             : 
     544         364 :     sal_uInt16 nMask = SFXSTYLEBIT_AUTO;
     545             : 
     546         728 :     OUString aDefaultCellStyleName( "default" );
     547             : 
     548         364 :     pSheet = &(pSSPool->Make(aDefaultCellStyleName, SD_STYLE_FAMILY_CELL, nMask));
     549         364 :     pSheet->SetHelpId( aHelpFile, HID_SD_CELL_STYLE_DEFAULT );
     550         364 :     SfxItemSet& rISet = pSheet->GetItemSet();
     551             : 
     552         364 :     Color    aNullCol(RGB_Color(COL_BLACK));
     553             : 
     554         364 :     XDash     aNullDash;
     555         364 :     XGradient aNullGrad(aNullCol,RGB_Color(COL_WHITE));
     556         364 :               aNullGrad.SetStartIntens( 100 );
     557         364 :               aNullGrad.SetEndIntens( 100 );
     558         364 :     XHatch    aNullHatch(aNullCol);
     559             : 
     560         364 :     rISet.Put(XFillStyleItem(drawing::FillStyle_SOLID));
     561         364 :     rISet.Put(XFillColorItem(OUString(), RGB_Color(0x00ccccff)));
     562             : 
     563         728 :     vcl::Font aLatinFont, aCJKFont, aCTLFont;
     564             : 
     565         364 :     getDefaultFonts( aLatinFont, aCJKFont, aCTLFont );
     566             : 
     567         364 :     SvxFontItem aSvxFontItem( aLatinFont.GetFamily(), aLatinFont.GetName(), aLatinFont.GetStyleName(), aLatinFont.GetPitch(),
     568        1092 :                               aLatinFont.GetCharSet(), EE_CHAR_FONTINFO );
     569             : 
     570         364 :     SvxFontItem aSvxFontItemCJK( aCJKFont.GetFamily(), aCJKFont.GetName(), aCJKFont.GetStyleName(), aCJKFont.GetPitch(),
     571        1092 :                                  aCJKFont.GetCharSet(), EE_CHAR_FONTINFO_CJK );
     572             : 
     573         364 :     SvxFontItem aSvxFontItemCTL( aCTLFont.GetFamily(), aCTLFont.GetName(), aCTLFont.GetStyleName(), aCTLFont.GetPitch(),
     574        1092 :                                  aCTLFont.GetCharSet(), EE_CHAR_FONTINFO_CTL );
     575             : 
     576         364 :     rISet.Put( aSvxFontItem );
     577         364 :     rISet.Put( aSvxFontItemCJK );
     578         364 :     rISet.Put( aSvxFontItemCTL );
     579             : 
     580         364 :     rISet.Put( SvxFontHeightItem( 635, 100, EE_CHAR_FONTHEIGHT ) );     // sj: (i33745) changed default from 24 to 18 pt
     581         364 :     rISet.Put( SvxFontHeightItem( 635, 100, EE_CHAR_FONTHEIGHT_CJK ) ); // 18 pt
     582         364 :     rISet.Put( SvxFontHeightItem( convertFontHeightToCTL( 635 ), 100, EE_CHAR_FONTHEIGHT_CTL ) ); // 18 pt
     583             : 
     584         364 :     rISet.Put(SvxColorItem(Color(COL_AUTO), EE_CHAR_COLOR ));
     585             : 
     586             :     // Paragraph attributes (Edit Engine)
     587         364 :     rISet.Put(SvxLRSpaceItem(EE_PARA_LRSPACE));
     588         364 :     rISet.Put(SvxULSpaceItem(EE_PARA_ULSPACE));
     589             : 
     590         364 :     rISet.Put( makeSdrTextLeftDistItem( 250 ) );
     591         364 :     rISet.Put( makeSdrTextRightDistItem( 250 ) );
     592         364 :     rISet.Put( makeSdrTextUpperDistItem( 130 ) );
     593         364 :     rISet.Put( makeSdrTextLowerDistItem( 130 ) );
     594             : 
     595         364 :     rISet.Put( SvxLineSpacingItem( LINE_SPACE_DEFAULT_HEIGHT, EE_PARA_SBL ) );
     596         364 :     rISet.Put( SvxAutoKernItem( true, EE_CHAR_PAIRKERNING ) );
     597         364 :     rISet.Put( SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP) );
     598         364 :     rISet.Put( SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_LEFT) );
     599             : 
     600         364 :     Color aWhite( COL_WHITE );
     601             :     ::editeng::SvxBorderLine aBorderLine(
     602         364 :             &aWhite, 1, table::BorderLineStyle::SOLID);
     603             : 
     604         728 :     SvxBoxItem aBoxItem( SDRATTR_TABLE_BORDER );
     605         364 :     aBoxItem.SetLine( &aBorderLine, BOX_LINE_TOP );
     606         364 :     aBoxItem.SetLine( &aBorderLine, BOX_LINE_BOTTOM );
     607         364 :     aBoxItem.SetLine( &aBorderLine, BOX_LINE_LEFT );
     608         364 :     aBoxItem.SetLine( &aBorderLine, BOX_LINE_RIGHT );
     609             : 
     610         364 :     rISet.Put( aBoxItem );
     611             : 
     612             :     // ---- default --------------------------------------------------
     613             : 
     614         728 :     Any aGray1( implMakeSolidCellStyle( pSSPool, "gray1" , aDefaultCellStyleName, RGB_COLORDATA(230,230,230)));
     615         728 :     Any aGray2( implMakeSolidCellStyle( pSSPool, "gray2" , aDefaultCellStyleName, RGB_COLORDATA(204,204,204)));
     616         728 :     Any aGray3( implMakeSolidCellStyle( pSSPool, "gray3" , aDefaultCellStyleName, RGB_COLORDATA(179,179,179)));
     617             : 
     618         364 :     implCreateTableTemplate( xTableFamily, "default" , aGray1, aGray3, aGray2 );
     619             : 
     620             :     // ---- BW ------------------------------------------------
     621             : 
     622         728 :     Any aBW1( implMakeSolidCellStyle( pSSPool, "bw1" , aDefaultCellStyleName, RGB_COLORDATA(255,255,255)));
     623         728 :     Any aBW2( implMakeSolidCellStyle( pSSPool, "bw2" , aDefaultCellStyleName, RGB_COLORDATA(230,230,230)));
     624         728 :     Any aBW3( implMakeSolidCellStyle( pSSPool, "bw3" , aDefaultCellStyleName, RGB_COLORDATA(0,0,0)));
     625             : 
     626         364 :     implCreateTableTemplate( xTableFamily, "bw" , aBW1, aBW3, aBW2 );
     627             : 
     628             :     // ---- Orange --------------------------------------------------
     629             : 
     630         728 :     Any aOrange1( implMakeSolidCellStyle( pSSPool, "orange1" , aDefaultCellStyleName, RGB_COLORDATA(255,204,153)));
     631         728 :     Any aOrange2( implMakeSolidCellStyle( pSSPool, "orange2" , aDefaultCellStyleName, RGB_COLORDATA(255,153,102)));
     632         728 :     Any aOrange3( implMakeSolidCellStyle( pSSPool, "orange3" , aDefaultCellStyleName, RGB_COLORDATA(255,102,51)));
     633             : 
     634         364 :     implCreateTableTemplate( xTableFamily, "orange" , aOrange1, aOrange3, aOrange2 );
     635             : 
     636             :     // ---- Turquoise --------------------------------------------------
     637             : 
     638         728 :     Any aTurquoise1( implMakeSolidCellStyle( pSSPool, "turquoise1" , aDefaultCellStyleName, RGB_COLORDATA(71,184,184)));
     639         728 :     Any aTurquoise2( implMakeSolidCellStyle( pSSPool, "turquoise2" , aDefaultCellStyleName, RGB_COLORDATA(51,163,163)));
     640         728 :     Any aTurquoise3( implMakeSolidCellStyle( pSSPool, "turquoise3" , aDefaultCellStyleName, RGB_COLORDATA(25,138,138)));
     641             : 
     642         364 :     implCreateTableTemplate( xTableFamily, "turquoise" , aTurquoise1, aTurquoise3, aTurquoise2 );
     643             : 
     644             :     // ---- Gray ------------------------------------------------
     645             : 
     646         728 :     Any aBlue1( implMakeSolidCellStyle( pSSPool, "blue1" , aDefaultCellStyleName, RGB_COLORDATA(153,204,255)));
     647         728 :     Any aBlue2( implMakeSolidCellStyle( pSSPool, "blue2" , aDefaultCellStyleName, RGB_COLORDATA(0,153,255)));
     648         728 :     Any aBlue3( implMakeSolidCellStyle( pSSPool, "blue3" , aDefaultCellStyleName, RGB_COLORDATA(0,102,204)));
     649             : 
     650         364 :     implCreateTableTemplate( xTableFamily, "blue" , aBlue1, aBlue3, aBlue2 );
     651             : 
     652             :     // ---- Sun ------------------------------------------------
     653             : 
     654         728 :     Any aSun1( implMakeSolidCellStyle( pSSPool, "sun1" , aDefaultCellStyleName, RGB_COLORDATA(230,230,255)));
     655         728 :     Any aSun2( implMakeSolidCellStyle( pSSPool, "sun2" , aDefaultCellStyleName, RGB_COLORDATA(204,204,255)));
     656         728 :     Any aSun3( implMakeSolidCellStyle( pSSPool, "sun3" , aDefaultCellStyleName, RGB_COLORDATA(153,153,255)));
     657             : 
     658         364 :     implCreateTableTemplate( xTableFamily, "sun" , aSun1, aSun3, aSun2 );
     659             : 
     660             :     // ---- Earth ----------------------------------------------
     661             : 
     662         728 :     Any aEarth1( implMakeSolidCellStyle( pSSPool, "earth1" , aDefaultCellStyleName, RGB_COLORDATA(255,255,204)));
     663         728 :     Any aEarth2( implMakeSolidCellStyle( pSSPool, "earth2" , aDefaultCellStyleName, RGB_COLORDATA(255,204,153)));
     664         728 :     Any aEarth3( implMakeSolidCellStyle( pSSPool, "earth3" , aDefaultCellStyleName, RGB_COLORDATA(204,102,51)));
     665             : 
     666         364 :     implCreateTableTemplate( xTableFamily, "earth" , aEarth1, aEarth3, aEarth2 );
     667             : 
     668             :     // ---- Green ----------------------------------------------
     669             : 
     670         728 :     Any aGreen1( implMakeSolidCellStyle( pSSPool, "green1" , aDefaultCellStyleName, RGB_COLORDATA(255,255,204)));
     671         728 :     Any aGreen2( implMakeSolidCellStyle( pSSPool, "green2" , aDefaultCellStyleName, RGB_COLORDATA(148,189,94)));
     672         728 :     Any aGreen3( implMakeSolidCellStyle( pSSPool, "green3" , aDefaultCellStyleName, RGB_COLORDATA(92,133,38)));
     673             : 
     674         364 :     implCreateTableTemplate( xTableFamily, "green" , aGreen1, aGreen3, aGreen2 );
     675             : 
     676             :     // ---- Seaweed ----------------------------------------------
     677             : 
     678         728 :     Any aSeetang1( implMakeSolidCellStyle( pSSPool, "seetang1" , aDefaultCellStyleName, RGB_COLORDATA(204,255,255)));
     679         728 :     Any aSeetang2( implMakeSolidCellStyle( pSSPool, "seetang2" , aDefaultCellStyleName, RGB_COLORDATA(71,184,184)));
     680         728 :     Any aSeetang3( implMakeSolidCellStyle( pSSPool, "seetang3" , aDefaultCellStyleName, RGB_COLORDATA(51,163,163)));
     681             : 
     682         364 :     implCreateTableTemplate( xTableFamily, "seetang" , aSeetang1, aSeetang3, aSeetang2 );
     683             : 
     684             :     // ---- LightBlue ----------------------------------------------
     685             : 
     686         728 :     Any aLightBlue1( implMakeSolidCellStyle( pSSPool, "lightblue1" , aDefaultCellStyleName, RGB_COLORDATA(255,255,255)));
     687         728 :     Any aLightBlue2( implMakeSolidCellStyle( pSSPool, "lightblue2" , aDefaultCellStyleName, RGB_COLORDATA(230,230,255)));
     688         728 :     Any aLightBlue3( implMakeSolidCellStyle( pSSPool, "lightblue3" , aDefaultCellStyleName, RGB_COLORDATA(153,153,204)));
     689             : 
     690         364 :     implCreateTableTemplate( xTableFamily, "lightblue" , aLightBlue1, aLightBlue3, aLightBlue2 );
     691             : 
     692             :     // ---- Yellow ----------------------------------------------
     693             : 
     694         728 :     Any aYellow1( implMakeSolidCellStyle( pSSPool, "yellow1" , aDefaultCellStyleName, RGB_COLORDATA(255,255,204)));
     695         728 :     Any aYellow2( implMakeSolidCellStyle( pSSPool, "yellow2" , aDefaultCellStyleName, RGB_COLORDATA(255,255,153)));
     696         728 :     Any aYellow3( implMakeSolidCellStyle( pSSPool, "yellow3" , aDefaultCellStyleName, RGB_COLORDATA(255,204,153)));
     697             : 
     698         728 :     implCreateTableTemplate( xTableFamily, "yellow" , aYellow1, aYellow3, aYellow2 );
     699         364 : }
     700             : 
     701             : // Number of pages that reference a master page
     702           2 : sal_uInt16 SdDrawDocument::GetMasterPageUserCount(SdrPage* pMaster) const
     703             : {
     704           2 :     sal_uInt16 nResult = 0;
     705             :     sal_uInt16 nPage;
     706           2 :     sal_uInt16 nPageCount = GetPageCount();
     707             : 
     708           8 :     for (nPage = 0; nPage < nPageCount; nPage++)
     709             :     {
     710           6 :         const SdrPage* pPage = GetPage(nPage);
     711             : 
     712           6 :         if(pPage->TRG_HasMasterPage())
     713             :         {
     714           6 :             if(&(pPage->TRG_GetMasterPage()) == pMaster)
     715             :             {
     716           0 :                 nResult++;
     717             :             }
     718             :         }
     719             :     }
     720           2 :     return nResult;
     721             : }
     722             : 
     723             : // Finish OnlineSpelling in the background
     724             : 
     725        1018 : void SdDrawDocument::StopOnlineSpelling()
     726             : {
     727        1018 :     if (mpOnlineSpellingTimer && mpOnlineSpellingTimer->IsActive())
     728             :     {
     729         524 :         mpOnlineSpellingTimer->Stop();
     730             :     }
     731             : 
     732        1018 :     delete mpOnlineSpellingTimer;
     733        1018 :     mpOnlineSpellingTimer = NULL;
     734             : 
     735        1018 :     delete mpOnlineSpellingList;
     736        1018 :     mpOnlineSpellingList = NULL;
     737        1018 : }
     738             : 
     739             : // Start OnlineSpelling in the background
     740         550 : void SdDrawDocument::StartOnlineSpelling(bool bForceSpelling)
     741             : {
     742        1100 :     if (mbOnlineSpell && (bForceSpelling || mbInitialOnlineSpellingEnabled) &&
     743        1100 :         mpDocSh && !mpDocSh->IsReadOnly() )
     744             :     {
     745         550 :         StopOnlineSpelling();
     746             : 
     747         550 :         ::sd::Outliner* pOutl = GetInternalOutliner(true);
     748             : 
     749         550 :         Reference< XSpellChecker1 > xSpellChecker( LinguMgr::GetSpellChecker() );
     750         550 :         if ( xSpellChecker.is() )
     751         550 :             pOutl->SetSpeller( xSpellChecker );
     752             : 
     753        1100 :         Reference< XHyphenator > xHyphenator( LinguMgr::GetHyphenator() );
     754         550 :         if( xHyphenator.is() )
     755         550 :             pOutl->SetHyphenator( xHyphenator );
     756             : 
     757         550 :         pOutl->SetDefaultLanguage( meLanguage );
     758             : 
     759         550 :         mpOnlineSpellingList = new ShapeList;
     760             :         sal_uInt16 nPage;
     761             : 
     762        1648 :         for ( nPage = 0; nPage < GetPageCount(); nPage++ )
     763             :         {
     764             :             // Search in all pages
     765        1098 :             FillOnlineSpellingList((SdPage*) GetPage(nPage));
     766             :         }
     767             : 
     768        1632 :         for (nPage = 0; nPage < GetMasterPageCount(); nPage++)
     769             :         {
     770             :             // Search all master pages
     771        1082 :             FillOnlineSpellingList((SdPage*) GetMasterPage(nPage));
     772             :         }
     773             : 
     774         550 :         mpOnlineSpellingList->seekShape(0);
     775         550 :         mpOnlineSpellingTimer = new Timer();
     776         550 :         mpOnlineSpellingTimer->SetTimeoutHdl( LINK(this, SdDrawDocument, OnlineSpellingHdl) );
     777         550 :         mpOnlineSpellingTimer->SetTimeout(250);
     778        1100 :         mpOnlineSpellingTimer->Start();
     779             :     }
     780         550 : }
     781             : 
     782             : // Fill OnlineSpelling list
     783        2180 : void SdDrawDocument::FillOnlineSpellingList(SdPage* pPage)
     784             : {
     785        2180 :     SdrObject* pObj = NULL;
     786        2180 :     SdrObjListIter aIter(*pPage, IM_FLAT);
     787             : 
     788        7283 :     while (aIter.IsMore())
     789             :     {
     790        2923 :         pObj = aIter.Next();
     791             : 
     792        2923 :         if( !pObj )
     793           0 :             continue;
     794             : 
     795        2923 :         if (pObj->GetOutlinerParaObject())
     796             :         {
     797             :             // Found a text object
     798        1904 :             mpOnlineSpellingList->addShape(*pObj);
     799             :         }
     800        1019 :         else if (pObj->GetObjIdentifier() == OBJ_GRUP)
     801             :         {
     802             :             // Found a group object
     803           0 :             SdrObjListIter aGroupIter(*((SdrObjGroup*)pObj)->GetSubList(),
     804           0 :                                       IM_DEEPNOGROUPS);
     805             : 
     806           0 :             bool bSubTextObjFound = false;
     807             : 
     808           0 :             while (aGroupIter.IsMore() && !bSubTextObjFound)
     809             :             {
     810           0 :                 if (aGroupIter.Next()->GetOutlinerParaObject())
     811             :                 {
     812             :                     // Found a text object in a group object
     813           0 :                     bSubTextObjFound = true;
     814             :                 }
     815             :             }
     816             : 
     817           0 :             if (bSubTextObjFound)
     818             :             {
     819           0 :                 mpOnlineSpellingList->addShape(*pObj);
     820           0 :             }
     821             :         }
     822        2180 :     }
     823        2180 : }
     824             : 
     825             : // OnlineSpelling in the background
     826         218 : IMPL_LINK_NOARG(SdDrawDocument, OnlineSpellingHdl)
     827             : {
     828         218 :     if (mpOnlineSpellingList!=NULL
     829         109 :         && ( !mbOnlineSpell || mpOnlineSpellingList->hasMore()))
     830             :     {
     831             :         // Spell next object
     832          83 :         SdrObject* pObj = mpOnlineSpellingList->getNextShape();
     833             : 
     834          83 :         if (pObj)
     835             :         {
     836          83 :             if (pObj->GetOutlinerParaObject() && pObj->ISA(SdrTextObj))
     837             :             {
     838             :                 // Spell text object
     839          83 :                 SpellObject((SdrTextObj*) pObj);
     840             :             }
     841           0 :             else if (pObj->GetObjIdentifier() == OBJ_GRUP)
     842             :             {
     843             :                 // Found a group object
     844           0 :                 SdrObjListIter aGroupIter(*((SdrObjGroup*)pObj)->GetSubList(),
     845           0 :                                           IM_DEEPNOGROUPS);
     846             : 
     847           0 :                 SdrObject* pSubObj = NULL;
     848             : 
     849           0 :                 while (aGroupIter.IsMore())
     850             :                 {
     851           0 :                     pSubObj = aGroupIter.Next();
     852             : 
     853           0 :                     if (pSubObj->GetOutlinerParaObject() && pSubObj->ISA(SdrTextObj))
     854             :                     {
     855             :                         // Found a text object in a group object
     856           0 :                         SpellObject((SdrTextObj*) pSubObj);
     857             :                     }
     858           0 :                 }
     859             :             }
     860             :         }
     861             : 
     862             :         // Continue search
     863          83 :         mpOnlineSpellingTimer->Start();
     864             :     }
     865             :     else
     866             :     {
     867             :         // Initial spelling has finished
     868          26 :         mbInitialOnlineSpellingEnabled = false;
     869             : 
     870             :         // Stop search
     871          26 :         StopOnlineSpelling();
     872             : 
     873          26 :         delete mpOnlineSearchItem;
     874          26 :         mpOnlineSearchItem = NULL;
     875             :     }
     876             : 
     877         109 :     return(0);
     878             : }
     879             : 
     880             : // Spell object (for OnlineSpelling)
     881          83 : void SdDrawDocument::SpellObject(SdrTextObj* pObj)
     882             : {
     883          83 :     if (pObj && pObj->GetOutlinerParaObject() /* && pObj != pView->GetTextEditObject() */)
     884             :     {
     885          83 :         mbHasOnlineSpellErrors = false;
     886          83 :         ::sd::Outliner* pOutl = GetInternalOutliner(true);
     887          83 :         pOutl->SetUpdateMode(true);
     888          83 :         Link aEvtHdl = pOutl->GetStatusEventHdl();
     889          83 :         pOutl->SetStatusEventHdl(LINK(this, SdDrawDocument, OnlineSpellEventHdl));
     890             : 
     891          83 :         sal_uInt16 nOldOutlMode = pOutl->GetMode();
     892          83 :         sal_uInt16 nOutlMode = OUTLINERMODE_TEXTOBJECT;
     893         166 :         if (((SdrTextObj*) pObj)->GetObjInventor() == SdrInventor &&
     894          83 :             ((SdrTextObj*) pObj)->GetObjIdentifier() == OBJ_OUTLINETEXT)
     895             :         {
     896           0 :             nOutlMode = OUTLINERMODE_OUTLINEOBJECT;
     897             :         }
     898          83 :         pOutl->Init( nOutlMode );
     899             : 
     900             :         // Put text into the outliner
     901          83 :         pOutl->SetText(*((SdrTextObj*) pObj)->GetOutlinerParaObject());
     902             : 
     903          83 :         if (!mpOnlineSearchItem || pOutl->HasText(*mpOnlineSearchItem))
     904             :         {
     905             :             // Spelling
     906          83 :             pOutl->CompleteOnlineSpelling();
     907             : 
     908          83 :             if (mbHasOnlineSpellErrors)
     909             :             {
     910           0 :                 sd::ModifyGuard aGuard( this );
     911           0 :                 SdrModel* pModel = pObj->GetModel();
     912           0 :                 bool bLock = false;
     913           0 :                 if ( pModel )
     914             :                 {
     915           0 :                     bLock = pModel->isLocked();
     916           0 :                     pModel->setLock(true);
     917             :                 }
     918             :                 // taking text from the outliner
     919           0 :                 ((SdrTextObj*) pObj)->SetOutlinerParaObject( pOutl->CreateParaObject() );
     920             : 
     921           0 :                 pObj->BroadcastObjectChange();
     922           0 :                 if ( pModel )
     923           0 :                     pModel->setLock(bLock);
     924             :             }
     925             :         }
     926             : 
     927          83 :         pOutl->SetStatusEventHdl(aEvtHdl);
     928          83 :         pOutl->SetUpdateMode(false);
     929          83 :         pOutl->Init( nOldOutlMode );
     930          83 :         mbHasOnlineSpellErrors = false;
     931             :     }
     932          83 : }
     933             : 
     934             : // Object was inserted into model
     935       11470 : void SdDrawDocument::InsertObject(SdrObject* pObj, SdPage* /*pPage*/)
     936             : {
     937       11470 :     if(mpOnlineSpellingList && pObj)
     938             :     {
     939        2787 :         if (pObj->GetOutlinerParaObject() || (pObj->GetObjIdentifier() == OBJ_GRUP))
     940             :         {
     941             :             // Add object to OnlineSpelling list
     942         382 :             mpOnlineSpellingList->addShape(*pObj);
     943             :         }
     944             :     }
     945       11470 : }
     946             : 
     947             : // Object removed from model
     948        2524 : void SdDrawDocument::RemoveObject(SdrObject* pObj, SdPage* /*pPage*/)
     949             : {
     950        2524 :     if(mpOnlineSpellingList && pObj)
     951             :     {
     952         210 :         if (pObj->GetOutlinerParaObject() || (pObj->GetObjIdentifier() == OBJ_GRUP))
     953             :         {
     954             :             // Replace object in OnlineSpelling list by 0 pointer
     955          92 :             mpOnlineSpellingList->removeShape(*pObj);
     956             :         }
     957             :     }
     958        2524 : }
     959             : 
     960             : // Callback for ExecuteSpellPopup()
     961         332 : IMPL_LINK(SdDrawDocument, OnlineSpellEventHdl, EditStatus*, pEditStat)
     962             : {
     963         166 :     sal_uLong nStat = pEditStat->GetStatusWord();
     964         166 :     mbHasOnlineSpellErrors = (nStat & EE_STAT_WRONGWORDCHANGED) != 0;
     965             : 
     966         166 :     return(0);
     967             : }
     968             : 
     969             : // Callback for ExecuteSpellPopup()
     970             : 
     971             : // removed link and replaced with Imp method
     972           0 : void SdDrawDocument::ImpOnlineSpellCallback(SpellCallbackInfo* pInfo, SdrObject* pObj, SdrOutliner* pOutl)
     973             : {
     974           0 :     delete mpOnlineSearchItem;
     975           0 :     mpOnlineSearchItem = NULL;
     976             : 
     977           0 :     sal_uInt16 nCommand = pInfo->nCommand;
     978             : 
     979           0 :     if (nCommand == SPELLCMD_IGNOREWORD
     980             :         // restart when add to dictionary takes place, too.
     981           0 :         || nCommand == SPELLCMD_ADDTODICTIONARY)
     982             :     {
     983           0 :         if(pObj && pOutl && pObj->ISA(SdrTextObj))
     984             :         {
     985           0 :             bool bModified(IsChanged());
     986           0 :             ((SdrTextObj*)pObj)->SetOutlinerParaObject(pOutl->CreateParaObject());
     987           0 :             SetChanged(bModified);
     988           0 :             pObj->BroadcastObjectChange();
     989             :         }
     990             : 
     991           0 :         mpOnlineSearchItem = new SvxSearchItem( SID_SEARCH_ITEM );
     992           0 :         mpOnlineSearchItem->SetSearchString(pInfo->aWord);
     993           0 :         StartOnlineSpelling();
     994             :     }
     995           0 :     else if (nCommand == SPELLCMD_STARTSPELLDLG)
     996             :     {
     997             :         SfxViewFrame::Current()->GetDispatcher()->Execute( SID_SPELL_DIALOG,
     998           0 :             SfxCallMode::ASYNCHRON );
     999             :     }
    1000           0 : }
    1001             : 
    1002             : // Replace the unambiguous names of the default layers by their names in the
    1003             : // native language
    1004           0 : void SdDrawDocument::RestoreLayerNames()
    1005             : {
    1006           0 :     SdrLayerAdmin& rLayerAdmin = GetLayerAdmin();
    1007           0 :     sal_uInt16 nLayerCount = rLayerAdmin.GetLayerCount();
    1008             : 
    1009           0 :     for (sal_uInt16 nLayer = 0; nLayer < nLayerCount; nLayer++)
    1010             :     {
    1011           0 :         SdrLayer* pLayer = rLayerAdmin.GetLayer(nLayer);
    1012             : 
    1013           0 :         if (pLayer)
    1014             :         {
    1015           0 :             OUString aLayerName(pLayer->GetName());
    1016             : 
    1017           0 :             if (aLayerName == "LAYER_LAYOUT")
    1018             :             {
    1019           0 :                 pLayer->SetName(SD_RESSTR(STR_LAYER_LAYOUT));
    1020             :             }
    1021           0 :             else if (aLayerName == "LAYER_BCKGRND")
    1022             :             {
    1023           0 :                 pLayer->SetName(SD_RESSTR(STR_LAYER_BCKGRND));
    1024             :             }
    1025           0 :             else if (aLayerName == "LAYER_BACKGRNDOBJ")
    1026             :             {
    1027           0 :                 pLayer->SetName(SD_RESSTR(STR_LAYER_BCKGRNDOBJ));
    1028             :             }
    1029           0 :             else if (aLayerName == "LAYER_CONTROLS")
    1030             :             {
    1031           0 :                 pLayer->SetName(SD_RESSTR(STR_LAYER_CONTROLS));
    1032             :             }
    1033           0 :             else if (aLayerName == "LAYER_MEASURELINES")
    1034             :             {
    1035           0 :                 pLayer->SetName(SD_RESSTR(STR_LAYER_MEASURELINES));
    1036           0 :             }
    1037             :         }
    1038             :     }
    1039           0 : }
    1040             : 
    1041             : // Return formatted page number (1, I, i, a, etc.)
    1042        5168 : OUString SdDrawDocument::CreatePageNumValue(sal_uInt16 nNum) const
    1043             : {
    1044        5168 :     OUString aPageNumValue;
    1045        5168 :     bool bUpper = false;
    1046             : 
    1047        5168 :     switch (mePageNumType)
    1048             :     {
    1049             :         case SVX_CHARS_UPPER_LETTER:
    1050           0 :             aPageNumValue += OUString( (sal_Unicode)(char)((nNum - 1) % 26 + 'A') );
    1051           0 :             break;
    1052             :         case SVX_CHARS_LOWER_LETTER:
    1053           0 :             aPageNumValue += OUString( (sal_Unicode)(char)((nNum - 1) % 26 + 'a') );
    1054           0 :             break;
    1055             :         case SVX_ROMAN_UPPER:
    1056           0 :             bUpper = true;
    1057             :             //fall-through
    1058             :         case SVX_ROMAN_LOWER:
    1059           0 :             aPageNumValue += SvxNumberFormat::CreateRomanString(nNum, bUpper);
    1060           0 :             break;
    1061             :         case SVX_NUMBER_NONE:
    1062           0 :             aPageNumValue = " ";
    1063           0 :             break;
    1064             :         default:
    1065        5168 :             aPageNumValue += OUString::number(nNum);
    1066             :     }
    1067             : 
    1068        5168 :     return aPageNumValue;
    1069             : }
    1070             : 
    1071             : // Rename layout template
    1072             : // Keep in mind that rOldLayoutName contains the _complete_ name of the layout
    1073             : // (including ~LT~). This is unlike rNewName.
    1074         118 : void SdDrawDocument::RenameLayoutTemplate(const OUString& rOldLayoutName, const OUString& rNewName)
    1075             : {
    1076         118 :     OUString aSep(SD_LT_SEPARATOR);
    1077         236 :     OUString aOldName(rOldLayoutName);
    1078         118 :     sal_Int32 nPos = aOldName.indexOf( aSep );
    1079             : 
    1080             :     // erase everything after '~LT~'
    1081         118 :     if (nPos != -1)
    1082         118 :         aOldName = aOldName.copy(0, nPos + aSep.getLength());
    1083             : 
    1084         236 :     std::vector<StyleReplaceData> aReplList;
    1085         236 :     SfxStyleSheetIterator aIter(mxStyleSheetPool.get(), SD_STYLE_FAMILY_MASTERPAGE);
    1086         118 :     SfxStyleSheetBase* pSheet = aIter.First();
    1087             : 
    1088        2000 :     while (pSheet)
    1089             :     {
    1090        1764 :         OUString aSheetName = pSheet->GetName();
    1091             : 
    1092             :         // if the sheetname starts with aOldName + "~LT~"
    1093        1764 :         if (aSheetName.startsWith(aOldName))
    1094             :         {
    1095        1652 :             aSheetName = aSheetName.replaceAt(0, aOldName.getLength() - aSep.getLength(), rNewName);
    1096             : 
    1097        1652 :             StyleReplaceData aReplData;
    1098        1652 :             aReplData.nFamily     = pSheet->GetFamily();
    1099        1652 :             aReplData.nNewFamily = pSheet->GetFamily();
    1100        1652 :             aReplData.aName   = pSheet->GetName();
    1101        1652 :             aReplData.aNewName   = aSheetName;
    1102        1652 :             aReplList.push_back(aReplData);
    1103             : 
    1104        1652 :             pSheet->SetName(aSheetName);
    1105             :         }
    1106             : 
    1107        1764 :         pSheet = aIter.Next();
    1108        1764 :     }
    1109             : 
    1110             :     // Now set the layout name of the drawing and the notes page, as well as
    1111             :     // their master pages.
    1112         236 :     OUString aPageLayoutName(rNewName);
    1113         118 :     aPageLayoutName += aSep + SD_RESSTR(STR_LAYOUT_OUTLINE);
    1114             : 
    1115             :     // Inform all text objects on pages that use the renamed layout and set the
    1116             :     // new name.
    1117             :     sal_uInt16 nPage;
    1118         484 :     for (nPage = 0; nPage < GetPageCount(); nPage++)
    1119             :     {
    1120         366 :         SdPage* pPage = (SdPage*) GetPage(nPage);
    1121         366 :         OUString aTemp(pPage->GetLayoutName());
    1122             : 
    1123         366 :         if (aTemp == rOldLayoutName)
    1124             :         {
    1125         330 :             pPage->SetLayoutName(aPageLayoutName);
    1126             : 
    1127         762 :             for (size_t nObj = 0; nObj < pPage->GetObjCount(); ++nObj)
    1128             :             {
    1129         432 :                 SdrObject* pObj = pPage->GetObj(nObj);
    1130             : 
    1131         432 :                 if (pObj->GetObjInventor() == SdrInventor)
    1132             :                 {
    1133         432 :                     switch( pObj->GetObjIdentifier() )
    1134             :                     {
    1135             :                         case OBJ_TEXT:
    1136             :                         case OBJ_OUTLINETEXT:
    1137             :                         case OBJ_TITLETEXT:
    1138             :                         {
    1139         322 :                             OutlinerParaObject* pOPO = ((SdrTextObj*) pObj)->GetOutlinerParaObject();
    1140             : 
    1141         322 :                             if (pOPO)
    1142             :                             {
    1143         322 :                                 std::vector<StyleReplaceData>::iterator it;
    1144        4830 :                                 for (it = aReplList.begin(); it != aReplList.end(); ++it)
    1145        4508 :                                     pOPO->ChangeStyleSheets( it->aName, it->nFamily, it->aNewName, it->nNewFamily );
    1146             :                             }
    1147             :                         }
    1148         322 :                         break;
    1149             : 
    1150             :                         default:
    1151         110 :                         break;
    1152             :                     }
    1153             :                 }
    1154             :             }
    1155             :         }
    1156         366 :     }
    1157             : 
    1158             :     // Now do this again for all master pages.
    1159             :     // The affected master pages get the name of the layout as their page name.
    1160         488 :     for (nPage = 0; nPage < GetMasterPageCount(); nPage++)
    1161             :     {
    1162         370 :         SdPage* pPage = (SdPage*) GetMasterPage(nPage);
    1163         370 :         OUString aTemp(pPage->GetLayoutName());
    1164             : 
    1165         370 :         if (aTemp == rOldLayoutName)
    1166             :         {
    1167         346 :             pPage->SetLayoutName(aPageLayoutName);
    1168         346 :             pPage->SetName(rNewName);
    1169             : 
    1170        2206 :             for (size_t nObj = 0; nObj < pPage->GetObjCount(); ++nObj)
    1171             :             {
    1172        1860 :                 SdrObject* pObj = pPage->GetObj(nObj);
    1173             : 
    1174        1860 :                 if (pObj->GetObjInventor() == SdrInventor)
    1175             :                 {
    1176        1860 :                     switch(pObj->GetObjIdentifier())
    1177             :                     {
    1178             :                         case OBJ_TEXT:
    1179             :                         case OBJ_OUTLINETEXT:
    1180             :                         case OBJ_TITLETEXT:
    1181             :                         {
    1182        1148 :                             OutlinerParaObject* pOPO = ((SdrTextObj*)pObj)->GetOutlinerParaObject();
    1183             : 
    1184        1148 :                             if (pOPO)
    1185             :                             {
    1186        1148 :                                 std::vector<StyleReplaceData>::iterator it;
    1187       17220 :                                 for (it = aReplList.begin(); it != aReplList.end(); ++it)
    1188       16072 :                                     pOPO->ChangeStyleSheets( it->aName, it->nFamily, it->aNewName, it->nNewFamily );
    1189             :                             }
    1190             :                         }
    1191        1148 :                         break;
    1192             : 
    1193             :                         default:
    1194         712 :                         break;
    1195             :                     }
    1196             :                 }
    1197             :             }
    1198             :         }
    1199         488 :     }
    1200         118 : }
    1201             : 
    1202             : // Set outliner defaults (pool defaults)
    1203         442 : void SdDrawDocument::SetTextDefaults() const
    1204             : {
    1205             :     // BulletItem and BulletFont for Titel and Outline
    1206         442 :     SvxBulletItem aBulletItem(EE_PARA_BULLET);
    1207         884 :     vcl::Font aBulletFont( SdStyleSheetPool::GetBulletFont() );
    1208         442 :     aBulletFont.SetSize(Size(0,846));       // 24 pt
    1209         442 :     aBulletItem.SetFont(aBulletFont);
    1210         442 :     aBulletItem.SetStyle(BS_BULLET);
    1211         442 :     aBulletItem.SetStart(1);
    1212         442 :     aBulletItem.SetScale(45);               // In percent
    1213         442 :     aBulletItem.SetSymbol( 0x25CF );                // In points
    1214         442 :     pItemPool->SetPoolDefaultItem( aBulletItem );
    1215             : 
    1216             :     // New BulletItem
    1217         884 :     SvxNumberFormat aNumberFormat(SVX_NUM_CHAR_SPECIAL);
    1218         442 :     aNumberFormat.SetBulletFont(&aBulletFont);
    1219         442 :     aNumberFormat.SetBulletChar( 0x25CF );  // StarBats: 0xF000 + 34
    1220         442 :     aNumberFormat.SetBulletRelSize(45);
    1221         442 :     aNumberFormat.SetBulletColor(Color(COL_AUTO));
    1222         442 :     aNumberFormat.SetStart(1);
    1223         442 :     aNumberFormat.SetNumAdjust(SVX_ADJUST_LEFT);
    1224             : 
    1225         884 :     SvxNumRule aNumRule( NUM_BULLET_REL_SIZE|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE, SVX_MAX_NUM, false);
    1226             : 
    1227             :     //aNumberFormat.SetLSpace( 0 );
    1228             :     //aNumberFormat.SetAbsLSpace( 0 );
    1229             :     //aNumberFormat.SetFirstLineOffset( 0 );
    1230             :     //aNumRule.SetLevel( 0, aNumberFormat );
    1231             : 
    1232        4862 :     for( sal_uInt16 i = 0; i < aNumRule.GetLevelCount(); i++ )
    1233             :     {
    1234        4420 :         const short nLSpace = (i + 1) * 600;
    1235        4420 :         aNumberFormat.SetLSpace(nLSpace);
    1236        4420 :         aNumberFormat.SetAbsLSpace(nLSpace);
    1237        4420 :         aNumberFormat.SetFirstLineOffset(-600);
    1238        4420 :         aNumRule.SetLevel( i, aNumberFormat );
    1239             :     }
    1240             : 
    1241         884 :     SvxNumBulletItem aNumBulletItem( aNumRule, EE_PARA_NUMBULLET );
    1242         884 :     pItemPool->SetPoolDefaultItem( aNumBulletItem );
    1243         442 : }
    1244             : 
    1245         281 : ::com::sun::star::text::WritingMode SdDrawDocument::GetDefaultWritingMode() const
    1246             : {
    1247         281 :     const SfxPoolItem*                  pItem = ( pItemPool ? pItemPool->GetPoolDefaultItem( EE_PARA_WRITINGDIR ) : NULL );
    1248         281 :     ::com::sun::star::text::WritingMode eRet = ::com::sun::star::text::WritingMode_LR_TB;
    1249             : 
    1250         281 :     if( pItem )
    1251             :     {
    1252          36 :         switch( ( (SvxFrameDirectionItem&)( *pItem ) ).GetValue() )
    1253             :         {
    1254          36 :             case( FRMDIR_HORI_LEFT_TOP ): eRet = ::com::sun::star::text::WritingMode_LR_TB; break;
    1255           0 :             case( FRMDIR_HORI_RIGHT_TOP ): eRet = ::com::sun::star::text::WritingMode_RL_TB; break;
    1256           0 :             case( FRMDIR_VERT_TOP_RIGHT ): eRet = ::com::sun::star::text::WritingMode_TB_RL; break;
    1257             : 
    1258             :             default:
    1259             :                 OSL_FAIL( "Frame direction not supported yet" );
    1260           0 :             break;
    1261             :         }
    1262             :     }
    1263             : 
    1264         281 :     return eRet;
    1265             : }
    1266             : 
    1267           0 : void SdDrawDocument::SetDefaultWritingMode(::com::sun::star::text::WritingMode eMode )
    1268             : {
    1269           0 :     if( pItemPool )
    1270             :     {
    1271             :         SvxFrameDirection nVal;
    1272           0 :         switch( eMode )
    1273             :         {
    1274           0 :         case ::com::sun::star::text::WritingMode_LR_TB: nVal = FRMDIR_HORI_LEFT_TOP; break;
    1275           0 :         case ::com::sun::star::text::WritingMode_RL_TB: nVal = FRMDIR_HORI_RIGHT_TOP; break;
    1276           0 :         case ::com::sun::star::text::WritingMode_TB_RL: nVal = FRMDIR_VERT_TOP_RIGHT; break;
    1277             :         default:
    1278             :             OSL_FAIL( "Frame direction not supported yet" );
    1279           0 :             return;
    1280             :         }
    1281             : 
    1282           0 :         SvxFrameDirectionItem aModeItem( nVal, EE_PARA_WRITINGDIR );
    1283           0 :         pItemPool->SetPoolDefaultItem( aModeItem );
    1284             : 
    1285           0 :         SvxAdjustItem aAdjust( SVX_ADJUST_LEFT, EE_PARA_JUST );
    1286             : 
    1287           0 :         if( eMode == ::com::sun::star::text::WritingMode_RL_TB )
    1288           0 :             aAdjust.SetEnumValue( SVX_ADJUST_RIGHT );
    1289             : 
    1290           0 :         pItemPool->SetPoolDefaultItem( aAdjust );
    1291             : 
    1292             :     }
    1293             : }
    1294             : 
    1295        1126 : void SdDrawDocument::getDefaultFonts( vcl::Font& rLatinFont, vcl::Font& rCJKFont, vcl::Font& rCTLFont )
    1296             : {
    1297        1126 :     LanguageType eLatin = GetLanguage( EE_CHAR_LANGUAGE );
    1298             : 
    1299             :     //  If the UI language is Korean, the default Latin font has to
    1300             :     //  be queried for Korean, too (the Latin language from the document can't be Korean).
    1301             :     //  This is the same logic as in SwDocShell::InitNew.
    1302        1126 :     LanguageType eUiLanguage = Application::GetSettings().GetUILanguageTag().getLanguageType();
    1303        1126 :     if (MsLangId::isKorean(eUiLanguage))
    1304           0 :         eLatin = eUiLanguage;
    1305             : 
    1306        1126 :     rLatinFont = OutputDevice::GetDefaultFont( DEFAULTFONT_LATIN_PRESENTATION, eLatin, DEFAULTFONT_FLAGS_ONLYONE );
    1307        1126 :     rCJKFont = OutputDevice::GetDefaultFont( DEFAULTFONT_CJK_PRESENTATION, GetLanguage( EE_CHAR_LANGUAGE_CJK ), DEFAULTFONT_FLAGS_ONLYONE );
    1308        1126 :     rCTLFont = OutputDevice::GetDefaultFont( DEFAULTFONT_CTL_PRESENTATION, GetLanguage( EE_CHAR_LANGUAGE_CTL ), DEFAULTFONT_FLAGS_ONLYONE ) ;
    1309        1126 : }
    1310             : 
    1311             : /* converts the given western font height to a corresponding ctl font height, depending on the system language */
    1312        5456 : sal_uInt32 SdDrawDocument::convertFontHeightToCTL( sal_uInt32 nWesternFontHeight )
    1313             : {
    1314        5456 :     LanguageType eRealCTLLanguage = Application::GetSettings().GetLanguageTag().getLanguageType();
    1315        5456 :     if( LANGUAGE_THAI == eRealCTLLanguage )
    1316             :     {
    1317             :         // http://specs.openoffice.org/g11n/font_sizes/42775_42725_Individual_configurable_font_size_for_default_fonts.odt
    1318           0 :         double fTemp = double(nWesternFontHeight) * 1.333;
    1319           0 :         nWesternFontHeight = (sal_uInt32)fTemp;
    1320             :         // make some nice values for UI that displays PT instead of 1/100th mm
    1321           0 :         nWesternFontHeight = ((nWesternFontHeight * 72) + 1270) / 2540L;
    1322           0 :         nWesternFontHeight = ((nWesternFontHeight * 2540L) + 36) / 72;
    1323             :     }
    1324        5456 :     return nWesternFontHeight;
    1325             : }
    1326             : 
    1327          22 : SdStyleSheetPool* SdDrawDocument::GetSdStyleSheetPool() const
    1328             : {
    1329          22 :     return dynamic_cast< SdStyleSheetPool* >( GetStyleSheetPool() );
    1330             : }
    1331             : 
    1332        2389 : ModifyGuard::ModifyGuard( SdDrawDocument* pDoc )
    1333        2389 : : mpDocShell( 0 ), mpDoc( pDoc )
    1334             : {
    1335        2389 :     init();
    1336        2389 : }
    1337             : 
    1338        2389 : void ModifyGuard::init()
    1339             : {
    1340        2389 :     if( mpDocShell )
    1341             :     {
    1342           0 :         mpDoc = mpDocShell->GetDoc();
    1343             :     }
    1344        2389 :     else if( mpDoc )
    1345             :     {
    1346        2389 :         mpDocShell = mpDoc->GetDocSh();
    1347             :     }
    1348             : 
    1349        2389 :     mbIsEnableSetModified = mpDocShell ? mpDocShell->IsEnableSetModified() : sal_False;
    1350        2389 :     mbIsDocumentChanged = mpDoc && mpDoc->IsChanged();
    1351             : 
    1352        2389 :     if( mbIsEnableSetModified )
    1353         991 :         mpDocShell->EnableSetModified( false );
    1354        2389 : }
    1355             : 
    1356        2389 : ModifyGuard::~ModifyGuard()
    1357             : {
    1358        2389 :     if( mbIsEnableSetModified )
    1359         991 :         mpDocShell->EnableSetModified( true );
    1360             : 
    1361        2389 :     if( mpDoc && (mpDoc->IsChanged() != mbIsDocumentChanged) )
    1362           0 :         mpDoc->SetChanged(mbIsDocumentChanged);
    1363        2503 : }
    1364             : 
    1365             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10