summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2018-04-25 17:04:49 +0300
committerTor Lillqvist <tml@collabora.com>2018-05-31 15:46:25 +0300
commit034e8bfafadf3dfe930447696b7a686345aa6632 (patch)
tree8106381c203afb3d750219298d83296613f54718
parentb11329eed924483a24f2c05d97c573b9a95b26e8 (diff)
Add Author property to ooo::vba::excel::XWorkbook and implement it
Corresponds to the Author attribute of css::document::XDocumentProperties. I.e. the initial creator of the document. Change-Id: I07d3ce9dfb87900948d2bb7af14109b17546fb4c
-rw-r--r--oovbaapi/ooo/vba/excel/XWorkbook.idl1
-rw-r--r--sc/source/ui/vba/vbaworkbook.cxx18
-rw-r--r--sc/source/ui/vba/vbaworkbook.hxx2
3 files changed, 21 insertions, 0 deletions
diff --git a/oovbaapi/ooo/vba/excel/XWorkbook.idl b/oovbaapi/ooo/vba/excel/XWorkbook.idl
index 2c9b5871fdb6..fe310e2adc1a 100644
--- a/oovbaapi/ooo/vba/excel/XWorkbook.idl
+++ b/oovbaapi/ooo/vba/excel/XWorkbook.idl
@@ -32,6 +32,7 @@ interface XWorkbook
[attribute, readonly] string CodeName;
[attribute, readonly] long FileFormat;
[attribute] boolean PrecisionAsDisplayed;
+ [attribute] string Author;
any Worksheets( [in] any Index );
any Styles( [in] any Index ) raises (com::sun::star::script::BasicErrorException);
diff --git a/sc/source/ui/vba/vbaworkbook.cxx b/sc/source/ui/vba/vbaworkbook.cxx
index de08c8b59114..96ee2bf64a99 100644
--- a/sc/source/ui/vba/vbaworkbook.cxx
+++ b/sc/source/ui/vba/vbaworkbook.cxx
@@ -292,6 +292,24 @@ void SAL_CALL ScVbaWorkbook::setPrecisionAsDisplayed( sal_Bool _precisionAsDispl
rDoc.SetDocOptions( aOpt );
}
+OUString SAL_CALL ScVbaWorkbook::getAuthor()
+{
+ uno::Reference<document::XDocumentPropertiesSupplier> xDPS( getModel(), uno::UNO_QUERY );
+ if (!xDPS.is())
+ return OUString("?");
+ uno::Reference<document::XDocumentProperties> xDocProps = xDPS->getDocumentProperties();
+ return xDocProps->getAuthor();
+}
+
+void SAL_CALL ScVbaWorkbook::setAuthor( const OUString& _author )
+{
+ uno::Reference<document::XDocumentPropertiesSupplier> xDPS( getModel(), uno::UNO_QUERY );
+ if (!xDPS.is())
+ return;
+ uno::Reference<document::XDocumentProperties> xDocProps = xDPS->getDocumentProperties();
+ xDocProps->setAuthor( _author );
+}
+
void
ScVbaWorkbook::SaveCopyAs( const OUString& sFileName )
{
diff --git a/sc/source/ui/vba/vbaworkbook.hxx b/sc/source/ui/vba/vbaworkbook.hxx
index 25c4b188017c..6efaa938cfa8 100644
--- a/sc/source/ui/vba/vbaworkbook.hxx
+++ b/sc/source/ui/vba/vbaworkbook.hxx
@@ -44,6 +44,8 @@ public:
virtual css::uno::Reference< ov::excel::XWorksheet > SAL_CALL getActiveSheet() override;
virtual sal_Bool SAL_CALL getPrecisionAsDisplayed() override;
virtual void SAL_CALL setPrecisionAsDisplayed( sal_Bool _precisionAsDisplayed ) override;
+ virtual OUString SAL_CALL getAuthor() override;
+ virtual void SAL_CALL setAuthor( const OUString& _author ) override;
// Methods
virtual css::uno::Any SAL_CALL Worksheets( const css::uno::Any& aIndex ) override;