use more concrete UNO type in writerfilter
Change-Id: Idf3fd445994e0b42cffc173ed68475398d74cdd2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171447 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
committed by
Noel Grandin
parent
4cad111206
commit
f13e5718f5
+64
-1
@@ -48,6 +48,8 @@ class SwXStyle;
|
||||
class SwXTextCellStyle;
|
||||
class SwXPageStyle;
|
||||
class SwXFrameStyle;
|
||||
class StyleFamilyEntry;
|
||||
class SwXStyleFamily;
|
||||
|
||||
class SwXStyleFamilies final : public cppu::WeakImplHelper
|
||||
<
|
||||
@@ -60,7 +62,7 @@ class SwXStyleFamilies final : public cppu::WeakImplHelper
|
||||
{
|
||||
SwDocShell* m_pDocShell;
|
||||
|
||||
std::map<SfxStyleFamily, css::uno::Reference<css::container::XNameContainer>> m_vFamilies;
|
||||
std::map<SfxStyleFamily, rtl::Reference<SwXStyleFamily>> m_vFamilies;
|
||||
|
||||
virtual ~SwXStyleFamilies() override;
|
||||
public:
|
||||
@@ -88,6 +90,12 @@ public:
|
||||
virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
|
||||
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
|
||||
|
||||
SW_DLLPUBLIC rtl::Reference<SwXStyleFamily> GetPageStyles();
|
||||
SW_DLLPUBLIC rtl::Reference<SwXStyleFamily> GetCharacterStyles();
|
||||
SW_DLLPUBLIC rtl::Reference<SwXStyleFamily> GetParagraphStyles();
|
||||
rtl::Reference<SwXStyleFamily> GetStylesByName(const OUString& rName);
|
||||
rtl::Reference<SwXStyleFamily> GetStylesByIndex(sal_Int32 nIndex);
|
||||
|
||||
static css::uno::Reference<css::style::XStyle> CreateStyle(SfxStyleFamily eFamily, SwDoc& rDoc);
|
||||
static rtl::Reference<SwXStyle> CreateStyleCharOrParaOrPseudo(SfxStyleFamily eFamily, SwDoc& rDoc);
|
||||
static rtl::Reference<SwXPageStyle> CreateStylePage(SwDoc& rDoc);
|
||||
@@ -390,4 +398,59 @@ class SwXTextCellStyle final : public cppu::WeakImplHelper
|
||||
static rtl::Reference<SwXTextCellStyle> CreateXTextCellStyle(SwDocShell* pDocShell, const OUString& sName);
|
||||
};
|
||||
|
||||
class SW_DLLPUBLIC SwXStyleFamily final : public cppu::WeakImplHelper
|
||||
<
|
||||
css::container::XNameContainer,
|
||||
css::lang::XServiceInfo,
|
||||
css::container::XIndexAccess,
|
||||
css::beans::XPropertySet
|
||||
>
|
||||
, public SfxListener
|
||||
{
|
||||
const StyleFamilyEntry& m_rEntry;
|
||||
SfxStyleSheetBasePool* m_pBasePool;
|
||||
SwDocShell* m_pDocShell;
|
||||
|
||||
SwXStyle* FindStyle(std::u16string_view rStyleName) const;
|
||||
sal_Int32 GetCountOrName(OUString* pString, sal_Int32 nIndex = SAL_MAX_INT32);
|
||||
static const StyleFamilyEntry& InitEntry(SfxStyleFamily eFamily);
|
||||
public:
|
||||
SwXStyleFamily(SwDocShell* pDocShell, const SfxStyleFamily eFamily);
|
||||
|
||||
//XIndexAccess
|
||||
virtual sal_Int32 SAL_CALL getCount() override;
|
||||
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override;
|
||||
|
||||
//XElementAccess
|
||||
virtual css::uno::Type SAL_CALL getElementType( ) override;
|
||||
virtual sal_Bool SAL_CALL hasElements( ) override;
|
||||
|
||||
//XNameAccess
|
||||
virtual css::uno::Any SAL_CALL getByName(const OUString& Name) override;
|
||||
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
|
||||
virtual sal_Bool SAL_CALL hasByName(const OUString& Name) override;
|
||||
|
||||
//XNameContainer
|
||||
virtual void SAL_CALL insertByName(const OUString& Name, const css::uno::Any& Element) override;
|
||||
virtual void SAL_CALL replaceByName(const OUString& Name, const css::uno::Any& Element) override;
|
||||
virtual void SAL_CALL removeByName(const OUString& Name) override;
|
||||
|
||||
//XPropertySet
|
||||
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
|
||||
virtual void SAL_CALL setPropertyValue( const OUString&, const css::uno::Any&) override;
|
||||
virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
|
||||
virtual void SAL_CALL addPropertyChangeListener( const OUString&, const css::uno::Reference<css::beans::XPropertyChangeListener>&) override;
|
||||
virtual void SAL_CALL removePropertyChangeListener( const OUString&, const css::uno::Reference<css::beans::XPropertyChangeListener>&) override;
|
||||
virtual void SAL_CALL addVetoableChangeListener(const OUString&, const css::uno::Reference<css::beans::XVetoableChangeListener>&) override;
|
||||
virtual void SAL_CALL removeVetoableChangeListener(const OUString&, const css::uno::Reference<css::beans::XVetoableChangeListener>&) override;
|
||||
|
||||
//SfxListener
|
||||
virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
|
||||
|
||||
//XServiceInfo
|
||||
virtual OUString SAL_CALL getImplementationName() override;
|
||||
virtual sal_Bool SAL_CALL supportsService(const OUString& rServiceName) override;
|
||||
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
|
||||
};
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
||||
@@ -538,6 +538,7 @@ public:
|
||||
rtl::Reference<SwXFootnote> createEndnote();
|
||||
rtl::Reference<SwXTextEmbeddedObject> createTextEmbeddedObject();
|
||||
rtl::Reference<SvXMLEmbeddedObjectHelper> createEmbeddedObjectResolver();
|
||||
rtl::Reference< SwXStyleFamilies > getSwStyleFamilies();
|
||||
};
|
||||
|
||||
class SwXLinkTargetSupplier final : public cppu::WeakImplHelper
|
||||
|
||||
+117
-109
@@ -586,108 +586,91 @@ static rtl::Reference<SwXTextCellStyle> CreateStyleCell(SwDocShell* pDocShell, c
|
||||
return SwXTextCellStyle::CreateXTextCellStyle(pDocShell, sStyleName);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
class XStyleFamily : public cppu::WeakImplHelper
|
||||
<
|
||||
container::XNameContainer,
|
||||
lang::XServiceInfo,
|
||||
container::XIndexAccess,
|
||||
beans::XPropertySet
|
||||
>
|
||||
, public SfxListener
|
||||
sal_Int32 SwXStyleFamily::GetCountOrName(OUString* pString, sal_Int32 nIndex)
|
||||
{
|
||||
const StyleFamilyEntry& m_rEntry;
|
||||
SfxStyleSheetBasePool* m_pBasePool;
|
||||
SwDocShell* m_pDocShell;
|
||||
|
||||
SwXStyle* FindStyle(std::u16string_view rStyleName) const;
|
||||
sal_Int32 GetCountOrName(OUString* pString, sal_Int32 nIndex = SAL_MAX_INT32)
|
||||
{ return m_rEntry.getCountOrName(*m_pDocShell->GetDoc(), pString, nIndex); };
|
||||
static const StyleFamilyEntry& InitEntry(SfxStyleFamily eFamily)
|
||||
{
|
||||
auto& entries = lcl_GetStyleFamilyEntries();
|
||||
const auto pEntry = std::find_if(entries.begin(), entries.end(),
|
||||
[eFamily] (const StyleFamilyEntry& e) { return e.family() == eFamily; });
|
||||
assert(pEntry != entries.end());
|
||||
return *pEntry;
|
||||
}
|
||||
public:
|
||||
XStyleFamily(SwDocShell* pDocShell, const SfxStyleFamily eFamily)
|
||||
: m_rEntry(InitEntry(eFamily))
|
||||
, m_pBasePool(pDocShell->GetStyleSheetPool())
|
||||
, m_pDocShell(pDocShell)
|
||||
{
|
||||
if (m_pBasePool) //tdf#124142 html docs can have no styles
|
||||
StartListening(*m_pBasePool);
|
||||
}
|
||||
|
||||
//XIndexAccess
|
||||
virtual sal_Int32 SAL_CALL getCount() override
|
||||
{
|
||||
SolarMutexGuard aGuard;
|
||||
return GetCountOrName(nullptr);
|
||||
};
|
||||
virtual uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override;
|
||||
|
||||
//XElementAccess
|
||||
virtual uno::Type SAL_CALL getElementType( ) override
|
||||
{ return cppu::UnoType<style::XStyle>::get(); };
|
||||
virtual sal_Bool SAL_CALL hasElements( ) override
|
||||
{
|
||||
if(!m_pBasePool)
|
||||
throw uno::RuntimeException();
|
||||
return true;
|
||||
}
|
||||
|
||||
//XNameAccess
|
||||
virtual uno::Any SAL_CALL getByName(const OUString& Name) override;
|
||||
virtual uno::Sequence< OUString > SAL_CALL getElementNames() override;
|
||||
virtual sal_Bool SAL_CALL hasByName(const OUString& Name) override;
|
||||
|
||||
//XNameContainer
|
||||
virtual void SAL_CALL insertByName(const OUString& Name, const uno::Any& Element) override;
|
||||
virtual void SAL_CALL replaceByName(const OUString& Name, const uno::Any& Element) override;
|
||||
virtual void SAL_CALL removeByName(const OUString& Name) override;
|
||||
|
||||
//XPropertySet
|
||||
virtual uno::Reference< beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override
|
||||
{ return {}; };
|
||||
virtual void SAL_CALL setPropertyValue( const OUString&, const uno::Any&) override
|
||||
{ SAL_WARN("sw.uno", "###unexpected!"); };
|
||||
virtual uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
|
||||
virtual void SAL_CALL addPropertyChangeListener( const OUString&, const uno::Reference<beans::XPropertyChangeListener>&) override
|
||||
{ SAL_WARN("sw.uno", "###unexpected!"); };
|
||||
virtual void SAL_CALL removePropertyChangeListener( const OUString&, const uno::Reference<beans::XPropertyChangeListener>&) override
|
||||
{ SAL_WARN("sw.uno", "###unexpected!"); };
|
||||
virtual void SAL_CALL addVetoableChangeListener(const OUString&, const uno::Reference<beans::XVetoableChangeListener>&) override
|
||||
{ SAL_WARN("sw.uno", "###unexpected!"); };
|
||||
virtual void SAL_CALL removeVetoableChangeListener(const OUString&, const uno::Reference<beans::XVetoableChangeListener>&) override
|
||||
{ SAL_WARN("sw.uno", "###unexpected!"); };
|
||||
|
||||
//SfxListener
|
||||
virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override
|
||||
{
|
||||
if(rHint.GetId() == SfxHintId::Dying)
|
||||
{
|
||||
m_pBasePool = nullptr;
|
||||
m_pDocShell = nullptr;
|
||||
EndListening(rBC);
|
||||
}
|
||||
}
|
||||
|
||||
//XServiceInfo
|
||||
virtual OUString SAL_CALL getImplementationName() override
|
||||
{ return {u"XStyleFamily"_ustr}; };
|
||||
virtual sal_Bool SAL_CALL supportsService(const OUString& rServiceName) override
|
||||
{ return cppu::supportsService(this, rServiceName); };
|
||||
virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
|
||||
{ return { u"com.sun.star.style.StyleFamily"_ustr }; }
|
||||
return m_rEntry.getCountOrName(*m_pDocShell->GetDoc(), pString, nIndex);
|
||||
};
|
||||
|
||||
/*static*/ const StyleFamilyEntry& SwXStyleFamily::InitEntry(SfxStyleFamily eFamily)
|
||||
{
|
||||
auto& entries = lcl_GetStyleFamilyEntries();
|
||||
const auto pEntry = std::find_if(entries.begin(), entries.end(),
|
||||
[eFamily] (const StyleFamilyEntry& e) { return e.family() == eFamily; });
|
||||
assert(pEntry != entries.end());
|
||||
return *pEntry;
|
||||
}
|
||||
|
||||
SwXStyleFamily::SwXStyleFamily(SwDocShell* pDocShell, const SfxStyleFamily eFamily)
|
||||
: m_rEntry(InitEntry(eFamily))
|
||||
, m_pBasePool(pDocShell->GetStyleSheetPool())
|
||||
, m_pDocShell(pDocShell)
|
||||
{
|
||||
if (m_pBasePool) //tdf#124142 html docs can have no styles
|
||||
StartListening(*m_pBasePool);
|
||||
}
|
||||
|
||||
//XIndexAccess
|
||||
sal_Int32 SAL_CALL SwXStyleFamily::getCount()
|
||||
{
|
||||
SolarMutexGuard aGuard;
|
||||
return GetCountOrName(nullptr);
|
||||
};
|
||||
|
||||
//XElementAccess
|
||||
uno::Type SAL_CALL SwXStyleFamily::getElementType()
|
||||
{
|
||||
return cppu::UnoType<style::XStyle>::get();
|
||||
};
|
||||
|
||||
sal_Bool SAL_CALL SwXStyleFamily::hasElements()
|
||||
{
|
||||
if(!m_pBasePool)
|
||||
throw uno::RuntimeException();
|
||||
return true;
|
||||
}
|
||||
|
||||
//XPropertySet
|
||||
uno::Reference< beans::XPropertySetInfo > SAL_CALL SwXStyleFamily::getPropertySetInfo()
|
||||
{ return {}; };
|
||||
|
||||
void SAL_CALL SwXStyleFamily::setPropertyValue( const OUString&, const uno::Any&)
|
||||
{ SAL_WARN("sw.uno", "###unexpected!"); };
|
||||
|
||||
void SAL_CALL SwXStyleFamily::addPropertyChangeListener( const OUString&, const uno::Reference<beans::XPropertyChangeListener>&)
|
||||
{ SAL_WARN("sw.uno", "###unexpected!"); };
|
||||
|
||||
void SAL_CALL SwXStyleFamily::removePropertyChangeListener( const OUString&, const uno::Reference<beans::XPropertyChangeListener>&)
|
||||
{ SAL_WARN("sw.uno", "###unexpected!"); };
|
||||
|
||||
void SAL_CALL SwXStyleFamily::addVetoableChangeListener(const OUString&, const uno::Reference<beans::XVetoableChangeListener>&)
|
||||
{ SAL_WARN("sw.uno", "###unexpected!"); };
|
||||
|
||||
void SAL_CALL SwXStyleFamily::removeVetoableChangeListener(const OUString&, const uno::Reference<beans::XVetoableChangeListener>&)
|
||||
{ SAL_WARN("sw.uno", "###unexpected!"); };
|
||||
|
||||
//SfxListener
|
||||
void SwXStyleFamily::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
|
||||
{
|
||||
if(rHint.GetId() == SfxHintId::Dying)
|
||||
{
|
||||
m_pBasePool = nullptr;
|
||||
m_pDocShell = nullptr;
|
||||
EndListening(rBC);
|
||||
}
|
||||
}
|
||||
|
||||
//XServiceInfo
|
||||
OUString SAL_CALL SwXStyleFamily::getImplementationName()
|
||||
{ return {u"XStyleFamily"_ustr}; };
|
||||
|
||||
sal_Bool SAL_CALL SwXStyleFamily::supportsService(const OUString& rServiceName)
|
||||
{ return cppu::supportsService(this, rServiceName); };
|
||||
|
||||
uno::Sequence< OUString > SAL_CALL SwXStyleFamily::getSupportedServiceNames()
|
||||
{ return { u"com.sun.star.style.StyleFamily"_ustr }; }
|
||||
|
||||
OUString SwXStyleFamilies::getImplementationName()
|
||||
{ return {u"SwXStyleFamilies"_ustr}; }
|
||||
{ return {u"SwXStyleFamilies"_ustr}; }
|
||||
|
||||
sal_Bool SwXStyleFamilies::supportsService(const OUString& rServiceName)
|
||||
{
|
||||
@@ -706,6 +689,11 @@ SwXStyleFamilies::~SwXStyleFamilies()
|
||||
{ }
|
||||
|
||||
uno::Any SAL_CALL SwXStyleFamilies::getByName(const OUString& Name)
|
||||
{
|
||||
return uno::Any(uno::Reference(static_cast<css::container::XNameContainer*>(GetStylesByName(Name).get())));
|
||||
}
|
||||
|
||||
rtl::Reference<SwXStyleFamily> SwXStyleFamilies::GetStylesByName(const OUString& Name)
|
||||
{
|
||||
SolarMutexGuard aGuard;
|
||||
if(!IsValid())
|
||||
@@ -715,7 +703,22 @@ uno::Any SAL_CALL SwXStyleFamilies::getByName(const OUString& Name)
|
||||
[&Name] (const StyleFamilyEntry& e) { return e.name() == Name; });
|
||||
if(pEntry == entries.end())
|
||||
throw container::NoSuchElementException();
|
||||
return getByIndex(pEntry - entries.begin());
|
||||
return GetStylesByIndex(pEntry - entries.begin());
|
||||
}
|
||||
|
||||
rtl::Reference<SwXStyleFamily> SwXStyleFamilies::GetPageStyles()
|
||||
{
|
||||
return GetStylesByName(u"PageStyles"_ustr);
|
||||
}
|
||||
|
||||
rtl::Reference<SwXStyleFamily> SwXStyleFamilies::GetCharacterStyles()
|
||||
{
|
||||
return GetStylesByName(u"CharacterStyles"_ustr);
|
||||
}
|
||||
|
||||
rtl::Reference<SwXStyleFamily> SwXStyleFamilies::GetParagraphStyles()
|
||||
{
|
||||
return GetStylesByName(u"ParagraphStyles"_ustr);
|
||||
}
|
||||
|
||||
uno::Sequence< OUString > SwXStyleFamilies::getElementNames()
|
||||
@@ -740,6 +743,11 @@ sal_Int32 SwXStyleFamilies::getCount()
|
||||
}
|
||||
|
||||
uno::Any SwXStyleFamilies::getByIndex(sal_Int32 nIndex)
|
||||
{
|
||||
return uno::Any(uno::Reference(static_cast<css::container::XNameContainer*>(GetStylesByIndex(nIndex).get())));
|
||||
}
|
||||
|
||||
rtl::Reference<SwXStyleFamily> SwXStyleFamilies::GetStylesByIndex(sal_Int32 nIndex)
|
||||
{
|
||||
auto& entries(lcl_GetStyleFamilyEntries());
|
||||
SolarMutexGuard aGuard;
|
||||
@@ -751,8 +759,8 @@ uno::Any SwXStyleFamilies::getByIndex(sal_Int32 nIndex)
|
||||
assert(eFamily != SfxStyleFamily::All);
|
||||
auto& rxFamily = m_vFamilies[eFamily];
|
||||
if(!rxFamily.is())
|
||||
rxFamily = new XStyleFamily(m_pDocShell, eFamily);
|
||||
return uno::Any(rxFamily);
|
||||
rxFamily = new SwXStyleFamily(m_pDocShell, eFamily);
|
||||
return rxFamily;
|
||||
}
|
||||
|
||||
uno::Type SwXStyleFamilies::getElementType()
|
||||
@@ -888,7 +896,7 @@ rtl::Reference<SwXTextCellStyle> SwXStyleFamilies::CreateStyleCell(SwDoc& rDoc)
|
||||
uno::Reference<css::style::XStyle> SwXStyleFamilies::CreateStyleCondParagraph(SwDoc& rDoc)
|
||||
{ return new SwXStyle(&rDoc, SfxStyleFamily::Para, true); };
|
||||
|
||||
uno::Any XStyleFamily::getByIndex(sal_Int32 nIndex)
|
||||
uno::Any SwXStyleFamily::getByIndex(sal_Int32 nIndex)
|
||||
{
|
||||
SolarMutexGuard aGuard;
|
||||
if(nIndex < 0)
|
||||
@@ -907,7 +915,7 @@ uno::Any XStyleFamily::getByIndex(sal_Int32 nIndex)
|
||||
return getByName(sStyleName);
|
||||
}
|
||||
|
||||
uno::Any XStyleFamily::getByName(const OUString& rName)
|
||||
uno::Any SwXStyleFamily::getByName(const OUString& rName)
|
||||
{
|
||||
SolarMutexGuard aGuard;
|
||||
OUString sStyleName;
|
||||
@@ -944,7 +952,7 @@ uno::Any XStyleFamily::getByName(const OUString& rName)
|
||||
return uno::Any(xStyle);
|
||||
}
|
||||
|
||||
uno::Sequence<OUString> XStyleFamily::getElementNames()
|
||||
uno::Sequence<OUString> SwXStyleFamily::getElementNames()
|
||||
{
|
||||
SolarMutexGuard aGuard;
|
||||
if(!m_pBasePool)
|
||||
@@ -960,7 +968,7 @@ uno::Sequence<OUString> XStyleFamily::getElementNames()
|
||||
return comphelper::containerToSequence(vRet);
|
||||
}
|
||||
|
||||
sal_Bool XStyleFamily::hasByName(const OUString& rName)
|
||||
sal_Bool SwXStyleFamily::hasByName(const OUString& rName)
|
||||
{
|
||||
SolarMutexGuard aGuard;
|
||||
if(!m_pBasePool)
|
||||
@@ -971,7 +979,7 @@ sal_Bool XStyleFamily::hasByName(const OUString& rName)
|
||||
return nullptr != pBase;
|
||||
}
|
||||
|
||||
void XStyleFamily::insertByName(const OUString& rName, const uno::Any& rElement)
|
||||
void SwXStyleFamily::insertByName(const OUString& rName, const uno::Any& rElement)
|
||||
{
|
||||
SolarMutexGuard aGuard;
|
||||
if(!m_pBasePool)
|
||||
@@ -1026,7 +1034,7 @@ void XStyleFamily::insertByName(const OUString& rName, const uno::Any& rElement)
|
||||
}
|
||||
}
|
||||
|
||||
void XStyleFamily::replaceByName(const OUString& rName, const uno::Any& rElement)
|
||||
void SwXStyleFamily::replaceByName(const OUString& rName, const uno::Any& rElement)
|
||||
{
|
||||
SolarMutexGuard aGuard;
|
||||
if(!m_pBasePool)
|
||||
@@ -1087,7 +1095,7 @@ void XStyleFamily::replaceByName(const OUString& rName, const uno::Any& rElement
|
||||
}
|
||||
}
|
||||
|
||||
void XStyleFamily::removeByName(const OUString& rName)
|
||||
void SwXStyleFamily::removeByName(const OUString& rName)
|
||||
{
|
||||
SolarMutexGuard aGuard;
|
||||
if(!m_pBasePool)
|
||||
@@ -1111,7 +1119,7 @@ void XStyleFamily::removeByName(const OUString& rName)
|
||||
m_pBasePool->Remove(pBase);
|
||||
}
|
||||
|
||||
uno::Any SAL_CALL XStyleFamily::getPropertyValue( const OUString& sPropertyName )
|
||||
uno::Any SAL_CALL SwXStyleFamily::getPropertyValue( const OUString& sPropertyName )
|
||||
{
|
||||
if(sPropertyName != "DisplayName")
|
||||
throw beans::UnknownPropertyException( "unknown property: " + sPropertyName, getXWeak() );
|
||||
@@ -1120,7 +1128,7 @@ uno::Any SAL_CALL XStyleFamily::getPropertyValue( const OUString& sPropertyName
|
||||
}
|
||||
|
||||
|
||||
SwXStyle* XStyleFamily::FindStyle(std::u16string_view rStyleName) const
|
||||
SwXStyle* SwXStyleFamily::FindStyle(std::u16string_view rStyleName) const
|
||||
{
|
||||
SwXStyle* pFoundStyle = nullptr;
|
||||
m_pBasePool->ForAllListeners(
|
||||
|
||||
@@ -1250,6 +1250,11 @@ Reference< XNameAccess > SwXTextDocument::getTextFrames()
|
||||
}
|
||||
|
||||
Reference< XNameAccess > SwXTextDocument::getStyleFamilies()
|
||||
{
|
||||
return getSwStyleFamilies();
|
||||
}
|
||||
|
||||
rtl::Reference< SwXStyleFamilies > SwXTextDocument::getSwStyleFamilies()
|
||||
{
|
||||
SolarMutexGuard aGuard;
|
||||
ThrowIfInvalid();
|
||||
|
||||
@@ -93,6 +93,7 @@
|
||||
#include <sal/log.hxx>
|
||||
#include <tools/UnitConversion.hxx>
|
||||
#include <unotxdoc.hxx>
|
||||
#include <unostyle.hxx>
|
||||
#include <SwXTextDefaults.hxx>
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
@@ -5085,7 +5086,7 @@ void DomainMapper::commentProps(const OUString& sId, const CommentProperties& rP
|
||||
m_pImpl->commentProps(sId, rProps);
|
||||
}
|
||||
|
||||
css::uno::Reference<css::container::XNameContainer> const & DomainMapper::GetCharacterStyles()
|
||||
rtl::Reference<SwXStyleFamily> const & DomainMapper::GetCharacterStyles()
|
||||
{
|
||||
return m_pImpl->GetCharacterStyles();
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <memory>
|
||||
|
||||
class SwXTextDocument;
|
||||
class SwXStyleFamily;
|
||||
namespace com::sun::star{
|
||||
namespace beans{
|
||||
struct PropertyValue;
|
||||
@@ -142,7 +143,7 @@ public:
|
||||
|
||||
virtual void commentProps(const OUString& sId, const CommentProperties& rProps) override;
|
||||
|
||||
css::uno::Reference<css::container::XNameContainer> const & GetCharacterStyles();
|
||||
rtl::Reference<SwXStyleFamily> const & GetCharacterStyles();
|
||||
OUString GetUnusedCharacterStyleName();
|
||||
bool IsNewDoc() const;
|
||||
|
||||
|
||||
@@ -145,6 +145,7 @@
|
||||
#include <unolinebreak.hxx>
|
||||
#include <unoframe.hxx>
|
||||
#include <unoxstyle.hxx>
|
||||
#include <unostyle.hxx>
|
||||
#include <unocontentcontrol.hxx>
|
||||
#include <unofootnote.hxx>
|
||||
#include <unoport.hxx>
|
||||
@@ -453,11 +454,13 @@ writerfilter::ooxml::OOXMLDocument* DomainMapper_Impl::getDocumentReference() co
|
||||
return m_pOOXMLDocument;
|
||||
}
|
||||
|
||||
uno::Reference< container::XNameContainer > const & DomainMapper_Impl::GetPageStyles()
|
||||
rtl::Reference< SwXStyleFamily > const & DomainMapper_Impl::GetPageStyles()
|
||||
{
|
||||
if(!m_xPageStyles1.is() && m_xTextDocument)
|
||||
m_xTextDocument->getStyleFamilies()->getByName(u"PageStyles"_ustr) >>= m_xPageStyles1;
|
||||
return m_xPageStyles1;
|
||||
if(!m_xPageStyles.is() && m_xTextDocument)
|
||||
{
|
||||
m_xPageStyles = m_xTextDocument->getSwStyleFamilies()->GetPageStyles();
|
||||
}
|
||||
return m_xPageStyles;
|
||||
}
|
||||
|
||||
OUString DomainMapper_Impl::GetUnusedPageStyleName()
|
||||
@@ -487,17 +490,21 @@ OUString DomainMapper_Impl::GetUnusedPageStyleName()
|
||||
return sPageStyleName;
|
||||
}
|
||||
|
||||
uno::Reference< container::XNameContainer > const & DomainMapper_Impl::GetCharacterStyles()
|
||||
rtl::Reference< SwXStyleFamily > const & DomainMapper_Impl::GetCharacterStyles()
|
||||
{
|
||||
if(!m_xCharacterStyles.is() && m_xTextDocument)
|
||||
m_xTextDocument->getStyleFamilies()->getByName(u"CharacterStyles"_ustr) >>= m_xCharacterStyles;
|
||||
{
|
||||
m_xCharacterStyles = m_xTextDocument->getSwStyleFamilies()->GetCharacterStyles();
|
||||
}
|
||||
return m_xCharacterStyles;
|
||||
}
|
||||
|
||||
uno::Reference<container::XNameContainer> const& DomainMapper_Impl::GetParagraphStyles()
|
||||
rtl::Reference<SwXStyleFamily> const& DomainMapper_Impl::GetParagraphStyles()
|
||||
{
|
||||
if (!m_xParagraphStyles.is() && m_xTextDocument)
|
||||
m_xTextDocument->getStyleFamilies()->getByName(u"ParagraphStyles"_ustr) >>= m_xParagraphStyles;
|
||||
{
|
||||
m_xParagraphStyles = m_xTextDocument->getSwStyleFamilies()->GetParagraphStyles();
|
||||
}
|
||||
return m_xParagraphStyles;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,6 +62,7 @@ class SwXTextField;
|
||||
class SwXTextFrame;
|
||||
class SwXTextEmbeddedObject;
|
||||
class SwXText;
|
||||
class SwXStyleFamily;
|
||||
namespace com::sun::star{
|
||||
namespace awt{
|
||||
struct Size;
|
||||
@@ -546,11 +547,11 @@ private:
|
||||
rtl::Reference<SwXTextDocument> m_xTextDocument;
|
||||
rtl::Reference<SwXDocumentSettings> m_xDocumentSettings;
|
||||
css::uno::Reference<css::uno::XComponentContext> m_xComponentContext;
|
||||
css::uno::Reference<css::container::XNameContainer> m_xPageStyles1;
|
||||
rtl::Reference<SwXStyleFamily> m_xPageStyles;
|
||||
// cache next available number, expensive to repeatedly compute
|
||||
std::optional<int> m_xNextUnusedPageStyleNo;
|
||||
css::uno::Reference<css::container::XNameContainer> m_xCharacterStyles;
|
||||
css::uno::Reference<css::container::XNameContainer> m_xParagraphStyles;
|
||||
rtl::Reference<SwXStyleFamily> m_xCharacterStyles;
|
||||
rtl::Reference<SwXStyleFamily> m_xParagraphStyles;
|
||||
|
||||
// cache next available number, expensive to repeatedly compute
|
||||
std::optional<int> m_xNextUnusedCharacterStyleNo;
|
||||
@@ -721,10 +722,10 @@ public:
|
||||
return m_pLastSectionContext.get( );
|
||||
}
|
||||
|
||||
css::uno::Reference<css::container::XNameContainer> const & GetPageStyles();
|
||||
rtl::Reference<SwXStyleFamily> const & GetPageStyles();
|
||||
OUString GetUnusedPageStyleName();
|
||||
css::uno::Reference<css::container::XNameContainer> const & GetCharacterStyles();
|
||||
css::uno::Reference<css::container::XNameContainer> const& GetParagraphStyles();
|
||||
rtl::Reference<SwXStyleFamily> const & GetCharacterStyles();
|
||||
rtl::Reference<SwXStyleFamily> const& GetParagraphStyles();
|
||||
OUString GetUnusedCharacterStyleName();
|
||||
rtl::Reference<SwXText> const & GetBodyText();
|
||||
const rtl::Reference<SwXTextDocument>& GetTextDocument() const
|
||||
|
||||
@@ -68,6 +68,7 @@
|
||||
#include <unosection.hxx>
|
||||
#include <unotxdoc.hxx>
|
||||
#include <unoxstyle.hxx>
|
||||
#include <unostyle.hxx>
|
||||
#include <unotext.hxx>
|
||||
#include <utility>
|
||||
|
||||
@@ -484,7 +485,7 @@ SectionPropertyMap::SectionPropertyMap( bool bIsFirstSection )
|
||||
|
||||
rtl::Reference<SwXPageStyle> SectionPropertyMap::GetPageStyle(DomainMapper_Impl& rDM_Impl)
|
||||
{
|
||||
const uno::Reference< container::XNameContainer >& xPageStyles = rDM_Impl.GetPageStyles();
|
||||
const rtl::Reference< SwXStyleFamily >& xPageStyles = rDM_Impl.GetPageStyles();
|
||||
rtl::Reference<SwXPageStyle> xReturnPageStyle;
|
||||
try
|
||||
{
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
#include <o3tl/sorted_vector.hxx>
|
||||
#include <unotxdoc.hxx>
|
||||
#include <unoxstyle.hxx>
|
||||
#include <unostyle.hxx>
|
||||
#include <SwXTextDefaults.hxx>
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
@@ -2145,7 +2146,7 @@ OUString StyleSheetTable::getOrCreateCharStyle( PropertyValueVector_t& rCharProp
|
||||
return sListLabel;
|
||||
|
||||
//create a new one otherwise
|
||||
const uno::Reference< container::XNameContainer >& xCharStyles = m_pImpl->m_rDMapper.GetCharacterStyles();
|
||||
const rtl::Reference< SwXStyleFamily >& xCharStyles = m_pImpl->m_rDMapper.GetCharacterStyles();
|
||||
sListLabel = m_pImpl->m_rDMapper.GetUnusedCharacterStyleName();
|
||||
if (!m_pImpl->m_xTextDocument)
|
||||
throw uno::RuntimeException();
|
||||
|
||||
Reference in New Issue
Block a user