summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/inc/fmtmeta.hxx10
-rw-r--r--sw/source/core/txtnode/fmtatr2.cxx18
-rw-r--r--sw/source/filter/ww8/rtfexport.cxx7
-rw-r--r--sw/source/uibase/dochdl/swdtflvr.cxx3
4 files changed, 37 insertions, 1 deletions
diff --git a/sw/inc/fmtmeta.hxx b/sw/inc/fmtmeta.hxx
index ab1ac82ddefb..eb276dfc2690 100644
--- a/sw/inc/fmtmeta.hxx
+++ b/sw/inc/fmtmeta.hxx
@@ -31,6 +31,9 @@
#include <vector>
namespace com { namespace sun { namespace star {
+ namespace document {
+ class XDocumentProperties;
+ }
namespace text {
class XTextField;
}
@@ -190,12 +193,14 @@ public:
};
/// knows all meta-fields in the document.
-class MetaFieldManager
+class SW_DLLPUBLIC MetaFieldManager
: private ::boost::noncopyable
{
private:
typedef ::std::vector< std::weak_ptr<MetaField> > MetaFieldList_t;
MetaFieldList_t m_MetaFields;
+ /// Document properties of a clipboard document, empty for non-clipboard documents.
+ css::uno::Reference<css::document::XDocumentProperties> m_xDocumentProperties;
public:
MetaFieldManager();
@@ -205,6 +210,9 @@ public:
const bool bIsFixedLanguage = false );
/// get all meta fields
::std::vector< css::uno::Reference<css::text::XTextField> > getMetaFields();
+ /// Copy document properties from rSource to m_xDocumentProperties.
+ void copyDocumentProperties(const SwDoc& rSource);
+ css::uno::Reference<css::document::XDocumentProperties> getDocumentProperties();
};
} // namespace sw
diff --git a/sw/source/core/txtnode/fmtatr2.cxx b/sw/source/core/txtnode/fmtatr2.cxx
index d709111e6a56..d4a481268029 100644
--- a/sw/source/core/txtnode/fmtatr2.cxx
+++ b/sw/source/core/txtnode/fmtatr2.cxx
@@ -36,6 +36,8 @@
#include <unostyle.hxx>
#include <unoevent.hxx>
#include <com/sun/star/text/RubyAdjust.hpp>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
#include <cmdid.h>
#include <com/sun/star/uno/Any.h>
@@ -827,6 +829,22 @@ MetaFieldManager::getMetaFields()
return ret;
}
+void MetaFieldManager::copyDocumentProperties(const SwDoc& rSource)
+{
+ const SwDocShell* pDocShell = rSource.GetDocShell();
+ if (!pDocShell)
+ return;
+
+ uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(pDocShell->GetModel(), uno::UNO_QUERY);
+ uno::Reference<util::XCloneable> xCloneable(xDocumentPropertiesSupplier->getDocumentProperties(), uno::UNO_QUERY);
+ m_xDocumentProperties.set(xCloneable->createClone(), uno::UNO_QUERY);
+}
+
+uno::Reference<document::XDocumentProperties> MetaFieldManager::getDocumentProperties()
+{
+ return m_xDocumentProperties;
+}
+
} // namespace sw
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx
index 2c3c88be8087..6ce10997629f 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -46,6 +46,7 @@
#endif
#include <svx/xflclit.hxx>
#include <editeng/hyphenzoneitem.hxx>
+#include <fmtmeta.hxx>
using namespace ::com::sun::star;
@@ -485,6 +486,12 @@ void RtfExport::WriteUserProps()
uno::Reference<document::XDocumentPropertiesSupplier> xDPS(pDocShell->GetModel(), uno::UNO_QUERY);
xDocProps.set(xDPS->getDocumentProperties());
}
+ else
+ {
+ // Clipboard document, read metadata from the meta field manager.
+ sw::MetaFieldManager& rManager = m_pDoc->GetMetaFieldManager();
+ xDocProps.set(rManager.getDocumentProperties());
+ }
if (xDocProps.is())
{
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 76ffde6c01b8..0e2b838b397a 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -123,6 +123,7 @@
#include <vcl/svapp.hxx>
#include <swserv.hxx>
#include <calbck.hxx>
+#include <fmtmeta.hxx>
#include <vcl/GraphicNativeTransform.hxx>
#include <vcl/GraphicNativeMetadata.hxx>
@@ -380,6 +381,8 @@ namespace
rDest.ReplaceStyles(rSrc, false);
rSrcWrtShell.Copy(&rDest);
+
+ rDest.GetMetaFieldManager().copyDocumentProperties(rSrc);
}
void lclCheckAndPerformRotation(Graphic& aGraphic)