summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2017-08-17 21:47:22 +0200
committerTamás Zolnai <tamas.zolnai@collabora.com>2017-08-17 23:11:15 +0200
commitc0cc02e2934aeb12dda44818955e5964496c186a (patch)
tree16f450bbe38e14d336bdbac3220b642b9a302a87 /writerfilter
parent8c0cc5cd7befffc6e8e6361ba67807a799cc997f (diff)
tdf#50097: DOCX: export form controls as MSO ActiveX controls
* Use the same structure for export what MSO uses ** Position and size information are exported as VML shape properties ** Different handling of inline and floating controls (pict or object) ** Do some changes on VML shape export to match how MSO exports these controls ** Write out activeX.xml and activeX.bin to store control properties ** Use persistStorage storage type defined in activeX.xml * Drop grabbaging of activex.XML and activeX.bin * Cleanup control related test code Change-Id: I38bb2b2ffd2676c5459b61ec2549c31348bab41c Signed-off-by: Tamás Zolnai <tamas.zolnai@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/41256 Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/inc/ooxml/OOXMLDocument.hxx4
-rw-r--r--writerfilter/source/filter/WriterFilter.cxx4
-rw-r--r--writerfilter/source/ooxml/OOXMLDocumentImpl.cxx78
-rw-r--r--writerfilter/source/ooxml/OOXMLDocumentImpl.hxx6
-rw-r--r--writerfilter/source/ooxml/OOXMLStreamImpl.cxx15
5 files changed, 3 insertions, 104 deletions
diff --git a/writerfilter/inc/ooxml/OOXMLDocument.hxx b/writerfilter/inc/ooxml/OOXMLDocument.hxx
index 8f0a12d3189c..909a5491b59a 100644
--- a/writerfilter/inc/ooxml/OOXMLDocument.hxx
+++ b/writerfilter/inc/ooxml/OOXMLDocument.hxx
@@ -75,7 +75,7 @@ class OOXMLStream
{
public:
enum StreamType_t { UNKNOWN, DOCUMENT, STYLES, WEBSETTINGS, FONTTABLE, NUMBERING,
- FOOTNOTES, ENDNOTES, COMMENTS, THEME, CUSTOMXML, CUSTOMXMLPROPS, ACTIVEX, ACTIVEXBIN, GLOSSARY, CHARTS, EMBEDDINGS, SETTINGS, VBAPROJECT, FOOTER, HEADER, VBADATA };
+ FOOTNOTES, ENDNOTES, COMMENTS, THEME, CUSTOMXML, CUSTOMXMLPROPS, GLOSSARY, CHARTS, EMBEDDINGS, SETTINGS, VBAPROJECT, FOOTER, HEADER, VBADATA };
typedef std::shared_ptr<OOXMLStream> Pointer_t;
virtual ~OOXMLStream() {}
@@ -230,8 +230,6 @@ public:
virtual css::uno::Sequence<css::uno::Sequence< css::uno::Any> > getGlossaryDomList() = 0;
virtual css::uno::Sequence<css::uno::Reference<css::xml::dom::XDocument> > getCustomXmlDomList( ) = 0;
virtual css::uno::Sequence<css::uno::Reference<css::xml::dom::XDocument> > getCustomXmlDomPropsList( ) = 0;
- virtual css::uno::Sequence<css::uno::Reference<css::xml::dom::XDocument> > getActiveXDomList( ) = 0;
- virtual css::uno::Sequence<css::uno::Reference<css::io::XInputStream> > getActiveXBinList() = 0;
virtual css::uno::Sequence<css::beans::PropertyValue > getEmbeddingsList() = 0;
};
diff --git a/writerfilter/source/filter/WriterFilter.cxx b/writerfilter/source/filter/WriterFilter.cxx
index 63c4d50a29be..2f49a4743cd2 100644
--- a/writerfilter/source/filter/WriterFilter.cxx
+++ b/writerfilter/source/filter/WriterFilter.cxx
@@ -227,10 +227,6 @@ sal_Bool WriterFilter::filter(const uno::Sequence< beans::PropertyValue >& aDesc
aGrabBagProperties["OOXCustomXml"] <<= pDocument->getCustomXmlDomList();
aGrabBagProperties["OOXCustomXmlProps"] <<= pDocument->getCustomXmlDomPropsList();
- // Adding the saved ActiveX DOM
- aGrabBagProperties["OOXActiveX"] <<= pDocument->getActiveXDomList();
- aGrabBagProperties["OOXActiveXBin"] <<= pDocument->getActiveXBinList();
-
// Adding the saved Glossary Documnet DOM to the document's grab bag
aGrabBagProperties["OOXGlossary"] <<= pDocument->getGlossaryDocDom();
aGrabBagProperties["OOXGlossaryDom"] <<= pDocument->getGlossaryDomList();
diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
index 119e6271d336..d884248e7908 100644
--- a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
+++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
@@ -169,10 +169,6 @@ uno::Reference<xml::dom::XDocument> OOXMLDocumentImpl::importSubStream(OOXMLStre
{
importSubStreamRelations(pStream, OOXMLStream::CUSTOMXMLPROPS);
}
- if(OOXMLStream::ACTIVEX == nType)
- {
- importSubStreamRelations(pStream, OOXMLStream::ACTIVEXBIN);
- }
if(OOXMLStream::CHARTS == nType)
{
importSubStreamRelations(pStream, OOXMLStream::EMBEDDINGS);
@@ -223,14 +219,8 @@ void OOXMLDocumentImpl::importSubStreamRelations(const OOXMLStream::Pointer_t& p
mxCustomXmlProsDom = xRelation;
}
}
- else if(OOXMLStream::ACTIVEXBIN == nType)
- {
- // imporing activex.bin files for activex.xml from activeX folder.
- mxActiveXBin = xcpInputStream;
- }
else if(OOXMLStream::EMBEDDINGS == nType)
{
- // imporing activex.bin files for activex.xml from activeX folder.
mxEmbeddings = xcpInputStream;
}
else if(OOXMLStream::CHARTS == nType)
@@ -485,8 +475,6 @@ void OOXMLDocumentImpl::resolve(Stream & rStream)
// Custom xml's are handled as part of grab bag.
resolveCustomXmlStream(rStream);
- resolveActiveXStream(rStream);
-
resolveFastSubStream(rStream, OOXMLStream::FONTTABLE);
resolveFastSubStream(rStream, OOXMLStream::STYLES);
resolveFastSubStream(rStream, OOXMLStream::NUMBERING);
@@ -796,62 +784,6 @@ void OOXMLDocumentImpl::resolveEmbeddingsStream(const OOXMLStream::Pointer_t& pS
mxEmbeddingsList = comphelper::containerToSequence(aEmbeddings);
}
-void OOXMLDocumentImpl::resolveActiveXStream(Stream & rStream)
-{
- // Resolving all ActiveX[n].xml files from ActiveX folder.
- uno::Reference<embed::XRelationshipAccess> xRelationshipAccess;
- xRelationshipAccess.set((dynamic_cast<OOXMLStreamImpl&>(*mpStream.get())).accessDocumentStream(), uno::UNO_QUERY);
- if (xRelationshipAccess.is())
- {
- static const char sCustomType[] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/control";
- static const char sCustomTypeStrict[] = "http://purl.oclc.org/ooxml/officeDocument/relationships/control";
- bool bFound = false;
- sal_Int32 counter = 0;
- uno::Sequence< uno::Sequence< beans::StringPair > > aSeqs = xRelationshipAccess->getAllRelationships();
- uno::Sequence<uno::Reference<xml::dom::XDocument> > xActiveXDomListTemp(aSeqs.getLength());
- uno::Sequence<uno::Reference<io::XInputStream> > xActiveXBinListTemp(aSeqs.getLength());
- for (sal_Int32 j = 0; j < aSeqs.getLength(); j++)
- {
- uno::Sequence< beans::StringPair > aSeq = aSeqs[j];
- for (sal_Int32 i = 0; i < aSeq.getLength(); i++)
- {
- beans::StringPair aPair = aSeq[i];
- // Need to resolve only ActiveX files from document relationships.
- // Skipping other files.
- if (aPair.Second == sCustomType ||
- aPair.Second == sCustomTypeStrict)
- bFound = true;
- else if(aPair.First == "Target" && bFound)
- {
- // Adding value to extern variable customTarget. It will be used in ooxmlstreamimpl
- // to ensure ActiveX.xml target is visited in lcl_getTarget.
- customTarget = aPair.Second;
- }
- }
- if(bFound)
- {
- uno::Reference<xml::dom::XDocument> activeXTemp = importSubStream(OOXMLStream::ACTIVEX);
- // This will add all ActiveX[n].xml to grabbag list.
- if(activeXTemp.is())
- {
- xActiveXDomListTemp[counter] = activeXTemp;
- if(mxActiveXBin.is())
- {
- xActiveXBinListTemp[counter] = mxActiveXBin;
- }
- counter++;
- resolveFastSubStream(rStream, OOXMLStream::ACTIVEX);
- }
- bFound = false;
- }
- }
- xActiveXDomListTemp.realloc(counter);
- xActiveXBinListTemp.realloc(counter);
- mxActiveXDomList = xActiveXDomListTemp;
- mxActiveXBinList = xActiveXBinListTemp;
- }
-}
-
uno::Reference<xml::dom::XDocument> OOXMLDocumentImpl::getGlossaryDocDom( )
{
return mxGlossaryDocDom;
@@ -934,16 +866,6 @@ uno::Sequence<uno::Reference<xml::dom::XDocument> > OOXMLDocumentImpl::getCustom
return mxCustomXmlDomPropsList;
}
-uno::Sequence<uno::Reference<xml::dom::XDocument> > OOXMLDocumentImpl::getActiveXDomList( )
-{
- return mxActiveXDomList;
-}
-
-uno::Sequence<uno::Reference<io::XInputStream> > OOXMLDocumentImpl::getActiveXBinList( )
-{
- return mxActiveXBinList;
-}
-
uno::Sequence<beans::PropertyValue > OOXMLDocumentImpl::getEmbeddingsList( )
{
return mxEmbeddingsList;
diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx b/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx
index adc834dd1146..48412cd64ffd 100644
--- a/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx
+++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx
@@ -49,9 +49,6 @@ class OOXMLDocumentImpl : public OOXMLDocument
css::uno::Sequence<css::uno::Reference<css::xml::dom::XDocument> > mxCustomXmlDomList;
css::uno::Sequence<css::uno::Reference<css::xml::dom::XDocument> > mxCustomXmlDomPropsList;
css::uno::Reference<css::xml::dom::XDocument> mxCustomXmlProsDom;
- css::uno::Sequence<css::uno::Reference<css::xml::dom::XDocument> > mxActiveXDomList;
- css::uno::Sequence<css::uno::Reference<css::io::XInputStream> > mxActiveXBinList;
- css::uno::Reference<css::io::XInputStream> mxActiveXBin;
css::uno::Reference<css::io::XInputStream> mxEmbeddings;
css::uno::Sequence < css::beans::PropertyValue > mxEmbeddingsList;
std::vector<css::beans::PropertyValue> aEmbeddings;
@@ -90,7 +87,6 @@ protected:
const sal_Int32 nNoteId);
void resolveCustomXmlStream(Stream & rStream);
- void resolveActiveXStream(Stream & rStream);
void resolveGlossaryStream(Stream & rStream);
void resolveEmbeddingsStream(const OOXMLStream::Pointer_t& pStream);
public:
@@ -135,8 +131,6 @@ public:
virtual css::uno::Reference<css::xml::dom::XDocument> getThemeDom() override;
virtual css::uno::Sequence<css::uno::Reference<css::xml::dom::XDocument> > getCustomXmlDomList() override;
virtual css::uno::Sequence<css::uno::Reference<css::xml::dom::XDocument> > getCustomXmlDomPropsList() override;
- virtual css::uno::Sequence<css::uno::Reference<css::xml::dom::XDocument> > getActiveXDomList() override;
- virtual css::uno::Sequence<css::uno::Reference<css::io::XInputStream> > getActiveXBinList() override;
virtual css::uno::Reference<css::xml::dom::XDocument> getGlossaryDocDom() override;
virtual css::uno::Sequence<css::uno::Sequence< css::uno::Any> > getGlossaryDomList() override;
virtual css::uno::Sequence<css::beans::PropertyValue > getEmbeddingsList() override;
diff --git a/writerfilter/source/ooxml/OOXMLStreamImpl.cxx b/writerfilter/source/ooxml/OOXMLStreamImpl.cxx
index 3267e89ee6b2..e8ae8c1dca20 100644
--- a/writerfilter/source/ooxml/OOXMLStreamImpl.cxx
+++ b/writerfilter/source/ooxml/OOXMLStreamImpl.cxx
@@ -141,8 +141,6 @@ bool OOXMLStreamImpl::lcl_getTarget(const uno::Reference<embed::XRelationshipAcc
static const char sThemeType[] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme";
static const char sCustomType[] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml";
static const char sCustomPropsType[] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps";
- static const char sActiveXType[] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/control";
- static const char sActiveXBinType[] = "http://schemas.microsoft.com/office/2006/relationships/activeXControlBinary";
static const char sGlossaryType[] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/glossaryDocument";
static const char sWebSettings[] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings";
static const char sSettingsType[] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings";
@@ -162,7 +160,6 @@ bool OOXMLStreamImpl::lcl_getTarget(const uno::Reference<embed::XRelationshipAcc
static const char sThemeTypeStrict[] = "http://purl.oclc.org/ooxml/officeDocument/relationships/theme";
static const char sCustomTypeStrict[] = "http://purl.oclc.org/ooxml/officeDocument/relationships/customXml";
static const char sCustomPropsTypeStrict[] = "http://purl.oclc.org/ooxml/officeDocument/relationships/customXmlProps";
- static const char sActiveXTypeStrict[] = "http://purl.oclc.org/ooxml/officeDocument/relationships/control";
static const char sGlossaryTypeStrict[] = "http://purl.oclc.org/ooxml/officeDocument/relationships/glossaryDocument";
static const char sWebSettingsStrict[] = "http://purl.oclc.org/ooxml/officeDocument/relationships/webSettings";
static const char sSettingsTypeStrict[] = "http://purl.oclc.org/ooxml/officeDocument/relationships/settings";
@@ -227,14 +224,6 @@ bool OOXMLStreamImpl::lcl_getTarget(const uno::Reference<embed::XRelationshipAcc
sStreamType = sCustomPropsType;
sStreamTypeStrict = sCustomPropsTypeStrict;
break;
- case ACTIVEX:
- sStreamType = sActiveXType;
- sStreamTypeStrict = sActiveXTypeStrict;
- break;
- case ACTIVEXBIN:
- sStreamType = sActiveXBinType;
- sStreamTypeStrict = sActiveXBinType;
- break;
case SETTINGS:
sStreamType = sSettingsType;
sStreamTypeStrict = sSettingsTypeStrict;
@@ -298,8 +287,8 @@ bool OOXMLStreamImpl::lcl_getTarget(const uno::Reference<embed::XRelationshipAcc
bFound = true;
else if (rPair.First == sTarget)
{
- // checking item[n].xml or activex[n].xml is not visited already.
- if(customTarget != rPair.Second && (sStreamType == sCustomType || sStreamType == sActiveXType || sStreamType == sChartType || sStreamType == sFooterType || sStreamType == sHeaderType))
+ // checking item[n].xml is not visited already.
+ if(customTarget != rPair.Second && (sStreamType == sCustomType || sStreamType == sChartType || sStreamType == sFooterType || sStreamType == sHeaderType))
{
bFound = false;
}