20#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
21#include <com/sun/star/document/XDocumentProperties.hpp>
22#include <com/sun/star/beans/XPropertySet.hpp>
23#include <com/sun/star/beans/XPropertySetInfo.hpp>
24#include <com/sun/star/frame/XModel.hpp>
25#include <osl/diagnose.h>
41 const uno::Reference<document::XDocumentProperties>& xSourceDocProps)
43 OSL_ENSURE(xSourceDocProps.is(),
"null reference");
45 uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
47 uno::Reference<document::XDocumentProperties> xDocProps(
48 xDPS->getDocumentProperties() );
49 OSL_ENSURE(xDocProps.is(),
"null reference");
51 uno::Reference<beans::XPropertySet> xSourceUDSet(
52 xSourceDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW);
53 uno::Reference<beans::XPropertyContainer> xTargetUD(
54 xDocProps->getUserDefinedProperties());
55 uno::Reference<beans::XPropertySet> xTargetUDSet(xTargetUD,
56 uno::UNO_QUERY_THROW);
57 const uno::Sequence<beans::Property> tgtprops
58 = xTargetUDSet->getPropertySetInfo()->getProperties();
60 for (
const auto& rTgtProp : tgtprops) {
62 xTargetUD->removeProperty(rTgtProp.Name);
63 }
catch (uno::Exception &) {
68 uno::Reference<beans::XPropertySetInfo> xSetInfo
69 = xSourceUDSet->getPropertySetInfo();
70 const uno::Sequence<beans::Property> srcprops = xSetInfo->getProperties();
72 for (
const auto& rSrcProp : srcprops) {
74 OUString
name = rSrcProp.Name;
75 xTargetUD->addProperty(
name, rSrcProp.Attributes,
76 xSourceUDSet->getPropertyValue(
name));
77 }
catch (uno::Exception &) {
85 uno::Reference<document::XDocumentPropertiesSupplier> xSourceDPS(
87 uno::Reference<document::XDocumentProperties> xSourceDocProps(
88 xSourceDPS->getDocumentProperties() );
89 OSL_ENSURE(xSourceDocProps.is(),
"null reference");
91 uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
93 uno::Reference<document::XDocumentProperties> xDocProps(
94 xDPS->getDocumentProperties() );
95 OSL_ENSURE(xDocProps.is(),
"null reference");
97 xDocProps->setAuthor(xSourceDocProps->getAuthor());
98 xDocProps->setGenerator(xSourceDocProps->getGenerator());
99 xDocProps->setCreationDate(xSourceDocProps->getCreationDate());
100 xDocProps->setTitle(xSourceDocProps->getTitle());
101 xDocProps->setSubject(xSourceDocProps->getSubject());
102 xDocProps->setDescription(xSourceDocProps->getDescription());
103 xDocProps->setKeywords(xSourceDocProps->getKeywords());
104 xDocProps->setLanguage(xSourceDocProps->getLanguage());
106 xDocProps->setModifiedBy(xSourceDocProps->getModifiedBy());
107 xDocProps->setModificationDate(xSourceDocProps->getModificationDate());
108 xDocProps->setPrintedBy(xSourceDocProps->getPrintedBy());
109 xDocProps->setPrintDate(xSourceDocProps->getPrintDate());
110 xDocProps->setTemplateName(xSourceDocProps->getTemplateName());
111 xDocProps->setTemplateURL(xSourceDocProps->getTemplateURL());
112 xDocProps->setTemplateDate(xSourceDocProps->getTemplateDate());
113 xDocProps->setAutoloadURL(xSourceDocProps->getAutoloadURL());
114 xDocProps->setAutoloadSecs(xSourceDocProps->getAutoloadSecs());
115 xDocProps->setDefaultTarget(xSourceDocProps->getDefaultTarget());
116 xDocProps->setDocumentStatistics(xSourceDocProps->getDocumentStatistics());
117 xDocProps->setEditingCycles(xSourceDocProps->getEditingCycles());
118 xDocProps->setEditingDuration(xSourceDocProps->getEditingDuration());
124 xDocProps->setCreationDate( xSourceDocProps->getModificationDate() );
135 const sal_uInt16 nIdx = rBlock.
GetIndex( rEntry );
136 if( USHRT_MAX != nIdx )
159 OSL_ENSURE(pGDoc->
GetDocShell(),
"no SwDocShell at glossary");
170 SwPaM aCpyPam( pTableNd ? *
const_cast<SwNode*
>(
static_cast<SwNode const *
>(pTableNd)) : *
static_cast<SwNode*
>(pContentNd) );
180 SwPaM *_pStartCursor = &rPaM, *_pStartCursor2 = _pStartCursor;
185 FindTableBoxStartNode());
204 }
while( (_pStartCursor = _pStartCursor->
GetNext()) !=
@ CheckPosInFly
check if target position is in fly anchored at source range
virtual bool CopyRange(SwPaM &rPam, SwPosition &rPos, SwCopyFlags flags) const =0
Copy a selected content range to a position.
virtual bool DelFullPara(SwPaM &)=0
Delete full paragraphs.
virtual void LockExpFields()=0
virtual void SetFixFields(const DateTime *pNewDateTime)=0
virtual void UpdateExpFields(SwTextField *pField, bool bUpdateRefFields)=0
virtual void UnlockExpFields()=0
css::uno::Reference< css::frame::XModel3 > GetModel() const
virtual sal_Int32 Len() const
void SaveTableBoxContent(const SwPosition *pPos=nullptr)
bool InsertGlossary(SwTextBlocks &rBlock, const OUString &rEntry, SwPaM &rPaM, SwCursorShell *pShell=nullptr)
inserts an AutoText block
IDocumentContentOperations const & getIDocumentContentOperations() const
IDocumentUndoRedo & GetIDocumentUndoRedo()
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
void ReplaceDocumentProperties(const SwDoc &rSource, bool mailMerge=false)
Replace document properties with those from rSource.
void ReplaceUserDefinedDocumentProperties(const css::uno::Reference< css::document::XDocumentProperties > &xSourceDocProps)
Replace all user defined document properties with xSourceDocProps.
void ClearBoxNumAttrs(SwNode &rNode)
SwDocShell * GetDocShell()
void RestoreDontExpandItems(const SwPosition &rPos)
void SaveDontExpandItems(const SwPosition &rPos)
Marks a node in the document model.
Base class of the Writer document model elements.
SwNodeOffset GetIndex() const
SwTableNode * FindTableNode()
Search table node, in which it is.
SwNodeOffset EndOfSectionIndex() const
SwNode & GetEndOfExtras() const
This is the last EndNode of a special section.
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
SwContentNode * GoNext(SwNodeIndex *) const
PaM is Point and Mark: a selection of the document model.
const SwPosition * GetMark() const
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
SwContentNode * GetPointContentNode() const
const SwPosition * GetPoint() const
Starts a section of nodes in the document model.
bool BeginGetDoc(sal_uInt16)
bool IsOnlyTextBlock(sal_uInt16) const
sal_uInt16 GetIndex(const OUString &) const
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
Marks a position in the document model.
void Assign(const SwNode &rNd, SwNodeOffset nDelta, sal_Int32 nContentOffset=0)
These all set both nNode and nContent.
void SetContent(sal_Int32 nContentIndex)
Set content index, only valid to call this if the position points to a SwContentNode subclass.