Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
0de4f894
Kaydet (Commit)
0de4f894
authored
Mar 26, 2019
tarafından
Tor Lillqvist
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add SaveAs2000() and SaveAs() to ooo.vba.word.XDocument and implement
Change-Id: If7e45e2f791a7806e6cf8e7fc9693e19e87d2dbb
üst
6a96ea63
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
117 additions
and
0 deletions
+117
-0
XDocument.idl
oovbaapi/ooo/vba/word/XDocument.idl
+3
-0
vbadocument.cxx
sw/source/ui/vba/vbadocument.cxx
+112
-0
vbadocument.hxx
sw/source/ui/vba/vbadocument.hxx
+2
-0
No files found.
oovbaapi/ooo/vba/word/XDocument.idl
Dosyayı görüntüle @
0de4f894
...
...
@@ -61,6 +61,9 @@ interface XDocument
void
ClosePrintPreview
()
;
any
Revisions
(
[
in
]
any
index
)
;
any
Frames
(
[
in
]
any
index
)
;
void
SaveAs2000
(
[
in
]
any
FileName
,
[
in
]
any
FileFormat
,
[
in
]
any
LockComments
,
[
in
]
any
Password
,
[
in
]
any
AddToRecentFiles
,
[
in
]
any
WritePassword
,
[
in
]
any
ReadOnlyRecommended
,
[
in
]
any
EmbedTrueTypeFonts
,
[
in
]
any
SaveNativePictureFormat
,
[
in
]
any
SaveFormsData
,
[
in
]
any
SaveAsAOCELetter
)
;
void
SaveAs
(
[
in
]
any
FileName
,
[
in
]
any
FileFormat
,
[
in
]
any
LockComments
,
[
in
]
any
Password
,
[
in
]
any
AddToRecentFiles
,
[
in
]
any
WritePassword
,
[
in
]
any
ReadOnlyRecommended
,
[
in
]
any
EmbedTrueTypeFonts
,
[
in
]
any
SaveNativePictureFormat
,
[
in
]
any
SaveFormsData
,
[
in
]
any
SaveAsAOCELetter
,
[
in
]
any
Encoding
,
[
in
]
any
InsertLineBreaks
,
[
in
]
any
AllowSubstitutions
,
[
in
]
any
LineEnding
,
[
in
]
any
AddBiDiMarks
)
;
}
;
}
; }; };
...
...
sw/source/ui/vba/vbadocument.cxx
Dosyayı görüntüle @
0de4f894
...
...
@@ -33,9 +33,13 @@
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
#include <com/sun/star/drawing/XControlShape.hpp>
#include <com/sun/star/form/XFormsSupplier.hpp>
#include <com/sun/star/frame/XStorable.hpp>
#include <com/sun/star/document/XRedlinesSupplier.hpp>
#include <com/sun/star/util/thePathSettings.hpp>
#include <ooo/vba/XControlProvider.hpp>
#include <ooo/vba/word/WdProtectionType.hpp>
#include <ooo/vba/word/WdSaveFormat.hpp>
#include <ooo/vba/word/XApplication.hpp>
#include <ooo/vba/word/XDocumentOutgoing.hpp>
#include <vbahelper/helperdecl.hxx>
...
...
@@ -450,6 +454,114 @@ SwVbaDocument::Frames( const uno::Any& index )
return
uno
::
makeAny
(
xCol
);
}
namespace
{
bool
setFilterPropsFromFormat
(
sal_Int32
nFormat
,
uno
::
Sequence
<
beans
::
PropertyValue
>&
rProps
)
{
bool
bRes
=
false
;
for
(
sal_Int32
index
=
0
;
index
<
rProps
.
getLength
();
++
index
)
{
if
(
rProps
[
index
].
Name
==
"FilterName"
)
{
switch
(
nFormat
)
{
case
word
:
:
WdSaveFormat
::
wdFormatDocument
:
rProps
[
index
].
Value
<<=
OUString
(
"MS Word 97"
);
break
;
// Just save all the text formats as "Text"
case
word
:
:
WdSaveFormat
::
wdFormatDOSText
:
case
word
:
:
WdSaveFormat
::
wdFormatDOSTextLineBreaks
:
case
word
:
:
WdSaveFormat
::
wdFormatEncodedText
:
case
word
:
:
WdSaveFormat
::
wdFormatText
:
case
word
:
:
WdSaveFormat
::
wdFormatTextLineBreaks
:
rProps
[
index
].
Value
<<=
OUString
(
"Text"
);
break
;
case
word
:
:
WdSaveFormat
::
wdFormatFilteredHTML
:
case
word
:
:
WdSaveFormat
::
wdFormatHTML
:
rProps
[
index
].
Value
<<=
OUString
(
"HTML"
);
break
;
case
word
:
:
WdSaveFormat
::
wdFormatRTF
:
rProps
[
index
].
Value
<<=
OUString
(
"Rich Text Format"
);
break
;
case
word
:
:
WdSaveFormat
::
wdFormatTemplate
:
rProps
[
index
].
Value
<<=
OUString
(
"MS Word 97 Vorlage"
);
break
;
// Default to "MS Word 97"
default
:
rProps
[
index
].
Value
<<=
OUString
(
"MS Word 97"
);
break
;
}
bRes
=
true
;
break
;
}
}
return
bRes
;
}
}
void
SAL_CALL
SwVbaDocument
::
SaveAs2000
(
const
uno
::
Any
&
FileName
,
const
uno
::
Any
&
FileFormat
,
const
uno
::
Any
&
/*LockComments*/
,
const
uno
::
Any
&
/*Password*/
,
const
uno
::
Any
&
/*AddToRecentFiles*/
,
const
uno
::
Any
&
/*WritePassword*/
,
const
uno
::
Any
&
/*ReadOnlyRecommended*/
,
const
uno
::
Any
&
/*EmbedTrueTypeFonts*/
,
const
uno
::
Any
&
/*SaveNativePictureFormat*/
,
const
uno
::
Any
&
/*SaveFormsData*/
,
const
uno
::
Any
&
/*SaveAsAOCELetter*/
)
{
// Based on ScVbaWorkbook::SaveAs.
OUString
sFileName
;
FileName
>>=
sFileName
;
OUString
sURL
;
osl
::
FileBase
::
getFileURLFromSystemPath
(
sFileName
,
sURL
);
// Detect if there is no path then we need to use the current folder.
INetURLObject
aURL
(
sURL
);
sURL
=
aURL
.
GetMainURL
(
INetURLObject
::
DecodeMechanism
::
ToIUri
);
if
(
sURL
.
isEmpty
()
)
{
// Need to add cur dir ( of this document ) or else the 'Work' dir
sURL
=
getModel
()
->
getURL
();
if
(
sURL
.
isEmpty
()
)
{
// Not path available from 'this' document. Need to add the 'document'/work directory then.
// Based on SwVbaOptions::getValueEvent()
uno
::
Reference
<
util
::
XPathSettings
>
xPathSettings
=
util
::
thePathSettings
::
get
(
comphelper
::
getProcessComponentContext
()
);
OUString
sPathUrl
;
xPathSettings
->
getPropertyValue
(
"Work"
)
>>=
sPathUrl
;
// Path could be a multipath, Microsoft doesn't support this feature in Word currently.
// Only the last path is from interest.
sal_Int32
nIndex
=
sPathUrl
.
lastIndexOf
(
';'
);
if
(
nIndex
!=
-
1
)
{
sPathUrl
=
sPathUrl
.
copy
(
nIndex
+
1
);
}
aURL
.
SetURL
(
sPathUrl
);
}
else
{
aURL
.
SetURL
(
sURL
);
aURL
.
Append
(
sFileName
);
}
sURL
=
aURL
.
GetMainURL
(
INetURLObject
::
DecodeMechanism
::
ToIUri
);
}
sal_Int32
nFileFormat
=
word
::
WdSaveFormat
::
wdFormatDocument
;
FileFormat
>>=
nFileFormat
;
uno
::
Sequence
<
beans
::
PropertyValue
>
storeProps
(
1
);
storeProps
[
0
].
Name
=
"FilterName"
;
setFilterPropsFromFormat
(
nFileFormat
,
storeProps
);
uno
::
Reference
<
frame
::
XStorable
>
xStor
(
getModel
(),
uno
::
UNO_QUERY_THROW
);
xStor
->
storeAsURL
(
sURL
,
storeProps
);
}
void
SAL_CALL
SwVbaDocument
::
SaveAs
(
const
uno
::
Any
&
FileName
,
const
uno
::
Any
&
FileFormat
,
const
uno
::
Any
&
LockComments
,
const
uno
::
Any
&
Password
,
const
uno
::
Any
&
AddToRecentFiles
,
const
uno
::
Any
&
WritePassword
,
const
uno
::
Any
&
ReadOnlyRecommended
,
const
uno
::
Any
&
EmbedTrueTypeFonts
,
const
uno
::
Any
&
SaveNativePictureFormat
,
const
uno
::
Any
&
SaveFormsData
,
const
uno
::
Any
&
SaveAsAOCELetter
,
const
uno
::
Any
&
/*Encoding*/
,
const
uno
::
Any
&
/*InsertLineBreaks*/
,
const
uno
::
Any
&
/*AllowSubstitutions*/
,
const
uno
::
Any
&
/*LineEnding*/
,
const
uno
::
Any
&
/*AddBiDiMarks*/
)
{
return
SaveAs2000
(
FileName
,
FileFormat
,
LockComments
,
Password
,
AddToRecentFiles
,
WritePassword
,
ReadOnlyRecommended
,
EmbedTrueTypeFonts
,
SaveNativePictureFormat
,
SaveFormsData
,
SaveAsAOCELetter
);
}
uno
::
Any
SwVbaDocument
::
getControlShape
(
const
OUString
&
sName
)
{
...
...
sw/source/ui/vba/vbadocument.hxx
Dosyayı görüntüle @
0de4f894
...
...
@@ -88,6 +88,8 @@ public:
virtual
void
SAL_CALL
ClosePrintPreview
(
)
override
;
virtual
css
::
uno
::
Any
SAL_CALL
Revisions
(
const
css
::
uno
::
Any
&
aIndex
)
override
;
virtual
css
::
uno
::
Any
SAL_CALL
Frames
(
const
css
::
uno
::
Any
&
aIndex
)
override
;
virtual
void
SAL_CALL
SaveAs2000
(
const
css
::
uno
::
Any
&
FileName
,
const
css
::
uno
::
Any
&
FileFormat
,
const
css
::
uno
::
Any
&
LockComments
,
const
css
::
uno
::
Any
&
Password
,
const
css
::
uno
::
Any
&
AddToRecentFiles
,
const
css
::
uno
::
Any
&
WritePassword
,
const
css
::
uno
::
Any
&
ReadOnlyRecommended
,
const
css
::
uno
::
Any
&
EmbedTrueTypeFonts
,
const
css
::
uno
::
Any
&
SaveNativePictureFormat
,
const
css
::
uno
::
Any
&
SaveFormsData
,
const
css
::
uno
::
Any
&
SaveAsAOCELetter
)
override
;
virtual
void
SAL_CALL
SaveAs
(
const
css
::
uno
::
Any
&
FileName
,
const
css
::
uno
::
Any
&
FileFormat
,
const
css
::
uno
::
Any
&
LockComments
,
const
css
::
uno
::
Any
&
Password
,
const
css
::
uno
::
Any
&
AddToRecentFiles
,
const
css
::
uno
::
Any
&
WritePassword
,
const
css
::
uno
::
Any
&
ReadOnlyRecommended
,
const
css
::
uno
::
Any
&
EmbedTrueTypeFonts
,
const
css
::
uno
::
Any
&
SaveNativePictureFormat
,
const
css
::
uno
::
Any
&
SaveFormsData
,
const
css
::
uno
::
Any
&
SaveAsAOCELetter
,
const
css
::
uno
::
Any
&
Encoding
,
const
css
::
uno
::
Any
&
InsertLineBreaks
,
const
css
::
uno
::
Any
&
AllowSubstitutions
,
const
css
::
uno
::
Any
&
LineEnding
,
const
css
::
uno
::
Any
&
AddBiDiMarks
)
override
;
// XInvocation
virtual
css
::
uno
::
Reference
<
css
::
beans
::
XIntrospectionAccess
>
SAL_CALL
getIntrospection
(
)
override
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment