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
e61770f9
Kaydet (Commit)
e61770f9
authored
Haz 11, 2013
tarafından
Michael Stahl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
de-dent SwXFieldMaster a bit
Change-Id: Ibfd1b6ad2fab06543913e2b38fad25d98351f9e2
üst
b2d08481
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
92 additions
and
95 deletions
+92
-95
unofield.cxx
sw/source/core/unocore/unofield.cxx
+92
-95
No files found.
sw/source/core/unocore/unofield.cxx
Dosyayı görüntüle @
e61770f9
...
@@ -456,7 +456,9 @@ throw (uno::RuntimeException)
...
@@ -456,7 +456,9 @@ throw (uno::RuntimeException)
return
OUString
(
"SwXFieldMaster"
);
return
OUString
(
"SwXFieldMaster"
);
}
}
sal_Bool
SwXFieldMaster
::
supportsService
(
const
OUString
&
rServiceName
)
throw
(
uno
::
RuntimeException
)
sal_Bool
SAL_CALL
SwXFieldMaster
::
supportsService
(
const
OUString
&
rServiceName
)
throw
(
uno
::
RuntimeException
)
{
{
sal_Bool
bRet
=
sal_False
;
sal_Bool
bRet
=
sal_False
;
if
(
rServiceName
.
equalsAsciiL
(
if
(
rServiceName
.
equalsAsciiL
(
...
@@ -485,7 +487,8 @@ sal_Bool SwXFieldMaster::supportsService(const OUString& rServiceName) throw( un
...
@@ -485,7 +487,8 @@ sal_Bool SwXFieldMaster::supportsService(const OUString& rServiceName) throw( un
return
bRet
;
return
bRet
;
}
}
uno
::
Sequence
<
OUString
>
SwXFieldMaster
::
getSupportedServiceNames
(
void
)
throw
(
uno
::
RuntimeException
)
uno
::
Sequence
<
OUString
>
SAL_CALL
SwXFieldMaster
::
getSupportedServiceNames
()
throw
(
uno
::
RuntimeException
)
{
{
uno
::
Sequence
<
OUString
>
aRet
(
2
);
uno
::
Sequence
<
OUString
>
aRet
(
2
);
OUString
*
pArray
=
aRet
.
getArray
();
OUString
*
pArray
=
aRet
.
getArray
();
...
@@ -617,54 +620,50 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
...
@@ -617,54 +620,50 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
{
{
throw
lang
::
IllegalArgumentException
();
throw
lang
::
IllegalArgumentException
();
}
}
else
switch
(
m_pImpl
->
m_nResTypeId
)
{
{
switch
(
m_pImpl
->
m_nResTypeId
)
case
RES_USERFLD
:
{
{
case
RES_USERFLD
:
SwUserFieldType
aType
(
m_pImpl
->
m_pDoc
,
sTypeName
);
{
pType2
=
m_pImpl
->
m_pDoc
->
InsertFldType
(
aType
);
SwUserFieldType
aType
(
m_pImpl
->
m_pDoc
,
sTypeName
);
static_cast
<
SwUserFieldType
*>
(
pType2
)
->
SetContent
(
m_pImpl
->
m_sParam1
);
pType2
=
m_pImpl
->
m_pDoc
->
InsertFldType
(
aType
);
static_cast
<
SwUserFieldType
*>
(
pType2
)
->
SetValue
(
m_pImpl
->
m_fParam1
);
static_cast
<
SwUserFieldType
*>
(
pType2
)
->
SetContent
(
m_pImpl
->
m_sParam1
);
static_cast
<
SwUserFieldType
*>
(
pType2
)
->
SetType
(
m_pImpl
->
m_bParam1
static_cast
<
SwUserFieldType
*>
(
pType2
)
->
SetValue
(
m_pImpl
->
m_fParam1
);
?
nsSwGetSetExpType
::
GSE_EXPR
:
nsSwGetSetExpType
::
GSE_STRING
);
static_cast
<
SwUserFieldType
*>
(
pType2
)
->
SetType
(
m_pImpl
->
m_bParam1
?
nsSwGetSetExpType
::
GSE_EXPR
:
nsSwGetSetExpType
::
GSE_STRING
);
}
break
;
case
RES_DDEFLD
:
{
SwDDEFieldType
aType
(
sTypeName
,
m_pImpl
->
m_sParam1
,
sal
::
static_int_cast
<
sal_uInt16
>
((
m_pImpl
->
m_bParam1
)
?
sfx2
::
LINKUPDATE_ALWAYS
:
sfx2
::
LINKUPDATE_ONCALL
));
pType2
=
m_pImpl
->
m_pDoc
->
InsertFldType
(
aType
);
}
break
;
case
RES_SETEXPFLD
:
{
SwSetExpFieldType
aType
(
m_pImpl
->
m_pDoc
,
sTypeName
);
if
(
m_pImpl
->
m_sParam1
.
Len
())
aType
.
SetDelimiter
(
OUString
(
m_pImpl
->
m_sParam1
.
GetChar
(
0
)));
if
(
m_pImpl
->
m_nParam1
>
-
1
&&
m_pImpl
->
m_nParam1
<
MAXLEVEL
)
aType
.
SetOutlineLvl
(
m_pImpl
->
m_nParam1
);
pType2
=
m_pImpl
->
m_pDoc
->
InsertFldType
(
aType
);
}
break
;
case
RES_DBFLD
:
{
::
GetString
(
rValue
,
m_pImpl
->
m_sParam3
);
pType
=
GetFldType
();
}
break
;
}
}
if
(
pType2
)
break
;
case
RES_DDEFLD
:
{
{
pType2
->
Add
(
m_pImpl
.
get
());
SwDDEFieldType
aType
(
sTypeName
,
m_pImpl
->
m_sParam1
,
m_pImpl
->
m_bIsDescriptor
=
false
;
sal
::
static_int_cast
<
sal_uInt16
>
((
m_pImpl
->
m_bParam1
)
?
sfx2
::
LINKUPDATE_ALWAYS
:
sfx2
::
LINKUPDATE_ONCALL
));
pType2
=
m_pImpl
->
m_pDoc
->
InsertFldType
(
aType
);
}
}
else
break
;
throw
uno
::
RuntimeException
();
case
RES_SETEXPFLD
:
{
SwSetExpFieldType
aType
(
m_pImpl
->
m_pDoc
,
sTypeName
);
if
(
m_pImpl
->
m_sParam1
.
Len
())
aType
.
SetDelimiter
(
OUString
(
m_pImpl
->
m_sParam1
.
GetChar
(
0
)));
if
(
m_pImpl
->
m_nParam1
>
-
1
&&
m_pImpl
->
m_nParam1
<
MAXLEVEL
)
aType
.
SetOutlineLvl
(
m_pImpl
->
m_nParam1
);
pType2
=
m_pImpl
->
m_pDoc
->
InsertFldType
(
aType
);
}
break
;
case
RES_DBFLD
:
{
::
GetString
(
rValue
,
m_pImpl
->
m_sParam3
);
pType
=
GetFldType
();
}
break
;
}
}
if
(
!
pType2
)
OSL_ENSURE
(
pType2
,
"kein FieldType gefunden!"
);
{
throw
uno
::
RuntimeException
(
"no field type found!"
,
*
this
);
}
pType2
->
Add
(
m_pImpl
.
get
());
m_pImpl
->
m_bIsDescriptor
=
false
;
}
}
else
else
{
{
...
@@ -819,33 +818,34 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
...
@@ -819,33 +818,34 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
{
{
//TODO: Properties fuer die uebrigen Feldtypen einbauen
//TODO: Properties fuer die uebrigen Feldtypen einbauen
sal_uInt16
nMId
=
GetFieldTypeMId
(
rPropertyName
,
*
pType
);
sal_uInt16
nMId
=
GetFieldTypeMId
(
rPropertyName
,
*
pType
);
if
(
USHRT_MAX
!=
nMId
)
if
(
USHRT_MAX
==
nMId
)
{
{
pType
->
QueryValue
(
aRet
,
nMId
);
throw
beans
::
UnknownPropertyException
(
"Unknown property: "
+
rPropertyName
,
if
(
rPropertyName
.
equalsAsciiL
(
SW_PROP_NAME
(
UNO_NAME_DATA_BASE_NAME
))
||
static_cast
<
cppu
::
OWeakObject
*>
(
this
));
rPropertyName
.
equalsAsciiL
(
SW_PROP_NAME
(
UNO_NAME_DATA_BASE_URL
)))
}
{
pType
->
QueryValue
(
aRet
,
nMId
);
OUString
aDataSource
;
aRet
>>=
aDataSource
;
aRet
<<=
OUString
();
OUString
*
pStr
=
0
;
// only one of this properties will return
// a non-empty string.
INetURLObject
aObj
;
aObj
.
SetURL
(
aDataSource
);
bool
bIsURL
=
aObj
.
GetProtocol
()
!=
INET_PROT_NOT_VALID
;
if
(
bIsURL
&&
rPropertyName
.
equalsAsciiL
(
SW_PROP_NAME
(
UNO_NAME_DATA_BASE_URL
)))
pStr
=
&
aDataSource
;
// DataBaseURL
else
if
(
!
bIsURL
&&
rPropertyName
.
equalsAsciiL
(
SW_PROP_NAME
(
UNO_NAME_DATA_BASE_NAME
)))
pStr
=
&
aDataSource
;
// DataBaseName
if
(
pStr
)
if
(
rPropertyName
.
equalsAsciiL
(
SW_PROP_NAME
(
UNO_NAME_DATA_BASE_NAME
))
||
aRet
<<=
*
pStr
;
rPropertyName
.
equalsAsciiL
(
SW_PROP_NAME
(
UNO_NAME_DATA_BASE_URL
)))
}
{
OUString
aDataSource
;
aRet
>>=
aDataSource
;
aRet
<<=
OUString
();
OUString
*
pStr
=
0
;
// only one of this properties will return
// a non-empty string.
INetURLObject
aObj
;
aObj
.
SetURL
(
aDataSource
);
bool
bIsURL
=
aObj
.
GetProtocol
()
!=
INET_PROT_NOT_VALID
;
if
(
bIsURL
&&
rPropertyName
.
equalsAsciiL
(
SW_PROP_NAME
(
UNO_NAME_DATA_BASE_URL
)))
pStr
=
&
aDataSource
;
// DataBaseURL
else
if
(
!
bIsURL
&&
rPropertyName
.
equalsAsciiL
(
SW_PROP_NAME
(
UNO_NAME_DATA_BASE_NAME
)))
pStr
=
&
aDataSource
;
// DataBaseName
if
(
pStr
)
aRet
<<=
*
pStr
;
}
}
else
throw
beans
::
UnknownPropertyException
(
OUString
(
"Unknown property: "
)
+
rPropertyName
,
static_cast
<
cppu
::
OWeakObject
*
>
(
this
)
);
}
}
else
else
{
{
...
@@ -949,38 +949,35 @@ throw (uno::RuntimeException)
...
@@ -949,38 +949,35 @@ throw (uno::RuntimeException)
{
{
SolarMutexGuard
aGuard
;
SolarMutexGuard
aGuard
;
SwFieldType
*
const
pFldType
=
GetFldType
(
true
);
SwFieldType
*
const
pFldType
=
GetFldType
(
true
);
if
(
pFldType
)
if
(
!
pFldType
)
throw
uno
::
RuntimeException
();
sal_uInt16
nTypeIdx
=
USHRT_MAX
;
const
SwFldTypes
*
pTypes
=
m_pImpl
->
m_pDoc
->
GetFldTypes
();
for
(
sal_uInt16
i
=
0
;
i
<
pTypes
->
size
();
i
++
)
{
{
sal_uInt16
nTypeIdx
=
USHRT_MAX
;
if
((
*
pTypes
)[
i
]
==
pFldType
)
const
SwFldTypes
*
pTypes
=
m_pImpl
->
m_pDoc
->
GetFldTypes
();
nTypeIdx
=
i
;
for
(
sal_uInt16
i
=
0
;
i
<
pTypes
->
size
();
i
++
)
}
{
if
((
*
pTypes
)[
i
]
==
pFldType
)
nTypeIdx
=
i
;
}
// zuerst alle Felder loeschen
// zuerst alle Felder loeschen
SwIterator
<
SwFmtFld
,
SwFieldType
>
aIter
(
*
pFldType
);
SwIterator
<
SwFmtFld
,
SwFieldType
>
aIter
(
*
pFldType
);
SwFmtFld
*
pFld
=
aIter
.
First
();
SwFmtFld
*
pFld
=
aIter
.
First
();
while
(
pFld
)
while
(
pFld
)
{
// Feld im Undo?
SwTxtFld
*
pTxtFld
=
pFld
->
GetTxtFld
();
if
(
pTxtFld
&&
pTxtFld
->
GetTxtNode
().
GetNodes
().
IsDocNodes
()
)
{
{
// Feld im Undo?
SwTxtNode
&
rTxtNode
=
(
SwTxtNode
&
)
*
pTxtFld
->
GetpTxtNode
();
SwTxtFld
*
pTxtFld
=
pFld
->
GetTxtFld
();
SwPaM
aPam
(
rTxtNode
,
*
pTxtFld
->
GetStart
());
if
(
pTxtFld
&&
pTxtFld
->
GetTxtNode
().
GetNodes
().
IsDocNodes
()
)
aPam
.
SetMark
();
{
aPam
.
Move
();
SwTxtNode
&
rTxtNode
=
(
SwTxtNode
&
)
*
pTxtFld
->
GetpTxtNode
();
m_pImpl
->
m_pDoc
->
DeleteAndJoin
(
aPam
);
SwPaM
aPam
(
rTxtNode
,
*
pTxtFld
->
GetStart
());
aPam
.
SetMark
();
aPam
.
Move
();
m_pImpl
->
m_pDoc
->
DeleteAndJoin
(
aPam
);
}
pFld
=
aIter
.
Next
();
}
}
// dann den FieldType loeschen
pFld
=
aIter
.
Next
();
m_pImpl
->
m_pDoc
->
RemoveFldType
(
nTypeIdx
);
}
}
else
// dann den FieldType loeschen
throw
uno
::
RuntimeException
(
);
m_pImpl
->
m_pDoc
->
RemoveFldType
(
nTypeIdx
);
}
}
void
SAL_CALL
SwXFieldMaster
::
addEventListener
(
void
SAL_CALL
SwXFieldMaster
::
addEventListener
(
...
...
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