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
6fa0930e
Kaydet (Commit)
6fa0930e
authored
Eki 28, 2012
tarafından
Xisco Fauli
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
pyletter: Translate the templates at runtime
Change-Id: Ie0b149b4a8928e5b61153a6ed62b66d02f916f20
üst
4a11a471
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
67 additions
and
58 deletions
+67
-58
FaxWizardDialogImpl.py
wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
+1
-14
FaxWizardDialogResources.py
wizards/com/sun/star/wizards/fax/FaxWizardDialogResources.py
+9
-18
CGLetter.py
wizards/com/sun/star/wizards/letter/CGLetter.py
+0
-1
LetterWizardDialogImpl.py
...rds/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
+15
-1
LetterWizardDialogResources.py
...om/sun/star/wizards/letter/LetterWizardDialogResources.py
+5
-0
TextDocument.py
wizards/com/sun/star/wizards/text/TextDocument.py
+37
-24
No files found.
wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
Dosyayı görüntüle @
6fa0930e
...
...
@@ -232,7 +232,7 @@ class FaxWizardDialogImpl(FaxWizardDialog):
def
drawConstants
(
self
):
'''Localise the template'''
constRangeList
=
self
.
searchFillInItems
(
1
)
constRangeList
=
TextDocument
.
searchFillInItems
(
1
)
for
i
in
xrange
(
constRangeList
.
Count
):
item
=
constRangeList
.
getByIndex
(
i
)
...
...
@@ -241,19 +241,6 @@ class FaxWizardDialogImpl(FaxWizardDialog):
"hint"
,
self
.
xMSF
)
aux
.
write
()
def
searchFillInItems
(
self
,
typeSearch
):
sd
=
TextDocument
.
xTextDocument
.
createSearchDescriptor
()
if
typeSearch
==
0
:
sd
.
setSearchString
(
"<[^>]+>"
)
elif
typeSearch
==
1
:
sd
.
setSearchString
(
"#[^#]+#"
)
sd
.
setPropertyValue
(
"SearchRegularExpression"
,
True
)
sd
.
setPropertyValue
(
"SearchWords"
,
True
)
return
TextDocument
.
xTextDocument
.
findAll
(
sd
)
def
insertRoadmap
(
self
):
self
.
addRoadmap
()
self
.
insertRoadMapItems
(
...
...
wizards/com/sun/star/wizards/fax/FaxWizardDialogResources.py
Dosyayı görüntüle @
6fa0930e
...
...
@@ -25,15 +25,6 @@ class FaxWizardDialogResources(Resource):
RID_FAXWIZARDSALUTATION_START
=
3290
RID_FAXWIZARDROADMAP_START
=
3300
RID_RID_COMMON_START
=
500
resToPlaceHolder
=
"#to#"
resFromPlaceHolder
=
"#from#"
resFaxconstPlaceHolder
=
"#faxconst#"
resTelconstPlaceHolder
=
"#telconst#"
resEmailconstPlaceHolder
=
"#emailconst#"
resConsist1PlaceHolder
=
"#consist1#"
resConsist2PlaceHolder
=
"#consist2#"
resConsist3PlaceHolder
=
"#consist3#"
def
__init__
(
self
,
xmsf
):
super
(
FaxWizardDialogResources
,
self
)
.
__init__
(
xmsf
,
...
...
@@ -121,24 +112,24 @@ class FaxWizardDialogResources(Resource):
FaxWizardDialogResources
.
RID_FAXWIZARDDIALOG_START
+
39
)
self
.
resLabel2_value
=
self
.
getResText
(
FaxWizardDialogResources
.
RID_FAXWIZARDDIALOG_START
+
40
)
#Create a Dictionary for the constants values.
self
.
dictConstants
=
{
FaxWizardDialogResources
.
resToPlaceHolder
:
self
.
getResText
(
"#to#"
:
self
.
getResText
(
FaxWizardDialogResources
.
RID_FAXWIZARDDIALOG_START
+
41
),
FaxWizardDialogResources
.
resFromPlaceHolder
:
self
.
getResText
(
"#from#"
:
self
.
getResText
(
FaxWizardDialogResources
.
RID_FAXWIZARDDIALOG_START
+
42
),
FaxWizardDialogResources
.
resFaxconstPlaceHolder
:
self
.
getResText
(
"#faxconst#"
:
self
.
getResText
(
FaxWizardDialogResources
.
RID_FAXWIZARDDIALOG_START
+
43
),
FaxWizardDialogResources
.
resTelconstPlaceHolder
:
self
.
getResText
(
"#telconst#"
:
self
.
getResText
(
FaxWizardDialogResources
.
RID_FAXWIZARDDIALOG_START
+
44
),
FaxWizardDialogResources
.
resEmailconstPlaceHolder
:
self
.
getResText
(
"#emailconst#"
:
self
.
getResText
(
FaxWizardDialogResources
.
RID_FAXWIZARDDIALOG_START
+
45
),
FaxWizardDialogResources
.
resConsist1PlaceHolder
:
self
.
getResText
(
"#consist1#"
:
self
.
getResText
(
FaxWizardDialogResources
.
RID_FAXWIZARDDIALOG_START
+
46
),
FaxWizardDialogResources
.
resConsist2PlaceHolder
:
self
.
getResText
(
"#consist2#"
:
self
.
getResText
(
FaxWizardDialogResources
.
RID_FAXWIZARDDIALOG_START
+
47
),
FaxWizardDialogResources
.
resConsist3PlaceHolder
:
self
.
getResText
(
"#consist3#"
:
self
.
getResText
(
FaxWizardDialogResources
.
RID_FAXWIZARDDIALOG_START
+
48
)}
#Create a dictionary for localising the private template
...
...
wizards/com/sun/star/wizards/letter/CGLetter.py
Dosyayı görüntüle @
6fa0930e
...
...
@@ -28,7 +28,6 @@ class CGLetter(ConfigGroup):
self
.
cp_PaperCompanyAddressReceiverField
=
bool
()
self
.
cp_PaperFooter
=
bool
()
self
.
cp_PaperFooterHeight
=
float
()
self
.
cp_Norm
=
int
()
self
.
cp_PrintCompanyLogo
=
bool
()
self
.
cp_PrintCompanyAddressReceiverField
=
bool
()
self
.
cp_PrintLetterSigns
=
bool
()
...
...
wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
Dosyayı görüntüle @
6fa0930e
...
...
@@ -25,6 +25,7 @@ from ..common.FileAccess import FileAccess
from
..common.Configuration
import
Configuration
from
..common.SystemDialog
import
SystemDialog
from
..common.Desktop
import
Desktop
from
..common.TextElement
import
TextElement
from
..ui.PathSelection
import
PathSelection
from
..ui.event.UnoDataAware
import
UnoDataAware
from
..ui.event.RadioDataAware
import
RadioDataAware
...
...
@@ -386,6 +387,7 @@ class LetterWizardDialogImpl(LetterWizardDialog):
self
.
initializeElements
()
self
.
chkBusinessPaperItemChanged
()
self
.
setElements
(
False
)
self
.
drawConstants
()
def
lstPrivOfficialStyleItemChanged
(
self
):
selectedItemPos
=
self
.
lstPrivOfficialStyle
.
SelectedItemPos
...
...
@@ -397,6 +399,7 @@ class LetterWizardDialogImpl(LetterWizardDialog):
self
.
initializeElements
()
self
.
setPossibleSenderData
(
True
)
self
.
setElements
(
False
)
self
.
drawConstants
()
def
lstPrivateStyleItemChanged
(
self
):
selectedItemPos
=
self
.
lstPrivateStyle
.
SelectedItemPos
...
...
@@ -981,7 +984,18 @@ class LetterWizardDialogImpl(LetterWizardDialog):
if
self
.
optMakeChanges
.
State
:
self
.
optMakeChangesItemChanged
()
def
drawConstants
(
self
):
'''Localise the template'''
constRangeList
=
TextDocument
.
searchFillInItems
(
1
)
for
i
in
xrange
(
constRangeList
.
Count
):
item
=
constRangeList
.
getByIndex
(
i
)
text
=
item
.
String
.
lower
()
aux
=
TextElement
(
item
,
self
.
resources
.
dictConstants
[
text
],
"hint"
,
self
.
xMSF
)
aux
.
write
()
def
insertRoadmap
(
self
):
self
.
addRoadmap
()
...
...
wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.py
Dosyayı görüntüle @
6fa0930e
...
...
@@ -208,6 +208,11 @@ class LetterWizardDialogResources(Resource):
self
.
reslblTitle6_value
=
\
self
.
getResText
(
LetterWizardDialogResources
.
RID_LETTERWIZARDDIALOG_START
+
58
)
#Create a Dictionary for the constants values.
self
.
dictConstants
=
{
"#subjectconst#"
:
self
.
getResText
(
LetterWizardDialogResources
.
RID_LETTERWIZARDDIALOG_START
+
59
)}
#Create a dictionary for localising the bussiness templates
self
.
dictBusinessTemplate
=
{
...
...
wizards/com/sun/star/wizards/text/TextDocument.py
Dosyayı görüntüle @
6fa0930e
...
...
@@ -34,13 +34,12 @@ from com.sun.star.beans.PropertyState import DIRECT_VALUE
class
TextDocument
(
object
):
xTextDocument
=
None
def
__init__
(
self
,
xMSF
,
listener
=
None
,
bShowStatusIndicator
=
None
,
FrameName
=
None
,
_sPreviewURL
=
None
,
_moduleIdentifier
=
None
,
_textDocument
=
None
,
xArgs
=
None
):
self
.
xMSF
=
xMSF
self
.
xTextDocument
=
None
if
listener
is
not
None
:
if
FrameName
is
not
None
:
...
...
@@ -55,19 +54,19 @@ class TextDocument(object):
'''creates an instance of TextDocument by
loading a given URL as preview'''
self
.
xFrame
=
OfficeDocument
.
createNewFrame
(
xMSF
,
listener
)
TextDocument
.
xTextDocument
=
self
.
loadAsPreview
(
_sPreviewURL
,
True
)
self
.
xTextDocument
=
self
.
loadAsPreview
(
_sPreviewURL
,
True
)
elif
xArgs
is
not
None
:
'''creates an instance of TextDocument
and creates a frame and loads a document'''
self
.
xDesktop
=
Desktop
.
getDesktop
(
xMSF
);
self
.
xFrame
=
OfficeDocument
.
createNewFrame
(
xMSF
,
listener
)
TextDocument
.
xTextDocument
=
OfficeDocument
.
load
(
self
.
xTextDocument
=
OfficeDocument
.
load
(
xFrame
,
URL
,
"_self"
,
xArgs
);
self
.
xWindowPeer
=
xFrame
.
getComponentWindow
()
self
.
m_xDocProps
=
TextDocument
.
xTextDocument
.
DocumentProperties
self
.
m_xDocProps
=
self
.
xTextDocument
.
DocumentProperties
CharLocale
=
Helper
.
getUnoStructValue
(
TextDocument
.
xTextDocument
,
"CharLocale"
);
self
.
xTextDocument
,
"CharLocale"
);
return
else
:
...
...
@@ -75,27 +74,27 @@ class TextDocument(object):
the desktop's current frame'''
self
.
xDesktop
=
Desktop
.
getDesktop
(
xMSF
);
self
.
xFrame
=
self
.
xDesktop
.
getActiveFrame
()
TextDocument
.
xTextDocument
=
self
.
xFrame
.
getController
()
.
Model
self
.
xTextDocument
=
self
.
xFrame
.
getController
()
.
Model
elif
_moduleIdentifier
is
not
None
:
try
:
'''create the empty document, and set its module identifier'''
TextDocument
.
xTextDocument
=
xMSF
.
createInstance
(
self
.
xTextDocument
=
xMSF
.
createInstance
(
"com.sun.star.text.TextDocument"
)
TextDocument
.
xTextDocument
.
initNew
()
TextDocument
.
xTextDocument
.
setIdentifier
(
self
.
xTextDocument
.
initNew
()
self
.
xTextDocument
.
setIdentifier
(
_moduleIdentifier
.
Identifier
)
# load the document into a blank frame
xDesktop
=
Desktop
.
getDesktop
(
xMSF
)
loadArgs
=
range
(
1
)
loadArgs
[
0
]
=
"Model"
loadArgs
[
0
]
=
-
1
loadArgs
[
0
]
=
TextDocument
.
xTextDocument
loadArgs
[
0
]
=
self
.
xTextDocument
loadArgs
[
0
]
=
DIRECT_VALUE
xDesktop
.
loadComponentFromURL
(
"private:object"
,
"_blank"
,
0
,
loadArgs
)
# remember some things for later usage
self
.
xFrame
=
TextDocument
.
xTextDocument
.
CurrentController
.
Frame
self
.
xFrame
=
self
.
xTextDocument
.
CurrentController
.
Frame
except
Exception
,
e
:
traceback
.
print_exc
()
...
...
@@ -103,17 +102,17 @@ class TextDocument(object):
'''creates an instance of TextDocument
from a given XTextDocument'''
self
.
xFrame
=
_textDocument
.
CurrentController
.
Frame
TextDocument
.
xTextDocument
=
_textDocument
self
.
xTextDocument
=
_textDocument
if
bShowStatusIndicator
:
self
.
showStatusIndicator
()
self
.
init
()
def
init
(
self
):
self
.
xWindowPeer
=
self
.
xFrame
.
getComponentWindow
()
self
.
m_xDocProps
=
TextDocument
.
xTextDocument
.
DocumentProperties
self
.
m_xDocProps
=
self
.
xTextDocument
.
DocumentProperties
self
.
CharLocale
=
Helper
.
getUnoStructValue
(
TextDocument
.
xTextDocument
,
"CharLocale"
)
self
.
xText
=
TextDocument
.
xTextDocument
.
Text
self
.
xTextDocument
,
"CharLocale"
)
self
.
xText
=
self
.
xTextDocument
.
Text
def
showStatusIndicator
(
self
):
self
.
xProgressBar
=
self
.
xFrame
.
createStatusIndicator
()
...
...
@@ -140,24 +139,24 @@ class TextDocument(object):
loadValues
[
2
]
.
Name
=
"Preview"
loadValues
[
2
]
.
Value
=
True
TextDocument
.
xTextDocument
=
OfficeDocument
.
load
(
self
.
xTextDocument
=
OfficeDocument
.
load
(
self
.
xFrame
,
sDefaultTemplate
,
"_self"
,
loadValues
)
self
.
DocSize
=
self
.
getPageSize
()
myViewHandler
=
ViewHandler
(
TextDocument
.
xTextDocument
,
TextDocument
.
xTextDocument
)
myViewHandler
=
ViewHandler
(
self
.
xTextDocument
,
self
.
xTextDocument
)
try
:
myViewHandler
.
setViewSetting
(
"ZoomType"
,
ENTIRE_PAGE
)
except
Exception
,
e
:
traceback
.
print_exc
()
myFieldHandler
=
TextFieldHandler
(
self
.
xMSF
,
TextDocument
.
xTextDocument
)
myFieldHandler
=
TextFieldHandler
(
self
.
xMSF
,
self
.
xTextDocument
)
myFieldHandler
.
updateDocInfoFields
()
return
TextDocument
.
xTextDocument
return
self
.
xTextDocument
def
getPageSize
(
self
):
try
:
xNameAccess
=
TextDocument
.
xTextDocument
.
StyleFamilies
xNameAccess
=
self
.
xTextDocument
.
StyleFamilies
xPageStyleCollection
=
xNameAccess
.
getByName
(
"PageStyles"
)
xPageStyle
=
xPageStyleCollection
.
getByName
(
"First Page"
)
return
Helper
.
getUnoPropertyValue
(
xPageStyle
,
"Size"
)
...
...
@@ -173,7 +172,7 @@ class TextDocument(object):
return
xTextCursor
def
refresh
(
self
):
TextDocument
.
xTextDocument
.
refresh
()
self
.
xTextDocument
.
refresh
()
'''
This method sets the Author of a Wizard-generated template correctly
...
...
@@ -197,10 +196,10 @@ class TextDocument(object):
day
=
time
.
strftime
(
"
%
d"
,
now
)
dateObject
=
dateTimeObject
(
int
(
year
),
int
(
month
),
int
(
day
))
du
=
Helper
.
DateUtils
(
self
.
xMSF
,
TextDocument
.
xTextDocument
)
du
=
Helper
.
DateUtils
(
self
.
xMSF
,
self
.
xTextDocument
)
ff
=
du
.
getFormat
(
DATE_SYS_DDMMYY
)
myDate
=
du
.
format
(
ff
,
dateObject
)
xDocProps2
=
TextDocument
.
xTextDocument
.
DocumentProperties
xDocProps2
=
self
.
xTextDocument
.
DocumentProperties
xDocProps2
.
Author
=
fullname
xDocProps2
.
ModifiedBy
=
fullname
description
=
xDocProps2
.
Description
...
...
@@ -238,3 +237,17 @@ class TextDocument(object):
return
xTD
.
TextFrames
.
getByName
(
sFrameName
)
return
None
@classmethod
def
searchFillInItems
(
self
,
typeSearch
):
sd
=
self
.
xTextDocument
.
createSearchDescriptor
()
if
typeSearch
==
0
:
sd
.
setSearchString
(
"<[^>]+>"
)
elif
typeSearch
==
1
:
sd
.
setSearchString
(
"#[^#]+#"
)
sd
.
setPropertyValue
(
"SearchRegularExpression"
,
True
)
sd
.
setPropertyValue
(
"SearchWords"
,
True
)
return
self
.
xTextDocument
.
findAll
(
sd
)
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