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

Generated by: LCOV version 1.11