20#include <libxml/xmlwriter.h>
34#include <unoevent.hxx>
35#include <com/sun/star/text/RubyAdjust.hpp>
36#include <com/sun/star/text/RubyPosition.hpp>
37#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
38#include <com/sun/star/util/XCloneable.hpp>
39#include <com/sun/star/frame/XModel.hpp>
41#include <com/sun/star/uno/Any.h>
50#include <osl/diagnose.h>
63 m_pTextAttribute( nullptr )
70 m_pTextAttribute( nullptr )
78 assert(SfxPoolItem::operator==(rAttr));
90 if (rHint.
GetId() != SfxHintId::SwLegacyModify)
104 OUString sCharFormatName;
107 rVal <<= sCharFormatName;
112 OSL_FAIL(
"format cannot be set with PutValue!");
118 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"SwFormatCharFormat"));
119 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST(
"ptr"),
"%p",
this);
120 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST(
"text-attribute"),
"%p",
m_pTextAttribute);
121 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST(
"char-format"),
"%p",
GetCharFormat());
122 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"char-format-name"),
124 (void)xmlTextWriterEndElement(pWriter);
134 assert(SfxPoolItem::operator==(rAttr));
157 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"SwFormatAutoFormat"));
158 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST(
"ptr"),
"%p",
this);
159 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"whichId"), BAD_CAST(OString::number(
Which()).getStr()));
164 (void)xmlTextWriterEndElement(pWriter);
172 , msVisitedFormatName()
174 , mpTextAttr( nullptr )
175 , mnINetFormatId( 0 )
176 , mnVisitedFormatId( 0 )
182 , msTargetFrame(
std::move(aTarget) )
184 , msVisitedFormatName()
186 , mpTextAttr( nullptr )
196 ,
sw::BroadcasterMixin()
198 , msTargetFrame( rAttr.msTargetFrame )
199 , msINetFormatName( rAttr.msINetFormatName )
200 , msVisitedFormatName( rAttr.msVisitedFormatName )
201 , msHyperlinkName( rAttr.msHyperlinkName )
202 , mpTextAttr( nullptr )
203 , mnINetFormatId( rAttr.mnINetFormatId )
204 , mnVisitedFormatId( rAttr.mnVisitedFormatId )
216 assert(SfxPoolItem::operator==(rAttr));
231 return ( !pOther || pOther->
empty() );
238 return rOwn == rOther;
279 nMemberId &= ~CONVERT_TWIPS;
318 pEvents->copyMacrosFromINetFormat(*
this);
321 rVal <<= uno::Reference<container::XNameReplace>(pEvents);
333 nMemberId &= ~CONVERT_TWIPS;
339 uno::Reference<container::XNameReplace> xReplace;
347 pEvents->copyMacrosFromNameReplace(xReplace);
348 pEvents->copyMacrosIntoINetFormat(*
this);
404 m_pTextAttr( nullptr ),
405 m_nCharFormatId( 0 ),
407 m_eAdjustment( css::
text::RubyAdjust_LEFT )
414 m_sCharFormatName( rAttr.m_sCharFormatName ),
415 m_pTextAttr( nullptr ),
416 m_nCharFormatId( rAttr.m_nCharFormatId),
418 m_eAdjustment( rAttr.m_eAdjustment )
442 assert(SfxPoolItem::operator==(rAttr));
459 nMemberId &= ~CONVERT_TWIPS;
490 nMemberId &= ~CONVERT_TWIPS;
500 if(nSet >= sal_Int16(text::RubyAdjust_LEFT) && nSet <= sal_Int16(text::RubyAdjust_INDENT_BLOCK))
509 if(rVal.
hasValue() && rVal.getValueType() == rType)
511 bool bAbove = *o3tl::doAccess<bool>(rVal);
520 if(nSet >= sal_Int16(text::RubyPosition::ABOVE) && nSet <= sal_Int16(text::RubyPosition::INTER_CHARACTER))
529 bRet = rVal >>= sTmp;
548 , m_pTextAttr( nullptr )
551 "ERROR: SwFormatMeta: invalid which id!");
555 const sal_uInt16 i_nWhich )
557 , m_pMeta(
std::move(i_pMeta) )
558 , m_pTextAttr( nullptr )
561 "ERROR: SwFormatMeta: invalid which id!");
562 OSL_ENSURE(
m_pMeta,
"SwFormatMeta: no Meta ?");
571 m_pMeta->SetFormatMeta(
nullptr);
591 "SwFormatMeta::SetTextAttr: already has text attribute?");
593 "SwFormatMeta::SetTextAttr: no attribute to remove?");
595 OSL_ENSURE(
m_pMeta,
"inserted SwFormatMeta has no sw::Meta?");
603 else if (
m_pMeta->GetFormatMeta() ==
this)
606 m_pMeta->SetFormatMeta(
nullptr);
615 OSL_ENSURE(
m_pMeta,
"SwFormatMeta::NotifyChangeTextNode: no Meta?");
618 m_pMeta->NotifyChangeTextNode(pTextNode);
627 OSL_ENSURE(
m_pMeta,
"DoCopy called for SwFormatMeta with no sw::Meta?");
631 const std::shared_ptr< ::sw::Meta> pOriginal(
m_pMeta );
634 m_pMeta = std::make_shared<::sw::Meta>(
this);
644 m_pMeta->NotifyChangeTextNode(& i_rTargetTextNode);
646 m_pMeta->RegisterAsCopyOf(*pOriginal);
652 : ::
sfx2::Metadatable()
653 ,
sw::BroadcastingModify()
654 , m_pFormat(i_pFormat)
655 , m_pTextNode(nullptr)
684 GetNotifier().Broadcast(
SfxHint(SfxHintId::Deinitializing));
690 if (rHint.
GetId() != SfxHintId::SwLegacyModify)
693 CallSwClientNotify(rHint);
694 GetNotifier().Broadcast(
SfxHint(SfxHintId::DataChanged));
698 GetNotifier().Broadcast(
SfxHint(SfxHintId::Deinitializing));
708 OSL_ENSURE(pTextNode,
"ERROR: GetRegistry: no text node?");
710 throw uno::RuntimeException();
725 return pTextNode ==
nullptr || pTextNode->
IsInUndo();
731 OSL_ENSURE(pTextNode,
"IsInContent: no text node?");
732 return pTextNode ==
nullptr || pTextNode->
IsInContent();
741 const sal_uInt32 nNumberFormat,
const bool bIsFixedLanguage)
743 , m_nNumberFormat( nNumberFormat )
744 , m_bIsFixedLanguage( bIsFixedLanguage )
749 OUString *
const o_pPrefix, OUString *
const o_pSuffix, OUString *
const o_pShadowsColor)
753 const uno::Reference<rdf::XMetadatable> xMetaField(
MakeUnoObject() );
754 assert(
dynamic_cast<SwXMetaField*
>(xMetaField.get()) &&
"GetPrefixAndSuffix: no SwXMetaField?");
759 const uno::Reference<frame::XModel>
xModel(
760 pShell ? pShell->
GetModel() :
nullptr, uno::UNO_SET_THROW);
764 catch (
const uno::Exception&)
780 return nNumberFormat;
794std::shared_ptr<MetaField>
796 const sal_uInt32 nNumberFormat,
const bool bIsFixedLanguage)
798 const std::shared_ptr<MetaField> pMetaField(
799 new MetaField(i_pFormat, nNumberFormat, bIsFixedLanguage) );
808 bool operator()(std::weak_ptr<MetaField>
const & pMetaField) {
809 return pMetaField.lock()->IsInUndo();
815 uno::Reference<text::XTextField>
816 operator()(std::weak_ptr<MetaField>
const & pMetaField) {
817 return uno::Reference<text::XTextField>(
818 pMetaField.lock()->MakeUnoObject(), uno::UNO_QUERY);
824std::vector< uno::Reference<text::XTextField> >
828 const MetaFieldList_t::iterator iter(
830 [] (std::weak_ptr<MetaField>
const& rField) { return rField.expired(); }));
834 const MetaFieldList_t::iterator iter2(
836 filtered.begin(), IsInUndo()));
837 filtered.erase(iter2, filtered.end());
839 std::vector< uno::Reference<text::XTextField> > ret(filtered.size());
840 std::transform(filtered.begin(), filtered.end(), ret.begin(),
851 uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(pDocShell->
GetModel(), uno::UNO_QUERY);
852 uno::Reference<util::XCloneable> xCloneable(xDocumentPropertiesSupplier->getDocumentProperties(), uno::UNO_QUERY);
css::uno::Reference< css::frame::XModel3 > GetModel() const
virtual bool operator==(const SfxPoolItem &) const=0
static OUString nameOf(const std::shared_ptr< SfxItemSet > &pSet)
SwDocShell * GetDocShell()
bool IsNumberFormat(const OUString &aString, sal_uInt32 &F_Index, double &fOutNumber)
static SW_DLLPUBLIC sal_uInt16 GetPoolIdFromUIName(const OUString &rName, SwGetPoolIdFromName)
static const OUString & GetUIName(const OUString &rName, SwGetPoolIdFromName)
static void FillProgName(const OUString &rName, OUString &rFillName, SwGetPoolIdFromName)
static void FillUIName(const OUString &rName, OUString &rFillName, SwGetPoolIdFromName)
bool GetInfo(SfxPoolItem const &rInfo) const
void TriggerNodeUpdate(const sw::LegacyModifyHint &)
SwTextNode is a paragraph in the document model.
virtual bool IsInUndo() const override
Is this node in the undo array?
virtual bool IsInClipboard() const override
virtual ::sfx2::IXmlIdRegistry & GetRegistry() override
sfx2::Metadatable
virtual bool IsInContent() const override
css::uno::Type const & get()
struct _xmlTextWriter * xmlTextWriterPtr
#define TOOLS_WARN_EXCEPTION(area, stream)
virtual OUString GetName() const override
constexpr TypedWhichId< SwPtrMsgPoolItem > RES_REMOVE_UNO_OBJECT(181)
constexpr TypedWhichId< SwFormatINetFormat > RES_TXTATR_INETFMT(51)
constexpr TypedWhichId< SwFormatCharFormat > RES_TXTATR_CHARFMT(52)
constexpr TypedWhichId< SwFormatMeta > RES_TXTATR_METAFIELD(49)
constexpr TypedWhichId< SwFormatMeta > RES_TXTATR_META(48)
constexpr TypedWhichId< SwFormatRuby > RES_TXTATR_CJK_RUBY(53)
Dialog to specify the properties of date form field.
@ RES_POOLCHR_INET_VISIT
Internet visited.
@ RES_POOLCHR_INET_NORMAL
Internet normal.
Reference< XModel > xModel
#define MID_RUBY_POSITION
#define MID_URL_UNVISITED_FMT
#define MID_URL_HYPERLINKEVENTS
#define MID_URL_HYPERLINKNAME
#define MID_URL_VISITED_FMT
#define MID_RUBY_CHARSTYLE