summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorAndreas Heinisch <andreas.heinisch@yahoo.de>2022-04-15 10:00:37 +0200
committerAndreas Heinisch <andreas.heinisch@yahoo.de>2022-04-25 22:10:42 +0200
commite4bdf75260169898f3204cae7071d91da5946e09 (patch)
tree318802663a0374455fb05b4784cc438206c97301 /basic
parent2bb3587f5e7b1ee1fcb7163419c21144258ebf00 (diff)
tdf#75263 - Export VBA-Project using detected charset on import
Change-Id: Ia1f1bb31e077dcb4293c1106ac324a25a975a656 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133064 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
Diffstat (limited to 'basic')
-rw-r--r--basic/source/inc/namecont.hxx26
-rw-r--r--basic/source/uno/namecont.cxx46
2 files changed, 71 insertions, 1 deletions
diff --git a/basic/source/inc/namecont.hxx b/basic/source/inc/namecont.hxx
index 5635c91144e0..5be51b159e95 100644
--- a/basic/source/inc/namecont.hxx
+++ b/basic/source/inc/namecont.hxx
@@ -37,6 +37,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/deployment/XPackage.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/script/vba/XVBACompatibility.hpp>
#include <com/sun/star/script/vba/XVBAScriptListener.hpp>
#include <com/sun/star/util/XChangesNotifier.hpp>
@@ -170,7 +171,8 @@ typedef ::cppu::WeakComponentImplHelper<
css::container::XContainer,
css::script::XLibraryQueryExecutable,
css::script::vba::XVBACompatibility,
- css::lang::XServiceInfo > SfxLibraryContainer_BASE;
+ css::lang::XServiceInfo,
+ css::beans::XPropertySet> SfxLibraryContainer_BASE;
class SfxLibraryContainer
: public ::cppu::BaseMutex
@@ -181,6 +183,7 @@ class SfxLibraryContainer
sal_Int32 mnRunningVBAScripts;
bool mbVBACompat;
OUString msProjectName;
+ rtl_TextEncoding meVBATextEncoding;
protected:
css::uno::Reference< css::uno::XComponentContext > mxContext;
css::uno::Reference< css::ucb::XSimpleFileAccess3 > mxSFI;
@@ -328,6 +331,7 @@ private:
void init_Impl( const OUString& rInitialDocumentURL,
const css::uno::Reference< css::embed::XStorage >& _rxInitialStorage );
void implScanExtensions();
+ static constexpr OUStringLiteral sVBATextEncodingPropName = u"VBATextEncoding";
public:
SfxLibraryContainer();
@@ -423,6 +427,26 @@ public:
virtual void SAL_CALL removeVBAScriptListener(
const css::uno::Reference< css::script::vba::XVBAScriptListener >& Listener ) override;
virtual void SAL_CALL broadcastVBAScriptEvent( sal_Int32 nIdentifier, const OUString& rModuleName ) override;
+
+ // css::beans::XPropertySet
+ virtual css::uno::Reference<css::beans::XPropertySetInfo>
+ SAL_CALL getPropertySetInfo() override;
+ virtual void SAL_CALL setPropertyValue(const OUString& aPropertyName,
+ const css::uno::Any& aValue) override;
+ virtual css::uno::Any SAL_CALL getPropertyValue(const OUString& PropertyName) override;
+ virtual void SAL_CALL addPropertyChangeListener(
+ const OUString& aPropertyName,
+ const css::uno::Reference<css::beans::XPropertyChangeListener>& xListener) override;
+ virtual void SAL_CALL removePropertyChangeListener(
+ const OUString& aPropertyName,
+ const css::uno::Reference<css::beans::XPropertyChangeListener>& aListener) override;
+ virtual void SAL_CALL addVetoableChangeListener(
+ const OUString& PropertyName,
+ const css::uno::Reference<css::beans::XVetoableChangeListener>& aListener) override;
+ virtual void SAL_CALL removeVetoableChangeListener(
+ const OUString& PropertyName,
+ const css::uno::Reference<css::beans::XVetoableChangeListener>& aListener) override;
+
};
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index b92f5a590617..21baaf99fb5c 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -25,6 +25,7 @@
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/embed/XTransactedObject.hpp>
#include <com/sun/star/io/IOException.hpp>
+#include <com/sun/star/lang/NoSupportException.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/ucb/ContentCreationException.hpp>
@@ -2867,6 +2868,51 @@ void SAL_CALL SfxLibraryContainer::broadcastVBAScriptEvent( sal_Int32 nIdentifie
maVBAScriptListeners.notifyEach( &css::script::vba::XVBAScriptListener::notifyVBAScriptEvent, aEvent );
}
+// Methods XPropertySet
+css::uno::Reference<css::beans::XPropertySetInfo> SAL_CALL SfxLibraryContainer::getPropertySetInfo()
+{
+ return uno::Reference<beans::XPropertySetInfo>();
+}
+
+void SAL_CALL SfxLibraryContainer::setPropertyValue(const OUString& aPropertyName,
+ const uno::Any& aValue)
+{
+ if (aPropertyName != sVBATextEncodingPropName)
+ throw UnknownPropertyException(aPropertyName, static_cast<uno::XWeak*>(this));
+ aValue >>= meVBATextEncoding;
+}
+
+css::uno::Any SAL_CALL SfxLibraryContainer::getPropertyValue(const OUString& aPropertyName)
+{
+ if (aPropertyName == sVBATextEncodingPropName)
+ return uno::makeAny(meVBATextEncoding);
+ throw UnknownPropertyException(aPropertyName, static_cast<uno::XWeak*>(this));
+}
+
+void SAL_CALL SfxLibraryContainer::addPropertyChangeListener(
+ const OUString& /* aPropertyName */, const Reference<XPropertyChangeListener>& /* xListener */)
+{
+ throw NoSupportException();
+}
+
+void SAL_CALL SfxLibraryContainer::removePropertyChangeListener(
+ const OUString& /* aPropertyName */, const Reference<XPropertyChangeListener>& /* aListener */)
+{
+ throw NoSupportException();
+}
+
+void SAL_CALL SfxLibraryContainer::addVetoableChangeListener(
+ const OUString& /* PropertyName */, const Reference<XVetoableChangeListener>& /* aListener */)
+{
+ throw NoSupportException();
+}
+
+void SAL_CALL SfxLibraryContainer::removeVetoableChangeListener(
+ const OUString& /* PropertyName */, const Reference<XVetoableChangeListener>& /* aListener */)
+{
+ throw NoSupportException();
+}
+
// Methods XServiceInfo
sal_Bool SAL_CALL SfxLibraryContainer::supportsService( const OUString& _rServiceName )
{