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

Generated by: LCOV version 1.10