2010-10-12 15:51:52 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-11-27 16:10:40 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2006-09-16 17:17:08 +00:00
|
|
|
|
2008-03-12 10:28:54 +00:00
|
|
|
#include <com/sun/star/lang/DisposedException.hpp>
|
2013-12-05 19:18:01 -02:00
|
|
|
#include <cppuhelper/supportsservice.hxx>
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/eeitem.hxx>
|
|
|
|
#include <editeng/fhgtitem.hxx>
|
|
|
|
#include <editeng/colritem.hxx>
|
2013-02-12 13:41:53 -05:00
|
|
|
#include <editeng/contouritem.hxx>
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/shdditem.hxx>
|
2013-02-12 13:41:53 -05:00
|
|
|
#include <editeng/crossedoutitem.hxx>
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/udlnitem.hxx>
|
|
|
|
#include <editeng/wghtitem.hxx>
|
|
|
|
#include <editeng/postitem.hxx>
|
|
|
|
#include <editeng/fontitem.hxx>
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/poolitem.hxx>
|
2000-09-18 23:16:46 +00:00
|
|
|
#include <svx/xfillit0.hxx>
|
|
|
|
#include <svx/xlineit0.hxx>
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/ulspitem.hxx>
|
|
|
|
#include <editeng/numitem.hxx>
|
2013-02-12 13:41:53 -05:00
|
|
|
#include <editeng/brushitem.hxx>
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/editeng.hxx>
|
2014-01-27 16:23:44 +05:30
|
|
|
#include <editeng/cmapitem.hxx>
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/smplhint.hxx>
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/langitem.hxx>
|
|
|
|
#include <editeng/charreliefitem.hxx>
|
2013-02-12 13:41:53 -05:00
|
|
|
#include <editeng/emphasismarkitem.hxx>
|
2008-03-12 10:28:54 +00:00
|
|
|
#include <svx/sdr/table/tabledesign.hxx>
|
2013-02-12 13:41:53 -05:00
|
|
|
#include <editeng/autokernitem.hxx>
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
#include <svx/svdattr.hxx>
|
2013-04-19 15:49:58 -04:00
|
|
|
#include <editeng/outliner.hxx>
|
2013-10-22 15:58:57 +03:00
|
|
|
#include <svx/xtable.hxx>
|
2013-02-12 13:41:53 -05:00
|
|
|
#include <editeng/bulletitem.hxx>
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/lrspitem.hxx>
|
2013-02-12 13:41:53 -05:00
|
|
|
#include <editeng/adjustitem.hxx>
|
2013-04-10 20:41:54 +02:00
|
|
|
#include <editeng/numdef.hxx>
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/itempool.hxx>
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
#include "stlpool.hxx"
|
|
|
|
#include "sdresid.hxx"
|
|
|
|
#include "stlsheet.hxx"
|
|
|
|
#include "glob.hrc"
|
|
|
|
#include "glob.hxx"
|
|
|
|
#include "drawdoc.hxx"
|
2002-08-01 10:30:12 +00:00
|
|
|
#include "sdmod.hxx"
|
2000-09-18 23:16:46 +00:00
|
|
|
#include "sdpage.hxx"
|
|
|
|
#include "helpids.h"
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/itemset.hxx>
|
2010-07-19 17:13:56 +02:00
|
|
|
#include "app.hrc"
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2008-03-12 10:28:54 +00:00
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::lang;
|
|
|
|
using namespace ::com::sun::star::style;
|
|
|
|
using namespace ::com::sun::star::container;
|
|
|
|
|
2014-02-13 16:10:47 +05:30
|
|
|
namespace
|
|
|
|
{
|
|
|
|
|
|
|
|
OUString lcl_findRenamedStyleName(std::vector< std::pair< OUString, OUString > > &rRenamedList, OUString& aOriginalName )
|
|
|
|
{
|
|
|
|
std::vector< std::pair< OUString, OUString > >::iterator aIter;
|
|
|
|
for( aIter = rRenamedList.begin(); aIter != rRenamedList.end(); ++aIter )
|
|
|
|
{
|
|
|
|
if((*aIter).first == aOriginalName )
|
|
|
|
return (*aIter).second;
|
|
|
|
}
|
|
|
|
return OUString();
|
|
|
|
}
|
|
|
|
|
|
|
|
SfxStyleSheet *lcl_findStyle(SdStyleSheetVector& rStyles, OUString aStyleName)
|
|
|
|
{
|
|
|
|
if( aStyleName.isEmpty() )
|
|
|
|
return NULL;
|
|
|
|
for(SdStyleSheetVector::const_iterator aIt(rStyles.begin()), aLast(rStyles.end()); aIt != aLast; ++aIt)
|
|
|
|
{
|
|
|
|
if((*aIt)->GetName() == aStyleName)
|
|
|
|
return (*aIt).get();
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2008-03-12 10:28:54 +00:00
|
|
|
// ----------------------------------------------------------
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2008-03-12 10:28:54 +00:00
|
|
|
SdStyleSheetPool::SdStyleSheetPool(SfxItemPool const& _rPool, SdDrawDocument* pDocument)
|
|
|
|
: SdStyleSheetPoolBase( _rPool )
|
2006-12-12 15:33:59 +00:00
|
|
|
, mpActualStyleSheet(NULL)
|
|
|
|
, mpDoc(pDocument)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2008-03-12 10:28:54 +00:00
|
|
|
if( mpDoc )
|
|
|
|
{
|
|
|
|
rtl::Reference< SfxStyleSheetPool > xPool( this );
|
|
|
|
|
|
|
|
// create graphics family
|
|
|
|
mxGraphicFamily = new SdStyleFamily( xPool, SD_STYLE_FAMILY_GRAPHICS );
|
|
|
|
mxCellFamily = new SdStyleFamily( xPool, SD_STYLE_FAMILY_CELL );
|
|
|
|
|
|
|
|
mxTableFamily = sdr::table::CreateTableDesignFamily();
|
|
|
|
Reference< XNamed > xNamed( mxTableFamily, UNO_QUERY );
|
|
|
|
if( xNamed.is() )
|
|
|
|
msTableFamilyName = xNamed->getName();
|
|
|
|
|
|
|
|
// create presentation families, one for each master page
|
|
|
|
const sal_uInt16 nCount = mpDoc->GetMasterSdPageCount(PK_STANDARD);
|
|
|
|
for( sal_uInt16 nPage = 0; nPage < nCount; ++nPage )
|
|
|
|
AddStyleFamily( mpDoc->GetMasterSdPage(nPage,PK_STANDARD) );
|
|
|
|
|
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
2008-03-12 10:28:54 +00:00
|
|
|
// ----------------------------------------------------------
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2001-10-22 12:36:57 +00:00
|
|
|
SdStyleSheetPool::~SdStyleSheetPool()
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2008-03-12 10:28:54 +00:00
|
|
|
DBG_ASSERT( mpDoc == NULL, "sd::SdStyleSheetPool::~SdStyleSheetPool(), dispose me first!" );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
2008-03-12 10:28:54 +00:00
|
|
|
// ----------------------------------------------------------
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2013-07-05 16:25:03 -05:00
|
|
|
SfxStyleSheetBase* SdStyleSheetPool::Create(const OUString& rName, SfxStyleFamily eFamily, sal_uInt16 _nMask )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2006-12-12 15:33:59 +00:00
|
|
|
return new SdStyleSheet(rName, *this, eFamily, _nMask);
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
2008-03-12 10:28:54 +00:00
|
|
|
// ----------------------------------------------------------
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2001-10-22 12:36:57 +00:00
|
|
|
SfxStyleSheetBase* SdStyleSheetPool::Create(const SdStyleSheet& rStyle)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2008-03-12 10:28:54 +00:00
|
|
|
return new SdStyleSheet( rStyle );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
2008-03-12 10:28:54 +00:00
|
|
|
// ----------------------------------------------------------
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2013-09-05 14:22:12 +02:00
|
|
|
SfxStyleSheetBase* SdStyleSheetPool::GetTitleSheet(const OUString& rLayoutName)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2013-09-05 14:22:12 +02:00
|
|
|
OUString aName(rLayoutName);
|
|
|
|
aName += SD_LT_SEPARATOR;
|
2013-08-24 13:15:47 +04:00
|
|
|
aName += SD_RESSTR(STR_LAYOUT_TITLE);
|
2008-03-12 10:28:54 +00:00
|
|
|
SfxStyleSheetBase* pResult = Find(aName, SD_STYLE_FAMILY_MASTERPAGE);
|
2000-09-18 23:16:46 +00:00
|
|
|
return pResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
2013-03-01 10:55:30 +01:00
|
|
|
|* Create a list of outline text templates for a presentation layout.
|
|
|
|
|* The caller has to delete the list.
|
2000-09-18 23:16:46 +00:00
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2013-09-05 14:22:12 +02:00
|
|
|
void SdStyleSheetPool::CreateOutlineSheetList (const OUString& rLayoutName, std::vector<SfxStyleSheetBase*> &rOutlineStyles)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2013-09-05 14:22:12 +02:00
|
|
|
OUString aName(rLayoutName);
|
|
|
|
aName += SD_LT_SEPARATOR;
|
2013-08-24 13:15:47 +04:00
|
|
|
aName += SD_RESSTR(STR_LAYOUT_OUTLINE);
|
2011-03-04 21:49:59 -08:00
|
|
|
|
2013-09-05 14:22:12 +02:00
|
|
|
for (sal_Int32 nSheet = 1; nSheet < 10; nSheet++)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2013-09-05 14:22:12 +02:00
|
|
|
OUString aFullName(aName + " " + OUString::number( nSheet ) );
|
2008-03-12 10:28:54 +00:00
|
|
|
SfxStyleSheetBase* pSheet = Find(aFullName, SD_STYLE_FAMILY_MASTERPAGE);
|
2011-03-04 21:49:59 -08:00
|
|
|
|
|
|
|
if (pSheet)
|
|
|
|
rOutlineStyles.push_back(pSheet);
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
2013-03-01 10:55:30 +01:00
|
|
|
|* Create style sheets with default values for the named presentation layout
|
2000-09-18 23:16:46 +00:00
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2013-09-05 14:22:12 +02:00
|
|
|
void SdStyleSheetPool::CreateLayoutStyleSheets(const OUString& rLayoutName, sal_Bool bCheck /*= sal_False*/ )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2008-06-09 14:10:07 +00:00
|
|
|
const sal_uInt16 nUsedMask = SFXSTYLEBIT_ALL & ~SFXSTYLEBIT_USERDEF;
|
|
|
|
|
2006-12-12 15:33:59 +00:00
|
|
|
(void)bCheck;
|
2002-01-09 13:38:46 +00:00
|
|
|
sal_Bool bCreated = sal_False;
|
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
SfxStyleSheetBase* pSheet = NULL;
|
|
|
|
|
2013-09-05 14:22:12 +02:00
|
|
|
OUString aPrefix(rLayoutName + SD_LT_SEPARATOR);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2003-06-26 10:11:49 +00:00
|
|
|
Font aLatinFont, aCJKFont, aCTLFont;
|
|
|
|
|
2006-12-12 15:33:59 +00:00
|
|
|
mpDoc->getDefaultFonts( aLatinFont, aCJKFont, aCTLFont );
|
2003-06-26 10:11:49 +00:00
|
|
|
|
2013-03-01 10:55:30 +01:00
|
|
|
// Font for title and outline
|
2001-06-25 10:50:53 +00:00
|
|
|
SvxFontItem aSvxFontItem( aLatinFont.GetFamily(), aLatinFont.GetName(), aLatinFont.GetStyleName(), aLatinFont.GetPitch(),
|
|
|
|
aLatinFont.GetCharSet(), EE_CHAR_FONTINFO );
|
|
|
|
|
|
|
|
SvxFontItem aSvxFontItemCJK( aCJKFont.GetFamily(), aCJKFont.GetName(), aCJKFont.GetStyleName(), aCJKFont.GetPitch(),
|
|
|
|
aCJKFont.GetCharSet(), EE_CHAR_FONTINFO_CJK );
|
|
|
|
|
|
|
|
SvxFontItem aSvxFontItemCTL( aCTLFont.GetFamily(), aCTLFont.GetName(), aCTLFont.GetStyleName(), aCTLFont.GetPitch(),
|
|
|
|
aCTLFont.GetCharSet(), EE_CHAR_FONTINFO_CTL );
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
Font aBulletFont( GetBulletFont() );
|
|
|
|
|
|
|
|
/**************************************************************************
|
2013-03-01 10:55:30 +01:00
|
|
|
* outline levels
|
2000-09-18 23:16:46 +00:00
|
|
|
**************************************************************************/
|
2013-09-05 14:22:12 +02:00
|
|
|
OUString aName(SD_RESSTR(STR_LAYOUT_OUTLINE));
|
2013-03-02 15:40:14 +01:00
|
|
|
OUString aHelpFile;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
SfxStyleSheetBase* pParent = NULL;
|
2007-05-10 14:22:57 +00:00
|
|
|
SvxLRSpaceItem aSvxLRSpaceItem( EE_PARA_LRSPACE );
|
|
|
|
SvxULSpaceItem aSvxULSpaceItem( EE_PARA_ULSPACE );
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2013-09-05 14:22:12 +02:00
|
|
|
for( sal_Int32 nLevel = 1; nLevel < 10; nLevel++)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2013-09-05 14:22:12 +02:00
|
|
|
OUString aLevelName( aPrefix + aName + " " + OUString::number( nLevel ) ) ;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2008-03-12 10:28:54 +00:00
|
|
|
if (!Find(aLevelName, SD_STYLE_FAMILY_MASTERPAGE))
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2002-01-09 13:38:46 +00:00
|
|
|
bCreated = sal_True;
|
2008-06-09 14:10:07 +00:00
|
|
|
pSheet = &Make(aLevelName, SD_STYLE_FAMILY_MASTERPAGE,nUsedMask);
|
2000-09-18 23:16:46 +00:00
|
|
|
pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_OUTLINE + nLevel );
|
|
|
|
|
2013-09-05 14:22:12 +02:00
|
|
|
pSheet->SetParent( OUString() );
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2013-03-01 10:55:30 +01:00
|
|
|
// attributing for level 1, the others levels inherit
|
2000-09-18 23:16:46 +00:00
|
|
|
if (nLevel == 1)
|
|
|
|
{
|
2002-08-01 10:30:12 +00:00
|
|
|
SfxItemSet& rSet = pSheet->GetItemSet();
|
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
rSet.Put(aSvxFontItem);
|
2000-11-16 12:55:39 +00:00
|
|
|
rSet.Put(aSvxFontItemCJK);
|
|
|
|
rSet.Put(aSvxFontItemCTL);
|
|
|
|
rSet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ) );
|
|
|
|
rSet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ) );
|
|
|
|
rSet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ) );
|
|
|
|
rSet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
|
|
|
|
rSet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ) );
|
|
|
|
rSet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ) );
|
2007-05-10 14:22:57 +00:00
|
|
|
rSet.Put( SvxUnderlineItem(UNDERLINE_NONE, EE_CHAR_UNDERLINE ) );
|
2009-01-05 17:49:45 +00:00
|
|
|
rSet.Put( SvxOverlineItem(UNDERLINE_NONE, EE_CHAR_OVERLINE ) );
|
2007-05-10 14:22:57 +00:00
|
|
|
rSet.Put( SvxCrossedOutItem(STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ) );
|
2014-01-27 16:23:44 +05:30
|
|
|
rSet.Put( SvxCaseMapItem(SVX_CASEMAP_NOT_MAPPED, EE_CHAR_CASEMAP ) );
|
2011-01-17 11:41:00 +01:00
|
|
|
rSet.Put( SvxShadowedItem(sal_False, EE_CHAR_SHADOW ) );
|
|
|
|
rSet.Put( SvxContourItem(sal_False, EE_CHAR_OUTLINE ) );
|
2007-05-10 14:22:57 +00:00
|
|
|
rSet.Put( SvxEmphasisMarkItem(EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK ) );
|
|
|
|
rSet.Put( SvxCharReliefItem(RELIEF_NONE, EE_CHAR_RELIEF) );
|
|
|
|
rSet.Put( SvxColorItem( Color(COL_AUTO), EE_CHAR_COLOR) );
|
2000-11-16 12:55:39 +00:00
|
|
|
rSet.Put( XLineStyleItem(XLINE_NONE) );
|
|
|
|
rSet.Put( XFillStyleItem(XFILL_NONE) );
|
2010-09-17 10:11:29 +02:00
|
|
|
rSet.Put( SdrTextFitToSizeTypeItem(SDRTEXTFIT_AUTOFIT) );
|
2011-03-13 06:22:49 -05:00
|
|
|
rSet.Put( SdrTextAutoGrowHeightItem(sal_False) );
|
2006-12-19 11:57:12 +00:00
|
|
|
// #i16874# enable kerning by default but only for new documents
|
2014-02-19 13:47:30 +02:00
|
|
|
rSet.Put( SvxAutoKernItem( true, EE_CHAR_PAIRKERNING ) );
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
if( nLevel == 1 )
|
|
|
|
{
|
2006-12-12 15:33:59 +00:00
|
|
|
Font f( GetBulletFont() );
|
|
|
|
PutNumBulletItem( pSheet, f );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-17 11:41:00 +01:00
|
|
|
sal_uLong nFontSize = 20;
|
|
|
|
sal_uInt16 nLower = 100;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
switch (nLevel)
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
nFontSize = 32;
|
|
|
|
nLower = 500;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
{
|
|
|
|
nFontSize = 28;
|
|
|
|
nLower = 400;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
{
|
|
|
|
nFontSize = 24;
|
|
|
|
nLower = 300;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 4:
|
|
|
|
{
|
|
|
|
nLower = 200;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// FontSize
|
2011-01-17 11:41:00 +01:00
|
|
|
nFontSize = (sal_uInt16)((nFontSize * 2540L) / 72); // Pt --> 1/100 mm
|
2000-11-16 12:55:39 +00:00
|
|
|
SfxItemSet& rOutlineSet = pSheet->GetItemSet();
|
|
|
|
rOutlineSet.Put( SvxFontHeightItem( nFontSize, 100, EE_CHAR_FONTHEIGHT ) );
|
|
|
|
rOutlineSet.Put( SvxFontHeightItem( nFontSize, 100, EE_CHAR_FONTHEIGHT_CJK ) );
|
2006-04-26 19:45:35 +00:00
|
|
|
rOutlineSet.Put( SvxFontHeightItem( SdDrawDocument::convertFontHeightToCTL( nFontSize ), 100, EE_CHAR_FONTHEIGHT_CTL ) );
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2010-12-02 22:57:42 +01:00
|
|
|
// Line distance (downwards). Stuff around here cleaned up in i35937
|
2000-09-18 23:16:46 +00:00
|
|
|
aSvxULSpaceItem.SetLower(nLower);
|
|
|
|
pSheet->GetItemSet().Put(aSvxULSpaceItem);
|
2002-01-09 13:38:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// if we created outline styles, we need to chain them
|
|
|
|
if( bCreated )
|
|
|
|
{
|
|
|
|
pParent = NULL;
|
2013-09-05 14:22:12 +02:00
|
|
|
for (sal_Int32 nLevel = 1; nLevel < 10; nLevel++)
|
2002-01-09 13:38:46 +00:00
|
|
|
{
|
2013-09-05 14:22:12 +02:00
|
|
|
OUString aLevelName( aPrefix + aName + " " + OUString::number( nLevel ) );
|
2002-01-09 13:38:46 +00:00
|
|
|
|
2008-03-12 10:28:54 +00:00
|
|
|
pSheet = Find(aLevelName, SD_STYLE_FAMILY_MASTERPAGE);
|
2002-01-09 13:38:46 +00:00
|
|
|
|
|
|
|
DBG_ASSERT( pSheet, "missing layout style!");
|
|
|
|
|
|
|
|
if( pSheet )
|
|
|
|
{
|
|
|
|
if (pParent)
|
|
|
|
pSheet->SetParent(pParent->GetName());
|
|
|
|
pParent = pSheet;
|
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2013-03-01 10:55:30 +01:00
|
|
|
* Title
|
2000-09-18 23:16:46 +00:00
|
|
|
**************************************************************************/
|
2013-09-05 14:22:12 +02:00
|
|
|
aName = aPrefix + SD_RESSTR(STR_LAYOUT_TITLE);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2008-03-12 10:28:54 +00:00
|
|
|
if (!Find(aName, SD_STYLE_FAMILY_MASTERPAGE))
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2002-01-09 13:38:46 +00:00
|
|
|
bCreated = sal_True;
|
|
|
|
|
2008-06-09 14:10:07 +00:00
|
|
|
pSheet = &Make(aName, SD_STYLE_FAMILY_MASTERPAGE,nUsedMask);
|
2000-09-18 23:16:46 +00:00
|
|
|
pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_TITLE );
|
2013-09-05 14:22:12 +02:00
|
|
|
pSheet->SetParent( OUString() );
|
2000-09-18 23:16:46 +00:00
|
|
|
SfxItemSet& rTitleSet = pSheet->GetItemSet();
|
|
|
|
rTitleSet.Put(XLineStyleItem(XLINE_NONE));
|
|
|
|
rTitleSet.Put(XFillStyleItem(XFILL_NONE));
|
|
|
|
rTitleSet.Put(aSvxFontItem);
|
2000-11-16 12:55:39 +00:00
|
|
|
rTitleSet.Put(aSvxFontItemCJK);
|
|
|
|
rTitleSet.Put(aSvxFontItemCTL);
|
|
|
|
rTitleSet.Put(SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ) );
|
|
|
|
rTitleSet.Put(SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ) );
|
|
|
|
rTitleSet.Put(SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ) );
|
|
|
|
rTitleSet.Put(SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
|
|
|
|
rTitleSet.Put(SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ) );
|
|
|
|
rTitleSet.Put(SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ) );
|
|
|
|
rTitleSet.Put(SvxFontHeightItem( 1552, 100, EE_CHAR_FONTHEIGHT ) ); // 44 pt
|
|
|
|
rTitleSet.Put(SvxFontHeightItem( 1552, 100, EE_CHAR_FONTHEIGHT_CJK ) ); // 44 pt
|
2006-04-26 19:45:35 +00:00
|
|
|
rTitleSet.Put(SvxFontHeightItem( SdDrawDocument::convertFontHeightToCTL( 1552 ), 100, EE_CHAR_FONTHEIGHT_CTL ) ); // 44 pt
|
2007-05-10 14:22:57 +00:00
|
|
|
rTitleSet.Put(SvxUnderlineItem(UNDERLINE_NONE, EE_CHAR_UNDERLINE ));
|
2009-01-05 17:49:45 +00:00
|
|
|
rTitleSet.Put(SvxOverlineItem(UNDERLINE_NONE, EE_CHAR_OVERLINE ));
|
2007-05-10 14:22:57 +00:00
|
|
|
rTitleSet.Put(SvxCrossedOutItem(STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ));
|
2014-01-27 16:23:44 +05:30
|
|
|
rTitleSet.Put(SvxCaseMapItem(SVX_CASEMAP_NOT_MAPPED, EE_CHAR_CASEMAP ));
|
2011-01-17 11:41:00 +01:00
|
|
|
rTitleSet.Put(SvxShadowedItem(sal_False, EE_CHAR_SHADOW ));
|
|
|
|
rTitleSet.Put(SvxContourItem(sal_False, EE_CHAR_OUTLINE ));
|
2007-05-10 14:22:57 +00:00
|
|
|
rTitleSet.Put( SvxEmphasisMarkItem(EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK ) );
|
|
|
|
rTitleSet.Put( SvxCharReliefItem(RELIEF_NONE, EE_CHAR_RELIEF ) );
|
|
|
|
rTitleSet.Put(SvxColorItem( Color(COL_AUTO), EE_CHAR_COLOR ));
|
|
|
|
rTitleSet.Put(SvxAdjustItem(SVX_ADJUST_CENTER, EE_PARA_JUST ));
|
2000-09-18 23:16:46 +00:00
|
|
|
rTitleSet.Put( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_CENTER ) );
|
2006-12-19 11:57:12 +00:00
|
|
|
// #i16874# enable kerning by default but only for new documents
|
2014-02-19 13:47:30 +02:00
|
|
|
rTitleSet.Put( SvxAutoKernItem( true, EE_CHAR_PAIRKERNING ) );
|
2006-12-19 11:57:12 +00:00
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
aBulletFont.SetSize(Size(0,1552)); // 44 pt
|
|
|
|
PutNumBulletItem( pSheet, aBulletFont );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2013-03-01 10:55:30 +01:00
|
|
|
* Subtitle
|
2000-09-18 23:16:46 +00:00
|
|
|
**************************************************************************/
|
2013-09-05 14:22:12 +02:00
|
|
|
aName = aPrefix + SD_RESSTR(STR_LAYOUT_SUBTITLE);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2008-03-12 10:28:54 +00:00
|
|
|
if (!Find(aName, SD_STYLE_FAMILY_MASTERPAGE))
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2002-01-09 13:38:46 +00:00
|
|
|
bCreated = sal_True;
|
|
|
|
|
2008-06-09 14:10:07 +00:00
|
|
|
pSheet = &Make(aName, SD_STYLE_FAMILY_MASTERPAGE,nUsedMask);
|
2000-09-18 23:16:46 +00:00
|
|
|
pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_SUBTITLE );
|
2013-09-05 14:22:12 +02:00
|
|
|
pSheet->SetParent( OUString() );
|
2000-09-18 23:16:46 +00:00
|
|
|
SfxItemSet& rSubtitleSet = pSheet->GetItemSet();
|
|
|
|
rSubtitleSet.Put(XLineStyleItem(XLINE_NONE));
|
|
|
|
rSubtitleSet.Put(XFillStyleItem(XFILL_NONE));
|
|
|
|
rSubtitleSet.Put(aSvxFontItem);
|
2000-11-16 12:55:39 +00:00
|
|
|
rSubtitleSet.Put(aSvxFontItemCJK);
|
|
|
|
rSubtitleSet.Put(aSvxFontItemCTL);
|
|
|
|
rSubtitleSet.Put(SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ) );
|
|
|
|
rSubtitleSet.Put(SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ) );
|
|
|
|
rSubtitleSet.Put(SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ) );
|
|
|
|
rSubtitleSet.Put(SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
|
|
|
|
rSubtitleSet.Put(SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ) );
|
|
|
|
rSubtitleSet.Put(SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ) );
|
|
|
|
rSubtitleSet.Put( SvxFontHeightItem( 1129, 100, EE_CHAR_FONTHEIGHT ) ); // 32 pt
|
|
|
|
rSubtitleSet.Put( SvxFontHeightItem( 1129, 100, EE_CHAR_FONTHEIGHT_CJK ) ); // 32 pt
|
2006-04-26 19:45:35 +00:00
|
|
|
rSubtitleSet.Put( SvxFontHeightItem( SdDrawDocument::convertFontHeightToCTL( 1129 ), 100, EE_CHAR_FONTHEIGHT_CTL ) ); // 32 pt
|
2007-05-10 14:22:57 +00:00
|
|
|
rSubtitleSet.Put(SvxUnderlineItem(UNDERLINE_NONE, EE_CHAR_UNDERLINE ));
|
2009-01-05 17:49:45 +00:00
|
|
|
rSubtitleSet.Put(SvxOverlineItem(UNDERLINE_NONE, EE_CHAR_OVERLINE ));
|
2007-05-10 14:22:57 +00:00
|
|
|
rSubtitleSet.Put(SvxCrossedOutItem(STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ));
|
2014-01-27 16:23:44 +05:30
|
|
|
rSubtitleSet.Put(SvxCaseMapItem(SVX_CASEMAP_NOT_MAPPED, EE_CHAR_CASEMAP ));
|
2011-01-17 11:41:00 +01:00
|
|
|
rSubtitleSet.Put(SvxShadowedItem(sal_False, EE_CHAR_SHADOW ));
|
|
|
|
rSubtitleSet.Put(SvxContourItem(sal_False, EE_CHAR_OUTLINE ));
|
2007-05-10 14:22:57 +00:00
|
|
|
rSubtitleSet.Put( SvxEmphasisMarkItem(EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK ) );
|
|
|
|
rSubtitleSet.Put( SvxCharReliefItem(RELIEF_NONE, EE_CHAR_RELIEF ) );
|
|
|
|
rSubtitleSet.Put(SvxColorItem( Color(COL_AUTO), EE_CHAR_COLOR ));
|
|
|
|
rSubtitleSet.Put(SvxAdjustItem(SVX_ADJUST_CENTER, EE_PARA_JUST ));
|
2000-09-18 23:16:46 +00:00
|
|
|
rSubtitleSet.Put( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_CENTER ) );
|
2006-12-19 11:57:12 +00:00
|
|
|
// #i16874# enable kerning by default but only for new documents
|
2014-02-19 13:47:30 +02:00
|
|
|
rSubtitleSet.Put( SvxAutoKernItem( true, EE_CHAR_PAIRKERNING ) );
|
2000-09-18 23:16:46 +00:00
|
|
|
aSvxLRSpaceItem.SetTxtLeft(0);
|
|
|
|
rSubtitleSet.Put(aSvxLRSpaceItem);
|
2006-12-12 15:33:59 +00:00
|
|
|
|
|
|
|
Font aTmpFont( GetBulletFont() );
|
|
|
|
aTmpFont.SetSize(Size(0, 1129)); // 32 pt
|
|
|
|
PutNumBulletItem( pSheet, aTmpFont );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2013-03-01 10:55:30 +01:00
|
|
|
* Notes
|
2000-09-18 23:16:46 +00:00
|
|
|
**************************************************************************/
|
2013-09-05 14:22:12 +02:00
|
|
|
aName = aPrefix + SD_RESSTR(STR_LAYOUT_NOTES);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2008-03-12 10:28:54 +00:00
|
|
|
if (!Find(aName, SD_STYLE_FAMILY_MASTERPAGE))
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2002-01-09 13:38:46 +00:00
|
|
|
bCreated = sal_True;
|
|
|
|
|
2008-06-09 14:10:07 +00:00
|
|
|
pSheet = &Make(aName, SD_STYLE_FAMILY_MASTERPAGE,nUsedMask);
|
2000-09-18 23:16:46 +00:00
|
|
|
pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_NOTES );
|
2013-09-05 14:22:12 +02:00
|
|
|
pSheet->SetParent( OUString() );
|
2000-09-18 23:16:46 +00:00
|
|
|
SfxItemSet& rNotesSet = pSheet->GetItemSet();
|
|
|
|
rNotesSet.Put(XLineStyleItem(XLINE_NONE));
|
|
|
|
rNotesSet.Put(XFillStyleItem(XFILL_NONE));
|
|
|
|
rNotesSet.Put(aSvxFontItem);
|
2000-11-16 12:55:39 +00:00
|
|
|
rNotesSet.Put(aSvxFontItemCJK);
|
|
|
|
rNotesSet.Put(aSvxFontItemCTL);
|
|
|
|
rNotesSet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ) );
|
|
|
|
rNotesSet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ) );
|
|
|
|
rNotesSet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ) );
|
|
|
|
rNotesSet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
|
|
|
|
rNotesSet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ) );
|
|
|
|
rNotesSet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ) );
|
2001-07-09 09:24:24 +00:00
|
|
|
rNotesSet.Put( SvxFontHeightItem( 705, 100, EE_CHAR_FONTHEIGHT ) ); // 20 pt
|
|
|
|
rNotesSet.Put( SvxFontHeightItem( 705, 100, EE_CHAR_FONTHEIGHT_CJK ) ); // 20 pt
|
2006-04-26 19:45:35 +00:00
|
|
|
rNotesSet.Put( SvxFontHeightItem( SdDrawDocument::convertFontHeightToCTL( 705 ), 100, EE_CHAR_FONTHEIGHT_CTL ) ); // 20 pt
|
2007-05-10 14:22:57 +00:00
|
|
|
rNotesSet.Put( SvxUnderlineItem(UNDERLINE_NONE, EE_CHAR_UNDERLINE ) );
|
2009-01-05 17:49:45 +00:00
|
|
|
rNotesSet.Put( SvxOverlineItem(UNDERLINE_NONE, EE_CHAR_OVERLINE ) );
|
2007-05-10 14:22:57 +00:00
|
|
|
rNotesSet.Put( SvxCrossedOutItem(STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ) );
|
2014-01-27 16:23:44 +05:30
|
|
|
rNotesSet.Put( SvxCaseMapItem(SVX_CASEMAP_NOT_MAPPED, EE_CHAR_CASEMAP ) );
|
2011-01-17 11:41:00 +01:00
|
|
|
rNotesSet.Put( SvxShadowedItem(sal_False, EE_CHAR_SHADOW ) );
|
|
|
|
rNotesSet.Put( SvxContourItem(sal_False, EE_CHAR_OUTLINE ) );
|
2007-05-10 14:22:57 +00:00
|
|
|
rNotesSet.Put( SvxEmphasisMarkItem(EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK ) );
|
|
|
|
rNotesSet.Put( SvxCharReliefItem(RELIEF_NONE, EE_CHAR_RELIEF) );
|
|
|
|
rNotesSet.Put( SvxColorItem( Color(COL_AUTO), EE_CHAR_COLOR ) );
|
|
|
|
rNotesSet.Put( SvxLRSpaceItem( 0, 0, 600, -600, EE_PARA_LRSPACE ) );
|
2006-12-19 11:57:12 +00:00
|
|
|
// #i16874# enable kerning by default but only for new documents
|
2014-02-19 13:47:30 +02:00
|
|
|
rNotesSet.Put( SvxAutoKernItem( true, EE_CHAR_PAIRKERNING ) );
|
2002-11-27 15:49:25 +00:00
|
|
|
|
2010-12-02 22:57:42 +01:00
|
|
|
/* #i35937# */
|
2002-11-27 15:49:25 +00:00
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2013-03-01 10:55:30 +01:00
|
|
|
* Background objects
|
2000-09-18 23:16:46 +00:00
|
|
|
**************************************************************************/
|
2013-09-05 14:22:12 +02:00
|
|
|
aName = aPrefix + SD_RESSTR(STR_LAYOUT_BACKGROUNDOBJECTS);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2008-03-12 10:28:54 +00:00
|
|
|
if (!Find(aName, SD_STYLE_FAMILY_MASTERPAGE))
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2002-01-09 13:38:46 +00:00
|
|
|
bCreated = sal_True;
|
|
|
|
|
2008-06-09 14:10:07 +00:00
|
|
|
pSheet = &Make(aName, SD_STYLE_FAMILY_MASTERPAGE,nUsedMask);
|
2000-09-18 23:16:46 +00:00
|
|
|
pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_BACKGROUNDOBJECTS );
|
2013-09-05 14:22:12 +02:00
|
|
|
pSheet->SetParent( OUString() );
|
2000-09-18 23:16:46 +00:00
|
|
|
SfxItemSet& rBackgroundObjectsSet = pSheet->GetItemSet();
|
2011-01-17 11:41:00 +01:00
|
|
|
rBackgroundObjectsSet.Put(SdrShadowItem(sal_False));
|
2013-01-30 10:40:45 +00:00
|
|
|
rBackgroundObjectsSet.Put(SdrShadowColorItem(Color(COL_GRAY)));
|
2013-03-01 10:55:30 +01:00
|
|
|
rBackgroundObjectsSet.Put(SdrShadowXDistItem(200)); // 3 mm shadow distance
|
2010-11-30 16:49:41 +01:00
|
|
|
rBackgroundObjectsSet.Put(SdrShadowYDistItem(200));
|
2006-12-19 11:57:12 +00:00
|
|
|
// #i16874# enable kerning by default but only for new documents
|
2014-02-19 13:47:30 +02:00
|
|
|
rBackgroundObjectsSet.Put( SvxAutoKernItem( true, EE_CHAR_PAIRKERNING ) );
|
2010-09-23 15:20:37 +02:00
|
|
|
rBackgroundObjectsSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_BLOCK));
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2013-03-01 10:55:30 +01:00
|
|
|
* Background
|
2000-09-18 23:16:46 +00:00
|
|
|
**************************************************************************/
|
2013-09-05 14:22:12 +02:00
|
|
|
aName = aPrefix + SD_RESSTR(STR_LAYOUT_BACKGROUND);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2008-03-12 10:28:54 +00:00
|
|
|
if (!Find(aName, SD_STYLE_FAMILY_MASTERPAGE))
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2002-01-09 13:38:46 +00:00
|
|
|
bCreated = sal_True;
|
|
|
|
|
2008-06-09 14:10:07 +00:00
|
|
|
pSheet = &Make(aName, SD_STYLE_FAMILY_MASTERPAGE,nUsedMask);
|
2000-09-18 23:16:46 +00:00
|
|
|
pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_BACKGROUND );
|
2013-09-05 14:22:12 +02:00
|
|
|
pSheet->SetParent( OUString() );
|
2000-09-18 23:16:46 +00:00
|
|
|
SfxItemSet& rBackgroundSet = pSheet->GetItemSet();
|
|
|
|
rBackgroundSet.Put(XLineStyleItem(XLINE_NONE));
|
|
|
|
rBackgroundSet.Put(XFillStyleItem(XFILL_NONE));
|
2006-12-19 11:57:12 +00:00
|
|
|
// #i16874# enable kerning by default but only for new documents
|
2014-02-19 13:47:30 +02:00
|
|
|
rBackgroundSet.Put( SvxAutoKernItem( true, EE_CHAR_PAIRKERNING ) );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
2002-01-09 13:38:46 +00:00
|
|
|
|
|
|
|
DBG_ASSERT( !bCheck || !bCreated, "missing layout style sheets detected!" );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
2013-03-01 10:55:30 +01:00
|
|
|
|* Copy graphic style sheets from source pool into this pool
|
2000-09-18 23:16:46 +00:00
|
|
|
|*
|
2013-03-01 10:55:30 +01:00
|
|
|
|* (rSourcePool can not be const since SfxStyleSheetPoolBase::Find isn't const)
|
2000-09-18 23:16:46 +00:00
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
void SdStyleSheetPool::CopyGraphicSheets(SdStyleSheetPool& rSourcePool)
|
|
|
|
{
|
2008-03-12 10:28:54 +00:00
|
|
|
CopySheets( rSourcePool, SD_STYLE_FAMILY_GRAPHICS );
|
|
|
|
}
|
|
|
|
|
|
|
|
void SdStyleSheetPool::CopyCellSheets(SdStyleSheetPool& rSourcePool)
|
|
|
|
{
|
|
|
|
CopySheets( rSourcePool, SD_STYLE_FAMILY_CELL );
|
|
|
|
}
|
|
|
|
|
|
|
|
void SdStyleSheetPool::CopyTableStyles(SdStyleSheetPool& rSourcePool)
|
|
|
|
{
|
|
|
|
Reference< XIndexAccess > xSource( rSourcePool.mxTableFamily, UNO_QUERY );
|
|
|
|
Reference< XNameContainer > xTarget( mxTableFamily, UNO_QUERY );
|
|
|
|
Reference< XSingleServiceFactory > xFactory( mxTableFamily, UNO_QUERY );
|
|
|
|
|
|
|
|
if( xSource.is() && xFactory.is() && mxTableFamily.is() )
|
|
|
|
{
|
|
|
|
for( sal_Int32 nIndex = 0; nIndex < xSource->getCount(); nIndex++ ) try
|
|
|
|
{
|
|
|
|
Reference< XStyle > xSourceTableStyle( xSource->getByIndex( nIndex ), UNO_QUERY );
|
|
|
|
if( xSourceTableStyle.is() )
|
|
|
|
{
|
|
|
|
Reference< XStyle > xNewTableStyle( xFactory->createInstance(), UNO_QUERY );
|
|
|
|
if( xNewTableStyle.is() )
|
|
|
|
{
|
|
|
|
Reference< XNameAccess> xSourceNames( xSourceTableStyle, UNO_QUERY_THROW );
|
|
|
|
|
|
|
|
Sequence< OUString > aStyleNames( xSourceNames->getElementNames() );
|
|
|
|
OUString* pStyleNames( aStyleNames.getArray() );
|
|
|
|
|
|
|
|
Reference< XNameReplace > xTargetNames( xNewTableStyle, UNO_QUERY );
|
|
|
|
|
|
|
|
sal_Int32 nNames = aStyleNames.getLength();
|
|
|
|
while( nNames-- )
|
|
|
|
{
|
|
|
|
const OUString aName( *pStyleNames++ );
|
|
|
|
Reference< XStyle > xSourceStyle( xSourceNames->getByName( aName ), UNO_QUERY );
|
|
|
|
Reference< XStyle > xTargetStyle;
|
|
|
|
if( xSourceStyle.is() ) try
|
|
|
|
{
|
|
|
|
mxCellFamily->getByName( xSourceStyle->getName() ) >>= xTargetStyle;
|
|
|
|
}
|
|
|
|
catch( Exception& )
|
|
|
|
{
|
2011-03-01 19:06:55 +01:00
|
|
|
OSL_FAIL( "sd::SdStyleSheetPool::CopyTableStyles(), exception caught!" );
|
2008-03-12 10:28:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( xTargetStyle.is() )
|
|
|
|
xTargetNames->replaceByName( aName, Any( xTargetStyle ) );
|
|
|
|
}
|
|
|
|
}
|
2008-07-02 10:47:01 +00:00
|
|
|
|
2013-05-02 10:36:43 +02:00
|
|
|
OUString sName( xSourceTableStyle->getName() );
|
2008-07-02 10:47:01 +00:00
|
|
|
if( xTarget->hasByName( sName ) )
|
|
|
|
xTarget->replaceByName( sName, Any( xNewTableStyle ) );
|
|
|
|
else
|
|
|
|
xTarget->insertByName( sName, Any( xNewTableStyle ) );
|
2008-03-12 10:28:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
catch( Exception& )
|
|
|
|
{
|
2011-03-01 19:06:55 +01:00
|
|
|
OSL_FAIL("sd::SdStyleSheetPool::CopyTableStyles(), exception caught!");
|
2008-03-12 10:28:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-01-17 15:01:32 +01:00
|
|
|
void SdStyleSheetPool::CopyCellSheets(SdStyleSheetPool& rSourcePool, SdStyleSheetVector& rCreatedSheets)
|
|
|
|
{
|
|
|
|
CopySheets( rSourcePool, SD_STYLE_FAMILY_CELL, rCreatedSheets );
|
|
|
|
}
|
|
|
|
|
2014-02-13 16:10:47 +05:30
|
|
|
void SdStyleSheetPool::RenameAndCopyGraphicSheets(SdStyleSheetPool& rSourcePool, SdStyleSheetVector& rCreatedSheets, OUString &rRenameSuffix)
|
|
|
|
{
|
|
|
|
RenameAndCopySheets( rSourcePool, SD_STYLE_FAMILY_GRAPHICS, rCreatedSheets, rRenameSuffix );
|
|
|
|
}
|
|
|
|
|
2008-03-12 10:28:54 +00:00
|
|
|
void SdStyleSheetPool::CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily )
|
2013-01-17 15:01:32 +01:00
|
|
|
{
|
|
|
|
SdStyleSheetVector aTmpSheets;
|
|
|
|
CopySheets(rSourcePool, eFamily, aTmpSheets);
|
|
|
|
}
|
|
|
|
|
2014-02-13 16:10:47 +05:30
|
|
|
void SdStyleSheetPool::RenameAndCopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily, SdStyleSheetVector& rCreatedSheets, OUString &rRenameSuffix)
|
|
|
|
{
|
|
|
|
CopySheets( rSourcePool, eFamily, rCreatedSheets, rRenameSuffix );
|
|
|
|
}
|
|
|
|
|
2013-01-17 15:01:32 +01:00
|
|
|
void SdStyleSheetPool::CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily, SdStyleSheetVector& rCreatedSheets)
|
2014-02-13 16:10:47 +05:30
|
|
|
{
|
|
|
|
OUString emptyName;
|
|
|
|
CopySheets(rSourcePool, eFamily, rCreatedSheets, emptyName);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SdStyleSheetPool::CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily, SdStyleSheetVector& rCreatedSheets, OUString& rRenameSuffix)
|
2008-03-12 10:28:54 +00:00
|
|
|
{
|
2013-03-02 15:40:14 +01:00
|
|
|
OUString aHelpFile;
|
2008-11-20 14:55:36 +00:00
|
|
|
|
2008-03-12 10:28:54 +00:00
|
|
|
sal_uInt32 nCount = rSourcePool.aStyles.size();
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2013-09-05 14:22:12 +02:00
|
|
|
std::vector< std::pair< rtl::Reference< SfxStyleSheetBase >, OUString > > aNewStyles;
|
2014-02-13 16:10:47 +05:30
|
|
|
std::vector< std::pair< OUString, OUString > > aRenamedList;
|
2003-03-27 09:58:12 +00:00
|
|
|
|
2008-03-12 10:28:54 +00:00
|
|
|
for (sal_uInt32 n = 0; n < nCount; n++)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2008-03-12 10:28:54 +00:00
|
|
|
rtl::Reference< SfxStyleSheetBase > xSheet( rSourcePool.aStyles[sal::static_int_cast<sal_uInt16>(n)] );
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2008-03-12 10:28:54 +00:00
|
|
|
if( xSheet->GetFamily() == eFamily )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2014-02-13 16:10:47 +05:30
|
|
|
bool bAddToList = false;
|
2013-09-05 14:22:12 +02:00
|
|
|
OUString aName( xSheet->GetName() );
|
2014-02-13 16:10:47 +05:30
|
|
|
SfxStyleSheetBase* pExistingSheet = Find(aName, eFamily);
|
|
|
|
if( pExistingSheet && !rRenameSuffix.isEmpty() )
|
|
|
|
{
|
Stick to a single O[U]String hash function
8f8bc0dcf3bc253ae49159d52db049767f476ced "Move string hash function into String
class" had introduced a new getHash64 that, besides returning sal_uInt64 instead
of just sal_Int32, didn't do sampling of only a handful of characters, but
always computed the hash over all characters (as the usage in SfxItemSet and
SdPage appears to require for either performance or approximated correctness).
However, it would be advantageous to keep the stable URE interface as small as
possible. Now, O(1) sampling was apparently considered state of the art when
the rtl string classes were first created, closely copying java.lang.String,
which at that time demanded sampling for hashCode(), too---but never sampling
more than 15 characters, with the obvious (in hindsight, at least) performance
catastrophes, so they changed it to O(n) somewhere along the way.
Based on that, this commit changes the existing hash functions to not do
sampling any more, and removes the newly introduced -64 variants again. (Where
the extended value range of sal_uInt64 compared to sal_Int32 was hopefully not
vital to the existing uses.)
The old implementation used sampling only for strings of length >= 256, so I did
a "make check" build with an instrumented hash function that flagged all uses
with inputs of length >= 256, and grepped workdir/{Cppunit,Junit,Python}Test for
hits. Of the 2849 hits encountered, 2845 where in the range from 256 to 295
characters, and only the remaining four where of 2472 characters. Those four
were from CppunitTest_sc_subsequent_filters_test, importing long text into a
cell, causing ScDocumentImport::setStringCell to call
svl::SharedStringPool::intern, which internally uses an unordered_set. These
results appear to justify the change.
Change-Id: I78fcc3b0f07389bdf36a21701b95a1ff0a0d970f
2014-02-18 12:49:50 +01:00
|
|
|
sal_Int32 nHash = xSheet->GetItemSet().getHash();
|
2014-02-13 16:10:47 +05:30
|
|
|
if( pExistingSheet->GetItemSet().getHash() != nHash )
|
|
|
|
{
|
|
|
|
OUString aTmpName = aName + rRenameSuffix;
|
|
|
|
sal_Int32 nSuffix = 1;
|
|
|
|
do
|
|
|
|
{
|
2014-02-13 12:45:51 +01:00
|
|
|
aTmpName = aName + rRenameSuffix + OUString::number(nSuffix);
|
2014-02-13 16:10:47 +05:30
|
|
|
pExistingSheet = Find(aTmpName, eFamily);
|
|
|
|
nSuffix++;
|
|
|
|
} while( pExistingSheet && pExistingSheet->GetItemSet().getHash() != nHash );
|
|
|
|
aName = aTmpName;
|
|
|
|
bAddToList = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( !pExistingSheet )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2008-03-12 10:28:54 +00:00
|
|
|
rtl::Reference< SfxStyleSheetBase > xNewSheet( &Make( aName, eFamily ) );
|
2001-09-26 15:19:08 +00:00
|
|
|
|
2008-03-12 10:28:54 +00:00
|
|
|
xNewSheet->SetMask( xSheet->GetMask() );
|
2005-03-23 12:56:08 +00:00
|
|
|
|
2011-02-07 22:11:09 +01:00
|
|
|
// Also set parent relation for copied style sheets
|
2013-09-05 14:22:12 +02:00
|
|
|
OUString aParent( xSheet->GetParent() );
|
|
|
|
if( !aParent.isEmpty() )
|
|
|
|
aNewStyles.push_back( std::pair< rtl::Reference< SfxStyleSheetBase >, OUString >( xNewSheet, aParent ) );
|
2001-09-26 15:19:08 +00:00
|
|
|
|
2008-11-20 14:55:36 +00:00
|
|
|
xNewSheet->SetHelpId( aHelpFile, xSheet->GetHelpId( aHelpFile ) );
|
2008-03-12 10:28:54 +00:00
|
|
|
xNewSheet->GetItemSet().Put( xSheet->GetItemSet() );
|
2013-01-17 15:01:32 +01:00
|
|
|
|
|
|
|
rCreatedSheets.push_back( SdStyleSheetRef( static_cast< SdStyleSheet* >( xNewSheet.get() ) ) );
|
2014-02-13 16:10:47 +05:30
|
|
|
aRenamedList.push_back( std::pair< OUString, OUString >( xSheet->GetName(), aName ) );
|
|
|
|
}
|
|
|
|
else if( bAddToList )
|
|
|
|
{
|
|
|
|
// Add to list - used for renaming
|
|
|
|
rCreatedSheets.push_back( SdStyleSheetRef( static_cast< SdStyleSheet* >( pExistingSheet ) ) );
|
|
|
|
aRenamedList.push_back( std::pair< OUString, OUString >( xSheet->GetName(), aName ) );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2003-03-27 09:58:12 +00:00
|
|
|
|
|
|
|
// set parents on newly added stylesheets
|
2013-09-05 14:22:12 +02:00
|
|
|
std::vector< std::pair< rtl::Reference< SfxStyleSheetBase >, OUString > >::iterator aIter;
|
2010-12-24 13:28:18 +00:00
|
|
|
for( aIter = aNewStyles.begin(); aIter != aNewStyles.end(); ++aIter )
|
2003-03-27 09:58:12 +00:00
|
|
|
{
|
2014-02-13 16:10:47 +05:30
|
|
|
if( !rRenameSuffix.isEmpty() )
|
|
|
|
{
|
|
|
|
SfxStyleSheet *pParent = lcl_findStyle(rCreatedSheets, lcl_findRenamedStyleName(aRenamedList, (*aIter).second));
|
|
|
|
if( pParent )
|
|
|
|
{
|
|
|
|
(*aIter).first->SetParent( pParent->GetName() );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
2008-03-12 10:28:54 +00:00
|
|
|
DBG_ASSERT( rSourcePool.Find( (*aIter).second, eFamily ), "StyleSheet has invalid parent: Family mismatch" );
|
2003-03-27 09:58:12 +00:00
|
|
|
(*aIter).first->SetParent( (*aIter).second );
|
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
2013-03-01 10:55:30 +01:00
|
|
|
|* Copy style sheets of the named presentation layout from the source pool into
|
|
|
|
|* this pool. Copies only the style sheets which aren't yet in this pool.
|
|
|
|
|* If not NULL, pCreatedSheets is filled with pointers to the created style
|
|
|
|
|* sheets.
|
2000-09-18 23:16:46 +00:00
|
|
|
|*
|
2013-03-01 10:55:30 +01:00
|
|
|
|* (rSourcePool can not be const since SfxStyleSheetPoolBase::Find isn't const)
|
2000-09-18 23:16:46 +00:00
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2013-09-05 14:22:12 +02:00
|
|
|
void SdStyleSheetPool::CopyLayoutSheets(const OUString& rLayoutName, SdStyleSheetPool& rSourcePool, SdStyleSheetVector& rCreatedSheets)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
SfxStyleSheetBase* pSheet = NULL;
|
|
|
|
|
2013-09-05 14:22:12 +02:00
|
|
|
std::vector<OUString> aNameList;
|
2011-03-04 21:18:25 -08:00
|
|
|
CreateLayoutSheetNames(rLayoutName,aNameList);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2013-03-02 15:40:14 +01:00
|
|
|
OUString sEmpty;
|
2013-09-05 14:22:12 +02:00
|
|
|
for (std::vector<OUString>::const_iterator it = aNameList.begin(); it != aNameList.end(); ++it)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2011-03-04 21:18:25 -08:00
|
|
|
pSheet = Find(*it, SD_STYLE_FAMILY_MASTERPAGE);
|
2000-09-18 23:16:46 +00:00
|
|
|
if (!pSheet)
|
|
|
|
{
|
2011-03-04 21:18:25 -08:00
|
|
|
SfxStyleSheetBase* pSourceSheet = rSourcePool.Find(*it, SD_STYLE_FAMILY_MASTERPAGE);
|
2013-03-11 22:51:42 +01:00
|
|
|
DBG_ASSERT(pSourceSheet, "CopyLayoutSheets: Style sheet missing");
|
2008-03-12 10:28:54 +00:00
|
|
|
if (pSourceSheet)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2013-03-01 10:55:30 +01:00
|
|
|
// In the case one comes with Methusalem-Docs.
|
2011-03-04 21:18:25 -08:00
|
|
|
SfxStyleSheetBase& rNewSheet = Make(*it, SD_STYLE_FAMILY_MASTERPAGE);
|
2008-11-20 14:55:36 +00:00
|
|
|
rNewSheet.SetHelpId( sEmpty, pSourceSheet->GetHelpId( sEmpty ) );
|
2000-09-18 23:16:46 +00:00
|
|
|
rNewSheet.GetItemSet().Put(pSourceSheet->GetItemSet());
|
2008-03-12 10:28:54 +00:00
|
|
|
rCreatedSheets.push_back( SdStyleSheetRef( static_cast< SdStyleSheet* >( &rNewSheet ) ) );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-01 10:55:30 +01:00
|
|
|
// Special treatment for outline templates: create parent relation
|
2011-03-04 21:49:59 -08:00
|
|
|
std::vector<SfxStyleSheetBase*> aOutlineSheets;
|
|
|
|
CreateOutlineSheetList(rLayoutName,aOutlineSheets);
|
|
|
|
|
2012-01-10 11:42:11 +01:00
|
|
|
if( !aOutlineSheets.empty() )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2012-01-10 11:42:11 +01:00
|
|
|
std::vector<SfxStyleSheetBase*>::iterator it = aOutlineSheets.begin();
|
|
|
|
SfxStyleSheetBase* pParent = *it;
|
|
|
|
++it;
|
2011-03-04 21:49:59 -08:00
|
|
|
|
2012-01-10 11:42:11 +01:00
|
|
|
while (it != aOutlineSheets.end())
|
|
|
|
{
|
|
|
|
pSheet = *it;
|
2011-03-04 21:49:59 -08:00
|
|
|
|
2012-01-10 11:42:11 +01:00
|
|
|
if (!pSheet)
|
|
|
|
break;
|
2011-03-04 21:49:59 -08:00
|
|
|
|
2013-07-05 16:25:03 -05:00
|
|
|
if (pSheet->GetParent().isEmpty())
|
2012-01-10 11:42:11 +01:00
|
|
|
pSheet->SetParent(pParent->GetName());
|
2011-03-04 21:49:59 -08:00
|
|
|
|
2012-01-10 11:42:11 +01:00
|
|
|
pParent = pSheet;
|
|
|
|
|
|
|
|
++it;
|
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
2013-03-01 10:55:30 +01:00
|
|
|
|* Create list with names of the presentation templates of a layout.
|
|
|
|
|* The list and the containing strings are owned by the caller!
|
2000-09-18 23:16:46 +00:00
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2013-09-05 14:22:12 +02:00
|
|
|
void SdStyleSheetPool::CreateLayoutSheetNames(const OUString& rLayoutName, std::vector<OUString> &aNameList) const
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2013-09-05 14:22:12 +02:00
|
|
|
OUString aPrefix(rLayoutName + SD_LT_SEPARATOR);
|
|
|
|
OUString aName(SD_RESSTR(STR_LAYOUT_OUTLINE));
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2013-09-05 14:22:12 +02:00
|
|
|
for (sal_Int32 nLevel = 1; nLevel < 10; nLevel++)
|
|
|
|
aNameList.push_back( aPrefix + aName + " " + OUString::number( nLevel ) );
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2013-09-05 14:22:12 +02:00
|
|
|
aNameList.push_back( aPrefix + SD_RESSTR(STR_LAYOUT_TITLE) );
|
|
|
|
aNameList.push_back( aPrefix + SD_RESSTR(STR_LAYOUT_SUBTITLE) );
|
|
|
|
aNameList.push_back( aPrefix + SD_RESSTR(STR_LAYOUT_NOTES) );
|
|
|
|
aNameList.push_back( aPrefix + SD_RESSTR(STR_LAYOUT_BACKGROUNDOBJECTS) );
|
|
|
|
aNameList.push_back( aPrefix + SD_RESSTR(STR_LAYOUT_BACKGROUND) );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
2013-03-01 10:55:30 +01:00
|
|
|
|* Create a list with pointer to presentation templates of a layout.
|
|
|
|
|* The list is owned by the caller!
|
2000-09-18 23:16:46 +00:00
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2013-09-05 14:22:12 +02:00
|
|
|
void SdStyleSheetPool::CreateLayoutSheetList(const OUString& rLayoutName, SdStyleSheetVector& rLayoutSheets )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2013-07-05 16:25:03 -05:00
|
|
|
OUString aLayoutNameWithSep(rLayoutName + OUString(SD_LT_SEPARATOR ));
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2008-03-12 10:28:54 +00:00
|
|
|
SfxStyleSheetIterator aIter(this, SD_STYLE_FAMILY_MASTERPAGE);
|
2000-09-18 23:16:46 +00:00
|
|
|
SfxStyleSheetBase* pSheet = aIter.First();
|
|
|
|
|
|
|
|
while (pSheet)
|
|
|
|
{
|
2013-07-05 16:25:03 -05:00
|
|
|
if (pSheet->GetName().startsWith(aLayoutNameWithSep))
|
2008-03-12 10:28:54 +00:00
|
|
|
rLayoutSheets.push_back( SdStyleSheetRef( static_cast< SdStyleSheet* >( pSheet ) ) );
|
2000-09-18 23:16:46 +00:00
|
|
|
pSheet = aIter.Next();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
2013-03-01 10:55:30 +01:00
|
|
|
|* Create pseudo style sheets if necessary
|
2000-09-18 23:16:46 +00:00
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
void SdStyleSheetPool::CreatePseudosIfNecessary()
|
|
|
|
{
|
2013-09-05 14:22:12 +02:00
|
|
|
OUString aName;
|
2013-03-02 15:40:14 +01:00
|
|
|
OUString aHelpFile;
|
2000-09-18 23:16:46 +00:00
|
|
|
SfxStyleSheetBase* pSheet = NULL;
|
|
|
|
SfxStyleSheetBase* pParent = NULL;
|
|
|
|
|
2011-01-17 11:41:00 +01:00
|
|
|
sal_uInt16 nUsedMask = SFXSTYLEBIT_USED;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2013-08-24 13:15:47 +04:00
|
|
|
aName = SD_RESSTR(STR_PSEUDOSHEET_TITLE);
|
2008-03-12 10:28:54 +00:00
|
|
|
if( (pSheet = Find(aName, SD_STYLE_FAMILY_PSEUDO)) == 0 )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2008-03-12 10:28:54 +00:00
|
|
|
pSheet = &Make(aName, SD_STYLE_FAMILY_PSEUDO, nUsedMask);
|
2013-09-05 14:22:12 +02:00
|
|
|
pSheet->SetParent( OUString() );
|
2000-09-18 23:16:46 +00:00
|
|
|
((SfxStyleSheet*)pSheet)->StartListening(*this);
|
|
|
|
}
|
|
|
|
pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_TITLE );
|
|
|
|
|
2013-08-24 13:15:47 +04:00
|
|
|
aName = SD_RESSTR(STR_PSEUDOSHEET_SUBTITLE);
|
2008-03-12 10:28:54 +00:00
|
|
|
if( (pSheet = Find(aName, SD_STYLE_FAMILY_PSEUDO)) == 0 )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2008-03-12 10:28:54 +00:00
|
|
|
pSheet = &Make(aName, SD_STYLE_FAMILY_PSEUDO, nUsedMask);
|
2013-09-05 14:22:12 +02:00
|
|
|
pSheet->SetParent( OUString() );
|
2000-09-18 23:16:46 +00:00
|
|
|
((SfxStyleSheet*)pSheet)->StartListening(*this);
|
|
|
|
}
|
|
|
|
pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_SUBTITLE );
|
|
|
|
|
2013-08-24 13:15:47 +04:00
|
|
|
aName = SD_RESSTR(STR_PSEUDOSHEET_BACKGROUNDOBJECTS);
|
2008-03-12 10:28:54 +00:00
|
|
|
if( (pSheet = Find(aName, SD_STYLE_FAMILY_PSEUDO)) == 0 )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2008-03-12 10:28:54 +00:00
|
|
|
pSheet = &Make(aName, SD_STYLE_FAMILY_PSEUDO, nUsedMask);
|
2013-09-05 14:22:12 +02:00
|
|
|
pSheet->SetParent( OUString() );
|
2000-09-18 23:16:46 +00:00
|
|
|
((SfxStyleSheet*)pSheet)->StartListening(*this);
|
|
|
|
}
|
|
|
|
pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_BACKGROUNDOBJECTS );
|
|
|
|
|
2013-08-24 13:15:47 +04:00
|
|
|
aName = SD_RESSTR(STR_PSEUDOSHEET_BACKGROUND);
|
2008-03-12 10:28:54 +00:00
|
|
|
if( (pSheet = Find(aName, SD_STYLE_FAMILY_PSEUDO)) == 0 )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2008-03-12 10:28:54 +00:00
|
|
|
pSheet = &Make(aName, SD_STYLE_FAMILY_PSEUDO, nUsedMask);
|
2013-09-05 14:22:12 +02:00
|
|
|
pSheet->SetParent( OUString() );
|
2000-09-18 23:16:46 +00:00
|
|
|
((SfxStyleSheet*)pSheet)->StartListening(*this);
|
|
|
|
}
|
|
|
|
pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_BACKGROUND );
|
|
|
|
|
2013-08-24 13:15:47 +04:00
|
|
|
aName = SD_RESSTR(STR_PSEUDOSHEET_NOTES);
|
2008-03-12 10:28:54 +00:00
|
|
|
if( (pSheet = Find(aName, SD_STYLE_FAMILY_PSEUDO)) == 0 )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2008-03-12 10:28:54 +00:00
|
|
|
pSheet = &Make(aName, SD_STYLE_FAMILY_PSEUDO, nUsedMask);
|
2013-09-05 14:22:12 +02:00
|
|
|
pSheet->SetParent( OUString() );
|
2000-09-18 23:16:46 +00:00
|
|
|
((SfxStyleSheet*)pSheet)->StartListening(*this);
|
|
|
|
}
|
|
|
|
pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_NOTES );
|
|
|
|
|
|
|
|
pParent = NULL;
|
2008-03-12 10:28:54 +00:00
|
|
|
SetSearchMask(SD_STYLE_FAMILY_PSEUDO);
|
2013-08-24 13:15:47 +04:00
|
|
|
aName = SD_RESSTR(STR_PSEUDOSHEET_OUTLINE);
|
2013-09-05 14:22:12 +02:00
|
|
|
for (sal_Int32 nLevel = 1; nLevel < 10; nLevel++)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2013-09-05 14:22:12 +02:00
|
|
|
OUString aLevelName( aName + " " + OUString::number( nLevel ) );
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2008-03-12 10:28:54 +00:00
|
|
|
if( (pSheet = Find(aLevelName, SD_STYLE_FAMILY_PSEUDO)) == 0 )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2008-03-12 10:28:54 +00:00
|
|
|
pSheet = &Make(aLevelName, SD_STYLE_FAMILY_PSEUDO, nUsedMask);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
if (pSheet)
|
|
|
|
{
|
|
|
|
if (pParent)
|
|
|
|
pSheet->SetParent(pParent->GetName());
|
|
|
|
pParent = pSheet;
|
|
|
|
((SfxStyleSheet*)pSheet)->StartListening(*this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_OUTLINE + nLevel );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
2013-03-01 10:55:30 +01:00
|
|
|
|* Set the correct name in the program language to the standard styles
|
2000-09-18 23:16:46 +00:00
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
void SdStyleSheetPool::UpdateStdNames()
|
|
|
|
{
|
2013-03-02 15:40:14 +01:00
|
|
|
OUString aHelpFile;
|
2008-03-12 10:28:54 +00:00
|
|
|
sal_uInt32 nCount = aStyles.size();
|
2011-06-12 18:37:27 -04:30
|
|
|
std::vector<SfxStyleSheetBase*> aEraseList;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2008-03-12 10:28:54 +00:00
|
|
|
for( sal_uInt32 n=0; n < nCount; n++ )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2008-03-12 10:28:54 +00:00
|
|
|
SfxStyleSheetBase* pStyle = aStyles[ n ].get();
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
if( !pStyle->IsUserDefined() )
|
|
|
|
{
|
2013-09-05 14:22:12 +02:00
|
|
|
OUString aOldName = pStyle->GetName();
|
2013-03-02 15:40:14 +01:00
|
|
|
sal_uLong nHelpId = pStyle->GetHelpId( aHelpFile );
|
2000-09-18 23:16:46 +00:00
|
|
|
SfxStyleFamily eFam = pStyle->GetFamily();
|
|
|
|
|
2011-01-17 11:41:00 +01:00
|
|
|
sal_Bool bHelpKnown = sal_True;
|
2013-09-05 14:22:12 +02:00
|
|
|
OUString aNewName;
|
2011-01-17 11:41:00 +01:00
|
|
|
sal_uInt16 nNameId = 0;
|
2000-09-18 23:16:46 +00:00
|
|
|
switch( nHelpId )
|
|
|
|
{
|
|
|
|
case HID_STANDARD_STYLESHEET_NAME: nNameId = STR_STANDARD_STYLESHEET_NAME; break;
|
|
|
|
case HID_POOLSHEET_OBJWITHARROW: nNameId = STR_POOLSHEET_OBJWITHARROW; break;
|
|
|
|
case HID_POOLSHEET_OBJWITHSHADOW: nNameId = STR_POOLSHEET_OBJWITHSHADOW; break;
|
|
|
|
case HID_POOLSHEET_OBJWITHOUTFILL: nNameId = STR_POOLSHEET_OBJWITHOUTFILL; break;
|
2012-05-31 13:23:45 +00:00
|
|
|
case HID_POOLSHEET_OBJNOLINENOFILL: nNameId = STR_POOLSHEET_OBJNOLINENOFILL;break;
|
2000-09-18 23:16:46 +00:00
|
|
|
case HID_POOLSHEET_TEXT: nNameId = STR_POOLSHEET_TEXT; break;
|
|
|
|
case HID_POOLSHEET_TEXTBODY: nNameId = STR_POOLSHEET_TEXTBODY; break;
|
|
|
|
case HID_POOLSHEET_TEXTBODY_JUSTIFY:nNameId = STR_POOLSHEET_TEXTBODY_JUSTIFY;break;
|
|
|
|
case HID_POOLSHEET_TEXTBODY_INDENT: nNameId = STR_POOLSHEET_TEXTBODY_INDENT;break;
|
|
|
|
case HID_POOLSHEET_TITLE: nNameId = STR_POOLSHEET_TITLE; break;
|
|
|
|
case HID_POOLSHEET_TITLE1: nNameId = STR_POOLSHEET_TITLE1; break;
|
|
|
|
case HID_POOLSHEET_TITLE2: nNameId = STR_POOLSHEET_TITLE2; break;
|
|
|
|
case HID_POOLSHEET_HEADLINE: nNameId = STR_POOLSHEET_HEADLINE; break;
|
|
|
|
case HID_POOLSHEET_HEADLINE1: nNameId = STR_POOLSHEET_HEADLINE1; break;
|
|
|
|
case HID_POOLSHEET_HEADLINE2: nNameId = STR_POOLSHEET_HEADLINE2; break;
|
|
|
|
case HID_POOLSHEET_MEASURE: nNameId = STR_POOLSHEET_MEASURE; break;
|
|
|
|
|
|
|
|
case HID_PSEUDOSHEET_TITLE: nNameId = STR_PSEUDOSHEET_TITLE; break;
|
|
|
|
case HID_PSEUDOSHEET_SUBTITLE: nNameId = STR_PSEUDOSHEET_SUBTITLE; break;
|
|
|
|
case HID_PSEUDOSHEET_OUTLINE1:
|
|
|
|
case HID_PSEUDOSHEET_OUTLINE2:
|
|
|
|
case HID_PSEUDOSHEET_OUTLINE3:
|
|
|
|
case HID_PSEUDOSHEET_OUTLINE4:
|
|
|
|
case HID_PSEUDOSHEET_OUTLINE5:
|
|
|
|
case HID_PSEUDOSHEET_OUTLINE6:
|
|
|
|
case HID_PSEUDOSHEET_OUTLINE7:
|
|
|
|
case HID_PSEUDOSHEET_OUTLINE8:
|
|
|
|
case HID_PSEUDOSHEET_OUTLINE9: nNameId = STR_PSEUDOSHEET_OUTLINE; break;
|
|
|
|
case HID_PSEUDOSHEET_BACKGROUNDOBJECTS: nNameId = STR_PSEUDOSHEET_BACKGROUNDOBJECTS; break;
|
|
|
|
case HID_PSEUDOSHEET_BACKGROUND: nNameId = STR_PSEUDOSHEET_BACKGROUND; break;
|
|
|
|
case HID_PSEUDOSHEET_NOTES: nNameId = STR_PSEUDOSHEET_NOTES; break;
|
|
|
|
|
2008-03-12 10:28:54 +00:00
|
|
|
case HID_SD_CELL_STYLE_DEFAULT: nNameId = STR_STANDARD_STYLESHEET_NAME; break;
|
|
|
|
case HID_SD_CELL_STYLE_BANDED: nNameId = STR_POOLSHEET_BANDED_CELL; break;
|
|
|
|
case HID_SD_CELL_STYLE_HEADER: nNameId = STR_POOLSHEET_HEADER; break;
|
|
|
|
case HID_SD_CELL_STYLE_TOTAL: nNameId = STR_POOLSHEET_TOTAL; break;
|
|
|
|
case HID_SD_CELL_STYLE_FIRST_COLUMN: nNameId = STR_POOLSHEET_FIRST_COLUMN; break;
|
|
|
|
case HID_SD_CELL_STYLE_LAST_COLUMN: nNameId = STR_POOLSHEET_LAST_COLUMN; break;
|
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
default:
|
2013-03-01 10:55:30 +01:00
|
|
|
// 0 or wrong (old) HelpId
|
2011-01-17 11:41:00 +01:00
|
|
|
bHelpKnown = sal_False;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
if( bHelpKnown )
|
|
|
|
{
|
|
|
|
if( nNameId )
|
|
|
|
{
|
2013-08-24 13:15:47 +04:00
|
|
|
aNewName = SD_RESSTR( nNameId );
|
2000-09-18 23:16:46 +00:00
|
|
|
if( nNameId == STR_PSEUDOSHEET_OUTLINE )
|
|
|
|
{
|
2013-09-05 14:22:12 +02:00
|
|
|
aNewName += " " + OUString::number( sal_Int32( nHelpId - HID_PSEUDOSHEET_OUTLINE ) );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-05 14:22:12 +02:00
|
|
|
if( !aNewName.isEmpty() && aNewName != aOldName )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
SfxStyleSheetBase* pSheetFound = Find( aNewName, eFam );
|
|
|
|
|
|
|
|
if ( !pSheetFound )
|
|
|
|
{
|
2013-03-01 10:55:30 +01:00
|
|
|
// Sheet does not yet exist: rename old sheet
|
|
|
|
pStyle->SetName( aNewName ); // transform also parents
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-03-01 10:55:30 +01:00
|
|
|
// Sheet does exist: old sheet has to be removed
|
2011-06-12 18:37:27 -04:30
|
|
|
aEraseList.push_back( pStyle );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-01 10:55:30 +01:00
|
|
|
// styles that could not be renamed, must be removed
|
2011-06-12 18:37:27 -04:30
|
|
|
for ( size_t i = 0, n = aEraseList.size(); i < n; ++i )
|
|
|
|
Remove( aEraseList[ i ] );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
2008-03-12 10:28:54 +00:00
|
|
|
// --------------------------------------------------------------------
|
2013-03-01 10:55:30 +01:00
|
|
|
// Set new SvxNumBulletItem for the respective style sheet
|
2008-03-12 10:28:54 +00:00
|
|
|
// --------------------------------------------------------------------
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
void SdStyleSheetPool::PutNumBulletItem( SfxStyleSheetBase* pSheet,
|
2001-03-30 14:29:32 +00:00
|
|
|
Font& rBulletFont )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2013-03-02 15:40:14 +01:00
|
|
|
OUString aHelpFile;
|
2011-01-17 11:41:00 +01:00
|
|
|
sal_uLong nHelpId = pSheet->GetHelpId( aHelpFile );
|
2000-09-18 23:16:46 +00:00
|
|
|
SfxItemSet& rSet = pSheet->GetItemSet();
|
|
|
|
|
|
|
|
switch ( nHelpId )
|
|
|
|
{
|
|
|
|
case HID_STANDARD_STYLESHEET_NAME :
|
|
|
|
{
|
2013-03-01 10:55:30 +01:00
|
|
|
// Standard template
|
2000-09-18 23:16:46 +00:00
|
|
|
SvxNumberFormat aNumberFormat(SVX_NUM_CHAR_SPECIAL);
|
|
|
|
aNumberFormat.SetBulletFont(&rBulletFont);
|
2001-06-25 11:13:52 +00:00
|
|
|
aNumberFormat.SetBulletChar( 0x25CF ); // StarBats: 0xF000 + 34
|
2000-09-18 23:16:46 +00:00
|
|
|
aNumberFormat.SetBulletRelSize(45);
|
2002-02-26 10:03:18 +00:00
|
|
|
aNumberFormat.SetBulletColor(Color(COL_AUTO));
|
2000-09-18 23:16:46 +00:00
|
|
|
aNumberFormat.SetStart(1);
|
|
|
|
aNumberFormat.SetNumAdjust(SVX_ADJUST_LEFT);
|
|
|
|
|
2013-04-10 20:41:54 +02:00
|
|
|
SvxNumRule aNumRule( NUM_BULLET_REL_SIZE|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE, SVX_MAX_NUM , sal_False);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2011-01-21 17:18:37 +01:00
|
|
|
for( sal_uInt16 i = 0; i < aNumRule.GetLevelCount(); i++ )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
const short nLSpace = (i + 1) * 600;
|
|
|
|
aNumberFormat.SetLSpace(nLSpace);
|
|
|
|
aNumberFormat.SetAbsLSpace(nLSpace);
|
|
|
|
aNumberFormat.SetFirstLineOffset(-600);
|
|
|
|
aNumRule.SetLevel( i, aNumberFormat );
|
|
|
|
}
|
|
|
|
|
|
|
|
rSet.Put( SvxNumBulletItem( aNumRule, EE_PARA_NUMBULLET ) );
|
|
|
|
((SfxStyleSheet*)pSheet)->Broadcast(SfxSimpleHint( SFX_HINT_DATACHANGED ) );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HID_PSEUDOSHEET_TITLE:
|
2011-02-07 22:11:09 +01:00
|
|
|
/* title gets same bullet as subtitle and not that page symbol anymore */
|
2000-09-18 23:16:46 +00:00
|
|
|
case HID_PSEUDOSHEET_SUBTITLE :
|
|
|
|
{
|
2013-03-01 10:55:30 +01:00
|
|
|
// Subtitle template
|
2000-09-18 23:16:46 +00:00
|
|
|
SvxNumRule* pDefaultRule = ((SvxNumBulletItem*) rSet.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET))->GetNumRule();
|
2013-03-11 22:51:42 +01:00
|
|
|
DBG_ASSERT( pDefaultRule, "Where is my default template? [CL]" );
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
if(pDefaultRule)
|
|
|
|
{
|
2011-01-17 11:41:00 +01:00
|
|
|
SvxNumRule aNumRule(pDefaultRule->GetFeatureFlags(), 10, sal_False);
|
|
|
|
for(sal_uInt16 i=0; i < aNumRule.GetLevelCount(); i++)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
SvxNumberFormat aFrmt( pDefaultRule->GetLevel(i) );
|
2001-02-23 11:29:54 +00:00
|
|
|
aFrmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
|
2010-12-17 11:00:57 +01:00
|
|
|
// #i93908# clear suffix for bullet lists
|
2013-04-07 12:06:47 +02:00
|
|
|
aFrmt.SetPrefix(OUString());
|
|
|
|
aFrmt.SetSuffix(OUString());
|
2000-09-18 23:16:46 +00:00
|
|
|
aFrmt.SetStart(1);
|
|
|
|
aFrmt.SetBulletRelSize(45);
|
2001-06-25 11:13:52 +00:00
|
|
|
aFrmt.SetBulletChar( 0x25CF ); // StarBats: 0xF000 + 34
|
2000-09-18 23:16:46 +00:00
|
|
|
aFrmt.SetBulletFont(&rBulletFont);
|
|
|
|
aNumRule.SetLevel(i, aFrmt);
|
|
|
|
}
|
|
|
|
|
|
|
|
rSet.Put( SvxNumBulletItem( aNumRule, EE_PARA_NUMBULLET ) );
|
|
|
|
((SfxStyleSheet*)pSheet)->Broadcast(SfxSimpleHint( SFX_HINT_DATACHANGED ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HID_PSEUDOSHEET_OUTLINE + 1 :
|
|
|
|
{
|
2013-03-01 10:55:30 +01:00
|
|
|
// Outline template
|
2000-09-18 23:16:46 +00:00
|
|
|
SvxNumberFormat aNumberFormat(SVX_NUM_CHAR_SPECIAL);
|
2002-02-26 10:03:18 +00:00
|
|
|
aNumberFormat.SetBulletColor(Color(COL_AUTO));
|
2000-09-18 23:16:46 +00:00
|
|
|
aNumberFormat.SetStart(1);
|
|
|
|
aNumberFormat.SetNumAdjust(SVX_ADJUST_LEFT);
|
|
|
|
|
|
|
|
SvxNumRule aNumRule( NUM_BULLET_REL_SIZE|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE|NUM_SYMBOL_ALIGNMENT,
|
2013-04-10 20:41:54 +02:00
|
|
|
SVX_MAX_NUM, sal_False );
|
2011-01-17 11:41:00 +01:00
|
|
|
for( sal_uInt16 i = 0; i < aNumRule.GetLevelCount(); i++ )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2001-06-25 11:13:52 +00:00
|
|
|
aNumberFormat.SetBulletChar( 0x25CF ); // StarBats: 0xF000 + 34
|
2000-09-18 23:16:46 +00:00
|
|
|
aNumberFormat.SetBulletRelSize(45);
|
2008-06-06 10:58:00 +00:00
|
|
|
const short nLSpace = (i + 1) * 1200;
|
2000-09-18 23:16:46 +00:00
|
|
|
aNumberFormat.SetLSpace(nLSpace);
|
|
|
|
aNumberFormat.SetAbsLSpace(nLSpace);
|
2006-12-12 15:33:59 +00:00
|
|
|
short nFirstLineOffset = -600;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2011-01-17 11:41:00 +01:00
|
|
|
sal_uLong nFontSize = 20;
|
2000-09-18 23:16:46 +00:00
|
|
|
switch(i)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
nFontSize = 32;
|
|
|
|
nFirstLineOffset = -900;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2011-12-06 01:43:22 +01:00
|
|
|
case 1:
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2001-06-25 11:13:52 +00:00
|
|
|
aNumberFormat.SetBulletChar( 0x2013 ); // StarBats: 0xF000 + 150
|
2000-09-18 23:16:46 +00:00
|
|
|
aNumberFormat.SetBulletRelSize(75);
|
2011-12-06 01:43:22 +01:00
|
|
|
nFontSize = 32;
|
|
|
|
nFirstLineOffset = -900;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2011-12-06 01:43:22 +01:00
|
|
|
case 2:
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2011-12-06 01:43:22 +01:00
|
|
|
nFontSize = 28;
|
|
|
|
nFirstLineOffset = -800;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2011-12-06 01:43:22 +01:00
|
|
|
case 3:
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2011-12-06 01:43:22 +01:00
|
|
|
aNumberFormat.SetBulletChar( 0x2013 ); // StarBats: 0xF000 + 150
|
2000-09-18 23:16:46 +00:00
|
|
|
aNumberFormat.SetBulletRelSize(75);
|
2011-12-06 01:43:22 +01:00
|
|
|
nFontSize = 24;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
aNumberFormat.SetFirstLineOffset(nFirstLineOffset);
|
2011-01-17 11:41:00 +01:00
|
|
|
nFontSize = (sal_uInt16)((nFontSize * 2540L) / 72); // Pt --> 1/100 mm
|
2000-09-18 23:16:46 +00:00
|
|
|
rBulletFont.SetSize(Size(0,846)); // 24 pt
|
|
|
|
aNumberFormat.SetBulletFont(&rBulletFont);
|
|
|
|
aNumRule.SetLevel( i, aNumberFormat );
|
|
|
|
}
|
|
|
|
|
|
|
|
rSet.Put( SvxNumBulletItem( aNumRule, EE_PARA_NUMBULLET ) );
|
|
|
|
((SfxStyleSheet*)pSheet)->Broadcast(SfxSimpleHint( SFX_HINT_DATACHANGED ) );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
2013-03-01 10:55:30 +01:00
|
|
|
|* Create standard bullet font (without size)
|
2000-09-18 23:16:46 +00:00
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
Font SdStyleSheetPool::GetBulletFont() const
|
|
|
|
{
|
2012-04-15 23:14:28 -03:00
|
|
|
Font aBulletFont( OUString( "StarSymbol" ), Size(0, 1000) );
|
2002-03-20 11:44:35 +00:00
|
|
|
aBulletFont.SetCharSet(RTL_TEXTENCODING_UNICODE);
|
2000-09-18 23:16:46 +00:00
|
|
|
aBulletFont.SetWeight(WEIGHT_NORMAL);
|
|
|
|
aBulletFont.SetUnderline(UNDERLINE_NONE);
|
2009-01-05 17:49:45 +00:00
|
|
|
aBulletFont.SetOverline(UNDERLINE_NONE);
|
2000-09-18 23:16:46 +00:00
|
|
|
aBulletFont.SetStrikeout(STRIKEOUT_NONE);
|
|
|
|
aBulletFont.SetItalic(ITALIC_NONE);
|
2011-01-17 11:41:00 +01:00
|
|
|
aBulletFont.SetOutline(sal_False);
|
|
|
|
aBulletFont.SetShadow(sal_False);
|
2002-02-26 10:03:18 +00:00
|
|
|
aBulletFont.SetColor(Color(COL_AUTO));
|
2011-01-17 11:41:00 +01:00
|
|
|
aBulletFont.SetTransparent(sal_True);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
return aBulletFont;
|
|
|
|
}
|
|
|
|
|
2008-03-12 10:28:54 +00:00
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SdStyleSheetPool::AddStyleFamily( const SdPage* pPage )
|
|
|
|
{
|
|
|
|
rtl::Reference< SfxStyleSheetPool > xPool( this );
|
|
|
|
maStyleFamilyMap[pPage] = new SdStyleFamily( xPool, pPage );
|
|
|
|
}
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SdStyleSheetPool::RemoveStyleFamily( const SdPage* pPage )
|
|
|
|
{
|
|
|
|
SdStyleFamilyMap::iterator iter( maStyleFamilyMap.find( pPage ) );
|
|
|
|
if( iter != maStyleFamilyMap.end() )
|
|
|
|
{
|
|
|
|
SdStyleFamilyRef xStyle( (*iter).second );
|
|
|
|
maStyleFamilyMap.erase( iter );
|
|
|
|
|
|
|
|
if( xStyle.is() ) try
|
|
|
|
{
|
|
|
|
xStyle->dispose();
|
|
|
|
}
|
|
|
|
catch( Exception& )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SdStyleSheetPool::throwIfDisposed() throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
if( mpDoc == NULL )
|
|
|
|
throw DisposedException();
|
|
|
|
}
|
|
|
|
|
|
|
|
// XServiceInfo
|
|
|
|
OUString SAL_CALL SdStyleSheetPool::getImplementationName() throw(RuntimeException)
|
|
|
|
{
|
2012-04-16 01:05:29 -03:00
|
|
|
return OUString( "SdStyleSheetPool" );
|
2008-03-12 10:28:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool SAL_CALL SdStyleSheetPool::supportsService( const OUString& ServiceName ) throw(RuntimeException)
|
|
|
|
{
|
2013-12-05 19:18:01 -02:00
|
|
|
return cppu::supportsService(this, ServiceName);
|
2008-03-12 10:28:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Sequence< OUString > SAL_CALL SdStyleSheetPool::getSupportedServiceNames() throw(RuntimeException)
|
|
|
|
{
|
2013-12-05 19:18:01 -02:00
|
|
|
OUString aStr("com.sun.star.style.StyleFamilies");
|
2008-03-12 10:28:54 +00:00
|
|
|
return Sequence< OUString >( &aStr, 1 );
|
|
|
|
}
|
|
|
|
|
|
|
|
// XNameAccess
|
|
|
|
Any SAL_CALL SdStyleSheetPool::getByName( const OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
|
|
|
|
{
|
|
|
|
throwIfDisposed();
|
|
|
|
|
|
|
|
if( mxGraphicFamily->getName() == aName )
|
|
|
|
return Any( Reference< XNameAccess >( static_cast< XNameAccess* >( mxGraphicFamily.get() ) ) );
|
|
|
|
|
|
|
|
if( mxCellFamily->getName() == aName )
|
|
|
|
return Any( Reference< XNameAccess >( static_cast< XNameAccess* >( mxCellFamily.get() ) ) );
|
|
|
|
|
|
|
|
if( msTableFamilyName == aName )
|
|
|
|
return Any( mxTableFamily );
|
|
|
|
|
2012-05-19 15:09:08 +02:00
|
|
|
for( SdStyleFamilyMap::iterator iter( maStyleFamilyMap.begin() ); iter != maStyleFamilyMap.end(); ++iter )
|
2008-03-12 10:28:54 +00:00
|
|
|
{
|
|
|
|
if( (*iter).second->getName() == aName )
|
|
|
|
return Any( Reference< XNameAccess >( static_cast< XNameAccess* >( (*iter).second.get() ) ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
throw NoSuchElementException();
|
|
|
|
}
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
|
|
|
Sequence< OUString > SAL_CALL SdStyleSheetPool::getElementNames() throw(RuntimeException)
|
|
|
|
{
|
|
|
|
throwIfDisposed();
|
|
|
|
|
|
|
|
Sequence< OUString > aNames( maStyleFamilyMap.size() + 3 );
|
|
|
|
OUString* pNames = aNames.getArray();
|
|
|
|
|
|
|
|
*pNames++ = mxGraphicFamily->getName();
|
|
|
|
*pNames++ = mxCellFamily->getName();
|
|
|
|
*pNames++ = msTableFamilyName;
|
|
|
|
|
2012-05-19 15:09:08 +02:00
|
|
|
for( SdStyleFamilyMap::iterator iter( maStyleFamilyMap.begin() ); iter != maStyleFamilyMap.end(); ++iter )
|
2008-03-12 10:28:54 +00:00
|
|
|
{
|
|
|
|
*pNames++ = (*iter).second->getName();
|
|
|
|
}
|
|
|
|
|
|
|
|
return aNames;
|
|
|
|
}
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Bool SAL_CALL SdStyleSheetPool::hasByName( const OUString& aName ) throw(RuntimeException)
|
|
|
|
{
|
|
|
|
throwIfDisposed();
|
|
|
|
|
|
|
|
if( mxGraphicFamily->getName() == aName )
|
|
|
|
return sal_True;
|
|
|
|
|
|
|
|
if( mxCellFamily->getName() == aName )
|
|
|
|
return sal_True;
|
|
|
|
|
|
|
|
if( msTableFamilyName == aName )
|
|
|
|
return sal_True;
|
|
|
|
|
2012-05-19 15:09:08 +02:00
|
|
|
for( SdStyleFamilyMap::iterator iter( maStyleFamilyMap.begin() ); iter != maStyleFamilyMap.end(); ++iter )
|
2008-03-12 10:28:54 +00:00
|
|
|
{
|
|
|
|
if( (*iter).second->getName() == aName )
|
|
|
|
return sal_True;
|
|
|
|
}
|
|
|
|
|
|
|
|
return sal_False;
|
|
|
|
}
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
// XElementAccess
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
|
|
|
Type SAL_CALL SdStyleSheetPool::getElementType() throw(RuntimeException)
|
|
|
|
{
|
|
|
|
throwIfDisposed();
|
|
|
|
|
2013-12-12 11:09:57 +01:00
|
|
|
return cppu::UnoType<XNameAccess>::get();
|
2008-03-12 10:28:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Bool SAL_CALL SdStyleSheetPool::hasElements() throw(RuntimeException)
|
|
|
|
{
|
|
|
|
return sal_True;
|
|
|
|
}
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
// XIndexAccess
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Int32 SAL_CALL SdStyleSheetPool::getCount() throw(RuntimeException)
|
|
|
|
{
|
|
|
|
throwIfDisposed();
|
|
|
|
|
|
|
|
return maStyleFamilyMap.size() + 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
|
|
|
Any SAL_CALL SdStyleSheetPool::getByIndex( sal_Int32 Index ) throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
|
|
|
|
{
|
|
|
|
switch( Index )
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
return Any( Reference< XNameAccess >( static_cast< XNameAccess* >( mxGraphicFamily.get() ) ) );
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
return Any( Reference< XNameAccess >( static_cast< XNameAccess* >( mxCellFamily.get() ) ) );
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
return Any( mxTableFamily );
|
|
|
|
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
Index -= 3;
|
|
|
|
if( (Index < 0) || (Index >= sal::static_int_cast<sal_Int32>(maStyleFamilyMap.size())) )
|
|
|
|
throw IndexOutOfBoundsException();
|
|
|
|
SdStyleFamilyMap::iterator iter( maStyleFamilyMap.begin() );
|
|
|
|
while( Index-- )
|
2012-05-19 15:09:08 +02:00
|
|
|
++iter;
|
2008-03-12 10:28:54 +00:00
|
|
|
|
|
|
|
return Any( Reference< XNameAccess >( static_cast< XNameAccess* >( (*iter).second.get() ) ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
// XComponent
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SAL_CALL SdStyleSheetPool::dispose() throw (RuntimeException)
|
|
|
|
{
|
|
|
|
if( mpDoc )
|
|
|
|
{
|
|
|
|
mxGraphicFamily->dispose();
|
|
|
|
mxGraphicFamily.clear();
|
|
|
|
mxCellFamily->dispose();
|
|
|
|
mxCellFamily.clear();
|
|
|
|
|
|
|
|
Reference< XComponent > xComp( mxTableFamily, UNO_QUERY );
|
|
|
|
if( xComp.is() )
|
|
|
|
xComp->dispose();
|
|
|
|
mxTableFamily = 0;
|
|
|
|
|
|
|
|
SdStyleFamilyMap aTempMap;
|
|
|
|
aTempMap.swap( maStyleFamilyMap );
|
|
|
|
|
2010-12-24 13:28:18 +00:00
|
|
|
for( SdStyleFamilyMap::iterator iter( aTempMap.begin() ); iter != aTempMap.end(); ++iter ) try
|
2008-03-12 10:28:54 +00:00
|
|
|
{
|
|
|
|
(*iter).second->dispose();
|
|
|
|
}
|
|
|
|
catch( Exception& )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
mpDoc = 0;
|
2010-04-16 16:10:11 +02:00
|
|
|
|
|
|
|
Clear();
|
2008-03-12 10:28:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2008-03-12 10:28:54 +00:00
|
|
|
void SAL_CALL SdStyleSheetPool::addEventListener( const Reference< XEventListener >& /*xListener*/ ) throw (RuntimeException)
|
|
|
|
{
|
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2008-03-12 10:28:54 +00:00
|
|
|
// --------------------------------------------------------------------
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2008-03-12 10:28:54 +00:00
|
|
|
void SAL_CALL SdStyleSheetPool::removeEventListener( const Reference< XEventListener >& /*aListener*/ ) throw (RuntimeException)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
|
|
|
SdStyleSheetVector SdStyleSheetPool::CreateChildList( SdStyleSheet* pSheet )
|
|
|
|
{
|
|
|
|
SdStyleSheetVector aResult;
|
|
|
|
|
2011-01-17 11:41:00 +01:00
|
|
|
sal_uInt16 nListenerCount = pSheet->GetListenerCount();
|
2008-03-12 10:28:54 +00:00
|
|
|
if (nListenerCount > 0)
|
|
|
|
{
|
2011-01-17 11:41:00 +01:00
|
|
|
for (sal_uInt16 n = 0; n < nListenerCount; n++)
|
2008-03-12 10:28:54 +00:00
|
|
|
{
|
2009-02-12 12:44:26 +00:00
|
|
|
SdStyleSheet* pChild = dynamic_cast< SdStyleSheet* >( pSheet->GetListener(n) );
|
2008-03-12 10:28:54 +00:00
|
|
|
if(pChild && pChild->GetParent() == pSheet->GetName())
|
|
|
|
{
|
|
|
|
aResult.push_back( SdStyleSheetRef( pChild ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return aResult;
|
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2008-03-12 10:28:54 +00:00
|
|
|
// --------------------------------------------------------------------
|
2010-04-16 16:10:11 +02:00
|
|
|
|
|
|
|
void SAL_CALL SdStyleSheetPool::acquire (void) throw ()
|
|
|
|
{
|
|
|
|
SdStyleSheetPoolBase::acquire();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL SdStyleSheetPool::release (void) throw ()
|
|
|
|
{
|
|
|
|
SdStyleSheetPoolBase::release();
|
|
|
|
}
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------
|
2010-10-12 15:51:52 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|