summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2017-08-23 17:46:30 +0200
committerAndras Timar <andras.timar@collabora.com>2017-08-25 15:31:15 +0200
commit9b40796fd3e8f724d69a343e0444220b69a6d6ab (patch)
tree777eeff0e42ce26e6011cf01c014dcba144f29cc /writerfilter
parent8170245a9d9b9aeff913e0b3477fc2a9d508af80 (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 Signed-off-by: Tamás Zolnai <tamas.zolnai@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/41256 Tested-by: Jenkins <ci@libreoffice.org> (cherry picked from commit c0cc02e2934aeb12dda44818955e5964496c186a) Change-Id: I38bb2b2ffd2676c5459b61ec2549c31348bab41c This test intended to be an export test Change-Id: Ib233bd603185efdb85ed30f3d00c28512d57a0ac Reviewed-on: https://gerrit.libreoffice.org/41355 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> (cherry picked from commit a7e8c5304b740cb4e03e25b7217ce6071c29c09b) Fix two issues in ActiveX DOCX import / export code * Inline anchored VML shape had wrong vertical position ** In MSO inline shapes are positioned to the top of the baseline * During export all shape ids were the same (shape_0) ** VML shapes used to be exported only as fallback, I guess that's why it did not cause any issue before. ** Override the shapeid generator with a new one, which actually generates unique shapeids. Reviewed-on: https://gerrit.libreoffice.org/41319 Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com> (cherry picked from commit 2d1fe7fb67ec1ff1b96912c0945d17d54aecb12e) Change-Id: I752f39d092d0b61d91824141655dae662dbeafbc DOCX: Fix an other test case of ActiveX control export When LO control is anchored to the end of the run, it is exported into a new run. Reviewed-on: https://gerrit.libreoffice.org/41472 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> (cherry picked from commit b129421764ae78a1422812169fce8eb4914a6b22) Change-Id: I9269fd1b34924780aad61c452d1e2094dc8e4aad Reviewed-on: https://gerrit.libreoffice.org/41484 Reviewed-by: Andras Timar <andras.timar@collabora.com> Tested-by: Andras Timar <andras.timar@collabora.com>
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.cxx79
-rw-r--r--writerfilter/source/ooxml/OOXMLDocumentImpl.hxx6
-rw-r--r--writerfilter/source/ooxml/OOXMLStreamImpl.cxx15
5 files changed, 3 insertions, 105 deletions
diff --git a/writerfilter/inc/ooxml/OOXMLDocument.hxx b/writerfilter/inc/ooxml/OOXMLDocument.hxx
index 1b33336c8996..123c26f8b301 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, SIGNATURE, VBADATA };
+ FOOTNOTES, ENDNOTES, COMMENTS, THEME, CUSTOMXML, CUSTOMXMLPROPS, GLOSSARY, CHARTS, EMBEDDINGS, SETTINGS, VBAPROJECT, FOOTER, HEADER, SIGNATURE, VBADATA };
typedef std::shared_ptr<OOXMLStream> Pointer_t;
virtual ~OOXMLStream() {}
@@ -226,8 +226,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 4a1ce7762e3c..206640bda607 100644
--- a/writerfilter/source/filter/WriterFilter.cxx
+++ b/writerfilter/source/filter/WriterFilter.cxx
@@ -225,10 +225,6 @@ sal_Bool WriterFilter::filter(const uno::Sequence< beans::PropertyValue >& aDesc
aGrabBagProperties["OOXCustomXml"] = uno::makeAny(pDocument->getCustomXmlDomList());
aGrabBagProperties["OOXCustomXmlProps"] = uno::makeAny(pDocument->getCustomXmlDomPropsList());
- // Adding the saved ActiveX DOM
- aGrabBagProperties["OOXActiveX"] = uno::makeAny(pDocument->getActiveXDomList());
- aGrabBagProperties["OOXActiveXBin"] = uno::makeAny(pDocument->getActiveXBinList());
-
// Adding the saved Glossary Documnet DOM to the document's grab bag
aGrabBagProperties["OOXGlossary"] = uno::makeAny(pDocument->getGlossaryDocDom());
aGrabBagProperties["OOXGlossaryDom"] = uno::makeAny(pDocument->getGlossaryDomList());
diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
index d313078f22a6..0f0e11bd7fb7 100644
--- a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
+++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
@@ -167,10 +167,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);
@@ -221,14 +217,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)
@@ -493,8 +483,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);
@@ -804,63 +792,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";
- OUString sTarget("Target");
- 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 == sTarget && 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;
@@ -928,16 +859,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 43bdeb651d78..5c9bd0b1bff5 100644
--- a/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx
+++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx
@@ -48,9 +48,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;
bool mbIsSubstream;
@@ -88,7 +85,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:
@@ -131,8 +127,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 fe26b58cbe93..3d3a6a0b268e 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";
@@ -163,7 +161,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";
@@ -228,14 +225,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;
@@ -302,8 +291,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;
}