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
|
|
|
|
2008-03-12 10:28:54 +00:00
|
|
|
#include <com/sun/star/lang/DisposedException.hpp>
|
2017-02-06 17:08:38 +01:00
|
|
|
#include <com/sun/star/lang/IndexOutOfBoundsException.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>
|
2016-09-22 22:20:48 +02:00
|
|
|
#include <svl/hint.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>
|
2014-03-05 20:06:39 +01:00
|
|
|
#include <svl/IndexedStyleSheets.hxx>
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2017-10-23 22:32:55 +02:00
|
|
|
#include <stlpool.hxx>
|
|
|
|
#include <sdresid.hxx>
|
|
|
|
#include <stlsheet.hxx>
|
|
|
|
#include <strings.hrc>
|
|
|
|
#include <glob.hxx>
|
|
|
|
#include <drawdoc.hxx>
|
|
|
|
#include <sdmod.hxx>
|
|
|
|
#include <sdpage.hxx>
|
|
|
|
#include <helpids.h>
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/itemset.hxx>
|
2017-10-23 22:32:55 +02:00
|
|
|
#include <app.hrc>
|
|
|
|
#include <strings.hxx>
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2014-11-21 20:48:11 +02:00
|
|
|
#include <com/sun/star/drawing/LineStyle.hpp>
|
|
|
|
|
2014-07-18 18:07:36 +02:00
|
|
|
using namespace ::com::sun::star;
|
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
|
|
|
|
{
|
|
|
|
|
2017-08-03 10:23:01 +02:00
|
|
|
OUString lcl_findRenamedStyleName(std::vector< std::pair< OUString, OUString > > &rRenamedList, OUString const & aOriginalName )
|
2014-02-13 16:10:47 +05:30
|
|
|
{
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
2018-08-22 10:08:42 +01:00
|
|
|
SfxStyleSheet *lcl_findStyle(StyleSheetCopyResultVector& rStyles, const OUString& aStyleName)
|
2014-02-13 16:10:47 +05:30
|
|
|
{
|
|
|
|
if( aStyleName.isEmpty() )
|
2015-11-10 10:23:02 +01:00
|
|
|
return nullptr;
|
2018-08-22 10:08:42 +01:00
|
|
|
for (const auto& a : rStyles)
|
2014-02-13 16:10:47 +05:30
|
|
|
{
|
2018-08-22 10:08:42 +01:00
|
|
|
if (a.m_xStyleSheet->GetName() == aStyleName)
|
|
|
|
return a.m_xStyleSheet.get();
|
2014-02-13 16:10:47 +05:30
|
|
|
}
|
2015-11-10 10:23:02 +01:00
|
|
|
return nullptr;
|
2014-02-13 16:10:47 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2008-03-12 10:28:54 +00:00
|
|
|
SdStyleSheetPool::SdStyleSheetPool(SfxItemPool const& _rPool, SdDrawDocument* pDocument)
|
|
|
|
: SdStyleSheetPoolBase( _rPool )
|
2015-11-10 10:23:02 +01:00
|
|
|
, mpActualStyleSheet(nullptr)
|
2006-12-12 15:33:59 +00:00
|
|
|
, 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
|
2018-01-19 12:16:31 +02:00
|
|
|
mxGraphicFamily = new SdStyleFamily( xPool, SfxStyleFamily::Para );
|
|
|
|
mxCellFamily = new SdStyleFamily( xPool, SfxStyleFamily::Frame );
|
2008-03-12 10:28:54 +00:00
|
|
|
|
|
|
|
mxTableFamily = sdr::table::CreateTableDesignFamily();
|
|
|
|
Reference< XNamed > xNamed( mxTableFamily, UNO_QUERY );
|
|
|
|
if( xNamed.is() )
|
|
|
|
msTableFamilyName = xNamed->getName();
|
|
|
|
|
|
|
|
// create presentation families, one for each master page
|
2016-10-11 13:01:32 +02:00
|
|
|
const sal_uInt16 nCount = mpDoc->GetMasterSdPageCount(PageKind::Standard);
|
2008-03-12 10:28:54 +00:00
|
|
|
for( sal_uInt16 nPage = 0; nPage < nCount; ++nPage )
|
2016-10-11 13:01:32 +02:00
|
|
|
AddStyleFamily( mpDoc->GetMasterSdPage(nPage,PageKind::Standard) );
|
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
|
|
|
{
|
2015-11-10 10:23:02 +01:00
|
|
|
DBG_ASSERT( mpDoc == nullptr, "sd::SdStyleSheetPool::~SdStyleSheetPool(), dispose me first!" );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
2018-04-18 12:14:37 +02:00
|
|
|
SfxStyleSheetBase* SdStyleSheetPool::Create(const OUString& rName, SfxStyleFamily eFamily, SfxStyleSearchBits _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
|
|
|
}
|
|
|
|
|
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;
|
2017-04-30 17:01:32 +01:00
|
|
|
aName += STR_LAYOUT_TITLE;
|
2018-01-19 12:16:31 +02:00
|
|
|
SfxStyleSheetBase* pResult = Find(aName, SfxStyleFamily::Page);
|
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;
|
2017-04-30 17:01:32 +01:00
|
|
|
aName += 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 ) );
|
2018-01-19 12:16:31 +02:00
|
|
|
SfxStyleSheetBase* pSheet = Find(aFullName, SfxStyleFamily::Page);
|
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
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2014-04-24 10:52:02 +02:00
|
|
|
void SdStyleSheetPool::CreateLayoutStyleSheets(const OUString& rLayoutName, bool bCheck /*= sal_False*/ )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2018-04-18 12:14:37 +02:00
|
|
|
const SfxStyleSearchBits nUsedMask = SfxStyleSearchBits::All & ~SfxStyleSearchBits::UserDefined;
|
2008-06-09 14:10:07 +00:00
|
|
|
|
2014-04-24 10:52:02 +02:00
|
|
|
bool bCreated = false;
|
2002-01-09 13:38:46 +00:00
|
|
|
|
2015-11-10 10:23:02 +01:00
|
|
|
SfxStyleSheetBase* pSheet = nullptr;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2013-09-05 14:22:12 +02:00
|
|
|
OUString aPrefix(rLayoutName + SD_LT_SEPARATOR);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2014-09-16 10:09:58 +02:00
|
|
|
vcl::Font aLatinFont, aCJKFont, aCTLFont;
|
2003-06-26 10:11:49 +00:00
|
|
|
|
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
|
2016-01-21 03:30:10 +11:00
|
|
|
SvxFontItem aSvxFontItem( aLatinFont.GetFamilyType(), aLatinFont.GetFamilyName(), aLatinFont.GetStyleName(), aLatinFont.GetPitch(),
|
2001-06-25 10:50:53 +00:00
|
|
|
aLatinFont.GetCharSet(), EE_CHAR_FONTINFO );
|
|
|
|
|
2016-01-21 03:30:10 +11:00
|
|
|
SvxFontItem aSvxFontItemCJK( aCJKFont.GetFamilyType(), aCJKFont.GetFamilyName(), aCJKFont.GetStyleName(), aCJKFont.GetPitch(),
|
2001-06-25 10:50:53 +00:00
|
|
|
aCJKFont.GetCharSet(), EE_CHAR_FONTINFO_CJK );
|
|
|
|
|
2016-01-21 03:30:10 +11:00
|
|
|
SvxFontItem aSvxFontItemCTL( aCTLFont.GetFamilyType(), aCTLFont.GetFamilyName(), aCTLFont.GetStyleName(), aCTLFont.GetPitch(),
|
2001-06-25 10:50:53 +00:00
|
|
|
aCTLFont.GetCharSet(), EE_CHAR_FONTINFO_CTL );
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2014-09-16 10:09:58 +02:00
|
|
|
vcl::Font aBulletFont( GetBulletFont() );
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
/**************************************************************************
|
2013-03-01 10:55:30 +01:00
|
|
|
* outline levels
|
2000-09-18 23:16:46 +00:00
|
|
|
**************************************************************************/
|
2017-04-30 17:01:32 +01:00
|
|
|
OUString aName(STR_LAYOUT_OUTLINE);
|
2013-03-02 15:40:14 +01:00
|
|
|
OUString aHelpFile;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2017-11-15 14:19:37 +02:00
|
|
|
SvxLRSpaceItem aSvxLRSpaceItem( EE_PARA_LRSPACE );
|
2007-05-10 14:22:57 +00:00
|
|
|
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
|
|
|
|
2018-01-19 12:16:31 +02:00
|
|
|
if (!Find(aLevelName, SfxStyleFamily::Page))
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2014-04-24 10:52:02 +02:00
|
|
|
bCreated = true;
|
2018-01-19 12:16:31 +02:00
|
|
|
pSheet = &Make(aLevelName, SfxStyleFamily::Page,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 ) );
|
2016-01-29 17:43:42 +11:00
|
|
|
rSet.Put( SvxUnderlineItem(LINESTYLE_NONE, EE_CHAR_UNDERLINE ) );
|
|
|
|
rSet.Put( SvxOverlineItem(LINESTYLE_NONE, EE_CHAR_OVERLINE ) );
|
2007-05-10 14:22:57 +00:00
|
|
|
rSet.Put( SvxCrossedOutItem(STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ) );
|
2017-03-07 14:39:38 +02:00
|
|
|
rSet.Put( SvxCaseMapItem(SvxCaseMap::NotMapped, EE_CHAR_CASEMAP ) );
|
2014-02-26 12:53:18 +02:00
|
|
|
rSet.Put( SvxShadowedItem(false, EE_CHAR_SHADOW ) );
|
2014-02-19 16:40:55 +02:00
|
|
|
rSet.Put( SvxContourItem(false, EE_CHAR_OUTLINE ) );
|
2016-05-08 09:21:17 +02:00
|
|
|
rSet.Put( SvxEmphasisMarkItem(FontEmphasisMark::NONE, EE_CHAR_EMPHASISMARK ) );
|
2016-05-29 20:23:09 +02:00
|
|
|
rSet.Put( SvxCharReliefItem(FontRelief::NONE, EE_CHAR_RELIEF) );
|
2018-02-26 13:30:35 +02:00
|
|
|
rSet.Put( SvxColorItem( COL_AUTO, EE_CHAR_COLOR) );
|
|
|
|
rSet.Put( SvxBackgroundColorItem( COL_AUTO, EE_CHAR_BKGCOLOR ) );
|
2015-10-28 12:01:32 +02:00
|
|
|
rSet.Put( XLineStyleItem(css::drawing::LineStyle_NONE) );
|
2014-07-18 18:07:36 +02:00
|
|
|
rSet.Put( XFillStyleItem(drawing::FillStyle_NONE) );
|
2017-10-18 12:28:45 +02:00
|
|
|
rSet.Put( SdrTextFitToSizeTypeItem(drawing::TextFitToSizeType_AUTOFIT) );
|
2014-08-04 19:22:55 +02:00
|
|
|
rSet.Put( makeSdrTextAutoGrowHeightItem(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
|
|
|
|
2017-03-05 10:50:21 +01:00
|
|
|
vcl::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;
|
2014-06-24 06:43:14 +00:00
|
|
|
sal_uInt16 nUpper = 100;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
switch (nLevel)
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
nFontSize = 32;
|
2014-06-24 06:43:14 +00:00
|
|
|
nUpper = 500;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
{
|
|
|
|
nFontSize = 28;
|
2014-06-24 06:43:14 +00:00
|
|
|
nUpper = 400;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
{
|
|
|
|
nFontSize = 24;
|
2014-06-24 06:43:14 +00:00
|
|
|
nUpper = 300;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 4:
|
|
|
|
{
|
2014-06-24 06:43:14 +00:00
|
|
|
nUpper = 200;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// FontSize
|
2018-01-12 20:16:43 +01:00
|
|
|
nFontSize = static_cast<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
|
|
|
|
2014-06-24 06:43:14 +00:00
|
|
|
// Line distance (upwards). Stuff around here cleaned up in i35937
|
|
|
|
aSvxULSpaceItem.SetUpper(nUpper);
|
2000-09-18 23:16:46 +00:00
|
|
|
pSheet->GetItemSet().Put(aSvxULSpaceItem);
|
2002-01-09 13:38:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// if we created outline styles, we need to chain them
|
|
|
|
if( bCreated )
|
|
|
|
{
|
2015-11-10 10:23:02 +01:00
|
|
|
SfxStyleSheetBase* pParent = nullptr;
|
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
|
|
|
|
2018-01-19 12:16:31 +02:00
|
|
|
pSheet = Find(aLevelName, SfxStyleFamily::Page);
|
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
|
|
|
**************************************************************************/
|
2017-04-30 17:01:32 +01:00
|
|
|
aName = aPrefix + STR_LAYOUT_TITLE;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2018-01-19 12:16:31 +02:00
|
|
|
if (!Find(aName, SfxStyleFamily::Page))
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2014-04-24 10:52:02 +02:00
|
|
|
bCreated = true;
|
2002-01-09 13:38:46 +00:00
|
|
|
|
2018-01-19 12:16:31 +02:00
|
|
|
pSheet = &Make(aName, SfxStyleFamily::Page,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();
|
2014-11-21 20:48:11 +02:00
|
|
|
rTitleSet.Put(XLineStyleItem(drawing::LineStyle_NONE));
|
2014-07-18 18:07:36 +02:00
|
|
|
rTitleSet.Put(XFillStyleItem(drawing::FillStyle_NONE));
|
2000-09-18 23:16:46 +00:00
|
|
|
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
|
2016-01-29 17:43:42 +11:00
|
|
|
rTitleSet.Put(SvxUnderlineItem(LINESTYLE_NONE, EE_CHAR_UNDERLINE ));
|
|
|
|
rTitleSet.Put(SvxOverlineItem(LINESTYLE_NONE, EE_CHAR_OVERLINE ));
|
2007-05-10 14:22:57 +00:00
|
|
|
rTitleSet.Put(SvxCrossedOutItem(STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ));
|
2017-03-07 14:39:38 +02:00
|
|
|
rTitleSet.Put(SvxCaseMapItem(SvxCaseMap::NotMapped, EE_CHAR_CASEMAP ));
|
2014-02-26 12:53:18 +02:00
|
|
|
rTitleSet.Put(SvxShadowedItem(false, EE_CHAR_SHADOW ));
|
2014-02-19 16:40:55 +02:00
|
|
|
rTitleSet.Put(SvxContourItem(false, EE_CHAR_OUTLINE ));
|
2016-05-08 09:21:17 +02:00
|
|
|
rTitleSet.Put( SvxEmphasisMarkItem(FontEmphasisMark::NONE, EE_CHAR_EMPHASISMARK ) );
|
2016-05-29 20:23:09 +02:00
|
|
|
rTitleSet.Put( SvxCharReliefItem(FontRelief::NONE, EE_CHAR_RELIEF ) );
|
2018-02-26 13:30:35 +02:00
|
|
|
rTitleSet.Put(SvxColorItem( COL_AUTO, EE_CHAR_COLOR ));
|
|
|
|
rTitleSet.Put(SvxBackgroundColorItem( COL_AUTO, EE_CHAR_BKGCOLOR ));
|
2017-03-07 11:19:35 +02:00
|
|
|
rTitleSet.Put(SvxAdjustItem(SvxAdjust::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
|
|
|
|
2016-02-03 10:13:00 +11:00
|
|
|
aBulletFont.SetFontSize(Size(0,1552)); // 44 pt
|
2000-09-18 23:16:46 +00:00
|
|
|
PutNumBulletItem( pSheet, aBulletFont );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2013-03-01 10:55:30 +01:00
|
|
|
* Subtitle
|
2000-09-18 23:16:46 +00:00
|
|
|
**************************************************************************/
|
2017-04-30 17:01:32 +01:00
|
|
|
aName = aPrefix + STR_LAYOUT_SUBTITLE;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2018-01-19 12:16:31 +02:00
|
|
|
if (!Find(aName, SfxStyleFamily::Page))
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2014-04-24 10:52:02 +02:00
|
|
|
bCreated = true;
|
2002-01-09 13:38:46 +00:00
|
|
|
|
2018-01-19 12:16:31 +02:00
|
|
|
pSheet = &Make(aName, SfxStyleFamily::Page,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();
|
2014-11-21 20:48:11 +02:00
|
|
|
rSubtitleSet.Put(XLineStyleItem(drawing::LineStyle_NONE));
|
2014-07-18 18:07:36 +02:00
|
|
|
rSubtitleSet.Put(XFillStyleItem(drawing::FillStyle_NONE));
|
2000-09-18 23:16:46 +00:00
|
|
|
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
|
2016-01-29 17:43:42 +11:00
|
|
|
rSubtitleSet.Put(SvxUnderlineItem(LINESTYLE_NONE, EE_CHAR_UNDERLINE ));
|
|
|
|
rSubtitleSet.Put(SvxOverlineItem(LINESTYLE_NONE, EE_CHAR_OVERLINE ));
|
2007-05-10 14:22:57 +00:00
|
|
|
rSubtitleSet.Put(SvxCrossedOutItem(STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ));
|
2017-03-07 14:39:38 +02:00
|
|
|
rSubtitleSet.Put(SvxCaseMapItem(SvxCaseMap::NotMapped, EE_CHAR_CASEMAP ));
|
2014-02-26 12:53:18 +02:00
|
|
|
rSubtitleSet.Put(SvxShadowedItem(false, EE_CHAR_SHADOW ));
|
2014-02-19 16:40:55 +02:00
|
|
|
rSubtitleSet.Put(SvxContourItem(false, EE_CHAR_OUTLINE ));
|
2016-05-08 09:21:17 +02:00
|
|
|
rSubtitleSet.Put( SvxEmphasisMarkItem(FontEmphasisMark::NONE, EE_CHAR_EMPHASISMARK ) );
|
2016-05-29 20:23:09 +02:00
|
|
|
rSubtitleSet.Put( SvxCharReliefItem(FontRelief::NONE, EE_CHAR_RELIEF ) );
|
2018-02-26 13:30:35 +02:00
|
|
|
rSubtitleSet.Put(SvxColorItem( COL_AUTO, EE_CHAR_COLOR ));
|
|
|
|
rSubtitleSet.Put(SvxBackgroundColorItem( COL_AUTO, EE_CHAR_BKGCOLOR ));
|
2017-03-07 11:19:35 +02:00
|
|
|
rSubtitleSet.Put(SvxAdjustItem(SvxAdjust::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 ) );
|
2015-05-20 13:05:49 +02:00
|
|
|
aSvxLRSpaceItem.SetTextLeft(0);
|
2000-09-18 23:16:46 +00:00
|
|
|
rSubtitleSet.Put(aSvxLRSpaceItem);
|
2006-12-12 15:33:59 +00:00
|
|
|
|
2014-09-16 10:09:58 +02:00
|
|
|
vcl::Font aTmpFont( GetBulletFont() );
|
2016-02-03 10:13:00 +11:00
|
|
|
aTmpFont.SetFontSize(Size(0, 1129)); // 32 pt
|
2006-12-12 15:33:59 +00:00
|
|
|
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
|
|
|
**************************************************************************/
|
2017-04-30 17:01:32 +01:00
|
|
|
aName = aPrefix + STR_LAYOUT_NOTES;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2018-01-19 12:16:31 +02:00
|
|
|
if (!Find(aName, SfxStyleFamily::Page))
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2014-04-24 10:52:02 +02:00
|
|
|
bCreated = true;
|
2002-01-09 13:38:46 +00:00
|
|
|
|
2018-01-19 12:16:31 +02:00
|
|
|
pSheet = &Make(aName, SfxStyleFamily::Page,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();
|
2014-11-21 20:48:11 +02:00
|
|
|
rNotesSet.Put(XLineStyleItem(drawing::LineStyle_NONE));
|
2014-07-18 18:07:36 +02:00
|
|
|
rNotesSet.Put(XFillStyleItem(drawing::FillStyle_NONE));
|
2000-09-18 23:16:46 +00:00
|
|
|
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
|
2016-01-29 17:43:42 +11:00
|
|
|
rNotesSet.Put( SvxUnderlineItem(LINESTYLE_NONE, EE_CHAR_UNDERLINE ) );
|
|
|
|
rNotesSet.Put( SvxOverlineItem(LINESTYLE_NONE, EE_CHAR_OVERLINE ) );
|
2007-05-10 14:22:57 +00:00
|
|
|
rNotesSet.Put( SvxCrossedOutItem(STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ) );
|
2017-03-07 14:39:38 +02:00
|
|
|
rNotesSet.Put( SvxCaseMapItem(SvxCaseMap::NotMapped, EE_CHAR_CASEMAP ) );
|
2014-02-26 12:53:18 +02:00
|
|
|
rNotesSet.Put( SvxShadowedItem(false, EE_CHAR_SHADOW ) );
|
2014-02-19 16:40:55 +02:00
|
|
|
rNotesSet.Put( SvxContourItem(false, EE_CHAR_OUTLINE ) );
|
2016-05-08 09:21:17 +02:00
|
|
|
rNotesSet.Put( SvxEmphasisMarkItem(FontEmphasisMark::NONE, EE_CHAR_EMPHASISMARK ) );
|
2016-05-29 20:23:09 +02:00
|
|
|
rNotesSet.Put( SvxCharReliefItem(FontRelief::NONE, EE_CHAR_RELIEF) );
|
2018-02-26 13:30:35 +02:00
|
|
|
rNotesSet.Put( SvxColorItem( COL_AUTO, EE_CHAR_COLOR ) );
|
|
|
|
rNotesSet.Put( SvxBackgroundColorItem( COL_AUTO, EE_CHAR_BKGCOLOR ) );
|
2017-11-15 14:19:37 +02:00
|
|
|
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
|
|
|
**************************************************************************/
|
2017-04-30 17:01:32 +01:00
|
|
|
aName = aPrefix + STR_LAYOUT_BACKGROUNDOBJECTS;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2018-01-19 12:16:31 +02:00
|
|
|
if (!Find(aName, SfxStyleFamily::Page))
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2014-04-24 10:52:02 +02:00
|
|
|
bCreated = true;
|
2002-01-09 13:38:46 +00:00
|
|
|
|
2018-01-19 12:16:31 +02:00
|
|
|
pSheet = &Make(aName, SfxStyleFamily::Page,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();
|
2014-08-05 08:59:37 +02:00
|
|
|
rBackgroundObjectsSet.Put(makeSdrShadowItem(false));
|
2018-02-26 13:30:35 +02:00
|
|
|
rBackgroundObjectsSet.Put(makeSdrShadowColorItem(COL_GRAY));
|
2014-08-18 10:55:03 +02:00
|
|
|
rBackgroundObjectsSet.Put(makeSdrShadowXDistItem(200)); // 3 mm shadow distance
|
|
|
|
rBackgroundObjectsSet.Put(makeSdrShadowYDistItem(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
|
|
|
**************************************************************************/
|
2017-04-30 17:01:32 +01:00
|
|
|
aName = aPrefix + STR_LAYOUT_BACKGROUND;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2018-01-19 12:16:31 +02:00
|
|
|
if (!Find(aName, SfxStyleFamily::Page))
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2014-04-24 10:52:02 +02:00
|
|
|
bCreated = true;
|
2002-01-09 13:38:46 +00:00
|
|
|
|
2018-01-19 12:16:31 +02:00
|
|
|
pSheet = &Make(aName, SfxStyleFamily::Page,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();
|
2014-11-21 20:48:11 +02:00
|
|
|
rBackgroundSet.Put(XLineStyleItem(drawing::LineStyle_NONE));
|
2014-07-18 18:07:36 +02:00
|
|
|
rBackgroundSet.Put(XFillStyleItem(drawing::FillStyle_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)
|
|
|
|
{
|
2018-01-19 12:16:31 +02:00
|
|
|
CopySheets( rSourcePool, SfxStyleFamily::Para );
|
2008-03-12 10:28:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SdStyleSheetPool::CopyCellSheets(SdStyleSheetPool& rSourcePool)
|
|
|
|
{
|
2018-01-19 12:16:31 +02:00
|
|
|
CopySheets( rSourcePool, SfxStyleFamily::Frame );
|
2008-03-12 10:28:54 +00:00
|
|
|
}
|
|
|
|
|
2017-08-03 10:23:01 +02:00
|
|
|
void SdStyleSheetPool::CopyTableStyles(SdStyleSheetPool const & rSourcePool)
|
2008-03-12 10:28:54 +00:00
|
|
|
{
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-22 10:08:42 +01:00
|
|
|
void SdStyleSheetPool::CopyCellSheets(SdStyleSheetPool& rSourcePool, StyleSheetCopyResultVector& rCreatedSheets)
|
2013-01-17 15:01:32 +01:00
|
|
|
{
|
2018-01-19 12:16:31 +02:00
|
|
|
CopySheets( rSourcePool, SfxStyleFamily::Frame, rCreatedSheets );
|
2013-01-17 15:01:32 +01:00
|
|
|
}
|
|
|
|
|
2018-08-22 10:08:42 +01:00
|
|
|
void SdStyleSheetPool::RenameAndCopyGraphicSheets(SdStyleSheetPool& rSourcePool, StyleSheetCopyResultVector& rCreatedSheets, OUString const &rRenameSuffix)
|
2014-02-13 16:10:47 +05:30
|
|
|
{
|
2018-01-19 12:16:31 +02:00
|
|
|
CopySheets( rSourcePool, SfxStyleFamily::Para, rCreatedSheets, rRenameSuffix );
|
2014-02-13 16:10:47 +05:30
|
|
|
}
|
|
|
|
|
2008-03-12 10:28:54 +00:00
|
|
|
void SdStyleSheetPool::CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily )
|
2013-01-17 15:01:32 +01:00
|
|
|
{
|
2018-08-22 10:08:42 +01:00
|
|
|
StyleSheetCopyResultVector aTmpSheets;
|
2013-01-17 15:01:32 +01:00
|
|
|
CopySheets(rSourcePool, eFamily, aTmpSheets);
|
|
|
|
}
|
|
|
|
|
2018-08-22 10:08:42 +01:00
|
|
|
void SdStyleSheetPool::CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily, StyleSheetCopyResultVector& rCreatedSheets)
|
2014-02-13 16:10:47 +05:30
|
|
|
{
|
2017-05-08 16:12:01 +02:00
|
|
|
CopySheets(rSourcePool, eFamily, rCreatedSheets, "");
|
2014-02-13 16:10:47 +05:30
|
|
|
}
|
|
|
|
|
2014-03-05 20:06:39 +01:00
|
|
|
namespace
|
|
|
|
{
|
|
|
|
|
|
|
|
struct HasFamilyPredicate : svl::StyleSheetPredicate
|
|
|
|
{
|
2015-10-25 17:33:13 +02:00
|
|
|
explicit HasFamilyPredicate(SfxStyleFamily eFamily)
|
2016-11-13 19:08:22 +01:00
|
|
|
: meFamily(eFamily) {}
|
2014-03-05 20:06:39 +01:00
|
|
|
|
2015-10-12 16:04:04 +02:00
|
|
|
bool Check(const SfxStyleSheetBase& sheet) override
|
2014-03-05 20:06:39 +01:00
|
|
|
{
|
|
|
|
return sheet.GetFamily() == meFamily;
|
|
|
|
}
|
2018-10-08 16:12:06 +02:00
|
|
|
SfxStyleFamily const meFamily;
|
2014-03-05 20:06:39 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-08-22 10:08:42 +01:00
|
|
|
void SdStyleSheetPool::CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily, StyleSheetCopyResultVector& rCreatedSheets, const OUString& rRenameSuffix)
|
2008-03-12 10:28:54 +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
|
|
|
|
2014-03-05 20:06:39 +01:00
|
|
|
// find all style sheets of the source pool which have the same family
|
|
|
|
HasFamilyPredicate aHasFamilyPredicate(eFamily);
|
|
|
|
std::vector<unsigned> aSheetsWithFamily = rSourcePool.GetIndexedStyleSheets().FindPositionsByPredicate(aHasFamilyPredicate);
|
|
|
|
|
|
|
|
for (std::vector<unsigned>::const_iterator it = aSheetsWithFamily.begin();
|
|
|
|
it != aSheetsWithFamily.end(); ++it )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2018-06-13 14:19:17 +02:00
|
|
|
SfxStyleSheetBase* pSheet = rSourcePool.GetStyleSheetByPositionInIndex( *it );
|
|
|
|
if( !pSheet )
|
2014-04-04 12:10:01 +05:30
|
|
|
continue;
|
2018-06-13 14:19:17 +02:00
|
|
|
rtl::OUString aName( pSheet->GetName() );
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2014-03-05 20:06:39 +01:00
|
|
|
// now check whether we already have a sheet with the same name
|
|
|
|
std::vector<unsigned> aSheetsWithName = GetIndexedStyleSheets().FindPositionsByName(aName);
|
|
|
|
bool bAddToList = false;
|
2015-11-10 10:23:02 +01:00
|
|
|
SfxStyleSheetBase * pExistingSheet = nullptr;
|
2014-05-10 23:00:54 +02:00
|
|
|
if (!aSheetsWithName.empty())
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2014-03-05 20:06:39 +01:00
|
|
|
// if we have a rename suffix, try to find a new name
|
2014-05-10 23:00:54 +02:00
|
|
|
pExistingSheet =
|
2018-06-13 14:19:17 +02:00
|
|
|
GetStyleSheetByPositionInIndex(aSheetsWithName.front());
|
2014-05-10 23:00:54 +02:00
|
|
|
if (!rRenameSuffix.isEmpty() &&
|
2018-06-13 14:19:17 +02:00
|
|
|
pExistingSheet->GetItemSet().Equals(pSheet->GetItemSet(), false))
|
2014-02-13 16:10:47 +05:30
|
|
|
{
|
2014-03-05 20:06:39 +01:00
|
|
|
// we have found a sheet with the same name, but different contents. Try to find a new name.
|
|
|
|
// If we already have a sheet with the new name, and it is equal to the one in the source pool,
|
|
|
|
// do nothing.
|
|
|
|
OUString aTmpName = aName + rRenameSuffix;
|
|
|
|
sal_Int32 nSuffix = 1;
|
|
|
|
do
|
2014-02-13 16:10:47 +05:30
|
|
|
{
|
2014-03-05 20:06:39 +01:00
|
|
|
aTmpName = aName + rRenameSuffix + OUString::number(nSuffix);
|
|
|
|
pExistingSheet = Find(aTmpName, eFamily);
|
|
|
|
nSuffix++;
|
2018-06-13 14:19:17 +02:00
|
|
|
} while( pExistingSheet && pExistingSheet->GetItemSet().Equals(pSheet->GetItemSet(), false) );
|
2014-03-05 20:06:39 +01:00
|
|
|
aName = aTmpName;
|
|
|
|
bAddToList = true;
|
2014-02-13 16:10:47 +05:30
|
|
|
}
|
2014-05-10 23:00:54 +02:00
|
|
|
}
|
2014-05-10 23:04:45 +02:00
|
|
|
// we do not already have a sheet with the same name and contents. Create a new one.
|
|
|
|
if (!pExistingSheet)
|
2014-05-10 23:00:54 +02:00
|
|
|
{
|
2014-05-10 23:04:45 +02:00
|
|
|
assert(!Find(aName, eFamily));
|
|
|
|
rtl::Reference< SfxStyleSheetBase > xNewSheet( &Make( aName, eFamily ) );
|
2001-09-26 15:19:08 +00:00
|
|
|
|
2018-06-13 14:19:17 +02:00
|
|
|
xNewSheet->SetMask( pSheet->GetMask() );
|
2005-03-23 12:56:08 +00:00
|
|
|
|
2014-05-10 23:04:45 +02:00
|
|
|
// Also set parent relation for copied style sheets
|
2018-06-13 14:19:17 +02:00
|
|
|
OUString aParent( pSheet->GetParent() );
|
2014-05-10 23:04:45 +02:00
|
|
|
if( !aParent.isEmpty() )
|
2017-09-12 09:45:17 +02:00
|
|
|
aNewStyles.emplace_back( xNewSheet, aParent );
|
2001-09-26 15:19:08 +00:00
|
|
|
|
2014-12-08 18:06:01 +01:00
|
|
|
if( !bAddToList )
|
2014-12-08 18:12:54 +01:00
|
|
|
{
|
|
|
|
OUString aHelpFile;
|
2018-06-13 14:19:17 +02:00
|
|
|
xNewSheet->SetHelpId( aHelpFile, pSheet->GetHelpId( aHelpFile ) );
|
2014-12-08 18:12:54 +01:00
|
|
|
}
|
2018-06-13 14:19:17 +02:00
|
|
|
xNewSheet->GetItemSet().Put( pSheet->GetItemSet() );
|
2013-01-17 15:01:32 +01:00
|
|
|
|
2018-08-22 10:08:42 +01:00
|
|
|
rCreatedSheets.emplace_back(static_cast<SdStyleSheet*>(xNewSheet.get()), true);
|
2018-06-13 14:19:17 +02:00
|
|
|
aRenamedList.emplace_back( pSheet->GetName(), aName );
|
2014-05-10 23:04:45 +02:00
|
|
|
}
|
|
|
|
else if (bAddToList)
|
|
|
|
{
|
|
|
|
// Add to list - used for renaming
|
2018-08-22 10:08:42 +01:00
|
|
|
rCreatedSheets.emplace_back(static_cast<SdStyleSheet*>(pExistingSheet), false);
|
2018-06-13 14:19:17 +02:00
|
|
|
aRenamedList.emplace_back( pSheet->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 );
|
|
|
|
}
|
2014-03-05 20:06:39 +01:00
|
|
|
// we have changed names of style sheets. Trigger reindexing.
|
|
|
|
Reindex();
|
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
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2018-08-22 10:08:42 +01:00
|
|
|
void SdStyleSheetPool::CopyLayoutSheets(const OUString& rLayoutName, SdStyleSheetPool& rSourcePool, StyleSheetCopyResultVector& rCreatedSheets)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2015-11-10 10:23:02 +01:00
|
|
|
SfxStyleSheetBase* pSheet = nullptr;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
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-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
|
|
|
{
|
2018-01-19 12:16:31 +02:00
|
|
|
pSheet = Find(*it, SfxStyleFamily::Page);
|
2000-09-18 23:16:46 +00:00
|
|
|
if (!pSheet)
|
|
|
|
{
|
2018-01-19 12:16:31 +02:00
|
|
|
SfxStyleSheetBase* pSourceSheet = rSourcePool.Find(*it, SfxStyleFamily::Page);
|
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.
|
2018-01-19 12:16:31 +02:00
|
|
|
SfxStyleSheetBase& rNewSheet = Make(*it, SfxStyleFamily::Page);
|
2015-08-26 23:44:02 +02:00
|
|
|
OUString file;
|
|
|
|
rNewSheet.SetHelpId( file, pSourceSheet->GetHelpId( file ) );
|
2000-09-18 23:16:46 +00:00
|
|
|
rNewSheet.GetItemSet().Put(pSourceSheet->GetItemSet());
|
2018-08-22 10:08:42 +01:00
|
|
|
rCreatedSheets.emplace_back(static_cast<SdStyleSheet*>(&rNewSheet), true);
|
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
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2015-04-29 09:55:11 +02:00
|
|
|
void SdStyleSheetPool::CreateLayoutSheetNames(const OUString& rLayoutName, std::vector<OUString> &aNameList)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2013-09-05 14:22:12 +02:00
|
|
|
OUString aPrefix(rLayoutName + SD_LT_SEPARATOR);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2013-09-05 14:22:12 +02:00
|
|
|
for (sal_Int32 nLevel = 1; nLevel < 10; nLevel++)
|
2017-09-12 09:45:17 +02:00
|
|
|
aNameList.emplace_back(aPrefix + STR_LAYOUT_OUTLINE " " + OUString::number( nLevel ) );
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2017-09-12 09:45:17 +02:00
|
|
|
aNameList.emplace_back(aPrefix + STR_LAYOUT_TITLE);
|
|
|
|
aNameList.emplace_back(aPrefix + STR_LAYOUT_SUBTITLE);
|
|
|
|
aNameList.emplace_back(aPrefix + STR_LAYOUT_NOTES);
|
|
|
|
aNameList.emplace_back(aPrefix + STR_LAYOUT_BACKGROUNDOBJECTS);
|
|
|
|
aNameList.emplace_back(aPrefix + 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
|
|
|
{
|
2014-12-18 13:30:26 +01:00
|
|
|
OUString aLayoutNameWithSep(rLayoutName + SD_LT_SEPARATOR);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2018-01-19 12:16:31 +02:00
|
|
|
SfxStyleSheetIterator aIter(this, SfxStyleFamily::Page);
|
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))
|
2017-09-12 09:45:17 +02:00
|
|
|
rLayoutSheets.emplace_back( 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;
|
2015-11-10 10:23:02 +01:00
|
|
|
SfxStyleSheetBase* pSheet = nullptr;
|
|
|
|
SfxStyleSheetBase* pParent = nullptr;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2018-04-18 12:14:37 +02:00
|
|
|
SfxStyleSearchBits nUsedMask = SfxStyleSearchBits::Used;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2017-05-18 21:14:00 +01:00
|
|
|
aName = SdResId(STR_PSEUDOSHEET_TITLE);
|
2018-01-19 12:16:31 +02:00
|
|
|
if( (pSheet = Find(aName, SfxStyleFamily::Pseudo)) == nullptr )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2018-01-19 12:16:31 +02:00
|
|
|
pSheet = &Make(aName, SfxStyleFamily::Pseudo, nUsedMask);
|
2013-09-05 14:22:12 +02:00
|
|
|
pSheet->SetParent( OUString() );
|
2014-11-11 07:52:45 +02:00
|
|
|
static_cast<SfxStyleSheet*>(pSheet)->StartListening(*this);
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_TITLE );
|
|
|
|
|
2017-05-18 21:14:00 +01:00
|
|
|
aName = SdResId(STR_PSEUDOSHEET_SUBTITLE);
|
2018-01-19 12:16:31 +02:00
|
|
|
if( (pSheet = Find(aName, SfxStyleFamily::Pseudo)) == nullptr )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2018-01-19 12:16:31 +02:00
|
|
|
pSheet = &Make(aName, SfxStyleFamily::Pseudo, nUsedMask);
|
2013-09-05 14:22:12 +02:00
|
|
|
pSheet->SetParent( OUString() );
|
2014-11-11 07:52:45 +02:00
|
|
|
static_cast<SfxStyleSheet*>(pSheet)->StartListening(*this);
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_SUBTITLE );
|
|
|
|
|
2017-05-18 21:14:00 +01:00
|
|
|
aName = SdResId(STR_PSEUDOSHEET_BACKGROUNDOBJECTS);
|
2018-01-19 12:16:31 +02:00
|
|
|
if( (pSheet = Find(aName, SfxStyleFamily::Pseudo)) == nullptr )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2018-01-19 12:16:31 +02:00
|
|
|
pSheet = &Make(aName, SfxStyleFamily::Pseudo, nUsedMask);
|
2013-09-05 14:22:12 +02:00
|
|
|
pSheet->SetParent( OUString() );
|
2014-11-11 07:52:45 +02:00
|
|
|
static_cast<SfxStyleSheet*>(pSheet)->StartListening(*this);
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_BACKGROUNDOBJECTS );
|
|
|
|
|
2017-05-18 21:14:00 +01:00
|
|
|
aName = SdResId(STR_PSEUDOSHEET_BACKGROUND);
|
2018-01-19 12:16:31 +02:00
|
|
|
if( (pSheet = Find(aName, SfxStyleFamily::Pseudo)) == nullptr )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2018-01-19 12:16:31 +02:00
|
|
|
pSheet = &Make(aName, SfxStyleFamily::Pseudo, nUsedMask);
|
2013-09-05 14:22:12 +02:00
|
|
|
pSheet->SetParent( OUString() );
|
2014-11-11 07:52:45 +02:00
|
|
|
static_cast<SfxStyleSheet*>(pSheet)->StartListening(*this);
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_BACKGROUND );
|
|
|
|
|
2017-05-18 21:14:00 +01:00
|
|
|
aName = SdResId(STR_PSEUDOSHEET_NOTES);
|
2018-01-19 12:16:31 +02:00
|
|
|
if( (pSheet = Find(aName, SfxStyleFamily::Pseudo)) == nullptr )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2018-01-19 12:16:31 +02:00
|
|
|
pSheet = &Make(aName, SfxStyleFamily::Pseudo, nUsedMask);
|
2013-09-05 14:22:12 +02:00
|
|
|
pSheet->SetParent( OUString() );
|
2014-11-11 07:52:45 +02:00
|
|
|
static_cast<SfxStyleSheet*>(pSheet)->StartListening(*this);
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_NOTES );
|
|
|
|
|
2015-11-10 10:23:02 +01:00
|
|
|
pParent = nullptr;
|
2018-01-19 12:16:31 +02:00
|
|
|
SetSearchMask(SfxStyleFamily::Pseudo);
|
2017-05-18 21:14:00 +01:00
|
|
|
aName = SdResId(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
|
|
|
|
2018-01-19 12:16:31 +02:00
|
|
|
if( (pSheet = Find(aLevelName, SfxStyleFamily::Pseudo)) == nullptr )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2018-01-19 12:16:31 +02:00
|
|
|
pSheet = &Make(aLevelName, SfxStyleFamily::Pseudo, nUsedMask);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
if (pSheet)
|
|
|
|
{
|
|
|
|
if (pParent)
|
|
|
|
pSheet->SetParent(pParent->GetName());
|
|
|
|
pParent = pSheet;
|
2014-11-11 07:52:45 +02:00
|
|
|
static_cast<SfxStyleSheet*>(pSheet)->StartListening(*this);
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
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
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2014-03-05 20:06:39 +01:00
|
|
|
namespace
|
|
|
|
{
|
|
|
|
struct StyleSheetIsUserDefinedPredicate : svl::StyleSheetPredicate
|
|
|
|
{
|
|
|
|
StyleSheetIsUserDefinedPredicate()
|
2016-11-13 19:08:22 +01:00
|
|
|
{}
|
2014-03-05 20:06:39 +01:00
|
|
|
|
2015-10-12 16:04:04 +02:00
|
|
|
bool Check(const SfxStyleSheetBase& sheet) override
|
2014-03-05 20:06:39 +01:00
|
|
|
{
|
2014-09-05 14:11:15 +02:00
|
|
|
return sheet.IsUserDefined();
|
2014-03-05 20:06:39 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
void SdStyleSheetPool::UpdateStdNames()
|
|
|
|
{
|
2013-03-02 15:40:14 +01:00
|
|
|
OUString aHelpFile;
|
2014-03-05 20:06:39 +01:00
|
|
|
StyleSheetIsUserDefinedPredicate aPredicate;
|
2011-06-12 18:37:27 -04:30
|
|
|
std::vector<SfxStyleSheetBase*> aEraseList;
|
2014-03-05 20:06:39 +01:00
|
|
|
std::vector<unsigned> aUserDefinedStyles = GetIndexedStyleSheets().FindPositionsByPredicate(aPredicate);
|
|
|
|
for (std::vector<unsigned>::const_iterator it = aUserDefinedStyles.begin();
|
|
|
|
it != aUserDefinedStyles.end(); ++it)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2018-06-13 14:19:17 +02:00
|
|
|
SfxStyleSheetBase* pStyle = GetStyleSheetByPositionInIndex(*it);
|
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();
|
|
|
|
|
2014-04-24 10:52:02 +02:00
|
|
|
bool bHelpKnown = true;
|
2013-09-05 14:22:12 +02:00
|
|
|
OUString aNewName;
|
2017-06-11 20:56:30 +01:00
|
|
|
const char* pNameId = nullptr;
|
2000-09-18 23:16:46 +00:00
|
|
|
switch( nHelpId )
|
|
|
|
{
|
2017-06-11 20:56:30 +01:00
|
|
|
case HID_STANDARD_STYLESHEET_NAME: pNameId = STR_STANDARD_STYLESHEET_NAME; break;
|
|
|
|
case HID_POOLSHEET_OBJWITHOUTFILL: pNameId = STR_POOLSHEET_OBJWITHOUTFILL; break;
|
|
|
|
case HID_POOLSHEET_OBJNOLINENOFILL: pNameId = STR_POOLSHEET_OBJNOLINENOFILL;break;
|
|
|
|
case HID_POOLSHEET_TEXT: pNameId = STR_POOLSHEET_TEXT; break;
|
2018-09-13 19:31:49 +02:00
|
|
|
case HID_POOLSHEET_A4: pNameId = STR_POOLSHEET_A4; break;
|
|
|
|
case HID_POOLSHEET_A4_TITLE: pNameId = STR_POOLSHEET_A4_TITLE; break;
|
|
|
|
case HID_POOLSHEET_A4_HEADLINE: pNameId = STR_POOLSHEET_A4_HEADLINE; break;
|
|
|
|
case HID_POOLSHEET_A4_TEXT: pNameId = STR_POOLSHEET_A4_TEXT; break;
|
|
|
|
case HID_POOLSHEET_A0: pNameId = STR_POOLSHEET_A0; break;
|
|
|
|
case HID_POOLSHEET_A0_TITLE: pNameId = STR_POOLSHEET_A0_TITLE; break;
|
|
|
|
case HID_POOLSHEET_A0_HEADLINE: pNameId = STR_POOLSHEET_A0_HEADLINE; break;
|
|
|
|
case HID_POOLSHEET_A0_TEXT: pNameId = STR_POOLSHEET_A0_TEXT; break;
|
|
|
|
case HID_POOLSHEET_GRAPHIC: pNameId = STR_POOLSHEET_GRAPHIC; break;
|
|
|
|
case HID_POOLSHEET_SHAPES: pNameId = STR_POOLSHEET_SHAPES; break;
|
2018-05-13 12:16:35 +02:00
|
|
|
case HID_POOLSHEET_FILLED: pNameId = STR_POOLSHEET_FILLED; break;
|
|
|
|
case HID_POOLSHEET_FILLED_BLUE: pNameId = STR_POOLSHEET_FILLED_BLUE; break;
|
|
|
|
case HID_POOLSHEET_FILLED_GREEN: pNameId = STR_POOLSHEET_FILLED_GREEN; break;
|
|
|
|
case HID_POOLSHEET_FILLED_RED: pNameId = STR_POOLSHEET_FILLED_RED; break;
|
|
|
|
case HID_POOLSHEET_FILLED_YELLOW: pNameId = STR_POOLSHEET_FILLED_YELLOW; break;
|
|
|
|
case HID_POOLSHEET_OUTLINE: pNameId = STR_POOLSHEET_OUTLINE; break;
|
|
|
|
case HID_POOLSHEET_OUTLINE_BLUE: pNameId = STR_POOLSHEET_OUTLINE_BLUE; break;
|
|
|
|
case HID_POOLSHEET_OUTLINE_GREEN: pNameId = STR_POOLSHEET_OUTLINE_GREEN; break;
|
|
|
|
case HID_POOLSHEET_OUTLINE_RED: pNameId = STR_POOLSHEET_OUTLINE_RED; break;
|
|
|
|
case HID_POOLSHEET_OUTLINE_YELLOW: pNameId = STR_POOLSHEET_OUTLINE_YELLOW; break;
|
2018-09-13 19:31:49 +02:00
|
|
|
case HID_POOLSHEET_LINES: pNameId = STR_POOLSHEET_LINES; break;
|
|
|
|
case HID_POOLSHEET_MEASURE: pNameId = STR_POOLSHEET_MEASURE; break;
|
|
|
|
case HID_POOLSHEET_LINES_DASHED: pNameId = STR_POOLSHEET_LINES_DASHED; break;
|
2017-06-11 20:56:30 +01:00
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
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:
|
2017-06-11 20:56:30 +01:00
|
|
|
case HID_PSEUDOSHEET_OUTLINE9: pNameId = STR_PSEUDOSHEET_OUTLINE; break;
|
|
|
|
case HID_PSEUDOSHEET_BACKGROUNDOBJECTS: pNameId = STR_PSEUDOSHEET_BACKGROUNDOBJECTS; break;
|
|
|
|
case HID_PSEUDOSHEET_BACKGROUND: pNameId = STR_PSEUDOSHEET_BACKGROUND; break;
|
|
|
|
case HID_PSEUDOSHEET_NOTES: pNameId = STR_PSEUDOSHEET_NOTES; break;
|
|
|
|
|
|
|
|
case HID_SD_CELL_STYLE_DEFAULT: pNameId = STR_STANDARD_STYLESHEET_NAME; break;
|
|
|
|
case HID_SD_CELL_STYLE_BANDED: pNameId = STR_POOLSHEET_BANDED_CELL; break;
|
|
|
|
case HID_SD_CELL_STYLE_HEADER: pNameId = STR_POOLSHEET_HEADER; break;
|
|
|
|
case HID_SD_CELL_STYLE_TOTAL: pNameId = STR_POOLSHEET_TOTAL; break;
|
|
|
|
case HID_SD_CELL_STYLE_FIRST_COLUMN: pNameId = STR_POOLSHEET_FIRST_COLUMN; break;
|
|
|
|
case HID_SD_CELL_STYLE_LAST_COLUMN: pNameId = STR_POOLSHEET_LAST_COLUMN; break;
|
2008-03-12 10:28:54 +00:00
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
default:
|
2013-03-01 10:55:30 +01:00
|
|
|
// 0 or wrong (old) HelpId
|
2014-04-24 10:52:02 +02:00
|
|
|
bHelpKnown = false;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
if( bHelpKnown )
|
|
|
|
{
|
2017-06-11 20:56:30 +01:00
|
|
|
if (pNameId)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2017-06-11 20:56:30 +01:00
|
|
|
aNewName = SdResId(pNameId);
|
|
|
|
if (strcmp(pNameId, STR_PSEUDOSHEET_OUTLINE) == 0)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-28 13:23:52 +01:00
|
|
|
if (!aEraseList.empty())
|
|
|
|
{
|
|
|
|
// styles that could not be renamed, must be removed
|
2016-05-09 13:22:38 +02:00
|
|
|
for (SfxStyleSheetBase* p : aEraseList)
|
|
|
|
Remove( p );
|
2014-05-28 13:23:52 +01:00
|
|
|
Reindex();
|
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-06-13 11:23:07 +01:00
|
|
|
void SdStyleSheetPool::setDefaultOutlineNumberFormatBulletAndIndent(sal_uInt16 i, SvxNumberFormat &rNumberFormat)
|
|
|
|
{
|
|
|
|
rNumberFormat.SetBulletChar( 0x25CF ); // StarBats: 0xF000 + 34
|
|
|
|
rNumberFormat.SetBulletRelSize(45);
|
SvxNumberFormat::nAbsLSpace should have a larger type
...as is seen when executing CppunitTest_sd_filters_test with Clang's new
-fsanitize=implicit-conversion (see below). The next larger natural choice
after short is sal_Int32, and some of the code calling GetAbsLSpace actually
already supported the value to be as wide (but not wider than) sal_Int32; code
calling GetAbsLSpace that expected the value to be no wider than short has
either been adapted or at least been marked with a TODO. (Other choices could
have been sal_Int64 or long.)
Some dependent function's parameter types have also been changed accordingly.
> Testing file:///home/sbergman/lo/core/sd/qa/unit/data/ppt/pass/hang-10.ppt:
[...]
> filter/source/msfilter/svdfppt.cxx:3792:33: runtime error: implicit conversion from type 'sal_uInt32' (aka 'unsigned int') of value 144780 (32-bit, unsigned) to type 'short' changed the value to 13708 (16-bit, signed)
> #0 in PPTNumberFormatCreator::ImplGetNumberFormat(SdrPowerPointImport const&, SvxNumberFormat&) at filter/source/msfilter/svdfppt.cxx:3792:33 (instdir/program/libmsfilterlo.so +0x7992cc)
> #1 in PPTNumberFormatCreator::GetNumberFormat(SdrPowerPointImport const&, SvxNumberFormat&, unsigned int, PPTParaLevel const&, PPTCharLevel const&, TSS_Type) at filter/source/msfilter/svdfppt.cxx:3674:5 (instdir/program/libmsfilterlo.so +0x797c6d)
> #2 in PPTStyleSheet::PPTStyleSheet(DffRecordHeader const&, SvStream&, SdrPowerPointImport&, PPTTextParagraphStyleAtomInterpreter const&, PPTTextSpecInfo const&) at filter/source/msfilter/svdfppt.cxx:4395:13 (instdir/program/libmsfilterlo.so +0x7ac38d)
> #3 in SdrPowerPointImport::SdrPowerPointImport(PowerPointImportParam&, rtl::OUString const&) at filter/source/msfilter/svdfppt.cxx:1618:59 (instdir/program/libmsfilterlo.so +0x74762f)
> #4 in ImplSdPPTImport::ImplSdPPTImport(SdDrawDocument*, SotStorage&, SfxMedium&, PowerPointImportParam&) at sd/source/filter/ppt/pptin.cxx:175:7 (instdir/program/libsdfiltlo.so +0x5f2be8)
> #5 in SdPPTImport::SdPPTImport(SdDrawDocument*, SvStream&, SotStorage&, SfxMedium&) at sd/source/filter/ppt/pptin.cxx:162:23 (instdir/program/libsdfiltlo.so +0x5ce2bb)
> #6 in ImportPPT at sd/source/filter/ppt/pptin.cxx:2760:47 (instdir/program/libsdfiltlo.so +0x617c79)
> #7 in SdPPTFilter::Import() at sd/source/filter/sdpptwrp.cxx:106:32 (instdir/program/libsdlo.so +0x2878413)
> #8 in sd::DrawDocShell::ConvertFrom(SfxMedium&) at sd/source/ui/docshell/docshel4.cxx:474:46 (instdir/program/libsdlo.so +0x2e165bc)
> #9 in SfxObjectShell::DoLoad(SfxMedium*) at sfx2/source/doc/objstor.cxx:786:23 (instdir/program/libsfxlo.so +0x2c8cb12)
> #10 in SdFiltersTest::load(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int) at sd/qa/unit/filters-test.cxx:75:31 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x19771)
> #11 in test::FiltersTest::recursiveScan(test::filterStatus, rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int, bool) at unotest/source/cpp/filters-test.cxx:130:20 (workdir/LinkTarget/CppunitTest/../Library/libunotest.so +0x5724c)
> #12 in test::FiltersTest::testDir(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int, bool) at unotest/source/cpp/filters-test.cxx:155:5 (workdir/LinkTarget/CppunitTest/../Library/libunotest.so +0x57ec9)
> #13 in SdFiltersTest::testCVEs() at sd/qa/unit/filters-test.cxx:83:5 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x19d6d)
Change-Id: Ifa298a51bb62b7cbee9249b8289963f3427721f5
Reviewed-on: https://gerrit.libreoffice.org/59116
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-08-15 16:48:09 +02:00
|
|
|
const auto nLSpace = (i + 1) * 1200;
|
2014-06-13 11:23:07 +01:00
|
|
|
rNumberFormat.SetAbsLSpace(nLSpace);
|
SvxNumberFormat::nFirstLineOffset should have a larger type
...similar to 0d227c96e11d7d03829144183bc66d229e059a4b
"SvxNumberFormat::nAbsLSpace should have a larger type", this time due to:
> Testing file:///home/sbergman/lo/core/sd/qa/unit/data/ppt/pass/hang-10.ppt:
[...]
> filter/source/msfilter/svdfppt.cxx:3793:39: runtime error: implicit conversion from type 'sal_Int32' (aka 'int') of value -142240 (32-bit, signed) to type 'short' changed the value to -11168 (16-bit, signed)
> #0 in PPTNumberFormatCreator::ImplGetNumberFormat(SdrPowerPointImport const&, SvxNumberFormat&) at filter/source/msfilter/svdfppt.cxx:3793:39 (instdir/program/libmsfilterlo.so +0x79930d)
> #1 in PPTNumberFormatCreator::GetNumberFormat(SdrPowerPointImport const&, SvxNumberFormat&, unsigned int, PPTParaLevel const&, PPTCharLevel const&, TSS_Type) at filter/source/msfilter/svdfppt.cxx:3674:5 (instdir/program/libmsfilterlo.so +0x797bad)
> #2 in PPTStyleSheet::PPTStyleSheet(DffRecordHeader const&, SvStream&, SdrPowerPointImport&, PPTTextParagraphStyleAtomInterpreter const&, PPTTextSpecInfo const&) at filter/source/msfilter/svdfppt.cxx:4395:13 (instdir/program/libmsfilterlo.so +0x7ac27d)
> #3 in SdrPowerPointImport::SdrPowerPointImport(PowerPointImportParam&, rtl::OUString const&) at filter/source/msfilter/svdfppt.cxx:1618:59 (instdir/program/libmsfilterlo.so +0x74759f)
> #4 in ImplSdPPTImport::ImplSdPPTImport(SdDrawDocument*, SotStorage&, SfxMedium&, PowerPointImportParam&) at sd/source/filter/ppt/pptin.cxx:175:7 (instdir/program/libsdfiltlo.so +0x5f2be8)
> #5 in SdPPTImport::SdPPTImport(SdDrawDocument*, SvStream&, SotStorage&, SfxMedium&) at sd/source/filter/ppt/pptin.cxx:162:23 (instdir/program/libsdfiltlo.so +0x5ce2bb)
> #6 in ImportPPT at sd/source/filter/ppt/pptin.cxx:2760:47 (instdir/program/libsdfiltlo.so +0x617c79)
> #7 in SdPPTFilter::Import() at sd/source/filter/sdpptwrp.cxx:106:32 (instdir/program/libsdlo.so +0x2878233)
> #8 in sd::DrawDocShell::ConvertFrom(SfxMedium&) at sd/source/ui/docshell/docshel4.cxx:474:46 (instdir/program/libsdlo.so +0x2e163dc)
> #9 in SfxObjectShell::DoLoad(SfxMedium*) at sfx2/source/doc/objstor.cxx:786:23 (instdir/program/libsfxlo.so +0x2c8c492)
> #10 in SdFiltersTest::load(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int) at sd/qa/unit/filters-test.cxx:75:31 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x19771)
> #11 in test::FiltersTest::recursiveScan(test::filterStatus, rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int, bool) at unotest/source/cpp/filters-test.cxx:130:20 (workdir/LinkTarget/CppunitTest/../Library/libunotest.so +0x5724c)
> #12 in test::FiltersTest::testDir(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int, bool) at unotest/source/cpp/filters-test.cxx:155:5 (workdir/LinkTarget/CppunitTest/../Library/libunotest.so +0x57ec9)
> #13 in SdFiltersTest::testCVEs() at sd/qa/unit/filters-test.cxx:83:5 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x19d6d)
Change-Id: Icd83120e99ac8e7181d75e2cf9d13f49064e65e1
Reviewed-on: https://gerrit.libreoffice.org/59212
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-08-16 18:06:22 +02:00
|
|
|
sal_Int32 nFirstLineOffset = -600;
|
2014-06-13 11:23:07 +01:00
|
|
|
|
|
|
|
switch(i)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
nFirstLineOffset = -900;
|
|
|
|
}
|
|
|
|
break;
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-06-13 11:23:07 +01:00
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
rNumberFormat.SetBulletChar( 0x2013 ); // StarBats: 0xF000 + 150
|
|
|
|
rNumberFormat.SetBulletRelSize(75);
|
|
|
|
nFirstLineOffset = -900;
|
|
|
|
}
|
|
|
|
break;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2014-06-13 11:23:07 +01:00
|
|
|
case 2:
|
|
|
|
{
|
|
|
|
nFirstLineOffset = -800;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
{
|
|
|
|
rNumberFormat.SetBulletChar( 0x2013 ); // StarBats: 0xF000 + 150
|
|
|
|
rNumberFormat.SetBulletRelSize(75);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
rNumberFormat.SetFirstLineOffset(nFirstLineOffset);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set new SvxNumBulletItem for the respective style sheet
|
2000-09-18 23:16:46 +00:00
|
|
|
void SdStyleSheetPool::PutNumBulletItem( SfxStyleSheetBase* pSheet,
|
2014-09-16 10:09:58 +02:00
|
|
|
vcl::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);
|
2018-02-26 13:30:35 +02:00
|
|
|
aNumberFormat.SetBulletColor(COL_AUTO);
|
2000-09-18 23:16:46 +00:00
|
|
|
aNumberFormat.SetStart(1);
|
2017-03-07 11:19:35 +02:00
|
|
|
aNumberFormat.SetNumAdjust(SvxAdjust::Left);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2015-03-25 14:42:40 +02:00
|
|
|
SvxNumRule aNumRule( SvxNumRuleFlags::BULLET_REL_SIZE | SvxNumRuleFlags::BULLET_COLOR | SvxNumRuleFlags::CHAR_TEXT_DISTANCE, SVX_MAX_NUM, 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
|
|
|
{
|
SvxNumberFormat::nAbsLSpace should have a larger type
...as is seen when executing CppunitTest_sd_filters_test with Clang's new
-fsanitize=implicit-conversion (see below). The next larger natural choice
after short is sal_Int32, and some of the code calling GetAbsLSpace actually
already supported the value to be as wide (but not wider than) sal_Int32; code
calling GetAbsLSpace that expected the value to be no wider than short has
either been adapted or at least been marked with a TODO. (Other choices could
have been sal_Int64 or long.)
Some dependent function's parameter types have also been changed accordingly.
> Testing file:///home/sbergman/lo/core/sd/qa/unit/data/ppt/pass/hang-10.ppt:
[...]
> filter/source/msfilter/svdfppt.cxx:3792:33: runtime error: implicit conversion from type 'sal_uInt32' (aka 'unsigned int') of value 144780 (32-bit, unsigned) to type 'short' changed the value to 13708 (16-bit, signed)
> #0 in PPTNumberFormatCreator::ImplGetNumberFormat(SdrPowerPointImport const&, SvxNumberFormat&) at filter/source/msfilter/svdfppt.cxx:3792:33 (instdir/program/libmsfilterlo.so +0x7992cc)
> #1 in PPTNumberFormatCreator::GetNumberFormat(SdrPowerPointImport const&, SvxNumberFormat&, unsigned int, PPTParaLevel const&, PPTCharLevel const&, TSS_Type) at filter/source/msfilter/svdfppt.cxx:3674:5 (instdir/program/libmsfilterlo.so +0x797c6d)
> #2 in PPTStyleSheet::PPTStyleSheet(DffRecordHeader const&, SvStream&, SdrPowerPointImport&, PPTTextParagraphStyleAtomInterpreter const&, PPTTextSpecInfo const&) at filter/source/msfilter/svdfppt.cxx:4395:13 (instdir/program/libmsfilterlo.so +0x7ac38d)
> #3 in SdrPowerPointImport::SdrPowerPointImport(PowerPointImportParam&, rtl::OUString const&) at filter/source/msfilter/svdfppt.cxx:1618:59 (instdir/program/libmsfilterlo.so +0x74762f)
> #4 in ImplSdPPTImport::ImplSdPPTImport(SdDrawDocument*, SotStorage&, SfxMedium&, PowerPointImportParam&) at sd/source/filter/ppt/pptin.cxx:175:7 (instdir/program/libsdfiltlo.so +0x5f2be8)
> #5 in SdPPTImport::SdPPTImport(SdDrawDocument*, SvStream&, SotStorage&, SfxMedium&) at sd/source/filter/ppt/pptin.cxx:162:23 (instdir/program/libsdfiltlo.so +0x5ce2bb)
> #6 in ImportPPT at sd/source/filter/ppt/pptin.cxx:2760:47 (instdir/program/libsdfiltlo.so +0x617c79)
> #7 in SdPPTFilter::Import() at sd/source/filter/sdpptwrp.cxx:106:32 (instdir/program/libsdlo.so +0x2878413)
> #8 in sd::DrawDocShell::ConvertFrom(SfxMedium&) at sd/source/ui/docshell/docshel4.cxx:474:46 (instdir/program/libsdlo.so +0x2e165bc)
> #9 in SfxObjectShell::DoLoad(SfxMedium*) at sfx2/source/doc/objstor.cxx:786:23 (instdir/program/libsfxlo.so +0x2c8cb12)
> #10 in SdFiltersTest::load(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int) at sd/qa/unit/filters-test.cxx:75:31 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x19771)
> #11 in test::FiltersTest::recursiveScan(test::filterStatus, rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int, bool) at unotest/source/cpp/filters-test.cxx:130:20 (workdir/LinkTarget/CppunitTest/../Library/libunotest.so +0x5724c)
> #12 in test::FiltersTest::testDir(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int, bool) at unotest/source/cpp/filters-test.cxx:155:5 (workdir/LinkTarget/CppunitTest/../Library/libunotest.so +0x57ec9)
> #13 in SdFiltersTest::testCVEs() at sd/qa/unit/filters-test.cxx:83:5 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x19d6d)
Change-Id: Ifa298a51bb62b7cbee9249b8289963f3427721f5
Reviewed-on: https://gerrit.libreoffice.org/59116
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-08-15 16:48:09 +02:00
|
|
|
const auto nLSpace = (i + 1) * 600;
|
2000-09-18 23:16:46 +00:00
|
|
|
aNumberFormat.SetAbsLSpace(nLSpace);
|
|
|
|
aNumberFormat.SetFirstLineOffset(-600);
|
|
|
|
aNumRule.SetLevel( i, aNumberFormat );
|
|
|
|
}
|
|
|
|
|
2017-11-15 14:19:37 +02:00
|
|
|
rSet.Put( SvxNumBulletItem( aNumRule, EE_PARA_NUMBULLET ) );
|
2016-12-08 10:26:01 +02:00
|
|
|
static_cast<SfxStyleSheet*>(pSheet)->Broadcast(SfxHint( SfxHintId::DataChanged ) );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
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
|
2015-07-15 18:38:38 +02:00
|
|
|
SvxNumBulletItem const*const pItem(
|
2017-11-10 12:48:21 +02:00
|
|
|
rSet.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET));
|
2017-11-22 14:12:34 +01:00
|
|
|
SvxNumRule *const pDefaultRule = pItem ? pItem->GetNumRule() : nullptr;
|
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)
|
|
|
|
{
|
2014-02-25 11:55:22 +02:00
|
|
|
SvxNumRule aNumRule(pDefaultRule->GetFeatureFlags(), 10, 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
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2017-11-15 14:19:37 +02:00
|
|
|
rSet.Put( SvxNumBulletItem( aNumRule, EE_PARA_NUMBULLET ) );
|
2016-12-08 10:26:01 +02:00
|
|
|
static_cast<SfxStyleSheet*>(pSheet)->Broadcast(SfxHint( SfxHintId::DataChanged ) );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
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);
|
2018-02-26 13:30:35 +02:00
|
|
|
aNumberFormat.SetBulletColor(COL_AUTO);
|
2000-09-18 23:16:46 +00:00
|
|
|
aNumberFormat.SetStart(1);
|
2017-03-07 11:19:35 +02:00
|
|
|
aNumberFormat.SetNumAdjust(SvxAdjust::Left);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2015-03-25 14:42:40 +02:00
|
|
|
SvxNumRule aNumRule( SvxNumRuleFlags::BULLET_REL_SIZE | SvxNumRuleFlags::BULLET_COLOR |
|
2017-11-11 18:17:52 +01:00
|
|
|
SvxNumRuleFlags::CHAR_TEXT_DISTANCE,
|
2014-02-25 11:55:22 +02:00
|
|
|
SVX_MAX_NUM, 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
|
|
|
{
|
2014-06-13 11:23:07 +01:00
|
|
|
setDefaultOutlineNumberFormatBulletAndIndent(i, aNumberFormat);
|
2016-02-03 10:13:00 +11:00
|
|
|
rBulletFont.SetFontSize(Size(0,846)); // 24 pt
|
2000-09-18 23:16:46 +00:00
|
|
|
aNumberFormat.SetBulletFont(&rBulletFont);
|
|
|
|
aNumRule.SetLevel( i, aNumberFormat );
|
|
|
|
}
|
|
|
|
|
2017-11-15 14:19:37 +02:00
|
|
|
rSet.Put( SvxNumBulletItem( aNumRule, EE_PARA_NUMBULLET ) );
|
2016-12-08 10:26:01 +02:00
|
|
|
static_cast<SfxStyleSheet*>(pSheet)->Broadcast(SfxHint( SfxHintId::DataChanged ) );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
2013-03-01 10:55:30 +01:00
|
|
|
|* Create standard bullet font (without size)
|
2000-09-18 23:16:46 +00:00
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2014-09-16 10:09:58 +02:00
|
|
|
vcl::Font SdStyleSheetPool::GetBulletFont()
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2014-09-16 10:09:58 +02:00
|
|
|
vcl::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);
|
2016-01-29 17:43:42 +11:00
|
|
|
aBulletFont.SetUnderline(LINESTYLE_NONE);
|
|
|
|
aBulletFont.SetOverline(LINESTYLE_NONE);
|
2000-09-18 23:16:46 +00:00
|
|
|
aBulletFont.SetStrikeout(STRIKEOUT_NONE);
|
|
|
|
aBulletFont.SetItalic(ITALIC_NONE);
|
2014-02-21 12:53:51 +01:00
|
|
|
aBulletFont.SetOutline(false);
|
|
|
|
aBulletFont.SetShadow(false);
|
2018-02-26 13:30:35 +02:00
|
|
|
aBulletFont.SetColor(COL_AUTO);
|
2014-02-21 12:53:51 +01:00
|
|
|
aBulletFont.SetTransparent(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& )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
void SdStyleSheetPool::throwIfDisposed()
|
2008-03-12 10:28:54 +00:00
|
|
|
{
|
2015-11-10 10:23:02 +01:00
|
|
|
if( mpDoc == nullptr )
|
2008-03-12 10:28:54 +00:00
|
|
|
throw DisposedException();
|
|
|
|
}
|
|
|
|
|
|
|
|
// XServiceInfo
|
2017-01-26 12:28:58 +01:00
|
|
|
OUString SAL_CALL SdStyleSheetPool::getImplementationName()
|
2008-03-12 10:28:54 +00:00
|
|
|
{
|
2012-04-16 01:05:29 -03:00
|
|
|
return OUString( "SdStyleSheetPool" );
|
2008-03-12 10:28:54 +00:00
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Bool SAL_CALL SdStyleSheetPool::supportsService( const OUString& ServiceName )
|
2008-03-12 10:28:54 +00:00
|
|
|
{
|
2013-12-05 19:18:01 -02:00
|
|
|
return cppu::supportsService(this, ServiceName);
|
2008-03-12 10:28:54 +00:00
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
Sequence< OUString > SAL_CALL SdStyleSheetPool::getSupportedServiceNames()
|
2008-03-12 10:28:54 +00:00
|
|
|
{
|
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
|
2017-01-26 12:28:58 +01:00
|
|
|
Any SAL_CALL SdStyleSheetPool::getByName( const OUString& aName )
|
2008-03-12 10:28:54 +00:00
|
|
|
{
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
Sequence< OUString > SAL_CALL SdStyleSheetPool::getElementNames()
|
2008-03-12 10:28:54 +00:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Bool SAL_CALL SdStyleSheetPool::hasByName( const OUString& aName )
|
2008-03-12 10:28:54 +00:00
|
|
|
{
|
|
|
|
throwIfDisposed();
|
|
|
|
|
|
|
|
if( mxGraphicFamily->getName() == aName )
|
2016-04-20 17:19:18 +02:00
|
|
|
return true;
|
2008-03-12 10:28:54 +00:00
|
|
|
|
|
|
|
if( mxCellFamily->getName() == aName )
|
2016-04-20 17:19:18 +02:00
|
|
|
return true;
|
2008-03-12 10:28:54 +00:00
|
|
|
|
|
|
|
if( msTableFamilyName == aName )
|
2016-04-20 17:19:18 +02:00
|
|
|
return true;
|
2008-03-12 10:28:54 +00:00
|
|
|
|
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 )
|
2016-04-20 17:19:18 +02:00
|
|
|
return true;
|
2008-03-12 10:28:54 +00:00
|
|
|
}
|
|
|
|
|
2016-04-20 17:19:18 +02:00
|
|
|
return false;
|
2008-03-12 10:28:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// XElementAccess
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
Type SAL_CALL SdStyleSheetPool::getElementType()
|
2008-03-12 10:28:54 +00:00
|
|
|
{
|
|
|
|
throwIfDisposed();
|
|
|
|
|
2013-12-12 11:09:57 +01:00
|
|
|
return cppu::UnoType<XNameAccess>::get();
|
2008-03-12 10:28:54 +00:00
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Bool SAL_CALL SdStyleSheetPool::hasElements()
|
2008-03-12 10:28:54 +00:00
|
|
|
{
|
2016-04-20 17:19:18 +02:00
|
|
|
return true;
|
2008-03-12 10:28:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// XIndexAccess
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Int32 SAL_CALL SdStyleSheetPool::getCount()
|
2008-03-12 10:28:54 +00:00
|
|
|
{
|
|
|
|
throwIfDisposed();
|
|
|
|
|
|
|
|
return maStyleFamilyMap.size() + 3;
|
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
Any SAL_CALL SdStyleSheetPool::getByIndex( sal_Int32 Index )
|
2008-03-12 10:28:54 +00:00
|
|
|
{
|
|
|
|
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
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
void SAL_CALL SdStyleSheetPool::dispose()
|
2008-03-12 10:28:54 +00:00
|
|
|
{
|
|
|
|
if( mpDoc )
|
|
|
|
{
|
|
|
|
mxGraphicFamily->dispose();
|
|
|
|
mxGraphicFamily.clear();
|
|
|
|
mxCellFamily->dispose();
|
|
|
|
mxCellFamily.clear();
|
|
|
|
|
|
|
|
Reference< XComponent > xComp( mxTableFamily, UNO_QUERY );
|
|
|
|
if( xComp.is() )
|
|
|
|
xComp->dispose();
|
2015-11-10 10:23:02 +01:00
|
|
|
mxTableFamily = nullptr;
|
2008-03-12 10:28:54 +00:00
|
|
|
|
|
|
|
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& )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-11-10 10:23:02 +01:00
|
|
|
mpDoc = nullptr;
|
2010-04-16 16:10:11 +02:00
|
|
|
|
|
|
|
Clear();
|
2008-03-12 10:28:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
void SAL_CALL SdStyleSheetPool::addEventListener( const Reference< XEventListener >& /*xListener*/ )
|
2008-03-12 10:28:54 +00:00
|
|
|
{
|
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
void SAL_CALL SdStyleSheetPool::removeEventListener( const Reference< XEventListener >& /*aListener*/ )
|
2008-03-12 10:28:54 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-08-03 10:23:01 +02:00
|
|
|
SdStyleSheetVector SdStyleSheetPool::CreateChildList( SdStyleSheet const * pSheet )
|
2008-03-12 10:28:54 +00:00
|
|
|
{
|
|
|
|
SdStyleSheetVector aResult;
|
|
|
|
|
2014-07-18 15:36:30 +02:00
|
|
|
const size_t nListenerCount = pSheet->GetSizeOfVector();
|
2014-05-11 20:57:50 +02:00
|
|
|
for (size_t n = 0; n < nListenerCount; ++n)
|
2008-03-12 10:28:54 +00:00
|
|
|
{
|
2014-05-11 20:57:50 +02:00
|
|
|
SdStyleSheet* pChild = dynamic_cast< SdStyleSheet* >( pSheet->GetListener(n) );
|
|
|
|
if(pChild && pChild->GetParent() == pSheet->GetName())
|
2008-03-12 10:28:54 +00:00
|
|
|
{
|
2017-09-12 09:45:17 +02:00
|
|
|
aResult.emplace_back( pChild );
|
2008-03-12 10:28:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return aResult;
|
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2010-10-12 15:51:52 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|