summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorDaniel Vogelheim <dvo@openoffice.org>2001-01-02 13:05:02 +0000
committerDaniel Vogelheim <dvo@openoffice.org>2001-01-02 13:05:02 +0000
commit79db5ab936dc694c67ab9d8b6a80f81907b7c11f (patch)
tree534bca9bf793ea978e0bec07315fdd864f467dbf /xmloff
parent5ba0fa6e20a85ce5f5a42daee77fc6f7780dd55f (diff)
- added: events in Hyperlinks
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/text/txtimp.cxx34
-rw-r--r--xmloff/source/text/txtparae.cxx18
-rw-r--r--xmloff/source/text/txtparai.cxx62
3 files changed, 93 insertions, 21 deletions
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index eaf868ec3c90..c33231cb8d14 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: txtimp.cxx,v $
*
- * $Revision: 1.34 $
+ * $Revision: 1.35 $
*
- * last change: $Author: sab $ $Date: 2000-12-21 17:53:29 $
+ * last change: $Author: dvo $ $Date: 2001-01-02 14:05:02 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -179,6 +179,9 @@
#ifndef _XMLOFF_NMSPMAP_HXX
#include "nmspmap.hxx"
#endif
+#ifndef _XMLOFF_XMLEVENTSIMPORTCONTEXT_HXX
+#include "XMLEventsImportContext.hxx"
+#endif
using namespace ::rtl;
@@ -495,7 +498,8 @@ XMLTextImportHelper::XMLTextImportHelper(
sVisitedCharStyleName(RTL_CONSTASCII_USTRINGPARAM("VisitedCharStyleName")),
sTextFrame(RTL_CONSTASCII_USTRINGPARAM("TextFrame")),
sPageDescName(RTL_CONSTASCII_USTRINGPARAM("PageDescName")),
- sServerMap(RTL_CONSTASCII_USTRINGPARAM("ServerMap"))
+ sServerMap(RTL_CONSTASCII_USTRINGPARAM("ServerMap")),
+ sHyperLinkEvents(RTL_CONSTASCII_USTRINGPARAM("HyperLinkEvents"))
{
Reference< XChapterNumberingSupplier > xCNSupplier( rModel, UNO_QUERY );
@@ -884,7 +888,8 @@ void XMLTextImportHelper::SetHyperlink(
const OUString& rName,
const OUString& rTargetFrameName,
const OUString& rStyleName,
- const OUString& rVisitedStyleName )
+ const OUString& rVisitedStyleName,
+ XMLEventsImportContext* pEvents)
{
Reference < XPropertySet > xPropSet( rCursor, UNO_QUERY );
Reference < XPropertySetInfo > xPropSetInfo =
@@ -908,6 +913,27 @@ void XMLTextImportHelper::SetHyperlink(
xPropSet->setPropertyValue( sHyperLinkTarget, aAny );
}
+ if ( (pEvents != NULL) &&
+ xPropSetInfo->hasPropertyByName( sHyperLinkEvents ))
+ {
+ // The API treats events at hyperlinks differently from most
+ // other properties: You have to set a name replace with the
+ // events in it. The easiest way to to this is to 1) get
+ // events, 2) set new ones, and 3) then put events back.
+ aAny = xPropSet->getPropertyValue( sHyperLinkEvents );
+ Reference<XNameReplace> xReplace;
+ aAny >>= xReplace;
+ if (xReplace.is())
+ {
+ // set events
+ pEvents->SetEvents(xReplace);
+
+ // put events
+ aAny <<= xReplace;
+ xPropSet->setPropertyValue( sHyperLinkEvents, aAny );
+ }
+ }
+
if( xTextStyles.is() )
{
if( rStyleName.getLength() &&
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index ae13b5903dd9..c659cb3bf786 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: txtparae.cxx,v $
*
- * $Revision: 1.39 $
+ * $Revision: 1.40 $
*
- * last change: $Author: dvo $ $Date: 2000-12-19 18:56:46 $
+ * last change: $Author: dvo $ $Date: 2001-01-02 14:05:02 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -2095,6 +2095,18 @@ void XMLTextParagraphExport::exportTextRange(
addHyperlinkAttributes( xPropSet, xPropState, xPropSetInfo );
SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT,
sXML_a, sal_False, sal_False );
+
+ // export events (if supported)
+ OUString sHyperLinkEvents(RTL_CONSTASCII_USTRINGPARAM(
+ "HyperLinkEvents"));
+ if (xPropSetInfo->hasPropertyByName(sHyperLinkEvents))
+ {
+ Any aAny = xPropSet->getPropertyValue(sHyperLinkEvents);
+ Reference<XNameReplace> xName;
+ aAny >>= xName;
+ GetExport().GetEventExport().Export(xName, sal_False);
+ }
+
_exportTextRange( rTextRange, xPropSet, rPrevCharIsSpace );
}
else
@@ -2261,5 +2273,3 @@ void XMLTextParagraphExport::exportTextAutoStyles()
GetExport().GetNamespaceMap() );
pListAutoPool->exportXML();
}
-
-
diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx
index 566658b4fff0..8327802053e8 100644
--- a/xmloff/source/text/txtparai.cxx
+++ b/xmloff/source/text/txtparai.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: txtparai.cxx,v $
*
- * $Revision: 1.14 $
+ * $Revision: 1.15 $
*
- * last change: $Author: dvo $ $Date: 2000-12-19 12:47:03 $
+ * last change: $Author: dvo $ $Date: 2001-01-02 14:05:02 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -136,6 +136,9 @@
#ifndef _XMLTEXTFRAMEHYPERLINKCONTEXT_HXX
#include "XMLTextFrameHyperlinkContext.hxx"
#endif
+#ifndef _XMLOFF_XMLEVENTSIMPORTCONTEXT_HXX
+#include "XMLEventsImportContext.hxx"
+#endif
using namespace ::rtl;
using namespace ::com::sun::star;
@@ -235,15 +238,21 @@ class XMLHyperlinkHint_Impl : public XMLHint_Impl
OUString sTargetFrameName;
OUString sStyleName;
OUString sVisitedStyleName;
+ XMLEventsImportContext* pEvents;
public:
XMLHyperlinkHint_Impl( const Reference < XTextRange > & rPos ) :
- XMLHint_Impl( XML_HINT_HYPERLINK, rPos, rPos )
+ XMLHint_Impl( XML_HINT_HYPERLINK, rPos, rPos ),
+ pEvents( NULL )
{
}
- virtual ~XMLHyperlinkHint_Impl() {}
+ virtual ~XMLHyperlinkHint_Impl()
+ {
+ if (NULL != pEvents)
+ pEvents->ReleaseRef();
+ }
void SetHRef( const OUString& s ) { sHRef = s; }
const OUString& GetHRef() const { return sHRef; }
@@ -255,8 +264,23 @@ public:
const OUString& GetStyleName() const { return sStyleName; }
void SetVisitedStyleName( const OUString& s ) { sVisitedStyleName = s; }
const OUString& GetVisitedStyleName() const { return sVisitedStyleName; }
+ XMLEventsImportContext* GetEventsContext() const;
+ void SetEventsContext( XMLEventsImportContext* pCtxt );
};
+void XMLHyperlinkHint_Impl::SetEventsContext( XMLEventsImportContext* pCtxt )
+{
+ pEvents = pCtxt;
+ if (pEvents != NULL)
+ pEvents->AddRef();
+}
+
+XMLEventsImportContext* XMLHyperlinkHint_Impl::GetEventsContext() const
+{
+ return pEvents;
+}
+
+
class XMLIndexMarkHint_Impl : public XMLHint_Impl
{
const Reference<beans::XPropertySet> xIndexMarkPropSet;
@@ -645,13 +669,24 @@ SvXMLImportContext *XMLImpHyperlinkContext_Impl::CreateChildContext(
sal_uInt16 nPrefix, const OUString& rLocalName,
const Reference< xml::sax::XAttributeList > & xAttrList )
{
- const SvXMLTokenMap& rTokenMap =
- GetImport().GetTextImport()->GetTextPElemTokenMap();
- sal_uInt16 nToken = rTokenMap.Get( nPrefix, rLocalName );
+ if ( (nPrefix == XML_NAMESPACE_SCRIPT) &&
+ (rLocalName.equalsAsciiL(sXML_events, sizeof(sXML_events)-1)))
+ {
+ XMLEventsImportContext* pCtxt = new XMLEventsImportContext(
+ GetImport(), nPrefix, rLocalName);
+ pHint->SetEventsContext(pCtxt);
+ return pCtxt;
+ }
+ else
+ {
+ const SvXMLTokenMap& rTokenMap =
+ GetImport().GetTextImport()->GetTextPElemTokenMap();
+ sal_uInt16 nToken = rTokenMap.Get( nPrefix, rLocalName );
- return XMLImpSpanContext_Impl::CreateChildContext( GetImport(), nPrefix,
- rLocalName, xAttrList,
- nToken, rHints, rIgnoreLeadingSpace );
+ return XMLImpSpanContext_Impl::CreateChildContext(
+ GetImport(), nPrefix, rLocalName, xAttrList,
+ nToken, rHints, rIgnoreLeadingSpace );
+ }
}
void XMLImpHyperlinkContext_Impl::Characters( const OUString& rChars )
@@ -1049,8 +1084,8 @@ void XMLIndexMarkImportContext_Impl::ProcessAttributes(
Reference<beans::XPropertySet>& rPropSet)
{
// process attributes
- sal_Int32 nLength = xAttrList->getLength();
- for(sal_Int32 i=0; i<nLength; i++)
+ sal_Int16 nLength = xAttrList->getLength();
+ for(sal_Int16 i=0; i<nLength; i++)
{
OUString sLocalName;
sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
@@ -1791,7 +1826,8 @@ XMLParaContext::~XMLParaContext()
pHHint->GetName(),
pHHint->GetTargetFrameName(),
pHHint->GetStyleName(),
- pHHint->GetVisitedStyleName() );
+ pHHint->GetVisitedStyleName(),
+ pHHint->GetEventsContext() );
}
break;
case XML_HINT_RUBY: