20 #include <config_features.h>
23 #include <osl/diagnose.h>
31 #include <com/sun/star/document/XEventsSupplier.hpp>
32 #include <com/sun/star/uno/Reference.hxx>
33 #include <com/sun/star/script/XLibraryContainer.hpp>
34 #include <com/sun/star/container/XNameContainer.hpp>
55 {
nullptr,
nullptr, SvMacroItemId::NONE }
72 bool bInsIntoBasic =
false,
73 bInsSrcIntoField =
false;
77 case HTMLScriptLanguage::StarBasic:
81 bInsSrcIntoField =
true;
102 bInsIntoBasic && IsNewDoc() )
114 aLibName =
"Standard";
119 if ( xModLibContainer.is() )
122 if ( xModLibContainer->hasByName( aLibName ) )
125 Any aElement = xModLibContainer->getByName( aLibName );
126 aElement >>= xModLib;
131 xModLib = xModLibContainer->createLibrary( aLibName );
149 if ( !xModLib->hasByName( aModName ) )
153 xModLib->insertByName( aModName , aElement );
161 if ( xDlgLibContainer.is() )
163 if ( !xDlgLibContainer->hasByName( aLibName ) )
166 xDlgLibContainer->createLibrary( aLibName );
182 if( aToken.getLength() > 2 &&
183 (HTMLScriptLanguage::StarBasic==
m_eScriptLang && aToken[ 0 ] ==
'\'') )
228 const OUString& rScrType )
230 OSL_ENSURE( !rName.isEmpty(),
"InsertBasicDocEvent() called without macro" );
231 if( rName.isEmpty() )
235 OSL_ENSURE( pDocSh,
"Where is the DocShell?" );
240 OUString sScriptType;
242 sScriptType = rScrType;
250 #if !HAVE_FEATURE_SCRIPTING
257 OSL_ENSURE( pBasicMan,
"Where is the Basic-Manager?" );
269 const OUString& rLibName = pBasic->
GetName();
270 for(
const auto& pModule: pBasic->
GetModules() )
291 const OUString& rModName = pModule->GetName();
295 &rLibName, &rModName,
304 "OnLoad",
"OnPrepareUnload",
"OnFocus",
"OnUnfocus"
315 uno::Reference< document::XEventsSupplier > xSup( pDocSh->
GetModel(), uno::UNO_QUERY );
316 uno::Reference < container::XNameReplace > xEvents = xSup->getEvents();
317 for ( sal_Int32
i=0;
i<4;
i++ )
326 if( !aDocTable.
empty() )
#define OOO_STRING_SVTOOLS_HTML_O_onload
static std::unique_ptr< SvxMacro > ConvertToMacro(const css::uno::Any &rElement, SfxObjectShell *pDoc)
HTMLOutEvent const aBodyEventTable[]
SvxMacro & Insert(SvMacroItemId nEvent, const SvxMacro &rMacro)
const OUString & GetBaseURL() const
TOOLS_DLLPUBLIC OString convertLineEnd(const OString &rIn, LineEnd eLineEnd)
void OutBasicBodyEvents()
#define OOO_STRING_SVTOOLS_HTML_O_onblur
const OUString & GetName(SbxNameType=SbxNameType::NONE) const
SwDocShell * GetDocShell()
#define OOO_STRING_SVTOOLS_HTML_META_content_script_type
static SVT_DLLPUBLIC SvStream & Out_Events(SvStream &, const SvxMacroTableDtor &, const HTMLOutEvent *, bool bOutStarBasic, rtl_TextEncoding eDestEnc, OUString *pNonConvertableChars)
#define OOO_STRING_SVTOOLS_HTML_meta
sal_uInt16 GetLibCount() const
static void ConfigureEvent(const OUString &aName, const SvxMacro &, SfxObjectShell const *pObjSh)
OUString m_aNonConvertableCharacters
SvStream & WriteOString(const OString &rStr)
css::uno::Reference< css::frame::XModel > GetModel() const
SvStream & WriteCharPtr(const char *pBuf)
void InsertBasicDocEvent(const OUString &aEventName, const OUString &rName, ScriptType eScrType, const OUString &rScrType)
void OutNewLine(bool bCheck=false)
static const char * aEventNames[]
LineEnd GetSystemLineEnd()
void OutBasic(const SwHTMLWriter &rHTMLWrt)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
void InsertAttr(const SfxPoolItem &rItem, bool bInsAtStart)
css::uno::Reference< css::script::XLibraryContainer > GetDialogContainer()
rtl_TextEncoding m_eDestEnc
#define OOO_STRING_SVTOOLS_HTML_O_SDonunload
#define OOO_STRING_SVTOOLS_HTML_O_SDonblur
#define OOO_STRING_SVTOOLS_HTML_SB_module
HTMLScriptLanguage m_eScriptLang
bool m_bIgnoreHTMLComments
static BasicManager * GetBasicManager()
#define OOO_STRING_SVTOOLS_HTML_O_SDonfocus
#define OOO_STRING_SVTOOLS_HTML_SB_library
#define OOO_STRING_SVTOOLS_HTML_O_onunload
OString strip(const OString &rIn, char c)
OString GetNamespace() const
Determines the prefix string needed to respect the requested namespace alias.
static SVT_DLLPUBLIC SvStream & OutScript(SvStream &rStrm, const OUString &rBaseURL, std::u16string_view rSource, const OUString &rLanguage, ScriptType eScriptType, const OUString &rSrc, const OUString *pSBLibrary, const OUString *pSBModule, rtl_TextEncoding eDestEnc=RTL_TEXTENCODING_MS_1252, OUString *pNonConvertableChars=nullptr)
#define OOO_STRING_SVTOOLS_HTML_O_content
#define OOO_STRING_SVTOOLS_HTML_O_SDonload
sal_uInt16 m_nSBModuleCnt
#define SVX_MACRO_LANGUAGE_STARBASIC
#define OOO_STRING_SVTOOLS_HTML_O_onfocus
rtl::Reference< SwDoc > m_xDoc
#define OOO_STRING_SVTOOLS_HTML_O_httpequiv
#define SAL_NEWLINE_STRING
BasicManager * GetBasicManager() const
css::uno::Reference< css::script::XLibraryContainer > GetBasicContainer()
StarBASIC * GetLib(sal_uInt16 nLib) const