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:29:21 +00:00
|
|
|
#include <com/sun/star/beans/PropertyAttribute.hpp>
|
|
|
|
#include <com/sun/star/lang/DisposedException.hpp>
|
2018-05-24 15:47:30 +02:00
|
|
|
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
|
2008-03-12 10:29:21 +00:00
|
|
|
#include <com/sun/star/style/XStyle.hpp>
|
|
|
|
|
2010-10-16 03:17:28 -05:00
|
|
|
#include <osl/mutex.hxx>
|
2018-07-28 16:47:47 +02:00
|
|
|
#include <sal/log.hxx>
|
2008-03-12 10:29:21 +00:00
|
|
|
#include <vcl/svapp.hxx>
|
2018-05-24 15:47:30 +02:00
|
|
|
#include <cppuhelper/exc_hlp.hxx>
|
2013-10-22 23:49:31 -02:00
|
|
|
#include <cppuhelper/supportsservice.hxx>
|
2016-01-19 19:45:45 +02:00
|
|
|
#include <cppuhelper/interfacecontainer.hxx>
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2013-04-19 15:49:58 -04:00
|
|
|
#include <editeng/outliner.hxx>
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/eeitem.hxx>
|
|
|
|
#include <editeng/fhgtitem.hxx>
|
2000-09-18 23:16:46 +00:00
|
|
|
#include <svx/svdoattr.hxx>
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/ulspitem.hxx>
|
2016-09-22 22:20:48 +02:00
|
|
|
#include <svl/hint.hxx>
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/itemset.hxx>
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2008-03-12 10:29:21 +00:00
|
|
|
#include <svx/xflbmtit.hxx>
|
|
|
|
#include <svx/xflbstit.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>
|
2008-03-12 10:29:21 +00:00
|
|
|
#include <svx/unoshprp.hxx>
|
|
|
|
#include <svx/unoshape.hxx>
|
2009-12-10 18:09:38 +01:00
|
|
|
#include <svx/svdpool.hxx>
|
2017-10-23 22:32:55 +02:00
|
|
|
#include <stlsheet.hxx>
|
|
|
|
#include <sdresid.hxx>
|
|
|
|
#include <sdpage.hxx>
|
|
|
|
#include <drawdoc.hxx>
|
|
|
|
#include <stlpool.hxx>
|
|
|
|
#include <strings.hrc>
|
|
|
|
#include <app.hrc>
|
|
|
|
#include <strings.hxx>
|
|
|
|
#include <glob.hxx>
|
|
|
|
#include <helpids.h>
|
|
|
|
#include <DrawViewShell.hxx>
|
|
|
|
#include <ViewShellBase.hxx>
|
2012-09-20 05:53:14 +00:00
|
|
|
#include <editeng/boxitem.hxx>
|
2004-01-20 09:28:49 +00:00
|
|
|
|
2017-02-08 07:57:36 +01:00
|
|
|
#include <cstddef>
|
2015-09-18 09:09:12 +01:00
|
|
|
#include <memory>
|
2013-02-21 03:54:57 +05:30
|
|
|
|
2008-03-12 10:29:21 +00:00
|
|
|
using ::osl::MutexGuard;
|
|
|
|
using ::osl::ClearableMutexGuard;
|
2012-09-20 05:53:14 +00:00
|
|
|
using ::com::sun::star::table::BorderLine;
|
2008-03-12 10:29:21 +00:00
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::util;
|
|
|
|
using namespace ::com::sun::star::lang;
|
|
|
|
using namespace ::com::sun::star::style;
|
|
|
|
using namespace ::com::sun::star::beans;
|
|
|
|
using namespace ::com::sun::star::container;
|
|
|
|
using namespace ::com::sun::star::drawing;
|
|
|
|
|
2012-12-03 17:48:40 +01:00
|
|
|
#define WID_STYLE_HIDDEN 7997
|
2008-03-12 10:29:21 +00:00
|
|
|
#define WID_STYLE_DISPNAME 7998
|
|
|
|
#define WID_STYLE_FAMILY 7999
|
|
|
|
|
2009-06-03 11:26:39 +00:00
|
|
|
static SvxItemPropertySet& GetStylePropertySet()
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
2009-06-03 11:26:39 +00:00
|
|
|
static const SfxItemPropertyMapEntry aFullPropertyMap_Impl[] =
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
2014-05-08 18:12:01 +02:00
|
|
|
{ OUString("Family"), WID_STYLE_FAMILY, ::cppu::UnoType<OUString>::get(), PropertyAttribute::READONLY, 0},
|
2013-12-12 11:09:57 +01:00
|
|
|
{ OUString("UserDefinedAttributes"), SDRATTR_XMLATTRIBUTES, cppu::UnoType<XNameContainer>::get(), 0, 0},
|
2014-05-08 18:12:01 +02:00
|
|
|
{ OUString("DisplayName"), WID_STYLE_DISPNAME, ::cppu::UnoType<OUString>::get(), PropertyAttribute::READONLY, 0},
|
2015-04-01 08:40:54 +02:00
|
|
|
{ OUString("Hidden"), WID_STYLE_HIDDEN, cppu::UnoType<bool>::get(), 0, 0},
|
2008-03-12 10:29:21 +00:00
|
|
|
|
|
|
|
SVX_UNOEDIT_NUMBERING_PROPERTIE,
|
|
|
|
SHADOW_PROPERTIES
|
|
|
|
LINE_PROPERTIES
|
|
|
|
LINE_PROPERTIES_START_END
|
|
|
|
FILL_PROPERTIES
|
|
|
|
EDGERADIUS_PROPERTIES
|
|
|
|
TEXT_PROPERTIES_DEFAULTS
|
|
|
|
CONNECTOR_PROPERTIES
|
2009-06-17 10:58:14 +00:00
|
|
|
SPECIAL_DIMENSIONING_PROPERTIES_DEFAULTS
|
2016-12-28 12:43:31 +01:00
|
|
|
{ OUString("TopBorder"), SDRATTR_TABLE_BORDER, ::cppu::UnoType<BorderLine>::get(), 0, TOP_BORDER },
|
|
|
|
{ OUString("BottomBorder"), SDRATTR_TABLE_BORDER, ::cppu::UnoType<BorderLine>::get(), 0, BOTTOM_BORDER },
|
|
|
|
{ OUString("LeftBorder"), SDRATTR_TABLE_BORDER, ::cppu::UnoType<BorderLine>::get(), 0, LEFT_BORDER },
|
|
|
|
{ OUString("RightBorder"), SDRATTR_TABLE_BORDER, ::cppu::UnoType<BorderLine>::get(), 0, RIGHT_BORDER },
|
2013-12-11 15:16:51 +01:00
|
|
|
{ OUString(), 0, css::uno::Type(), 0, 0 }
|
2008-03-12 10:29:21 +00:00
|
|
|
};
|
|
|
|
|
2009-12-10 18:09:38 +01:00
|
|
|
static SvxItemPropertySet aPropSet( aFullPropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
|
2008-03-12 10:29:21 +00:00
|
|
|
return aPropSet;
|
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2008-03-12 10:29:21 +00:00
|
|
|
class ModifyListenerForewarder : public SfxListener
|
|
|
|
{
|
|
|
|
public:
|
2015-10-25 17:33:13 +02:00
|
|
|
explicit ModifyListenerForewarder( SdStyleSheet* pStyleSheet );
|
2008-03-12 10:29:21 +00:00
|
|
|
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
|
2008-03-12 10:29:21 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
SdStyleSheet* mpStyleSheet;
|
|
|
|
};
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2008-03-12 10:29:21 +00:00
|
|
|
ModifyListenerForewarder::ModifyListenerForewarder( SdStyleSheet* pStyleSheet )
|
|
|
|
: mpStyleSheet( pStyleSheet )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2008-03-12 10:29:21 +00:00
|
|
|
if( pStyleSheet )
|
|
|
|
{
|
|
|
|
SfxBroadcaster& rBC = static_cast< SfxBroadcaster& >( *pStyleSheet );
|
|
|
|
StartListening( rBC );
|
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
2008-09-30 06:36:06 +00:00
|
|
|
void ModifyListenerForewarder::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& /*rHint*/)
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
|
|
|
if( mpStyleSheet )
|
|
|
|
mpStyleSheet->notifyModifyListener();
|
|
|
|
}
|
|
|
|
|
2018-04-18 12:14:37 +02:00
|
|
|
SdStyleSheet::SdStyleSheet(const OUString& rDisplayName, SfxStyleSheetBasePool& _rPool, SfxStyleFamily eFamily, SfxStyleSearchBits _nMask)
|
2017-05-10 12:37:04 +02:00
|
|
|
: SdStyleSheetBase( rDisplayName, _rPool, eFamily, _nMask)
|
2008-03-12 10:29:21 +00:00
|
|
|
, ::cppu::BaseMutex()
|
|
|
|
, msApiName( rDisplayName )
|
2015-05-29 12:04:41 +02:00
|
|
|
, mxPool( &_rPool )
|
2008-03-12 10:29:21 +00:00
|
|
|
, mrBHelper( m_aMutex )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2001-10-22 12:36:57 +00:00
|
|
|
SdStyleSheet::~SdStyleSheet()
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
delete pSet;
|
2015-11-10 10:23:02 +01:00
|
|
|
pSet = nullptr; // that following destructors also get a change
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
2008-03-12 10:29:21 +00:00
|
|
|
void SdStyleSheet::SetApiName( const OUString& rApiName )
|
|
|
|
{
|
|
|
|
msApiName = rApiName;
|
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2018-01-02 11:33:15 +02:00
|
|
|
OUString const & SdStyleSheet::GetApiName() const
|
2008-04-04 11:45:15 +00:00
|
|
|
{
|
2012-01-08 09:52:25 -02:00
|
|
|
if( !msApiName.isEmpty() )
|
2008-04-04 11:45:15 +00:00
|
|
|
return msApiName;
|
|
|
|
else
|
|
|
|
return GetName();
|
|
|
|
}
|
|
|
|
|
2013-07-05 16:25:03 -05:00
|
|
|
bool SdStyleSheet::SetParent(const OUString& rParentName)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2013-07-05 16:25:03 -05:00
|
|
|
bool bResult = false;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
if (SfxStyleSheet::SetParent(rParentName))
|
|
|
|
{
|
2013-03-21 09:12:38 +01:00
|
|
|
// PseudoStyleSheets do not have their own ItemSets
|
2018-01-19 12:16:31 +02:00
|
|
|
if (nFamily != SfxStyleFamily::Pseudo)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2013-07-05 16:25:03 -05:00
|
|
|
if( !rParentName.isEmpty() )
|
2003-03-27 09:58:12 +00:00
|
|
|
{
|
2018-04-07 14:30:26 +02:00
|
|
|
SfxStyleSheetBase* pStyle = m_pPool->Find(rParentName, nFamily);
|
2003-03-27 09:58:12 +00:00
|
|
|
if (pStyle)
|
|
|
|
{
|
2012-09-26 16:05:01 +02:00
|
|
|
bResult = true;
|
2003-03-27 09:58:12 +00:00
|
|
|
SfxItemSet& rParentSet = pStyle->GetItemSet();
|
|
|
|
GetItemSet().SetParent(&rParentSet);
|
2016-12-08 10:26:01 +02:00
|
|
|
Broadcast( SfxHint( SfxHintId::DataChanged ) );
|
2003-03-27 09:58:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2012-09-26 16:05:01 +02:00
|
|
|
bResult = true;
|
2015-11-10 10:23:02 +01:00
|
|
|
GetItemSet().SetParent(nullptr);
|
2016-12-08 10:26:01 +02:00
|
|
|
Broadcast( SfxHint( SfxHintId::DataChanged ) );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-09-26 16:05:01 +02:00
|
|
|
bResult = true;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return bResult;
|
|
|
|
}
|
|
|
|
|
2013-03-21 09:12:38 +01:00
|
|
|
/**
|
|
|
|
* create if necessary and return ItemSets
|
|
|
|
*/
|
2001-10-22 12:36:57 +00:00
|
|
|
SfxItemSet& SdStyleSheet::GetItemSet()
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2018-01-19 12:16:31 +02:00
|
|
|
if (nFamily == SfxStyleFamily::Para || nFamily == SfxStyleFamily::Page)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2013-03-21 09:12:38 +01:00
|
|
|
// we create the ItemSet 'on demand' if necessary
|
2000-09-18 23:16:46 +00:00
|
|
|
if (!pSet)
|
|
|
|
{
|
2017-08-22 18:08:48 +02:00
|
|
|
pSet = new SfxItemSet(
|
Avoid -fsanitize=null
...during CppunitTest_sd_filters_test (see below), where
SfxStyleSheetBase::m_pPool has apparently been null'ed in
SdStyleSheet::disposing (sd/source/core/stlsheet.cxx). Presumably introduced
with dfefe448c41921f2f1e54d3f69b8b9e89031d055 "SOSAW080: Added first bunch of
basic changes to helpers"; adding a "TTTT" marker on alg_'s request.
Needed to change SfxStyleSheetBase::GetPool to return pointer instead of ref.
> include/svl/style.hxx:142:47: runtime error: reference binding to null pointer of type 'SfxStyleSheetBasePool'
> #0 in SfxStyleSheetBase::GetPool() at include/svl/style.hxx:142:40 (instdir/program/libsvxcorelo.so +0x2d7a3ed)
> #1 in sdr::properties::AttributeProperties::ImpRemoveStyleSheet() at svx/source/sdr/properties/attributeproperties.cxx:136:44 (instdir/program/libsvxcorelo.so +0x2d72f40)
> #2 in sdr::properties::AttributeProperties::Notify(SfxBroadcaster&, SfxHint const&) at svx/source/sdr/properties/attributeproperties.cxx:474:25 (instdir/program/libsvxcorelo.so +0x2d793ec)
> #3 in sdr::properties::TextProperties::Notify(SfxBroadcaster&, SfxHint const&) at svx/source/sdr/properties/textproperties.cxx:542:34 (instdir/program/libsvxcorelo.so +0x2d631f2)
> #4 in SfxBroadcaster::Broadcast(SfxHint const&) at svl/source/notify/SfxBroadcaster.cxx:49:24 (instdir/program/libsvllo.so +0xc2d628)
> #5 in (anonymous namespace)::StyleSheetDisposerFunctor::Dispose(rtl::Reference<SfxStyleSheetBase>) at svl/source/items/style.cxx:804:16 (instdir/program/libsvllo.so +0x99e4ef)
> #6 in svl::IndexedStyleSheets::Clear(svl::StyleSheetDisposer&) at svl/source/items/IndexedStyleSheets.cxx:202:18 (instdir/program/libsvllo.so +0x8bb852)
> #7 in SfxStyleSheetBasePool::Clear() at svl/source/items/style.cxx:815:34 (instdir/program/libsvllo.so +0x9965ea)
> #8 in SdStyleSheetPool::dispose() at sd/source/core/stlpool.cxx:1386:9 (instdir/program/libsdlo.so +0x25353a7)
> #9 in SdrModel::~SdrModel() at svx/source/svdraw/svdmodel.cxx:275:25 (instdir/program/libsvxcorelo.so +0x323f1ad)
> #10 in FmFormModel::~FmFormModel() at svx/source/form/fmmodel.cxx:94:1 (instdir/program/libsvxcorelo.so +0x465f020)
> #11 in SdDrawDocument::~SdDrawDocument() at sd/source/core/drawdoc.cxx:394:1 (instdir/program/libsdlo.so +0x2324254)
> #12 in SdDrawDocument::~SdDrawDocument() at sd/source/core/drawdoc.cxx:346:1 (instdir/program/libsdlo.so +0x2324445)
> #13 in SdDrawDocument::~SdDrawDocument() at sd/source/core/drawdoc.cxx:346:1 (instdir/program/libsdlo.so +0x23244ce)
> #14 in sd::DrawDocShell::~DrawDocShell() at sd/source/ui/docshell/docshell.cxx:200:9 (instdir/program/libsdlo.so +0x2c4bdb9)
> #15 in sd::DrawDocShell::~DrawDocShell() at sd/source/ui/docshell/docshell.cxx:179:1 (instdir/program/libsdlo.so +0x2c4c4a5)
> #16 in sd::DrawDocShell::~DrawDocShell() at sd/source/ui/docshell/docshell.cxx:179:1 (instdir/program/libsdlo.so +0x2c4c56e)
> #17 in SvRefBase::ReleaseRef() at include/tools/ref.hxx:165:29 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x1ff01)
> #18 in tools::SvRef<sd::DrawDocShell>::~SvRef() at include/tools/ref.hxx:56:36 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x1a9fc)
> #19 in SdFiltersTest::load(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int) at sd/qa/unit/filters-test.cxx:78:1 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x17f53)
> #20 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 +0x5589c)
> #21 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 +0x56519)
> #22 in SdFiltersTest::testCVEs() at sd/qa/unit/filters-test.cxx:83:5 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x1839d)
Change-Id: Ibf61c18738c7a204ebf2bbc85b28930481b22612
Reviewed-on: https://gerrit.libreoffice.org/52554
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-04-07 16:28:08 +02:00
|
|
|
GetPool()->GetPool(),
|
2017-08-22 18:08:48 +02:00
|
|
|
svl::Items<
|
|
|
|
XATTR_LINE_FIRST, XATTR_LINE_LAST,
|
|
|
|
XATTR_FILL_FIRST, XATTR_FILL_LAST,
|
|
|
|
SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST,
|
|
|
|
SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_WORDWRAP,
|
|
|
|
SDRATTR_EDGE_FIRST, SDRATTR_MEASURE_LAST,
|
|
|
|
SDRATTR_3D_FIRST, SDRATTR_3D_LAST,
|
|
|
|
EE_PARA_START, EE_CHAR_END>{});
|
2015-09-18 14:40:24 +01:00
|
|
|
bMySet = true;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return *pSet;
|
|
|
|
}
|
|
|
|
|
2018-01-19 12:16:31 +02:00
|
|
|
else if( nFamily == SfxStyleFamily::Frame )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
|
|
|
if (!pSet)
|
|
|
|
{
|
2017-08-22 18:08:48 +02:00
|
|
|
pSet = new SfxItemSet(
|
Avoid -fsanitize=null
...during CppunitTest_sd_filters_test (see below), where
SfxStyleSheetBase::m_pPool has apparently been null'ed in
SdStyleSheet::disposing (sd/source/core/stlsheet.cxx). Presumably introduced
with dfefe448c41921f2f1e54d3f69b8b9e89031d055 "SOSAW080: Added first bunch of
basic changes to helpers"; adding a "TTTT" marker on alg_'s request.
Needed to change SfxStyleSheetBase::GetPool to return pointer instead of ref.
> include/svl/style.hxx:142:47: runtime error: reference binding to null pointer of type 'SfxStyleSheetBasePool'
> #0 in SfxStyleSheetBase::GetPool() at include/svl/style.hxx:142:40 (instdir/program/libsvxcorelo.so +0x2d7a3ed)
> #1 in sdr::properties::AttributeProperties::ImpRemoveStyleSheet() at svx/source/sdr/properties/attributeproperties.cxx:136:44 (instdir/program/libsvxcorelo.so +0x2d72f40)
> #2 in sdr::properties::AttributeProperties::Notify(SfxBroadcaster&, SfxHint const&) at svx/source/sdr/properties/attributeproperties.cxx:474:25 (instdir/program/libsvxcorelo.so +0x2d793ec)
> #3 in sdr::properties::TextProperties::Notify(SfxBroadcaster&, SfxHint const&) at svx/source/sdr/properties/textproperties.cxx:542:34 (instdir/program/libsvxcorelo.so +0x2d631f2)
> #4 in SfxBroadcaster::Broadcast(SfxHint const&) at svl/source/notify/SfxBroadcaster.cxx:49:24 (instdir/program/libsvllo.so +0xc2d628)
> #5 in (anonymous namespace)::StyleSheetDisposerFunctor::Dispose(rtl::Reference<SfxStyleSheetBase>) at svl/source/items/style.cxx:804:16 (instdir/program/libsvllo.so +0x99e4ef)
> #6 in svl::IndexedStyleSheets::Clear(svl::StyleSheetDisposer&) at svl/source/items/IndexedStyleSheets.cxx:202:18 (instdir/program/libsvllo.so +0x8bb852)
> #7 in SfxStyleSheetBasePool::Clear() at svl/source/items/style.cxx:815:34 (instdir/program/libsvllo.so +0x9965ea)
> #8 in SdStyleSheetPool::dispose() at sd/source/core/stlpool.cxx:1386:9 (instdir/program/libsdlo.so +0x25353a7)
> #9 in SdrModel::~SdrModel() at svx/source/svdraw/svdmodel.cxx:275:25 (instdir/program/libsvxcorelo.so +0x323f1ad)
> #10 in FmFormModel::~FmFormModel() at svx/source/form/fmmodel.cxx:94:1 (instdir/program/libsvxcorelo.so +0x465f020)
> #11 in SdDrawDocument::~SdDrawDocument() at sd/source/core/drawdoc.cxx:394:1 (instdir/program/libsdlo.so +0x2324254)
> #12 in SdDrawDocument::~SdDrawDocument() at sd/source/core/drawdoc.cxx:346:1 (instdir/program/libsdlo.so +0x2324445)
> #13 in SdDrawDocument::~SdDrawDocument() at sd/source/core/drawdoc.cxx:346:1 (instdir/program/libsdlo.so +0x23244ce)
> #14 in sd::DrawDocShell::~DrawDocShell() at sd/source/ui/docshell/docshell.cxx:200:9 (instdir/program/libsdlo.so +0x2c4bdb9)
> #15 in sd::DrawDocShell::~DrawDocShell() at sd/source/ui/docshell/docshell.cxx:179:1 (instdir/program/libsdlo.so +0x2c4c4a5)
> #16 in sd::DrawDocShell::~DrawDocShell() at sd/source/ui/docshell/docshell.cxx:179:1 (instdir/program/libsdlo.so +0x2c4c56e)
> #17 in SvRefBase::ReleaseRef() at include/tools/ref.hxx:165:29 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x1ff01)
> #18 in tools::SvRef<sd::DrawDocShell>::~SvRef() at include/tools/ref.hxx:56:36 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x1a9fc)
> #19 in SdFiltersTest::load(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int) at sd/qa/unit/filters-test.cxx:78:1 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x17f53)
> #20 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 +0x5589c)
> #21 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 +0x56519)
> #22 in SdFiltersTest::testCVEs() at sd/qa/unit/filters-test.cxx:83:5 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x1839d)
Change-Id: Ibf61c18738c7a204ebf2bbc85b28930481b22612
Reviewed-on: https://gerrit.libreoffice.org/52554
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-04-07 16:28:08 +02:00
|
|
|
GetPool()->GetPool(),
|
2017-08-22 18:08:48 +02:00
|
|
|
svl::Items<
|
|
|
|
XATTR_LINE_FIRST, XATTR_LINE_LAST,
|
|
|
|
XATTR_FILL_FIRST, XATTR_FILL_LAST,
|
|
|
|
SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST,
|
|
|
|
SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_XMLATTRIBUTES,
|
|
|
|
SDRATTR_TEXT_WORDWRAP, SDRATTR_TEXT_WORDWRAP,
|
|
|
|
SDRATTR_TABLE_FIRST, SDRATTR_TABLE_LAST,
|
|
|
|
EE_PARA_START, EE_CHAR_END>{});
|
2015-09-18 14:40:24 +01:00
|
|
|
bMySet = true;
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return *pSet;
|
|
|
|
}
|
|
|
|
|
2013-03-21 09:12:38 +01:00
|
|
|
// this is a dummy template for the internal template of the
|
|
|
|
// current presentation layout; return the ItemSet of that template
|
2000-09-18 23:16:46 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
|
|
|
|
SdStyleSheet* pSdSheet = GetRealStyleSheet();
|
|
|
|
|
|
|
|
if (pSdSheet)
|
|
|
|
{
|
2017-08-17 17:21:53 +02:00
|
|
|
return pSdSheet->GetItemSet();
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!pSet)
|
|
|
|
{
|
2017-08-23 09:52:52 +02:00
|
|
|
pSet = new SfxItemSet(
|
Avoid -fsanitize=null
...during CppunitTest_sd_filters_test (see below), where
SfxStyleSheetBase::m_pPool has apparently been null'ed in
SdStyleSheet::disposing (sd/source/core/stlsheet.cxx). Presumably introduced
with dfefe448c41921f2f1e54d3f69b8b9e89031d055 "SOSAW080: Added first bunch of
basic changes to helpers"; adding a "TTTT" marker on alg_'s request.
Needed to change SfxStyleSheetBase::GetPool to return pointer instead of ref.
> include/svl/style.hxx:142:47: runtime error: reference binding to null pointer of type 'SfxStyleSheetBasePool'
> #0 in SfxStyleSheetBase::GetPool() at include/svl/style.hxx:142:40 (instdir/program/libsvxcorelo.so +0x2d7a3ed)
> #1 in sdr::properties::AttributeProperties::ImpRemoveStyleSheet() at svx/source/sdr/properties/attributeproperties.cxx:136:44 (instdir/program/libsvxcorelo.so +0x2d72f40)
> #2 in sdr::properties::AttributeProperties::Notify(SfxBroadcaster&, SfxHint const&) at svx/source/sdr/properties/attributeproperties.cxx:474:25 (instdir/program/libsvxcorelo.so +0x2d793ec)
> #3 in sdr::properties::TextProperties::Notify(SfxBroadcaster&, SfxHint const&) at svx/source/sdr/properties/textproperties.cxx:542:34 (instdir/program/libsvxcorelo.so +0x2d631f2)
> #4 in SfxBroadcaster::Broadcast(SfxHint const&) at svl/source/notify/SfxBroadcaster.cxx:49:24 (instdir/program/libsvllo.so +0xc2d628)
> #5 in (anonymous namespace)::StyleSheetDisposerFunctor::Dispose(rtl::Reference<SfxStyleSheetBase>) at svl/source/items/style.cxx:804:16 (instdir/program/libsvllo.so +0x99e4ef)
> #6 in svl::IndexedStyleSheets::Clear(svl::StyleSheetDisposer&) at svl/source/items/IndexedStyleSheets.cxx:202:18 (instdir/program/libsvllo.so +0x8bb852)
> #7 in SfxStyleSheetBasePool::Clear() at svl/source/items/style.cxx:815:34 (instdir/program/libsvllo.so +0x9965ea)
> #8 in SdStyleSheetPool::dispose() at sd/source/core/stlpool.cxx:1386:9 (instdir/program/libsdlo.so +0x25353a7)
> #9 in SdrModel::~SdrModel() at svx/source/svdraw/svdmodel.cxx:275:25 (instdir/program/libsvxcorelo.so +0x323f1ad)
> #10 in FmFormModel::~FmFormModel() at svx/source/form/fmmodel.cxx:94:1 (instdir/program/libsvxcorelo.so +0x465f020)
> #11 in SdDrawDocument::~SdDrawDocument() at sd/source/core/drawdoc.cxx:394:1 (instdir/program/libsdlo.so +0x2324254)
> #12 in SdDrawDocument::~SdDrawDocument() at sd/source/core/drawdoc.cxx:346:1 (instdir/program/libsdlo.so +0x2324445)
> #13 in SdDrawDocument::~SdDrawDocument() at sd/source/core/drawdoc.cxx:346:1 (instdir/program/libsdlo.so +0x23244ce)
> #14 in sd::DrawDocShell::~DrawDocShell() at sd/source/ui/docshell/docshell.cxx:200:9 (instdir/program/libsdlo.so +0x2c4bdb9)
> #15 in sd::DrawDocShell::~DrawDocShell() at sd/source/ui/docshell/docshell.cxx:179:1 (instdir/program/libsdlo.so +0x2c4c4a5)
> #16 in sd::DrawDocShell::~DrawDocShell() at sd/source/ui/docshell/docshell.cxx:179:1 (instdir/program/libsdlo.so +0x2c4c56e)
> #17 in SvRefBase::ReleaseRef() at include/tools/ref.hxx:165:29 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x1ff01)
> #18 in tools::SvRef<sd::DrawDocShell>::~SvRef() at include/tools/ref.hxx:56:36 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x1a9fc)
> #19 in SdFiltersTest::load(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int) at sd/qa/unit/filters-test.cxx:78:1 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x17f53)
> #20 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 +0x5589c)
> #21 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 +0x56519)
> #22 in SdFiltersTest::testCVEs() at sd/qa/unit/filters-test.cxx:83:5 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x1839d)
Change-Id: Ibf61c18738c7a204ebf2bbc85b28930481b22612
Reviewed-on: https://gerrit.libreoffice.org/52554
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-04-07 16:28:08 +02:00
|
|
|
GetPool()->GetPool(),
|
2017-08-23 09:52:52 +02:00
|
|
|
svl::Items<
|
|
|
|
XATTR_LINE_FIRST, XATTR_LINE_LAST,
|
|
|
|
XATTR_FILL_FIRST, XATTR_FILL_LAST,
|
|
|
|
SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST,
|
|
|
|
SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_WORDWRAP,
|
|
|
|
SDRATTR_EDGE_FIRST, SDRATTR_MEASURE_LAST,
|
|
|
|
SDRATTR_3D_FIRST, SDRATTR_3D_LAST,
|
|
|
|
EE_PARA_START, EE_CHAR_END>{});
|
2015-09-18 14:40:24 +01:00
|
|
|
bMySet = true;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return(*pSet);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-21 09:12:38 +01:00
|
|
|
/**
|
|
|
|
* A template is used when it is referenced by inserted object or by a used
|
|
|
|
* template.
|
|
|
|
*/
|
2012-09-26 16:05:01 +02:00
|
|
|
bool SdStyleSheet::IsUsed() const
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2012-09-26 16:05:01 +02:00
|
|
|
bool bResult = false;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2014-07-18 15:36:30 +02:00
|
|
|
const size_t nListenerCount = GetSizeOfVector();
|
2014-05-11 20:57:50 +02:00
|
|
|
for (size_t n = 0; n < nListenerCount; ++n)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2014-05-11 20:57:50 +02:00
|
|
|
SfxListener* pListener = GetListener(n);
|
|
|
|
if( pListener == this )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
const svl::StyleSheetUser* const pUser(dynamic_cast<svl::StyleSheetUser*>(pListener));
|
|
|
|
if (pUser)
|
|
|
|
bResult = pUser->isUsedByModel();
|
|
|
|
if (bResult)
|
|
|
|
break;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
2008-03-12 10:29:21 +00:00
|
|
|
if( !bResult )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2008-03-12 10:29:21 +00:00
|
|
|
MutexGuard aGuard( mrBHelper.rMutex );
|
|
|
|
|
2016-01-19 19:45:45 +02:00
|
|
|
cppu::OInterfaceContainerHelper * pContainer = mrBHelper.getContainer( cppu::UnoType<XModifyListener>::get() );
|
2008-03-12 10:29:21 +00:00
|
|
|
if( pContainer )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2015-06-29 10:11:53 +02:00
|
|
|
Sequence< Reference< XInterface > > aModifyListeners( pContainer->getElements() );
|
|
|
|
Reference< XInterface > *p = aModifyListeners.getArray();
|
|
|
|
sal_Int32 nCount = aModifyListeners.getLength();
|
|
|
|
while( nCount-- && !bResult )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2015-06-29 10:11:53 +02:00
|
|
|
Reference< XStyle > xStyle( *p++, UNO_QUERY );
|
|
|
|
if( xStyle.is() )
|
2008-03-12 10:29:21 +00:00
|
|
|
bResult = xStyle->isInUse();
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-03-12 10:29:21 +00:00
|
|
|
return bResult;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
2013-03-21 09:12:38 +01:00
|
|
|
/**
|
|
|
|
* Determine the style sheet for which this dummy is for.
|
|
|
|
*/
|
2000-09-18 23:16:46 +00:00
|
|
|
SdStyleSheet* SdStyleSheet::GetRealStyleSheet() const
|
|
|
|
{
|
2013-02-21 03:54:57 +05:30
|
|
|
OUString aRealStyle;
|
|
|
|
OUString aSep( SD_LT_SEPARATOR );
|
2015-11-10 10:23:02 +01:00
|
|
|
SdStyleSheet* pRealStyle = nullptr;
|
2018-04-07 14:30:26 +02:00
|
|
|
SdDrawDocument* pDoc = static_cast<SdStyleSheetPool*>(m_pPool)->GetDoc();
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2015-11-10 10:23:02 +01:00
|
|
|
::sd::DrawViewShell* pDrawViewShell = nullptr;
|
2008-06-06 10:58:23 +00:00
|
|
|
|
|
|
|
::sd::ViewShellBase* pBase = dynamic_cast< ::sd::ViewShellBase* >( SfxViewShell::Current() );
|
|
|
|
if( pBase )
|
|
|
|
pDrawViewShell = dynamic_cast< ::sd::DrawViewShell* >( pBase->GetMainViewShell().get() );
|
|
|
|
|
2008-03-12 10:29:21 +00:00
|
|
|
if (pDrawViewShell && pDrawViewShell->GetDoc() == pDoc)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2008-03-12 10:29:21 +00:00
|
|
|
SdPage* pPage = pDrawViewShell->getCurrentPage();
|
|
|
|
if( pPage )
|
2004-01-20 09:28:49 +00:00
|
|
|
{
|
|
|
|
aRealStyle = pPage->GetLayoutName();
|
2013-05-15 10:42:04 +03:00
|
|
|
// cut after separator string
|
2013-03-19 01:30:44 +01:00
|
|
|
|
2013-02-21 03:54:57 +05:30
|
|
|
if( aRealStyle.indexOf(aSep) >= 0)
|
|
|
|
{
|
|
|
|
aRealStyle = aRealStyle.copy(0,(aRealStyle.indexOf(aSep) + aSep.getLength()));
|
2013-03-19 01:30:44 +01:00
|
|
|
}
|
2004-01-20 09:28:49 +00:00
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
2013-02-21 03:54:57 +05:30
|
|
|
if (aRealStyle.isEmpty())
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2016-10-11 13:01:32 +02:00
|
|
|
SdPage* pPage = pDoc->GetSdPage(0, PageKind::Standard);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
if (pPage)
|
|
|
|
{
|
2016-10-11 13:01:32 +02:00
|
|
|
aRealStyle = pDoc->GetSdPage(0, PageKind::Standard)->GetLayoutName();
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-06-15 17:03:57 +02:00
|
|
|
/* no page available yet. This can happen when actualizing the
|
2013-03-21 09:12:38 +01:00
|
|
|
document templates. */
|
2018-04-07 14:30:26 +02:00
|
|
|
SfxStyleSheetIterator aIter(m_pPool, SfxStyleFamily::Page);
|
2000-09-18 23:16:46 +00:00
|
|
|
SfxStyleSheetBase* pSheet = aIter.First();
|
|
|
|
if( pSheet )
|
|
|
|
aRealStyle = pSheet->GetName();
|
|
|
|
}
|
|
|
|
|
2013-02-21 03:54:57 +05:30
|
|
|
if( aRealStyle.indexOf(aSep) >= 0)
|
|
|
|
{
|
|
|
|
aRealStyle = aRealStyle.copy(0,(aRealStyle.indexOf(aSep) + aSep.getLength()));
|
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
2013-03-21 09:12:38 +01:00
|
|
|
/* now map from the name (specified for country language) to the internal
|
|
|
|
name (independent of the country language) */
|
2013-07-05 16:25:03 -05:00
|
|
|
OUString aInternalName;
|
|
|
|
OUString aStyleName(aName);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2017-05-18 21:14:00 +01:00
|
|
|
if (aStyleName == SdResId(STR_PSEUDOSHEET_TITLE))
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2017-04-30 17:01:32 +01:00
|
|
|
aInternalName = STR_LAYOUT_TITLE;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
2017-05-18 21:14:00 +01:00
|
|
|
else if (aStyleName == SdResId(STR_PSEUDOSHEET_SUBTITLE))
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2017-04-30 17:01:32 +01:00
|
|
|
aInternalName = STR_LAYOUT_SUBTITLE;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
2017-05-18 21:14:00 +01:00
|
|
|
else if (aStyleName == SdResId(STR_PSEUDOSHEET_BACKGROUND))
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2017-04-30 17:01:32 +01:00
|
|
|
aInternalName = STR_LAYOUT_BACKGROUND;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
2017-05-18 21:14:00 +01:00
|
|
|
else if (aStyleName == SdResId(STR_PSEUDOSHEET_BACKGROUNDOBJECTS))
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2017-04-30 17:01:32 +01:00
|
|
|
aInternalName = STR_LAYOUT_BACKGROUNDOBJECTS;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
2017-05-18 21:14:00 +01:00
|
|
|
else if (aStyleName == SdResId(STR_PSEUDOSHEET_NOTES))
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2017-04-30 17:01:32 +01:00
|
|
|
aInternalName = STR_LAYOUT_NOTES;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-07-05 16:25:03 -05:00
|
|
|
OUString aOutlineStr(SdResId(STR_PSEUDOSHEET_OUTLINE));
|
|
|
|
sal_Int32 nPos = aStyleName.indexOf(aOutlineStr);
|
|
|
|
if (nPos >= 0)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2013-09-05 14:22:12 +02:00
|
|
|
OUString aNumStr(aStyleName.copy(aOutlineStr.getLength()));
|
2017-04-30 17:01:32 +01:00
|
|
|
aInternalName = OUString(STR_LAYOUT_OUTLINE);
|
2000-09-18 23:16:46 +00:00
|
|
|
aInternalName += aNumStr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
aRealStyle += aInternalName;
|
2018-04-07 14:30:26 +02:00
|
|
|
pRealStyle = static_cast< SdStyleSheet* >( m_pPool->Find(aRealStyle, SfxStyleFamily::Page) );
|
2008-03-12 10:29:21 +00:00
|
|
|
|
2006-12-12 15:34:20 +00:00
|
|
|
#ifdef DBG_UTIL
|
2000-09-18 23:16:46 +00:00
|
|
|
if( !pRealStyle )
|
|
|
|
{
|
2018-04-07 14:30:26 +02:00
|
|
|
SfxStyleSheetIterator aIter(m_pPool, SfxStyleFamily::Page);
|
2000-09-18 23:16:46 +00:00
|
|
|
if( aIter.Count() > 0 )
|
|
|
|
// StyleSheet not found, but pool already loaded
|
|
|
|
DBG_ASSERT(pRealStyle, "Internal StyleSheet not found");
|
|
|
|
}
|
2006-12-12 15:34:20 +00:00
|
|
|
#endif
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
return pRealStyle;
|
|
|
|
}
|
|
|
|
|
2013-03-21 09:12:38 +01:00
|
|
|
/**
|
|
|
|
* Determine pseudo style sheet which stands for this style sheet.
|
|
|
|
*/
|
2000-09-18 23:16:46 +00:00
|
|
|
SdStyleSheet* SdStyleSheet::GetPseudoStyleSheet() const
|
|
|
|
{
|
2015-11-10 10:23:02 +01:00
|
|
|
SdStyleSheet* pPseudoStyle = nullptr;
|
2013-02-21 03:54:57 +05:30
|
|
|
OUString aSep( SD_LT_SEPARATOR );
|
|
|
|
OUString aStyleName(aName);
|
2013-05-15 10:42:04 +03:00
|
|
|
// without layout name and separator
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2013-02-21 03:54:57 +05:30
|
|
|
if( aStyleName.indexOf(aSep) >=0 )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2013-02-21 03:54:57 +05:30
|
|
|
aStyleName = aStyleName.copy (aStyleName.indexOf(aSep) + aSep.getLength());
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
2013-02-21 03:54:57 +05:30
|
|
|
|
2017-04-30 17:01:32 +01:00
|
|
|
if (aStyleName == STR_LAYOUT_TITLE)
|
2013-02-21 03:54:57 +05:30
|
|
|
{
|
2017-05-18 21:14:00 +01:00
|
|
|
aStyleName = SdResId(STR_PSEUDOSHEET_TITLE);
|
2013-02-21 03:54:57 +05:30
|
|
|
}
|
2017-04-30 17:01:32 +01:00
|
|
|
else if (aStyleName == STR_LAYOUT_SUBTITLE)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2017-05-18 21:14:00 +01:00
|
|
|
aStyleName = SdResId(STR_PSEUDOSHEET_SUBTITLE);
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
2017-04-30 17:01:32 +01:00
|
|
|
else if (aStyleName == STR_LAYOUT_BACKGROUND)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2017-05-18 21:14:00 +01:00
|
|
|
aStyleName = SdResId(STR_PSEUDOSHEET_BACKGROUND);
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
2017-04-30 17:01:32 +01:00
|
|
|
else if (aStyleName == STR_LAYOUT_BACKGROUNDOBJECTS)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2017-05-18 21:14:00 +01:00
|
|
|
aStyleName = SdResId(STR_PSEUDOSHEET_BACKGROUNDOBJECTS);
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
2017-04-30 17:01:32 +01:00
|
|
|
else if (aStyleName == STR_LAYOUT_NOTES)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2017-05-18 21:14:00 +01:00
|
|
|
aStyleName = SdResId(STR_PSEUDOSHEET_NOTES);
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-04-30 17:01:32 +01:00
|
|
|
OUString aOutlineStr(STR_LAYOUT_OUTLINE);
|
2013-02-21 03:54:57 +05:30
|
|
|
sal_Int32 nPos = aStyleName.indexOf(aOutlineStr);
|
|
|
|
if (nPos != -1)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2013-02-21 03:54:57 +05:30
|
|
|
OUString aNumStr(aStyleName.copy(aOutlineStr.getLength()));
|
2017-05-18 21:14:00 +01:00
|
|
|
aStyleName = SdResId(STR_PSEUDOSHEET_OUTLINE);
|
2000-09-18 23:16:46 +00:00
|
|
|
aStyleName += aNumStr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-07 14:30:26 +02:00
|
|
|
pPseudoStyle = static_cast<SdStyleSheet*>(m_pPool->Find(aStyleName, SfxStyleFamily::Pseudo));
|
2013-03-11 22:51:42 +01:00
|
|
|
DBG_ASSERT(pPseudoStyle, "PseudoStyleSheet missing");
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
return pPseudoStyle;
|
|
|
|
}
|
|
|
|
|
2008-09-30 06:36:06 +00:00
|
|
|
void SdStyleSheet::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2013-03-21 09:12:38 +01:00
|
|
|
// first, base class functionality
|
2000-09-18 23:16:46 +00:00
|
|
|
SfxStyleSheet::Notify(rBC, rHint);
|
|
|
|
|
2018-01-19 12:16:31 +02:00
|
|
|
if (nFamily != SfxStyleFamily::Pseudo)
|
2015-12-15 21:23:38 +01:00
|
|
|
return;
|
|
|
|
|
2013-03-21 09:12:38 +01:00
|
|
|
/* if the dummy gets a notify about a changed attribute, he takes care that
|
2017-03-02 10:03:34 +01:00
|
|
|
the actual meant style sheet sends broadcasts. */
|
2016-12-08 10:26:01 +02:00
|
|
|
if (rHint.GetId() == SfxHintId::DataChanged)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
SdStyleSheet* pRealStyle = GetRealStyleSheet();
|
|
|
|
if (pRealStyle)
|
|
|
|
pRealStyle->Broadcast(rHint);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-21 09:12:38 +01:00
|
|
|
/**
|
|
|
|
* Adjust the bullet width and the left text indent of the provided ItemSets to
|
|
|
|
* their font height. The new values are calculated that the ratio to the font
|
|
|
|
* height is as in the style sheet.
|
|
|
|
*
|
|
|
|
* @param bOnlyMissingItems If sal_True, only not set items are completed. With
|
|
|
|
* sal_False, are items are overwritten.
|
|
|
|
*/
|
2014-04-24 10:52:02 +02:00
|
|
|
void SdStyleSheet::AdjustToFontHeight(SfxItemSet& rSet, bool bOnlyMissingItems)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2014-04-10 10:03:30 +02:00
|
|
|
/* If not explicit set, adjust bullet width and text indent to new font
|
2013-03-21 09:12:38 +01:00
|
|
|
height. */
|
2000-09-18 23:16:46 +00:00
|
|
|
SfxStyleFamily eFamily = nFamily;
|
2013-02-21 03:54:57 +05:30
|
|
|
OUString aStyleName(aName);
|
2018-01-19 12:16:31 +02:00
|
|
|
if (eFamily == SfxStyleFamily::Pseudo)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
SfxStyleSheet* pRealStyle = GetRealStyleSheet();
|
|
|
|
eFamily = pRealStyle->GetFamily();
|
|
|
|
aStyleName = pRealStyle->GetName();
|
|
|
|
}
|
|
|
|
|
2018-01-19 12:16:31 +02:00
|
|
|
if (eFamily == SfxStyleFamily::Page &&
|
2017-04-30 17:01:32 +01:00
|
|
|
aStyleName.indexOf(STR_LAYOUT_OUTLINE) != -1 &&
|
2014-09-10 17:53:41 +02:00
|
|
|
rSet.GetItemState(EE_CHAR_FONTHEIGHT) == SfxItemState::SET)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
const SfxItemSet* pCurSet = &GetItemSet();
|
2017-11-16 13:09:02 +02:00
|
|
|
sal_uInt32 nNewHeight = rSet.Get(EE_CHAR_FONTHEIGHT).GetHeight();
|
|
|
|
sal_uInt32 nOldHeight = pCurSet->Get(EE_CHAR_FONTHEIGHT).GetHeight();
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2014-09-10 17:53:41 +02:00
|
|
|
if (rSet.GetItemState(EE_PARA_BULLET) != SfxItemState::SET || !bOnlyMissingItems)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2017-11-10 12:48:21 +02:00
|
|
|
const SvxBulletItem& rBItem = pCurSet->Get(EE_PARA_BULLET);
|
2000-09-18 23:16:46 +00:00
|
|
|
double fBulletFraction = double(rBItem.GetWidth()) / nOldHeight;
|
|
|
|
SvxBulletItem aNewBItem(rBItem);
|
2018-01-12 20:16:43 +01:00
|
|
|
aNewBItem.SetWidth(static_cast<sal_uInt32>(fBulletFraction * nNewHeight));
|
2000-09-18 23:16:46 +00:00
|
|
|
rSet.Put(aNewBItem);
|
|
|
|
}
|
|
|
|
|
2014-09-10 17:53:41 +02:00
|
|
|
if (rSet.GetItemState(EE_PARA_LRSPACE) != SfxItemState::SET || !bOnlyMissingItems)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2017-11-10 12:48:21 +02:00
|
|
|
const SvxLRSpaceItem& rLRItem = pCurSet->Get(EE_PARA_LRSPACE);
|
2015-05-20 13:05:49 +02:00
|
|
|
double fIndentFraction = double(rLRItem.GetTextLeft()) / nOldHeight;
|
2000-09-18 23:16:46 +00:00
|
|
|
SvxLRSpaceItem aNewLRItem(rLRItem);
|
2015-05-20 13:05:49 +02:00
|
|
|
aNewLRItem.SetTextLeft(fIndentFraction * nNewHeight);
|
|
|
|
double fFirstIndentFraction = double(rLRItem.GetTextFirstLineOfst()) / nOldHeight;
|
2018-01-12 20:16:43 +01:00
|
|
|
aNewLRItem.SetTextFirstLineOfst(static_cast<short>(fFirstIndentFraction * nNewHeight));
|
2000-09-18 23:16:46 +00:00
|
|
|
rSet.Put(aNewLRItem);
|
|
|
|
}
|
|
|
|
|
2014-09-10 17:53:41 +02:00
|
|
|
if (rSet.GetItemState(EE_PARA_ULSPACE) != SfxItemState::SET || !bOnlyMissingItems)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2017-11-15 14:20:57 +02:00
|
|
|
const SvxULSpaceItem& rULItem = pCurSet->Get(EE_PARA_ULSPACE);
|
2000-09-18 23:16:46 +00:00
|
|
|
SvxULSpaceItem aNewULItem(rULItem);
|
|
|
|
double fLowerFraction = double(rULItem.GetLower()) / nOldHeight;
|
2018-01-12 20:16:43 +01:00
|
|
|
aNewULItem.SetLower(static_cast<sal_uInt16>(fLowerFraction * nNewHeight));
|
2000-09-18 23:16:46 +00:00
|
|
|
double fUpperFraction = double(rULItem.GetUpper()) / nOldHeight;
|
2018-01-12 20:16:43 +01:00
|
|
|
aNewULItem.SetUpper(static_cast<sal_uInt16>(fUpperFraction * nNewHeight));
|
2000-09-18 23:16:46 +00:00
|
|
|
rSet.Put(aNewULItem);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-26 16:05:01 +02:00
|
|
|
bool SdStyleSheet::HasFollowSupport() const
|
2003-03-27 09:58:12 +00:00
|
|
|
{
|
2012-09-26 16:05:01 +02:00
|
|
|
return false;
|
2003-03-27 09:58:12 +00:00
|
|
|
}
|
|
|
|
|
2012-09-26 16:05:01 +02:00
|
|
|
bool SdStyleSheet::HasParentSupport() const
|
2003-03-27 09:58:12 +00:00
|
|
|
{
|
2012-09-26 16:05:01 +02:00
|
|
|
return true;
|
2003-03-27 09:58:12 +00:00
|
|
|
}
|
|
|
|
|
2012-09-26 16:05:01 +02:00
|
|
|
bool SdStyleSheet::HasClearParentSupport() const
|
2003-03-27 09:58:12 +00:00
|
|
|
{
|
2012-09-26 16:05:01 +02:00
|
|
|
return true;
|
2003-03-27 09:58:12 +00:00
|
|
|
}
|
2008-03-12 10:29:21 +00:00
|
|
|
|
2018-05-27 14:02:09 +03:00
|
|
|
namespace
|
|
|
|
{
|
|
|
|
struct ApiNameMap
|
|
|
|
{
|
2018-10-08 16:12:06 +02:00
|
|
|
OUStringLiteral const mpApiName;
|
|
|
|
sal_uInt32 const mnHelpId;
|
2018-05-27 14:02:09 +03:00
|
|
|
} const pApiNameMap[]
|
|
|
|
= { { OUStringLiteral("title"), HID_PSEUDOSHEET_TITLE },
|
|
|
|
{ OUStringLiteral("subtitle"), HID_PSEUDOSHEET_SUBTITLE },
|
|
|
|
{ OUStringLiteral("background"), HID_PSEUDOSHEET_BACKGROUND },
|
|
|
|
{ OUStringLiteral("backgroundobjects"), HID_PSEUDOSHEET_BACKGROUNDOBJECTS },
|
|
|
|
{ OUStringLiteral("notes"), HID_PSEUDOSHEET_NOTES },
|
|
|
|
{ OUStringLiteral("standard"), HID_STANDARD_STYLESHEET_NAME },
|
|
|
|
{ OUStringLiteral("objectwithoutfill"), HID_POOLSHEET_OBJWITHOUTFILL },
|
2018-09-13 19:31:49 +02:00
|
|
|
|
|
|
|
{ OUStringLiteral("Text"), HID_POOLSHEET_TEXT },
|
|
|
|
{ OUStringLiteral("A4"), HID_POOLSHEET_A4 },
|
|
|
|
{ OUStringLiteral("Title A4"), HID_POOLSHEET_A4_TITLE },
|
|
|
|
{ OUStringLiteral("Heading A4"), HID_POOLSHEET_A4_HEADLINE },
|
|
|
|
{ OUStringLiteral("Text A4"), HID_POOLSHEET_A4_TEXT },
|
|
|
|
{ OUStringLiteral("A4"), HID_POOLSHEET_A0 },
|
|
|
|
{ OUStringLiteral("Title A0"), HID_POOLSHEET_A0_TITLE },
|
|
|
|
{ OUStringLiteral("Heading A0"), HID_POOLSHEET_A0_HEADLINE },
|
|
|
|
{ OUStringLiteral("Text A0"), HID_POOLSHEET_A0_TEXT },
|
|
|
|
|
|
|
|
{ OUStringLiteral("Graphic"), HID_POOLSHEET_GRAPHIC },
|
|
|
|
{ OUStringLiteral("Shapes"), HID_POOLSHEET_SHAPES },
|
2018-05-27 14:02:09 +03:00
|
|
|
{ OUStringLiteral("Filled"), HID_POOLSHEET_FILLED },
|
|
|
|
{ OUStringLiteral("Filled Blue"), HID_POOLSHEET_FILLED_BLUE },
|
|
|
|
{ OUStringLiteral("Filled Green"), HID_POOLSHEET_FILLED_GREEN },
|
|
|
|
{ OUStringLiteral("Filled Red"), HID_POOLSHEET_FILLED_RED },
|
|
|
|
{ OUStringLiteral("Filled Yellow"), HID_POOLSHEET_FILLED_YELLOW },
|
|
|
|
{ OUStringLiteral("Outlined"), HID_POOLSHEET_OUTLINE },
|
|
|
|
{ OUStringLiteral("Outlined Blue"), HID_POOLSHEET_OUTLINE_BLUE },
|
|
|
|
{ OUStringLiteral("Outlined Green"), HID_POOLSHEET_OUTLINE_GREEN },
|
|
|
|
{ OUStringLiteral("Outlined Red"), HID_POOLSHEET_OUTLINE_RED },
|
2018-09-13 19:31:49 +02:00
|
|
|
{ OUStringLiteral("Outlined Yellow"), HID_POOLSHEET_OUTLINE_YELLOW },
|
|
|
|
{ OUStringLiteral("Lines"), HID_POOLSHEET_LINES },
|
|
|
|
{ OUStringLiteral("Arrow Line"), HID_POOLSHEET_MEASURE },
|
|
|
|
{ OUStringLiteral("Arrow Dashed"), HID_POOLSHEET_LINES_DASHED }
|
|
|
|
};
|
2018-05-27 14:02:09 +03:00
|
|
|
|
|
|
|
OUString GetApiNameForHelpId(sal_uLong nId)
|
|
|
|
{
|
|
|
|
if ((nId >= HID_PSEUDOSHEET_OUTLINE1) && (nId <= HID_PSEUDOSHEET_OUTLINE9))
|
|
|
|
return "outline" + OUStringLiteral1('1' + (nId - HID_PSEUDOSHEET_OUTLINE1));
|
|
|
|
|
|
|
|
for (const auto& i : pApiNameMap)
|
|
|
|
if (nId == i.mnHelpId)
|
|
|
|
return i.mpApiName;
|
|
|
|
|
|
|
|
return OUString();
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_uInt32 GetHelpIdForApiName(const OUString& sName)
|
|
|
|
{
|
|
|
|
OUString sRest;
|
|
|
|
if (sName.startsWith("outline", &sRest))
|
|
|
|
{
|
|
|
|
if (sRest.getLength() == 1)
|
|
|
|
{
|
|
|
|
sal_Unicode ch = sRest.toChar();
|
|
|
|
if ('1' <= ch && ch <= '9')
|
|
|
|
return HID_PSEUDOSHEET_OUTLINE1 + ch - '1';
|
|
|
|
}
|
|
|
|
// No other pre-defined names start with "outline"
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (const auto& i : pApiNameMap)
|
|
|
|
if (sName == i.mpApiName)
|
|
|
|
return i.mnHelpId;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-02 15:40:14 +01:00
|
|
|
void SdStyleSheet::SetHelpId( const OUString& r, sal_uLong nId )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
|
|
|
SfxStyleSheet::SetHelpId( r, nId );
|
|
|
|
|
2018-05-27 14:02:09 +03:00
|
|
|
const OUString sNewApiName = GetApiNameForHelpId(nId);
|
|
|
|
if (!sNewApiName.isEmpty())
|
|
|
|
msApiName = sNewApiName;
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
OUString SdStyleSheet::GetFamilyString( SfxStyleFamily eFamily )
|
|
|
|
{
|
|
|
|
switch( eFamily )
|
|
|
|
{
|
2018-01-19 12:16:31 +02:00
|
|
|
case SfxStyleFamily::Frame:
|
2012-04-15 23:14:28 -03:00
|
|
|
return OUString( "cell" );
|
2008-03-12 10:29:21 +00:00
|
|
|
default:
|
2011-03-01 19:06:55 +01:00
|
|
|
OSL_FAIL( "SdStyleSheet::GetFamilyString(), illegal family!" );
|
2016-05-10 17:10:32 +02:00
|
|
|
SAL_FALLTHROUGH;
|
2018-01-19 12:16:31 +02:00
|
|
|
case SfxStyleFamily::Para:
|
2012-04-15 23:14:28 -03:00
|
|
|
return OUString( "graphics" );
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
void SdStyleSheet::throwIfDisposed()
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
|
|
|
if( !mxPool.is() )
|
|
|
|
throw DisposedException();
|
|
|
|
}
|
|
|
|
|
|
|
|
SdStyleSheet* SdStyleSheet::CreateEmptyUserStyle( SfxStyleSheetBasePool& rPool, SfxStyleFamily eFamily )
|
|
|
|
{
|
|
|
|
OUString aName;
|
|
|
|
sal_Int32 nIndex = 1;
|
|
|
|
do
|
|
|
|
{
|
2017-06-25 19:10:54 +02:00
|
|
|
aName = "user" + OUString::number( nIndex++ );
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
2015-11-10 10:23:02 +01:00
|
|
|
while( rPool.Find( aName, eFamily ) != nullptr );
|
2008-03-12 10:29:21 +00:00
|
|
|
|
2018-04-18 12:14:37 +02:00
|
|
|
return new SdStyleSheet(aName, rPool, eFamily, SfxStyleSearchBits::UserDefined);
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// XInterface
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2008-03-12 10:29:21 +00:00
|
|
|
void SAL_CALL SdStyleSheet::release( ) throw ()
|
|
|
|
{
|
2012-09-22 01:51:12 -05:00
|
|
|
if (osl_atomic_decrement( &m_refCount ) == 0)
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
|
|
|
// restore reference count:
|
2012-09-22 01:51:12 -05:00
|
|
|
osl_atomic_increment( &m_refCount );
|
2008-03-12 10:29:21 +00:00
|
|
|
if (! mrBHelper.bDisposed) try
|
|
|
|
{
|
|
|
|
dispose();
|
|
|
|
}
|
|
|
|
catch (RuntimeException const& exc)
|
|
|
|
{ // don't break throw ()
|
2017-09-29 16:21:54 +02:00
|
|
|
SAL_WARN( "sd", exc );
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
2017-05-07 17:03:35 +10:00
|
|
|
OSL_ASSERT( mrBHelper.bDisposed );
|
2008-03-12 10:29:21 +00:00
|
|
|
SdStyleSheetBase::release();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// XComponent
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
void SAL_CALL SdStyleSheet::dispose( )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
|
|
|
ClearableMutexGuard aGuard( mrBHelper.rMutex );
|
|
|
|
if (!mrBHelper.bDisposed && !mrBHelper.bInDispose)
|
|
|
|
{
|
2016-04-20 17:19:18 +02:00
|
|
|
mrBHelper.bInDispose = true;
|
2008-03-12 10:29:21 +00:00
|
|
|
aGuard.clear();
|
|
|
|
try
|
|
|
|
{
|
|
|
|
// side effect: keeping a reference to this
|
|
|
|
EventObject aEvt( static_cast< OWeakObject * >( this ) );
|
|
|
|
try
|
|
|
|
{
|
|
|
|
mrBHelper.aLC.disposeAndClear( aEvt );
|
|
|
|
disposing();
|
|
|
|
}
|
|
|
|
catch (...)
|
|
|
|
{
|
|
|
|
MutexGuard aGuard2( mrBHelper.rMutex );
|
|
|
|
// bDisposed and bInDispose must be set in this order:
|
2016-04-20 17:19:18 +02:00
|
|
|
mrBHelper.bDisposed = true;
|
|
|
|
mrBHelper.bInDispose = false;
|
2008-03-12 10:29:21 +00:00
|
|
|
throw;
|
|
|
|
}
|
|
|
|
MutexGuard aGuard2( mrBHelper.rMutex );
|
|
|
|
// bDisposed and bInDispose must be set in this order:
|
2016-04-20 17:19:18 +02:00
|
|
|
mrBHelper.bDisposed = true;
|
|
|
|
mrBHelper.bInDispose = false;
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
|
|
|
catch (RuntimeException &)
|
|
|
|
{
|
|
|
|
throw;
|
|
|
|
}
|
2011-12-25 15:08:11 +09:00
|
|
|
catch (const Exception & exc)
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
2018-05-24 15:47:30 +02:00
|
|
|
css::uno::Any anyEx = cppu::getCaughtException();
|
|
|
|
throw css::lang::WrappedTargetRuntimeException(
|
|
|
|
"unexpected UNO exception caught: " + exc.Message ,
|
|
|
|
nullptr, anyEx );
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SdStyleSheet::disposing()
|
|
|
|
{
|
2015-07-07 23:57:07 +02:00
|
|
|
SolarMutexGuard aGuard;
|
|
|
|
if (bMySet)
|
|
|
|
{
|
|
|
|
delete pSet;
|
|
|
|
}
|
|
|
|
pSet = nullptr;
|
2018-04-07 14:30:26 +02:00
|
|
|
m_pPool = nullptr;
|
2008-03-12 10:29:21 +00:00
|
|
|
mxPool.clear();
|
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
void SAL_CALL SdStyleSheet::addEventListener( const Reference< XEventListener >& xListener )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
|
|
|
ClearableMutexGuard aGuard( mrBHelper.rMutex );
|
|
|
|
if (mrBHelper.bDisposed || mrBHelper.bInDispose)
|
|
|
|
{
|
|
|
|
aGuard.clear();
|
|
|
|
EventObject aEvt( static_cast< OWeakObject * >( this ) );
|
|
|
|
xListener->disposing( aEvt );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-04-01 08:40:54 +02:00
|
|
|
mrBHelper.addListener( cppu::UnoType<decltype(xListener)>::get(), xListener );
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
void SAL_CALL SdStyleSheet::removeEventListener( const Reference< XEventListener >& xListener )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
2015-04-01 08:40:54 +02:00
|
|
|
mrBHelper.removeListener( cppu::UnoType<decltype(xListener)>::get(), xListener );
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// XModifyBroadcaster
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
void SAL_CALL SdStyleSheet::addModifyListener( const Reference< XModifyListener >& xListener )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
|
|
|
ClearableMutexGuard aGuard( mrBHelper.rMutex );
|
|
|
|
if (mrBHelper.bDisposed || mrBHelper.bInDispose)
|
|
|
|
{
|
|
|
|
aGuard.clear();
|
|
|
|
EventObject aEvt( static_cast< OWeakObject * >( this ) );
|
|
|
|
xListener->disposing( aEvt );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( !mpModifyListenerForewarder.get() )
|
|
|
|
mpModifyListenerForewarder.reset( new ModifyListenerForewarder( this ) );
|
2013-12-12 11:09:57 +01:00
|
|
|
mrBHelper.addListener( cppu::UnoType<XModifyListener>::get(), xListener );
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
void SAL_CALL SdStyleSheet::removeModifyListener( const Reference< XModifyListener >& xListener )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
2013-12-12 11:09:57 +01:00
|
|
|
mrBHelper.removeListener( cppu::UnoType<XModifyListener>::get(), xListener );
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SdStyleSheet::notifyModifyListener()
|
|
|
|
{
|
|
|
|
MutexGuard aGuard( mrBHelper.rMutex );
|
|
|
|
|
2016-01-19 19:45:45 +02:00
|
|
|
cppu::OInterfaceContainerHelper * pContainer = mrBHelper.getContainer( cppu::UnoType<XModifyListener>::get() );
|
2008-03-12 10:29:21 +00:00
|
|
|
if( pContainer )
|
|
|
|
{
|
|
|
|
EventObject aEvt( static_cast< OWeakObject * >( this ) );
|
2016-03-03 11:36:09 +01:00
|
|
|
pContainer->forEach<XModifyListener>(
|
|
|
|
[&] (Reference<XModifyListener> const& xListener) {
|
|
|
|
return xListener->modified(aEvt);
|
|
|
|
} );
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// XServiceInfo
|
2017-01-26 12:28:58 +01:00
|
|
|
OUString SAL_CALL SdStyleSheet::getImplementationName()
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
2012-04-15 23:14:28 -03:00
|
|
|
return OUString( "SdStyleSheet" );
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Bool SAL_CALL SdStyleSheet::supportsService( const OUString& ServiceName )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
2013-10-22 23:49:31 -02:00
|
|
|
return cppu::supportsService( this, ServiceName );
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
Sequence< OUString > SAL_CALL SdStyleSheet::getSupportedServiceNames()
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
|
|
|
Sequence< OUString > aNameSequence( 10 );
|
|
|
|
OUString* pStrings = aNameSequence.getArray();
|
|
|
|
|
2012-04-15 23:14:28 -03:00
|
|
|
*pStrings++ = "com.sun.star.style.Style";
|
|
|
|
*pStrings++ = "com.sun.star.drawing.FillProperties";
|
|
|
|
*pStrings++ = "com.sun.star.drawing.LineProperties";
|
|
|
|
*pStrings++ = "com.sun.star.drawing.ShadowProperties";
|
|
|
|
*pStrings++ = "com.sun.star.drawing.ConnectorProperties";
|
|
|
|
*pStrings++ = "com.sun.star.drawing.MeasureProperties";
|
|
|
|
*pStrings++ = "com.sun.star.style.ParagraphProperties";
|
|
|
|
*pStrings++ = "com.sun.star.style.CharacterProperties";
|
|
|
|
*pStrings++ = "com.sun.star.drawing.TextProperties";
|
|
|
|
*pStrings++ = "com.sun.star.drawing.Text";
|
2008-03-12 10:29:21 +00:00
|
|
|
|
|
|
|
return aNameSequence;
|
|
|
|
}
|
|
|
|
|
2018-05-27 14:02:09 +03:00
|
|
|
bool SdStyleSheet::SetName(const OUString& rNewName, bool bReindexNow)
|
|
|
|
{
|
|
|
|
const bool bResult = SfxUnoStyleSheet::SetName(rNewName, bReindexNow);
|
|
|
|
// Don't overwrite predefined API names
|
|
|
|
if (bResult && GetHelpIdForApiName(msApiName) == 0)
|
|
|
|
{
|
|
|
|
msApiName = rNewName;
|
|
|
|
Broadcast(SfxHint(SfxHintId::DataChanged));
|
|
|
|
}
|
|
|
|
return bResult;
|
|
|
|
}
|
|
|
|
|
2008-03-12 10:29:21 +00:00
|
|
|
// XNamed
|
2017-01-26 12:28:58 +01:00
|
|
|
OUString SAL_CALL SdStyleSheet::getName()
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
2010-10-13 02:37:50 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2008-03-12 10:29:21 +00:00
|
|
|
throwIfDisposed();
|
2008-04-04 11:45:15 +00:00
|
|
|
return GetApiName();
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
void SAL_CALL SdStyleSheet::setName( const OUString& rName )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
2010-10-13 02:37:50 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2008-03-12 10:29:21 +00:00
|
|
|
throwIfDisposed();
|
2018-05-27 14:02:09 +03:00
|
|
|
SetName(rName);
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// XStyle
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Bool SAL_CALL SdStyleSheet::isUserDefined()
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
2010-10-13 02:37:50 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2008-03-12 10:29:21 +00:00
|
|
|
throwIfDisposed();
|
2015-07-16 13:54:14 +02:00
|
|
|
return IsUserDefined();
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Bool SAL_CALL SdStyleSheet::isInUse()
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
2010-10-13 02:37:50 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2008-03-12 10:29:21 +00:00
|
|
|
throwIfDisposed();
|
2015-07-16 13:54:14 +02:00
|
|
|
return IsUsed();
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
OUString SAL_CALL SdStyleSheet::getParentStyle()
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
2010-10-13 02:37:50 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2008-03-12 10:29:21 +00:00
|
|
|
throwIfDisposed();
|
|
|
|
|
2013-07-05 16:25:03 -05:00
|
|
|
if( !GetParent().isEmpty() )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
|
|
|
SdStyleSheet* pParentStyle = static_cast< SdStyleSheet* >( mxPool->Find( GetParent(), nFamily ) );
|
|
|
|
if( pParentStyle )
|
2018-03-11 07:04:23 +03:00
|
|
|
return pParentStyle->GetApiName();
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
|
|
|
return OUString();
|
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
void SAL_CALL SdStyleSheet::setParentStyle( const OUString& rParentName )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
2010-10-13 02:37:50 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2008-03-12 10:29:21 +00:00
|
|
|
throwIfDisposed();
|
|
|
|
|
2012-01-08 09:52:25 -02:00
|
|
|
if( !rParentName.isEmpty() )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
2014-08-29 19:09:29 +02:00
|
|
|
OUString const name(GetName());
|
|
|
|
sal_Int32 const sep(name.indexOf(SD_LT_SEPARATOR));
|
|
|
|
OUString const master((sep == -1) ? OUString() : name.copy(0, sep));
|
2015-09-18 09:09:12 +01:00
|
|
|
std::shared_ptr<SfxStyleSheetIterator> aSSSI = std::make_shared<SfxStyleSheetIterator>(mxPool.get(), nFamily);
|
2014-03-05 19:51:58 +01:00
|
|
|
for (SfxStyleSheetBase *pStyle = aSSSI->First(); pStyle; pStyle = aSSSI->Next())
|
2010-10-04 13:40:44 +02:00
|
|
|
{
|
2014-03-05 19:51:58 +01:00
|
|
|
// we hope that we have only sd style sheets
|
|
|
|
SdStyleSheet* pSdStyleSheet = static_cast<SdStyleSheet*>(pStyle);
|
2014-08-29 19:09:29 +02:00
|
|
|
OUString const curName(pStyle->GetName());
|
|
|
|
sal_Int32 const curSep(curName.indexOf(SD_LT_SEPARATOR));
|
|
|
|
OUString const curMaster((curSep == -1)
|
2014-09-09 15:32:49 +01:00
|
|
|
? OUString() : curName.copy(0, curSep));
|
2014-08-29 19:09:29 +02:00
|
|
|
// check that the master matches, as msApiName exists once per
|
|
|
|
// master page
|
|
|
|
if (pSdStyleSheet->msApiName == rParentName && master == curMaster)
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
2010-10-04 13:40:44 +02:00
|
|
|
if( pStyle != this )
|
2014-03-05 19:51:58 +01:00
|
|
|
{
|
2014-08-29 19:09:29 +02:00
|
|
|
SetParent(curName);
|
2014-03-05 19:51:58 +01:00
|
|
|
}
|
2010-10-04 13:40:44 +02:00
|
|
|
return;
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
|
|
|
}
|
2010-10-04 13:40:44 +02:00
|
|
|
throw NoSuchElementException();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SetParent( rParentName );
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// XPropertySet
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
Reference< XPropertySetInfo > SdStyleSheet::getPropertySetInfo()
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
|
|
|
throwIfDisposed();
|
2009-06-03 11:26:39 +00:00
|
|
|
static Reference< XPropertySetInfo > xInfo;
|
|
|
|
if( !xInfo.is() )
|
|
|
|
xInfo = GetStylePropertySet().getPropertySetInfo();
|
|
|
|
return xInfo;
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
void SAL_CALL SdStyleSheet::setPropertyValue( const OUString& aPropertyName, const Any& aValue )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
2010-10-13 02:37:50 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2008-03-12 10:29:21 +00:00
|
|
|
throwIfDisposed();
|
|
|
|
|
2009-06-03 11:26:39 +00:00
|
|
|
const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry( aPropertyName );
|
2015-11-10 10:23:02 +01:00
|
|
|
if( pEntry == nullptr )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
2016-11-25 19:05:20 +01:00
|
|
|
throw UnknownPropertyException( aPropertyName, static_cast<cppu::OWeakObject*>(this));
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
2017-09-28 10:33:09 +02:00
|
|
|
|
|
|
|
if( pEntry->nWID == WID_STYLE_HIDDEN )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
2017-09-28 10:33:09 +02:00
|
|
|
bool bValue = false;
|
|
|
|
if ( aValue >>= bValue )
|
|
|
|
SetHidden( bValue );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if( pEntry->nWID == SDRATTR_TEXTDIRECTION )
|
|
|
|
return; // not yet implemented for styles
|
2008-03-12 10:29:21 +00:00
|
|
|
|
2017-09-28 10:33:09 +02:00
|
|
|
if( pEntry->nWID == WID_STYLE_FAMILY )
|
|
|
|
throw PropertyVetoException();
|
2008-03-12 10:29:21 +00:00
|
|
|
|
2018-01-19 12:16:31 +02:00
|
|
|
if( (pEntry->nWID == EE_PARA_NUMBULLET) && (GetFamily() == SfxStyleFamily::Page) )
|
2017-09-28 10:33:09 +02:00
|
|
|
{
|
|
|
|
OUString aStr;
|
|
|
|
const sal_uInt32 nTempHelpId = GetHelpId( aStr );
|
2008-03-12 10:29:21 +00:00
|
|
|
|
2017-09-28 10:33:09 +02:00
|
|
|
if( (nTempHelpId >= HID_PSEUDOSHEET_OUTLINE2) && (nTempHelpId <= HID_PSEUDOSHEET_OUTLINE9) )
|
|
|
|
return;
|
|
|
|
}
|
2008-03-12 10:29:21 +00:00
|
|
|
|
2017-09-28 10:33:09 +02:00
|
|
|
SfxItemSet &rStyleSet = GetItemSet();
|
2008-03-12 10:29:21 +00:00
|
|
|
|
2017-09-28 10:33:09 +02:00
|
|
|
if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
|
|
|
|
{
|
|
|
|
BitmapMode eMode;
|
|
|
|
if( aValue >>= eMode )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
2017-09-28 10:33:09 +02:00
|
|
|
rStyleSet.Put( XFillBmpStretchItem( eMode == BitmapMode_STRETCH ) );
|
|
|
|
rStyleSet.Put( XFillBmpTileItem( eMode == BitmapMode_REPEAT ) );
|
|
|
|
return;
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
2017-09-28 10:33:09 +02:00
|
|
|
throw IllegalArgumentException();
|
|
|
|
}
|
2008-03-12 10:29:21 +00:00
|
|
|
|
Avoid -fsanitize=null
...during CppunitTest_sd_filters_test (see below), where
SfxStyleSheetBase::m_pPool has apparently been null'ed in
SdStyleSheet::disposing (sd/source/core/stlsheet.cxx). Presumably introduced
with dfefe448c41921f2f1e54d3f69b8b9e89031d055 "SOSAW080: Added first bunch of
basic changes to helpers"; adding a "TTTT" marker on alg_'s request.
Needed to change SfxStyleSheetBase::GetPool to return pointer instead of ref.
> include/svl/style.hxx:142:47: runtime error: reference binding to null pointer of type 'SfxStyleSheetBasePool'
> #0 in SfxStyleSheetBase::GetPool() at include/svl/style.hxx:142:40 (instdir/program/libsvxcorelo.so +0x2d7a3ed)
> #1 in sdr::properties::AttributeProperties::ImpRemoveStyleSheet() at svx/source/sdr/properties/attributeproperties.cxx:136:44 (instdir/program/libsvxcorelo.so +0x2d72f40)
> #2 in sdr::properties::AttributeProperties::Notify(SfxBroadcaster&, SfxHint const&) at svx/source/sdr/properties/attributeproperties.cxx:474:25 (instdir/program/libsvxcorelo.so +0x2d793ec)
> #3 in sdr::properties::TextProperties::Notify(SfxBroadcaster&, SfxHint const&) at svx/source/sdr/properties/textproperties.cxx:542:34 (instdir/program/libsvxcorelo.so +0x2d631f2)
> #4 in SfxBroadcaster::Broadcast(SfxHint const&) at svl/source/notify/SfxBroadcaster.cxx:49:24 (instdir/program/libsvllo.so +0xc2d628)
> #5 in (anonymous namespace)::StyleSheetDisposerFunctor::Dispose(rtl::Reference<SfxStyleSheetBase>) at svl/source/items/style.cxx:804:16 (instdir/program/libsvllo.so +0x99e4ef)
> #6 in svl::IndexedStyleSheets::Clear(svl::StyleSheetDisposer&) at svl/source/items/IndexedStyleSheets.cxx:202:18 (instdir/program/libsvllo.so +0x8bb852)
> #7 in SfxStyleSheetBasePool::Clear() at svl/source/items/style.cxx:815:34 (instdir/program/libsvllo.so +0x9965ea)
> #8 in SdStyleSheetPool::dispose() at sd/source/core/stlpool.cxx:1386:9 (instdir/program/libsdlo.so +0x25353a7)
> #9 in SdrModel::~SdrModel() at svx/source/svdraw/svdmodel.cxx:275:25 (instdir/program/libsvxcorelo.so +0x323f1ad)
> #10 in FmFormModel::~FmFormModel() at svx/source/form/fmmodel.cxx:94:1 (instdir/program/libsvxcorelo.so +0x465f020)
> #11 in SdDrawDocument::~SdDrawDocument() at sd/source/core/drawdoc.cxx:394:1 (instdir/program/libsdlo.so +0x2324254)
> #12 in SdDrawDocument::~SdDrawDocument() at sd/source/core/drawdoc.cxx:346:1 (instdir/program/libsdlo.so +0x2324445)
> #13 in SdDrawDocument::~SdDrawDocument() at sd/source/core/drawdoc.cxx:346:1 (instdir/program/libsdlo.so +0x23244ce)
> #14 in sd::DrawDocShell::~DrawDocShell() at sd/source/ui/docshell/docshell.cxx:200:9 (instdir/program/libsdlo.so +0x2c4bdb9)
> #15 in sd::DrawDocShell::~DrawDocShell() at sd/source/ui/docshell/docshell.cxx:179:1 (instdir/program/libsdlo.so +0x2c4c4a5)
> #16 in sd::DrawDocShell::~DrawDocShell() at sd/source/ui/docshell/docshell.cxx:179:1 (instdir/program/libsdlo.so +0x2c4c56e)
> #17 in SvRefBase::ReleaseRef() at include/tools/ref.hxx:165:29 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x1ff01)
> #18 in tools::SvRef<sd::DrawDocShell>::~SvRef() at include/tools/ref.hxx:56:36 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x1a9fc)
> #19 in SdFiltersTest::load(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int) at sd/qa/unit/filters-test.cxx:78:1 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x17f53)
> #20 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 +0x5589c)
> #21 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 +0x56519)
> #22 in SdFiltersTest::testCVEs() at sd/qa/unit/filters-test.cxx:83:5 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x1839d)
Change-Id: Ibf61c18738c7a204ebf2bbc85b28930481b22612
Reviewed-on: https://gerrit.libreoffice.org/52554
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-04-07 16:28:08 +02:00
|
|
|
SfxItemSet aSet( GetPool()->GetPool(), {{pEntry->nWID, pEntry->nWID}});
|
2017-09-28 10:33:09 +02:00
|
|
|
aSet.Put( rStyleSet );
|
2008-03-12 10:29:21 +00:00
|
|
|
|
2017-09-28 10:33:09 +02:00
|
|
|
if( !aSet.Count() )
|
|
|
|
{
|
|
|
|
if( EE_PARA_NUMBULLET == pEntry->nWID )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
2017-09-28 10:33:09 +02:00
|
|
|
vcl::Font aBulletFont;
|
|
|
|
SdStyleSheetPool::PutNumBulletItem( this, aBulletFont );
|
|
|
|
aSet.Put( rStyleSet );
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
2017-09-28 10:33:09 +02:00
|
|
|
else
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
Avoid -fsanitize=null
...during CppunitTest_sd_filters_test (see below), where
SfxStyleSheetBase::m_pPool has apparently been null'ed in
SdStyleSheet::disposing (sd/source/core/stlsheet.cxx). Presumably introduced
with dfefe448c41921f2f1e54d3f69b8b9e89031d055 "SOSAW080: Added first bunch of
basic changes to helpers"; adding a "TTTT" marker on alg_'s request.
Needed to change SfxStyleSheetBase::GetPool to return pointer instead of ref.
> include/svl/style.hxx:142:47: runtime error: reference binding to null pointer of type 'SfxStyleSheetBasePool'
> #0 in SfxStyleSheetBase::GetPool() at include/svl/style.hxx:142:40 (instdir/program/libsvxcorelo.so +0x2d7a3ed)
> #1 in sdr::properties::AttributeProperties::ImpRemoveStyleSheet() at svx/source/sdr/properties/attributeproperties.cxx:136:44 (instdir/program/libsvxcorelo.so +0x2d72f40)
> #2 in sdr::properties::AttributeProperties::Notify(SfxBroadcaster&, SfxHint const&) at svx/source/sdr/properties/attributeproperties.cxx:474:25 (instdir/program/libsvxcorelo.so +0x2d793ec)
> #3 in sdr::properties::TextProperties::Notify(SfxBroadcaster&, SfxHint const&) at svx/source/sdr/properties/textproperties.cxx:542:34 (instdir/program/libsvxcorelo.so +0x2d631f2)
> #4 in SfxBroadcaster::Broadcast(SfxHint const&) at svl/source/notify/SfxBroadcaster.cxx:49:24 (instdir/program/libsvllo.so +0xc2d628)
> #5 in (anonymous namespace)::StyleSheetDisposerFunctor::Dispose(rtl::Reference<SfxStyleSheetBase>) at svl/source/items/style.cxx:804:16 (instdir/program/libsvllo.so +0x99e4ef)
> #6 in svl::IndexedStyleSheets::Clear(svl::StyleSheetDisposer&) at svl/source/items/IndexedStyleSheets.cxx:202:18 (instdir/program/libsvllo.so +0x8bb852)
> #7 in SfxStyleSheetBasePool::Clear() at svl/source/items/style.cxx:815:34 (instdir/program/libsvllo.so +0x9965ea)
> #8 in SdStyleSheetPool::dispose() at sd/source/core/stlpool.cxx:1386:9 (instdir/program/libsdlo.so +0x25353a7)
> #9 in SdrModel::~SdrModel() at svx/source/svdraw/svdmodel.cxx:275:25 (instdir/program/libsvxcorelo.so +0x323f1ad)
> #10 in FmFormModel::~FmFormModel() at svx/source/form/fmmodel.cxx:94:1 (instdir/program/libsvxcorelo.so +0x465f020)
> #11 in SdDrawDocument::~SdDrawDocument() at sd/source/core/drawdoc.cxx:394:1 (instdir/program/libsdlo.so +0x2324254)
> #12 in SdDrawDocument::~SdDrawDocument() at sd/source/core/drawdoc.cxx:346:1 (instdir/program/libsdlo.so +0x2324445)
> #13 in SdDrawDocument::~SdDrawDocument() at sd/source/core/drawdoc.cxx:346:1 (instdir/program/libsdlo.so +0x23244ce)
> #14 in sd::DrawDocShell::~DrawDocShell() at sd/source/ui/docshell/docshell.cxx:200:9 (instdir/program/libsdlo.so +0x2c4bdb9)
> #15 in sd::DrawDocShell::~DrawDocShell() at sd/source/ui/docshell/docshell.cxx:179:1 (instdir/program/libsdlo.so +0x2c4c4a5)
> #16 in sd::DrawDocShell::~DrawDocShell() at sd/source/ui/docshell/docshell.cxx:179:1 (instdir/program/libsdlo.so +0x2c4c56e)
> #17 in SvRefBase::ReleaseRef() at include/tools/ref.hxx:165:29 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x1ff01)
> #18 in tools::SvRef<sd::DrawDocShell>::~SvRef() at include/tools/ref.hxx:56:36 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x1a9fc)
> #19 in SdFiltersTest::load(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int) at sd/qa/unit/filters-test.cxx:78:1 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x17f53)
> #20 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 +0x5589c)
> #21 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 +0x56519)
> #22 in SdFiltersTest::testCVEs() at sd/qa/unit/filters-test.cxx:83:5 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x1839d)
Change-Id: Ibf61c18738c7a204ebf2bbc85b28930481b22612
Reviewed-on: https://gerrit.libreoffice.org/52554
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-04-07 16:28:08 +02:00
|
|
|
aSet.Put( GetPool()->GetPool().GetDefaultItem( pEntry->nWID ) );
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
2017-09-28 10:33:09 +02:00
|
|
|
}
|
2008-03-12 10:29:21 +00:00
|
|
|
|
2017-09-28 10:33:09 +02:00
|
|
|
if( pEntry->nMemberId == MID_NAME &&
|
|
|
|
( pEntry->nWID == XATTR_FILLBITMAP || pEntry->nWID == XATTR_FILLGRADIENT ||
|
|
|
|
pEntry->nWID == XATTR_FILLHATCH || pEntry->nWID == XATTR_FILLFLOATTRANSPARENCE ||
|
|
|
|
pEntry->nWID == XATTR_LINESTART || pEntry->nWID == XATTR_LINEEND || pEntry->nWID == XATTR_LINEDASH) )
|
|
|
|
{
|
|
|
|
OUString aTempName;
|
|
|
|
if(!(aValue >>= aTempName ))
|
|
|
|
throw IllegalArgumentException();
|
|
|
|
|
|
|
|
SvxShape::SetFillAttribute( pEntry->nWID, aTempName, aSet );
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
2017-09-28 10:33:09 +02:00
|
|
|
else if(!SvxUnoTextRangeBase::SetPropertyValueHelper( pEntry, aValue, aSet ))
|
|
|
|
{
|
|
|
|
SvxItemPropertySet_setPropertyValue( pEntry, aValue, aSet );
|
|
|
|
}
|
|
|
|
|
|
|
|
rStyleSet.Put( aSet );
|
|
|
|
Broadcast(SfxHint(SfxHintId::DataChanged));
|
|
|
|
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
Any SAL_CALL SdStyleSheet::getPropertyValue( const OUString& PropertyName )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
2010-10-13 02:37:50 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2008-03-12 10:29:21 +00:00
|
|
|
|
|
|
|
throwIfDisposed();
|
|
|
|
|
2009-06-03 11:26:39 +00:00
|
|
|
const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry( PropertyName );
|
2015-11-10 10:23:02 +01:00
|
|
|
if( pEntry == nullptr )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
2016-11-25 19:05:20 +01:00
|
|
|
throw UnknownPropertyException( PropertyName, static_cast<cppu::OWeakObject*>(this));
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
|
|
|
|
2017-09-28 10:33:09 +02:00
|
|
|
Any aAny;
|
|
|
|
|
|
|
|
if( pEntry->nWID == WID_STYLE_FAMILY )
|
|
|
|
{
|
2018-01-19 12:16:31 +02:00
|
|
|
if( nFamily == SfxStyleFamily::Page )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
2017-09-28 10:33:09 +02:00
|
|
|
const OUString aLayoutName( GetName() );
|
|
|
|
aAny <<= aLayoutName.copy( 0, aLayoutName.indexOf( SD_LT_SEPARATOR) );
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
2017-09-28 10:33:09 +02:00
|
|
|
else
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
2017-09-28 10:33:09 +02:00
|
|
|
aAny <<= GetFamilyString(nFamily);
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
2017-09-28 10:33:09 +02:00
|
|
|
}
|
|
|
|
else if( pEntry->nWID == WID_STYLE_DISPNAME )
|
|
|
|
{
|
|
|
|
OUString aDisplayName;
|
2018-01-19 12:16:31 +02:00
|
|
|
if ( nFamily == SfxStyleFamily::Page )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
2017-09-28 10:33:09 +02:00
|
|
|
const SdStyleSheet* pStyleSheet = GetPseudoStyleSheet();
|
|
|
|
if (pStyleSheet != nullptr)
|
2018-01-03 14:08:19 +02:00
|
|
|
aDisplayName = pStyleSheet->GetName();
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
|
|
|
|
2017-09-28 10:33:09 +02:00
|
|
|
if (aDisplayName.isEmpty())
|
2018-01-03 14:08:19 +02:00
|
|
|
aDisplayName = GetName();
|
2008-03-12 10:29:21 +00:00
|
|
|
|
2017-09-28 10:33:09 +02:00
|
|
|
aAny <<= aDisplayName;
|
|
|
|
}
|
|
|
|
else if( pEntry->nWID == SDRATTR_TEXTDIRECTION )
|
|
|
|
{
|
|
|
|
aAny <<= false;
|
|
|
|
}
|
|
|
|
else if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
|
|
|
|
{
|
|
|
|
SfxItemSet &rStyleSet = GetItemSet();
|
|
|
|
|
|
|
|
const XFillBmpStretchItem* pStretchItem = rStyleSet.GetItem<XFillBmpStretchItem>(XATTR_FILLBMP_STRETCH);
|
|
|
|
const XFillBmpTileItem* pTileItem = rStyleSet.GetItem<XFillBmpTileItem>(XATTR_FILLBMP_TILE);
|
|
|
|
|
|
|
|
if( pStretchItem && pTileItem )
|
2012-12-03 17:48:40 +01:00
|
|
|
{
|
2017-09-28 10:33:09 +02:00
|
|
|
if( pTileItem->GetValue() )
|
|
|
|
aAny <<= BitmapMode_REPEAT;
|
|
|
|
else if( pStretchItem->GetValue() )
|
|
|
|
aAny <<= BitmapMode_STRETCH;
|
|
|
|
else
|
|
|
|
aAny <<= BitmapMode_NO_REPEAT;
|
2012-12-03 17:48:40 +01:00
|
|
|
}
|
2017-09-28 10:33:09 +02:00
|
|
|
}
|
|
|
|
else if( pEntry->nWID == WID_STYLE_HIDDEN )
|
|
|
|
{
|
|
|
|
aAny <<= IsHidden( );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
Avoid -fsanitize=null
...during CppunitTest_sd_filters_test (see below), where
SfxStyleSheetBase::m_pPool has apparently been null'ed in
SdStyleSheet::disposing (sd/source/core/stlsheet.cxx). Presumably introduced
with dfefe448c41921f2f1e54d3f69b8b9e89031d055 "SOSAW080: Added first bunch of
basic changes to helpers"; adding a "TTTT" marker on alg_'s request.
Needed to change SfxStyleSheetBase::GetPool to return pointer instead of ref.
> include/svl/style.hxx:142:47: runtime error: reference binding to null pointer of type 'SfxStyleSheetBasePool'
> #0 in SfxStyleSheetBase::GetPool() at include/svl/style.hxx:142:40 (instdir/program/libsvxcorelo.so +0x2d7a3ed)
> #1 in sdr::properties::AttributeProperties::ImpRemoveStyleSheet() at svx/source/sdr/properties/attributeproperties.cxx:136:44 (instdir/program/libsvxcorelo.so +0x2d72f40)
> #2 in sdr::properties::AttributeProperties::Notify(SfxBroadcaster&, SfxHint const&) at svx/source/sdr/properties/attributeproperties.cxx:474:25 (instdir/program/libsvxcorelo.so +0x2d793ec)
> #3 in sdr::properties::TextProperties::Notify(SfxBroadcaster&, SfxHint const&) at svx/source/sdr/properties/textproperties.cxx:542:34 (instdir/program/libsvxcorelo.so +0x2d631f2)
> #4 in SfxBroadcaster::Broadcast(SfxHint const&) at svl/source/notify/SfxBroadcaster.cxx:49:24 (instdir/program/libsvllo.so +0xc2d628)
> #5 in (anonymous namespace)::StyleSheetDisposerFunctor::Dispose(rtl::Reference<SfxStyleSheetBase>) at svl/source/items/style.cxx:804:16 (instdir/program/libsvllo.so +0x99e4ef)
> #6 in svl::IndexedStyleSheets::Clear(svl::StyleSheetDisposer&) at svl/source/items/IndexedStyleSheets.cxx:202:18 (instdir/program/libsvllo.so +0x8bb852)
> #7 in SfxStyleSheetBasePool::Clear() at svl/source/items/style.cxx:815:34 (instdir/program/libsvllo.so +0x9965ea)
> #8 in SdStyleSheetPool::dispose() at sd/source/core/stlpool.cxx:1386:9 (instdir/program/libsdlo.so +0x25353a7)
> #9 in SdrModel::~SdrModel() at svx/source/svdraw/svdmodel.cxx:275:25 (instdir/program/libsvxcorelo.so +0x323f1ad)
> #10 in FmFormModel::~FmFormModel() at svx/source/form/fmmodel.cxx:94:1 (instdir/program/libsvxcorelo.so +0x465f020)
> #11 in SdDrawDocument::~SdDrawDocument() at sd/source/core/drawdoc.cxx:394:1 (instdir/program/libsdlo.so +0x2324254)
> #12 in SdDrawDocument::~SdDrawDocument() at sd/source/core/drawdoc.cxx:346:1 (instdir/program/libsdlo.so +0x2324445)
> #13 in SdDrawDocument::~SdDrawDocument() at sd/source/core/drawdoc.cxx:346:1 (instdir/program/libsdlo.so +0x23244ce)
> #14 in sd::DrawDocShell::~DrawDocShell() at sd/source/ui/docshell/docshell.cxx:200:9 (instdir/program/libsdlo.so +0x2c4bdb9)
> #15 in sd::DrawDocShell::~DrawDocShell() at sd/source/ui/docshell/docshell.cxx:179:1 (instdir/program/libsdlo.so +0x2c4c4a5)
> #16 in sd::DrawDocShell::~DrawDocShell() at sd/source/ui/docshell/docshell.cxx:179:1 (instdir/program/libsdlo.so +0x2c4c56e)
> #17 in SvRefBase::ReleaseRef() at include/tools/ref.hxx:165:29 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x1ff01)
> #18 in tools::SvRef<sd::DrawDocShell>::~SvRef() at include/tools/ref.hxx:56:36 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x1a9fc)
> #19 in SdFiltersTest::load(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int) at sd/qa/unit/filters-test.cxx:78:1 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x17f53)
> #20 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 +0x5589c)
> #21 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 +0x56519)
> #22 in SdFiltersTest::testCVEs() at sd/qa/unit/filters-test.cxx:83:5 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x1839d)
Change-Id: Ibf61c18738c7a204ebf2bbc85b28930481b22612
Reviewed-on: https://gerrit.libreoffice.org/52554
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-04-07 16:28:08 +02:00
|
|
|
SfxItemSet aSet( GetPool()->GetPool(), {{pEntry->nWID, pEntry->nWID}});
|
2008-03-12 10:29:21 +00:00
|
|
|
|
2017-09-28 10:33:09 +02:00
|
|
|
const SfxPoolItem* pItem;
|
|
|
|
SfxItemSet& rStyleSet = GetItemSet();
|
2008-03-12 10:29:21 +00:00
|
|
|
|
2017-09-28 10:33:09 +02:00
|
|
|
if( rStyleSet.GetItemState( pEntry->nWID, true, &pItem ) == SfxItemState::SET )
|
|
|
|
aSet.Put( *pItem );
|
2008-03-12 10:29:21 +00:00
|
|
|
|
2017-09-28 10:33:09 +02:00
|
|
|
if( !aSet.Count() )
|
Avoid -fsanitize=null
...during CppunitTest_sd_filters_test (see below), where
SfxStyleSheetBase::m_pPool has apparently been null'ed in
SdStyleSheet::disposing (sd/source/core/stlsheet.cxx). Presumably introduced
with dfefe448c41921f2f1e54d3f69b8b9e89031d055 "SOSAW080: Added first bunch of
basic changes to helpers"; adding a "TTTT" marker on alg_'s request.
Needed to change SfxStyleSheetBase::GetPool to return pointer instead of ref.
> include/svl/style.hxx:142:47: runtime error: reference binding to null pointer of type 'SfxStyleSheetBasePool'
> #0 in SfxStyleSheetBase::GetPool() at include/svl/style.hxx:142:40 (instdir/program/libsvxcorelo.so +0x2d7a3ed)
> #1 in sdr::properties::AttributeProperties::ImpRemoveStyleSheet() at svx/source/sdr/properties/attributeproperties.cxx:136:44 (instdir/program/libsvxcorelo.so +0x2d72f40)
> #2 in sdr::properties::AttributeProperties::Notify(SfxBroadcaster&, SfxHint const&) at svx/source/sdr/properties/attributeproperties.cxx:474:25 (instdir/program/libsvxcorelo.so +0x2d793ec)
> #3 in sdr::properties::TextProperties::Notify(SfxBroadcaster&, SfxHint const&) at svx/source/sdr/properties/textproperties.cxx:542:34 (instdir/program/libsvxcorelo.so +0x2d631f2)
> #4 in SfxBroadcaster::Broadcast(SfxHint const&) at svl/source/notify/SfxBroadcaster.cxx:49:24 (instdir/program/libsvllo.so +0xc2d628)
> #5 in (anonymous namespace)::StyleSheetDisposerFunctor::Dispose(rtl::Reference<SfxStyleSheetBase>) at svl/source/items/style.cxx:804:16 (instdir/program/libsvllo.so +0x99e4ef)
> #6 in svl::IndexedStyleSheets::Clear(svl::StyleSheetDisposer&) at svl/source/items/IndexedStyleSheets.cxx:202:18 (instdir/program/libsvllo.so +0x8bb852)
> #7 in SfxStyleSheetBasePool::Clear() at svl/source/items/style.cxx:815:34 (instdir/program/libsvllo.so +0x9965ea)
> #8 in SdStyleSheetPool::dispose() at sd/source/core/stlpool.cxx:1386:9 (instdir/program/libsdlo.so +0x25353a7)
> #9 in SdrModel::~SdrModel() at svx/source/svdraw/svdmodel.cxx:275:25 (instdir/program/libsvxcorelo.so +0x323f1ad)
> #10 in FmFormModel::~FmFormModel() at svx/source/form/fmmodel.cxx:94:1 (instdir/program/libsvxcorelo.so +0x465f020)
> #11 in SdDrawDocument::~SdDrawDocument() at sd/source/core/drawdoc.cxx:394:1 (instdir/program/libsdlo.so +0x2324254)
> #12 in SdDrawDocument::~SdDrawDocument() at sd/source/core/drawdoc.cxx:346:1 (instdir/program/libsdlo.so +0x2324445)
> #13 in SdDrawDocument::~SdDrawDocument() at sd/source/core/drawdoc.cxx:346:1 (instdir/program/libsdlo.so +0x23244ce)
> #14 in sd::DrawDocShell::~DrawDocShell() at sd/source/ui/docshell/docshell.cxx:200:9 (instdir/program/libsdlo.so +0x2c4bdb9)
> #15 in sd::DrawDocShell::~DrawDocShell() at sd/source/ui/docshell/docshell.cxx:179:1 (instdir/program/libsdlo.so +0x2c4c4a5)
> #16 in sd::DrawDocShell::~DrawDocShell() at sd/source/ui/docshell/docshell.cxx:179:1 (instdir/program/libsdlo.so +0x2c4c56e)
> #17 in SvRefBase::ReleaseRef() at include/tools/ref.hxx:165:29 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x1ff01)
> #18 in tools::SvRef<sd::DrawDocShell>::~SvRef() at include/tools/ref.hxx:56:36 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x1a9fc)
> #19 in SdFiltersTest::load(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int) at sd/qa/unit/filters-test.cxx:78:1 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x17f53)
> #20 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 +0x5589c)
> #21 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 +0x56519)
> #22 in SdFiltersTest::testCVEs() at sd/qa/unit/filters-test.cxx:83:5 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x1839d)
Change-Id: Ibf61c18738c7a204ebf2bbc85b28930481b22612
Reviewed-on: https://gerrit.libreoffice.org/52554
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-04-07 16:28:08 +02:00
|
|
|
aSet.Put( GetPool()->GetPool().GetDefaultItem( pEntry->nWID ) );
|
2008-03-12 10:29:21 +00:00
|
|
|
|
2017-09-28 10:33:09 +02:00
|
|
|
if(SvxUnoTextRangeBase::GetPropertyValueHelper( aSet, pEntry, aAny ))
|
|
|
|
return aAny;
|
2008-03-12 10:29:21 +00:00
|
|
|
|
2017-09-28 10:33:09 +02:00
|
|
|
// Get value of ItemSet
|
|
|
|
aAny = SvxItemPropertySet_getPropertyValue( pEntry, aSet );
|
|
|
|
}
|
2008-03-12 10:29:21 +00:00
|
|
|
|
2017-09-28 10:33:09 +02:00
|
|
|
if( pEntry->aType != aAny.getValueType() )
|
|
|
|
{
|
|
|
|
// since the sfx uint16 item now exports a sal_Int32, we may have to fix this here
|
|
|
|
if( ( pEntry->aType == ::cppu::UnoType<sal_Int16>::get()) && aAny.getValueType() == ::cppu::UnoType<sal_Int32>::get() )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
2017-09-28 10:33:09 +02:00
|
|
|
sal_Int32 nValue = 0;
|
|
|
|
aAny >>= nValue;
|
2018-01-12 20:16:43 +01:00
|
|
|
aAny <<= static_cast<sal_Int16>(nValue);
|
2017-09-28 10:33:09 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
OSL_FAIL("SvxShape::GetAnyForItem() Returnvalue has wrong Type!" );
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
|
|
|
}
|
2017-09-28 10:33:09 +02:00
|
|
|
|
|
|
|
return aAny;
|
|
|
|
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
void SAL_CALL SdStyleSheet::addPropertyChangeListener( const OUString& , const Reference< XPropertyChangeListener >& ) {}
|
|
|
|
void SAL_CALL SdStyleSheet::removePropertyChangeListener( const OUString& , const Reference< XPropertyChangeListener >& ) {}
|
|
|
|
void SAL_CALL SdStyleSheet::addVetoableChangeListener( const OUString& , const Reference< XVetoableChangeListener >& ) {}
|
|
|
|
void SAL_CALL SdStyleSheet::removeVetoableChangeListener( const OUString& , const Reference< XVetoableChangeListener >& ) {}
|
2008-03-12 10:29:21 +00:00
|
|
|
|
|
|
|
// XPropertyState
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
PropertyState SAL_CALL SdStyleSheet::getPropertyState( const OUString& PropertyName )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
2010-10-13 02:37:50 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2008-03-12 10:29:21 +00:00
|
|
|
|
|
|
|
throwIfDisposed();
|
|
|
|
|
2009-06-03 11:26:39 +00:00
|
|
|
const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry( PropertyName );
|
2008-03-12 10:29:21 +00:00
|
|
|
|
2015-11-10 10:23:02 +01:00
|
|
|
if( pEntry == nullptr )
|
2016-11-25 19:05:20 +01:00
|
|
|
throw UnknownPropertyException( PropertyName, static_cast<cppu::OWeakObject*>(this));
|
2008-03-12 10:29:21 +00:00
|
|
|
|
2009-06-03 11:26:39 +00:00
|
|
|
if( pEntry->nWID == WID_STYLE_FAMILY )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
|
|
|
return PropertyState_DIRECT_VALUE;
|
|
|
|
}
|
2009-06-03 11:26:39 +00:00
|
|
|
else if( pEntry->nWID == SDRATTR_TEXTDIRECTION )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
|
|
|
return PropertyState_DEFAULT_VALUE;
|
|
|
|
}
|
2009-06-03 11:26:39 +00:00
|
|
|
else if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
|
|
|
const SfxItemSet& rSet = GetItemSet();
|
|
|
|
|
2014-09-10 17:53:41 +02:00
|
|
|
if( rSet.GetItemState( XATTR_FILLBMP_STRETCH, false ) == SfxItemState::SET ||
|
|
|
|
rSet.GetItemState( XATTR_FILLBMP_TILE, false ) == SfxItemState::SET )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
|
|
|
return PropertyState_DIRECT_VALUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return PropertyState_AMBIGUOUS_VALUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SfxItemSet &rStyleSet = GetItemSet();
|
|
|
|
|
|
|
|
PropertyState eState;
|
|
|
|
|
2014-02-19 21:49:02 +01:00
|
|
|
switch( rStyleSet.GetItemState( pEntry->nWID, false ) )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
2014-09-10 17:53:41 +02:00
|
|
|
case SfxItemState::READONLY:
|
|
|
|
case SfxItemState::SET:
|
2008-03-12 10:29:21 +00:00
|
|
|
eState = PropertyState_DIRECT_VALUE;
|
|
|
|
break;
|
2014-09-10 17:53:41 +02:00
|
|
|
case SfxItemState::DEFAULT:
|
2008-03-12 10:29:21 +00:00
|
|
|
eState = PropertyState_DEFAULT_VALUE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
eState = PropertyState_AMBIGUOUS_VALUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// if a item is set, this doesn't mean we want it :)
|
2017-05-18 18:04:20 +02:00
|
|
|
if( PropertyState_DIRECT_VALUE == eState )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
2009-06-03 11:26:39 +00:00
|
|
|
switch( pEntry->nWID )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
|
|
|
case XATTR_FILLBITMAP:
|
|
|
|
case XATTR_FILLGRADIENT:
|
|
|
|
case XATTR_FILLHATCH:
|
|
|
|
case XATTR_FILLFLOATTRANSPARENCE:
|
|
|
|
case XATTR_LINEEND:
|
|
|
|
case XATTR_LINESTART:
|
|
|
|
case XATTR_LINEDASH:
|
|
|
|
{
|
2018-06-29 15:54:50 +02:00
|
|
|
const NameOrIndex* pItem = rStyleSet.GetItem<NameOrIndex>(pEntry->nWID);
|
2015-11-10 10:23:02 +01:00
|
|
|
if( ( pItem == nullptr ) || pItem->GetName().isEmpty() )
|
2008-03-12 10:29:21 +00:00
|
|
|
eState = PropertyState_DEFAULT_VALUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return eState;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
Sequence< PropertyState > SAL_CALL SdStyleSheet::getPropertyStates( const Sequence< OUString >& aPropertyName )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
2010-10-13 02:37:50 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2008-03-12 10:29:21 +00:00
|
|
|
|
|
|
|
throwIfDisposed();
|
|
|
|
|
|
|
|
sal_Int32 nCount = aPropertyName.getLength();
|
|
|
|
const OUString* pNames = aPropertyName.getConstArray();
|
|
|
|
|
|
|
|
Sequence< PropertyState > aPropertyStateSequence( nCount );
|
|
|
|
PropertyState* pState = aPropertyStateSequence.getArray();
|
|
|
|
|
|
|
|
while( nCount-- )
|
|
|
|
*pState++ = getPropertyState( *pNames++ );
|
|
|
|
|
|
|
|
return aPropertyStateSequence;
|
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
void SAL_CALL SdStyleSheet::setPropertyToDefault( const OUString& PropertyName )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
2010-10-13 02:37:50 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2008-03-12 10:29:21 +00:00
|
|
|
|
|
|
|
throwIfDisposed();
|
|
|
|
|
2009-06-03 11:26:39 +00:00
|
|
|
const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry( PropertyName );
|
2015-11-10 10:23:02 +01:00
|
|
|
if( pEntry == nullptr )
|
2016-11-25 19:05:20 +01:00
|
|
|
throw UnknownPropertyException( PropertyName, static_cast<cppu::OWeakObject*>(this));
|
2008-03-12 10:29:21 +00:00
|
|
|
|
|
|
|
SfxItemSet &rStyleSet = GetItemSet();
|
|
|
|
|
2009-06-03 11:26:39 +00:00
|
|
|
if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
|
|
|
rStyleSet.ClearItem( XATTR_FILLBMP_STRETCH );
|
|
|
|
rStyleSet.ClearItem( XATTR_FILLBMP_TILE );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-06-03 11:26:39 +00:00
|
|
|
rStyleSet.ClearItem( pEntry->nWID );
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
2016-12-08 10:26:01 +02:00
|
|
|
Broadcast(SfxHint(SfxHintId::DataChanged));
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
Any SAL_CALL SdStyleSheet::getPropertyDefault( const OUString& aPropertyName )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
2010-10-13 02:37:50 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2008-03-12 10:29:21 +00:00
|
|
|
|
|
|
|
throwIfDisposed();
|
|
|
|
|
2009-06-03 11:26:39 +00:00
|
|
|
const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry( aPropertyName );
|
2015-11-10 10:23:02 +01:00
|
|
|
if( pEntry == nullptr )
|
2016-11-25 19:05:20 +01:00
|
|
|
throw UnknownPropertyException( aPropertyName, static_cast<cppu::OWeakObject*>(this));
|
2009-06-03 11:26:39 +00:00
|
|
|
Any aRet;
|
|
|
|
if( pEntry->nWID == WID_STYLE_FAMILY )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
2009-06-03 11:26:39 +00:00
|
|
|
aRet <<= GetFamilyString(nFamily);
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
2009-06-03 11:26:39 +00:00
|
|
|
else if( pEntry->nWID == SDRATTR_TEXTDIRECTION )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
2016-04-20 17:19:18 +02:00
|
|
|
aRet <<= false;
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
2009-06-03 11:26:39 +00:00
|
|
|
else if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
2009-06-03 11:26:39 +00:00
|
|
|
aRet <<= BitmapMode_REPEAT;
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
Avoid -fsanitize=null
...during CppunitTest_sd_filters_test (see below), where
SfxStyleSheetBase::m_pPool has apparently been null'ed in
SdStyleSheet::disposing (sd/source/core/stlsheet.cxx). Presumably introduced
with dfefe448c41921f2f1e54d3f69b8b9e89031d055 "SOSAW080: Added first bunch of
basic changes to helpers"; adding a "TTTT" marker on alg_'s request.
Needed to change SfxStyleSheetBase::GetPool to return pointer instead of ref.
> include/svl/style.hxx:142:47: runtime error: reference binding to null pointer of type 'SfxStyleSheetBasePool'
> #0 in SfxStyleSheetBase::GetPool() at include/svl/style.hxx:142:40 (instdir/program/libsvxcorelo.so +0x2d7a3ed)
> #1 in sdr::properties::AttributeProperties::ImpRemoveStyleSheet() at svx/source/sdr/properties/attributeproperties.cxx:136:44 (instdir/program/libsvxcorelo.so +0x2d72f40)
> #2 in sdr::properties::AttributeProperties::Notify(SfxBroadcaster&, SfxHint const&) at svx/source/sdr/properties/attributeproperties.cxx:474:25 (instdir/program/libsvxcorelo.so +0x2d793ec)
> #3 in sdr::properties::TextProperties::Notify(SfxBroadcaster&, SfxHint const&) at svx/source/sdr/properties/textproperties.cxx:542:34 (instdir/program/libsvxcorelo.so +0x2d631f2)
> #4 in SfxBroadcaster::Broadcast(SfxHint const&) at svl/source/notify/SfxBroadcaster.cxx:49:24 (instdir/program/libsvllo.so +0xc2d628)
> #5 in (anonymous namespace)::StyleSheetDisposerFunctor::Dispose(rtl::Reference<SfxStyleSheetBase>) at svl/source/items/style.cxx:804:16 (instdir/program/libsvllo.so +0x99e4ef)
> #6 in svl::IndexedStyleSheets::Clear(svl::StyleSheetDisposer&) at svl/source/items/IndexedStyleSheets.cxx:202:18 (instdir/program/libsvllo.so +0x8bb852)
> #7 in SfxStyleSheetBasePool::Clear() at svl/source/items/style.cxx:815:34 (instdir/program/libsvllo.so +0x9965ea)
> #8 in SdStyleSheetPool::dispose() at sd/source/core/stlpool.cxx:1386:9 (instdir/program/libsdlo.so +0x25353a7)
> #9 in SdrModel::~SdrModel() at svx/source/svdraw/svdmodel.cxx:275:25 (instdir/program/libsvxcorelo.so +0x323f1ad)
> #10 in FmFormModel::~FmFormModel() at svx/source/form/fmmodel.cxx:94:1 (instdir/program/libsvxcorelo.so +0x465f020)
> #11 in SdDrawDocument::~SdDrawDocument() at sd/source/core/drawdoc.cxx:394:1 (instdir/program/libsdlo.so +0x2324254)
> #12 in SdDrawDocument::~SdDrawDocument() at sd/source/core/drawdoc.cxx:346:1 (instdir/program/libsdlo.so +0x2324445)
> #13 in SdDrawDocument::~SdDrawDocument() at sd/source/core/drawdoc.cxx:346:1 (instdir/program/libsdlo.so +0x23244ce)
> #14 in sd::DrawDocShell::~DrawDocShell() at sd/source/ui/docshell/docshell.cxx:200:9 (instdir/program/libsdlo.so +0x2c4bdb9)
> #15 in sd::DrawDocShell::~DrawDocShell() at sd/source/ui/docshell/docshell.cxx:179:1 (instdir/program/libsdlo.so +0x2c4c4a5)
> #16 in sd::DrawDocShell::~DrawDocShell() at sd/source/ui/docshell/docshell.cxx:179:1 (instdir/program/libsdlo.so +0x2c4c56e)
> #17 in SvRefBase::ReleaseRef() at include/tools/ref.hxx:165:29 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x1ff01)
> #18 in tools::SvRef<sd::DrawDocShell>::~SvRef() at include/tools/ref.hxx:56:36 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x1a9fc)
> #19 in SdFiltersTest::load(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int) at sd/qa/unit/filters-test.cxx:78:1 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x17f53)
> #20 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 +0x5589c)
> #21 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 +0x56519)
> #22 in SdFiltersTest::testCVEs() at sd/qa/unit/filters-test.cxx:83:5 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x1839d)
Change-Id: Ibf61c18738c7a204ebf2bbc85b28930481b22612
Reviewed-on: https://gerrit.libreoffice.org/52554
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-04-07 16:28:08 +02:00
|
|
|
SfxItemPool& rMyPool = GetPool()->GetPool();
|
Make SfxItemSet ranges correct by construction
This is a follow-up to 45a7f5b62d0b1b21763c1c94255ef2309ea4280b "Keep WID ranges
sorted, and join adjacent ones". While SfxItemSet::MergeRange relies on the
m_pWhichRanges being sorted (and, under DBG_UTIL, asserts if they are not), the
various SfxItemSet constructors curiously only check (via assert or DBG_ASSERT)
that each individual range has an upper bound not smaller than its lower bound.
Arguably, all SfxItemSet instances should fulfill the stronger guarantees
required and checked by MergeRange.
And in many cases the ranges are statically known, so that the checking can
happen at compile time. Therefore, replace the two SfxItemSet ctors taking
explicit ranges with two other ctors that actually do proper checking. The
(templated) overload taking an svl::Items struct should be used in all cases
where the range values are statically known at compile time, while the overload
taking a std::initializer_list<Pair> is for the remaining cases (that can only
do runtime checking via assert). Most of those latter cases are simple cases
with a single range covering a single item, but a few are more complex.
(At least some of the uses of the existing SfxItemSet overload taking a
const sal_uInt16* pWhichPairTable
can probably also be strengthened, but that is left for another day.)
This commit is the first in a series of two. Apart from the manual changes to
compilerplugins/clang/store/sfxitemsetrewrite.cxx, include/svl/itemset.hxx, and
svl/source/items/itemset.cxx, it only consists of automatic rewriting of the
relevant SfxItemSet ctor calls (plus a few required manual fixes, see next).
But it does not yet check that the individual ranges are properly sorted (see
the TODO in svl::detail::validGap). That check will be enabled, and the ensuing
manual fixes will be made in a follow-up commit, to reduce the likelyhood of
accidents.
There were three cases of necessary manual intervention:
* sw/source/core/unocore/unostyle.cxx uses eAtr of enum type RES_FRMATR in
braced-init-list syntax now, so needs explicit narrowing conversion to
sal_uInt16.
* In sw/source/uibase/uiview/formatclipboard.cxx, the trailiing comma in the
definition of macro FORMAT_PAINTBRUSH_FRAME_IDS needed to be removed manually.
* In svx/source/svdraw/svdoashp.cxx, svx/source/svdraw/svdotext.cxx,
sw/source/uibase/app/docstyle.cxx, sw/source/uibase/shells/frmsh.cxx,
sw/source/uibase/shells/grfsh.cxx, and sw/source/uibase/shells/textsh1.cxx,
some comments had to be put back (see "TODO: the replaced range can contain
relevant comments" in compilerplugins/clang/store/sfxitemsetrewrite.cxx).
A few uses of the variadic form erroneously used nullptr instead of 0 for
termination. But this should have been harmless even if promoted std::nullptr_t
is larger than promoted sal_uInt16, assuming that the part of the nullptr value
that was interpreted as sal_uInt16/promoted int was all-zero bits. Similarly,
some uses made the harmless error of using 0L instead of 0.
Change-Id: I2afea97282803cb311b9321a99bb627520ef5e35
Reviewed-on: https://gerrit.libreoffice.org/38861
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
2017-06-16 09:58:13 +02:00
|
|
|
SfxItemSet aSet( rMyPool, {{pEntry->nWID, pEntry->nWID}});
|
2009-06-03 11:26:39 +00:00
|
|
|
aSet.Put( rMyPool.GetDefaultItem( pEntry->nWID ) );
|
2015-04-10 14:12:10 +02:00
|
|
|
aRet = SvxItemPropertySet_getPropertyValue( pEntry, aSet );
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
2009-06-03 11:26:39 +00:00
|
|
|
return aRet;
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/** this is used because our property map is not sorted yet */
|
2017-01-26 12:28:58 +01:00
|
|
|
const SfxItemPropertySimpleEntry* SdStyleSheet::getPropertyMapEntry( const OUString& rPropertyName )
|
2008-03-12 10:29:21 +00:00
|
|
|
{
|
2009-06-03 11:26:39 +00:00
|
|
|
return GetStylePropertySet().getPropertyMapEntry(rPropertyName);
|
2008-03-12 10:29:21 +00:00
|
|
|
}
|
|
|
|
|
2014-06-13 11:23:07 +01:00
|
|
|
//Broadcast that a SdStyleSheet has changed, taking into account outline sublevels
|
|
|
|
//which need to be explicitly broadcast as changing if their parent style was
|
|
|
|
//the one that changed
|
2017-08-03 10:23:01 +02:00
|
|
|
void SdStyleSheet::BroadcastSdStyleSheetChange(SfxStyleSheetBase const * pStyleSheet,
|
2014-06-13 11:23:07 +01:00
|
|
|
PresentationObjects ePO, SfxStyleSheetBasePool* pSSPool)
|
|
|
|
{
|
2017-08-03 10:23:01 +02:00
|
|
|
SdStyleSheet* pRealSheet = static_cast<SdStyleSheet const *>(pStyleSheet)->GetRealStyleSheet();
|
2016-12-08 10:26:01 +02:00
|
|
|
pRealSheet->Broadcast(SfxHint(SfxHintId::DataChanged));
|
2014-06-13 11:23:07 +01:00
|
|
|
|
|
|
|
if( (ePO >= PO_OUTLINE_1) && (ePO <= PO_OUTLINE_8) )
|
|
|
|
{
|
2017-05-18 21:14:00 +01:00
|
|
|
OUString sStyleName(SdResId(STR_PSEUDOSHEET_OUTLINE) + " ");
|
2014-06-13 11:23:07 +01:00
|
|
|
|
2018-01-12 20:16:43 +01:00
|
|
|
for( sal_uInt16 n = static_cast<sal_uInt16>(ePO - PO_OUTLINE_1 + 2); n < 10; n++ )
|
2014-06-13 11:23:07 +01:00
|
|
|
{
|
|
|
|
OUString aName( sStyleName + OUString::number(n) );
|
|
|
|
|
2018-01-19 12:16:31 +02:00
|
|
|
SfxStyleSheetBase* pSheet = pSSPool->Find( aName, SfxStyleFamily::Pseudo);
|
2014-06-13 11:23:07 +01:00
|
|
|
|
|
|
|
if(pSheet)
|
|
|
|
{
|
2014-11-11 07:52:45 +02:00
|
|
|
SdStyleSheet* pRealStyleSheet = static_cast<SdStyleSheet*>(pSheet)->GetRealStyleSheet();
|
2016-12-08 10:26:01 +02:00
|
|
|
pRealStyleSheet->Broadcast(SfxHint(SfxHintId::DataChanged));
|
2014-06-13 11:23:07 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-12 15:51:52 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|