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
151c2aeb
Kaydet (Commit)
151c2aeb
authored
May 09, 2012
tarafından
Kohei Yoshida
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Use UNO field type when searching for specific field items.
Change-Id: Ic79a545132aabaf93bd4ef465829b024c2e6a865
üst
1616759f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
25 deletions
+32
-25
fielduno.cxx
sc/source/ui/unoobj/fielduno.cxx
+32
-25
No files found.
sc/source/ui/unoobj/fielduno.cxx
Dosyayı görüntüle @
151c2aeb
...
@@ -161,11 +161,16 @@ enum ScUnoCollectMode
...
@@ -161,11 +161,16 @@ enum ScUnoCollectMode
SC_UNO_COLLECT_FINDPOS
SC_UNO_COLLECT_FINDPOS
};
};
/**
* This class exists solely to allow searching through field items. TODO:
* Look into providing the same functionality directly in EditEngine, to
* avoid having this class altogether.
*/
class
ScUnoEditEngine
:
public
ScEditEngineDefaulter
class
ScUnoEditEngine
:
public
ScEditEngineDefaulter
{
{
ScUnoCollectMode
eMode
;
ScUnoCollectMode
eMode
;
sal_uInt16
nFieldCount
;
sal_uInt16
nFieldCount
;
TypeId
a
FieldType
;
sal_Int32
mn
FieldType
;
SvxFieldData
*
pFound
;
// lokale Kopie
SvxFieldData
*
pFound
;
// lokale Kopie
sal_uInt16
nFieldPar
;
sal_uInt16
nFieldPar
;
xub_StrLen
nFieldPos
;
xub_StrLen
nFieldPos
;
...
@@ -179,9 +184,9 @@ public:
...
@@ -179,9 +184,9 @@ public:
virtual
String
CalcFieldValue
(
const
SvxFieldItem
&
rField
,
sal_uInt16
nPara
,
sal_uInt16
nPos
,
virtual
String
CalcFieldValue
(
const
SvxFieldItem
&
rField
,
sal_uInt16
nPara
,
sal_uInt16
nPos
,
Color
*&
rTxtColor
,
Color
*&
rFldColor
);
Color
*&
rTxtColor
,
Color
*&
rFldColor
);
sal_uInt16
CountFields
(
TypeId
aType
);
sal_uInt16
CountFields
(
);
SvxFieldData
*
FindByIndex
(
sal_uInt16
nIndex
,
TypeId
aType
);
SvxFieldData
*
FindByIndex
(
sal_uInt16
nIndex
);
SvxFieldData
*
FindByPos
(
sal_uInt16
nPar
,
xub_StrLen
nPos
,
TypeId
a
Type
);
SvxFieldData
*
FindByPos
(
sal_uInt16
nPar
,
xub_StrLen
nPos
,
sal_Int32
n
Type
);
sal_uInt16
GetFieldPar
()
const
{
return
nFieldPar
;
}
sal_uInt16
GetFieldPar
()
const
{
return
nFieldPar
;
}
xub_StrLen
GetFieldPos
()
const
{
return
nFieldPos
;
}
xub_StrLen
GetFieldPos
()
const
{
return
nFieldPos
;
}
...
@@ -191,7 +196,7 @@ ScUnoEditEngine::ScUnoEditEngine(ScEditEngineDefaulter* pSource) :
...
@@ -191,7 +196,7 @@ ScUnoEditEngine::ScUnoEditEngine(ScEditEngineDefaulter* pSource) :
ScEditEngineDefaulter
(
*
pSource
),
ScEditEngineDefaulter
(
*
pSource
),
eMode
(
SC_UNO_COLLECT_NONE
),
eMode
(
SC_UNO_COLLECT_NONE
),
nFieldCount
(
0
),
nFieldCount
(
0
),
aFieldType
(
NULL
),
mnFieldType
(
SvxFieldData
::
UNKNOWN_FIELD
),
pFound
(
NULL
)
pFound
(
NULL
)
{
{
if
(
pSource
)
if
(
pSource
)
...
@@ -216,7 +221,7 @@ String ScUnoEditEngine::CalcFieldValue( const SvxFieldItem& rField,
...
@@ -216,7 +221,7 @@ String ScUnoEditEngine::CalcFieldValue( const SvxFieldItem& rField,
const
SvxFieldData
*
pFieldData
=
rField
.
GetField
();
const
SvxFieldData
*
pFieldData
=
rField
.
GetField
();
if
(
pFieldData
)
if
(
pFieldData
)
{
{
if
(
!
aFieldType
||
pFieldData
->
Type
()
==
aFieldType
)
if
(
mnFieldType
==
SvxFieldData
::
UNKNOWN_FIELD
||
pFieldData
->
GetClassId
()
==
mnFieldType
)
{
{
if
(
eMode
==
SC_UNO_COLLECT_FINDINDEX
&&
!
pFound
&&
nFieldCount
==
nFieldIndex
)
if
(
eMode
==
SC_UNO_COLLECT_FINDINDEX
&&
!
pFound
&&
nFieldCount
==
nFieldIndex
)
{
{
...
@@ -237,40 +242,38 @@ String ScUnoEditEngine::CalcFieldValue( const SvxFieldItem& rField,
...
@@ -237,40 +242,38 @@ String ScUnoEditEngine::CalcFieldValue( const SvxFieldItem& rField,
return
aRet
;
return
aRet
;
}
}
sal_uInt16
ScUnoEditEngine
::
CountFields
(
TypeId
aType
)
sal_uInt16
ScUnoEditEngine
::
CountFields
()
{
{
eMode
=
SC_UNO_COLLECT_COUNT
;
eMode
=
SC_UNO_COLLECT_COUNT
;
aFieldType
=
aType
;
mnFieldType
=
SvxFieldData
::
UNKNOWN_FIELD
;
nFieldCount
=
0
;
nFieldCount
=
0
;
UpdateFields
();
UpdateFields
();
aFieldType
=
NULL
;
eMode
=
SC_UNO_COLLECT_NONE
;
eMode
=
SC_UNO_COLLECT_NONE
;
return
nFieldCount
;
return
nFieldCount
;
}
}
SvxFieldData
*
ScUnoEditEngine
::
FindByIndex
(
sal_uInt16
nIndex
,
TypeId
aType
)
SvxFieldData
*
ScUnoEditEngine
::
FindByIndex
(
sal_uInt16
nIndex
)
{
{
eMode
=
SC_UNO_COLLECT_FINDINDEX
;
eMode
=
SC_UNO_COLLECT_FINDINDEX
;
nFieldIndex
=
nIndex
;
nFieldIndex
=
nIndex
;
aFieldType
=
aType
;
mnFieldType
=
SvxFieldData
::
UNKNOWN_FIELD
;
nFieldCount
=
0
;
nFieldCount
=
0
;
UpdateFields
();
UpdateFields
();
aFieldType
=
NULL
;
eMode
=
SC_UNO_COLLECT_NONE
;
eMode
=
SC_UNO_COLLECT_NONE
;
return
pFound
;
return
pFound
;
}
}
SvxFieldData
*
ScUnoEditEngine
::
FindByPos
(
sal_uInt16
nPar
,
xub_StrLen
nPos
,
TypeId
a
Type
)
SvxFieldData
*
ScUnoEditEngine
::
FindByPos
(
sal_uInt16
nPar
,
xub_StrLen
nPos
,
sal_Int32
n
Type
)
{
{
eMode
=
SC_UNO_COLLECT_FINDPOS
;
eMode
=
SC_UNO_COLLECT_FINDPOS
;
nFieldPar
=
nPar
;
nFieldPar
=
nPar
;
nFieldPos
=
nPos
;
nFieldPos
=
nPos
;
aFieldType
=
a
Type
;
mnFieldType
=
n
Type
;
nFieldCount
=
0
;
nFieldCount
=
0
;
UpdateFields
();
UpdateFields
();
aFieldType
=
NULL
;
mnFieldType
=
SvxFieldData
::
UNKNOWN_FIELD
;
eMode
=
SC_UNO_COLLECT_NONE
;
eMode
=
SC_UNO_COLLECT_NONE
;
return
pFound
;
return
pFound
;
...
@@ -335,7 +338,7 @@ uno::Reference<text::XTextField> ScCellFieldsObj::GetObjectByIndex_Impl(sal_Int3
...
@@ -335,7 +338,7 @@ uno::Reference<text::XTextField> ScCellFieldsObj::GetObjectByIndex_Impl(sal_Int3
//! Feld-Funktionen muessen an den Forwarder !!!
//! Feld-Funktionen muessen an den Forwarder !!!
ScEditEngineDefaulter
*
pEditEngine
=
mpEditSource
->
GetEditEngine
();
ScEditEngineDefaulter
*
pEditEngine
=
mpEditSource
->
GetEditEngine
();
ScUnoEditEngine
aTempEngine
(
pEditEngine
);
ScUnoEditEngine
aTempEngine
(
pEditEngine
);
SvxFieldData
*
pData
=
aTempEngine
.
FindByIndex
(
static_cast
<
sal_uInt16
>
(
Index
)
,
0
);
SvxFieldData
*
pData
=
aTempEngine
.
FindByIndex
(
static_cast
<
sal_uInt16
>
(
Index
));
if
(
!
pData
)
if
(
!
pData
)
return
uno
::
Reference
<
text
::
XTextField
>
();
return
uno
::
Reference
<
text
::
XTextField
>
();
...
@@ -357,7 +360,7 @@ sal_Int32 SAL_CALL ScCellFieldsObj::getCount() throw(uno::RuntimeException)
...
@@ -357,7 +360,7 @@ sal_Int32 SAL_CALL ScCellFieldsObj::getCount() throw(uno::RuntimeException)
ScEditEngineDefaulter
*
pEditEngine
=
mpEditSource
->
GetEditEngine
();
ScEditEngineDefaulter
*
pEditEngine
=
mpEditSource
->
GetEditEngine
();
ScUnoEditEngine
aTempEngine
(
pEditEngine
);
ScUnoEditEngine
aTempEngine
(
pEditEngine
);
return
aTempEngine
.
CountFields
(
NULL
);
// Felder zaehlen, in Zelle ist der Typ egal
return
aTempEngine
.
CountFields
();
// Felder zaehlen, in Zelle ist der Typ egal
}
}
uno
::
Any
SAL_CALL
ScCellFieldsObj
::
getByIndex
(
sal_Int32
nIndex
)
uno
::
Any
SAL_CALL
ScCellFieldsObj
::
getByIndex
(
sal_Int32
nIndex
)
...
@@ -501,7 +504,7 @@ uno::Reference<text::XTextField> ScHeaderFieldsObj::GetObjectByIndex_Impl(sal_In
...
@@ -501,7 +504,7 @@ uno::Reference<text::XTextField> ScHeaderFieldsObj::GetObjectByIndex_Impl(sal_In
ScEditEngineDefaulter
*
pEditEngine
=
mpEditSource
->
GetEditEngine
();
ScEditEngineDefaulter
*
pEditEngine
=
mpEditSource
->
GetEditEngine
();
ScUnoEditEngine
aTempEngine
(
pEditEngine
);
ScUnoEditEngine
aTempEngine
(
pEditEngine
);
SvxFieldData
*
pData
=
aTempEngine
.
FindByIndex
(
(
sal_uInt16
)
Index
,
0
);
SvxFieldData
*
pData
=
aTempEngine
.
FindByIndex
(
static_cast
<
sal_uInt16
>
(
Index
)
);
if
(
!
pData
)
if
(
!
pData
)
return
NULL
;
return
NULL
;
...
@@ -537,7 +540,7 @@ sal_Int32 SAL_CALL ScHeaderFieldsObj::getCount() throw(uno::RuntimeException)
...
@@ -537,7 +540,7 @@ sal_Int32 SAL_CALL ScHeaderFieldsObj::getCount() throw(uno::RuntimeException)
//! Feld-Funktionen muessen an den Forwarder !!!
//! Feld-Funktionen muessen an den Forwarder !!!
ScEditEngineDefaulter
*
pEditEngine
=
mpEditSource
->
GetEditEngine
();
ScEditEngineDefaulter
*
pEditEngine
=
mpEditSource
->
GetEditEngine
();
ScUnoEditEngine
aTempEngine
(
pEditEngine
);
ScUnoEditEngine
aTempEngine
(
pEditEngine
);
return
aTempEngine
.
CountFields
(
0
);
return
aTempEngine
.
CountFields
();
}
}
uno
::
Any
SAL_CALL
ScHeaderFieldsObj
::
getByIndex
(
sal_Int32
nIndex
)
uno
::
Any
SAL_CALL
ScHeaderFieldsObj
::
getByIndex
(
sal_Int32
nIndex
)
...
@@ -704,7 +707,8 @@ void ScEditFieldObj::setPropertyValueURL(const rtl::OUString& rName, const com::
...
@@ -704,7 +707,8 @@ void ScEditFieldObj::setPropertyValueURL(const rtl::OUString& rName, const com::
ScUnoEditEngine
aTempEngine
(
pEditEngine
);
ScUnoEditEngine
aTempEngine
(
pEditEngine
);
// Typ egal (in Zellen gibts nur URLs)
// Typ egal (in Zellen gibts nur URLs)
SvxFieldData
*
pField
=
aTempEngine
.
FindByPos
(
aSelection
.
nStartPara
,
aSelection
.
nStartPos
,
0
);
SvxFieldData
*
pField
=
aTempEngine
.
FindByPos
(
aSelection
.
nStartPara
,
aSelection
.
nStartPos
,
SvxFieldData
::
UNKNOWN_FIELD
);
OSL_ENSURE
(
pField
,
"setPropertyValue: Feld nicht gefunden"
);
OSL_ENSURE
(
pField
,
"setPropertyValue: Feld nicht gefunden"
);
if
(
!
pField
)
if
(
!
pField
)
return
;
return
;
...
@@ -776,7 +780,8 @@ uno::Any ScEditFieldObj::getPropertyValueURL(const rtl::OUString& rName)
...
@@ -776,7 +780,8 @@ uno::Any ScEditFieldObj::getPropertyValueURL(const rtl::OUString& rName)
ScUnoEditEngine
aTempEngine
(
pEditEngine
);
ScUnoEditEngine
aTempEngine
(
pEditEngine
);
// Typ egal (in Zellen gibts nur URLs)
// Typ egal (in Zellen gibts nur URLs)
const
SvxFieldData
*
pField
=
aTempEngine
.
FindByPos
(
aSelection
.
nStartPara
,
aSelection
.
nStartPos
,
0
);
const
SvxFieldData
*
pField
=
aTempEngine
.
FindByPos
(
aSelection
.
nStartPara
,
aSelection
.
nStartPos
,
SvxFieldData
::
UNKNOWN_FIELD
);
OSL_ENSURE
(
pField
,
"getPropertyValue: Feld nicht gefunden"
);
OSL_ENSURE
(
pField
,
"getPropertyValue: Feld nicht gefunden"
);
if
(
!
pField
)
if
(
!
pField
)
throw
uno
::
RuntimeException
();
throw
uno
::
RuntimeException
();
...
@@ -827,7 +832,7 @@ void ScEditFieldObj::setPropertyValueFile(const rtl::OUString& rName, const uno:
...
@@ -827,7 +832,7 @@ void ScEditFieldObj::setPropertyValueFile(const rtl::OUString& rName, const uno:
ScEditEngineDefaulter
*
pEditEngine
=
mpEditSource
->
GetEditEngine
();
ScEditEngineDefaulter
*
pEditEngine
=
mpEditSource
->
GetEditEngine
();
ScUnoEditEngine
aTempEngine
(
pEditEngine
);
ScUnoEditEngine
aTempEngine
(
pEditEngine
);
SvxFieldData
*
pField
=
aTempEngine
.
FindByPos
(
SvxFieldData
*
pField
=
aTempEngine
.
FindByPos
(
aSelection
.
nStartPara
,
aSelection
.
nStartPos
,
TYPE
(
SvxExtFileField
)
);
aSelection
.
nStartPara
,
aSelection
.
nStartPos
,
text
::
textfield
::
Type
::
EXTENDED_FILE
);
OSL_ENSURE
(
pField
,
"setPropertyValueFile: Field not found"
);
OSL_ENSURE
(
pField
,
"setPropertyValueFile: Field not found"
);
if
(
pField
)
if
(
pField
)
{
{
...
@@ -861,7 +866,7 @@ uno::Any ScEditFieldObj::getPropertyValueFile(const rtl::OUString& rName)
...
@@ -861,7 +866,7 @@ uno::Any ScEditFieldObj::getPropertyValueFile(const rtl::OUString& rName)
ScEditEngineDefaulter
*
pEditEngine
=
mpEditSource
->
GetEditEngine
();
ScEditEngineDefaulter
*
pEditEngine
=
mpEditSource
->
GetEditEngine
();
ScUnoEditEngine
aTempEngine
(
pEditEngine
);
ScUnoEditEngine
aTempEngine
(
pEditEngine
);
pField
=
aTempEngine
.
FindByPos
(
pField
=
aTempEngine
.
FindByPos
(
aSelection
.
nStartPara
,
aSelection
.
nStartPos
,
TYPE
(
SvxExtFileField
)
);
aSelection
.
nStartPara
,
aSelection
.
nStartPos
,
text
::
textfield
::
Type
::
EXTENDED_FILE
);
}
}
else
else
pField
=
getData
();
pField
=
getData
();
...
@@ -921,7 +926,8 @@ void ScEditFieldObj::setPropertyValueSheet(const rtl::OUString& rName, const uno
...
@@ -921,7 +926,8 @@ void ScEditFieldObj::setPropertyValueSheet(const rtl::OUString& rName, const uno
ScUnoEditEngine
aTempEngine
(
pEditEngine
);
ScUnoEditEngine
aTempEngine
(
pEditEngine
);
// Typ egal (in Zellen gibts nur URLs)
// Typ egal (in Zellen gibts nur URLs)
SvxFieldData
*
pField
=
aTempEngine
.
FindByPos
(
aSelection
.
nStartPara
,
aSelection
.
nStartPos
,
0
);
SvxFieldData
*
pField
=
aTempEngine
.
FindByPos
(
aSelection
.
nStartPara
,
aSelection
.
nStartPos
,
SvxFieldData
::
UNKNOWN_FIELD
);
OSL_ENSURE
(
pField
,
"setPropertyValue: Feld nicht gefunden"
);
OSL_ENSURE
(
pField
,
"setPropertyValue: Feld nicht gefunden"
);
if
(
!
pField
)
if
(
!
pField
)
return
;
return
;
...
@@ -1058,7 +1064,8 @@ rtl::OUString SAL_CALL ScEditFieldObj::getPresentation( sal_Bool bShowCommand )
...
@@ -1058,7 +1064,8 @@ rtl::OUString SAL_CALL ScEditFieldObj::getPresentation( sal_Bool bShowCommand )
ScUnoEditEngine
aTempEngine
(
pEditEngine
);
ScUnoEditEngine
aTempEngine
(
pEditEngine
);
// Typ egal (in Zellen gibts nur URLs)
// Typ egal (in Zellen gibts nur URLs)
const
SvxFieldData
*
pField
=
aTempEngine
.
FindByPos
(
aSelection
.
nStartPara
,
aSelection
.
nStartPos
,
0
);
const
SvxFieldData
*
pField
=
aTempEngine
.
FindByPos
(
aSelection
.
nStartPara
,
aSelection
.
nStartPos
,
SvxFieldData
::
UNKNOWN_FIELD
);
OSL_ENSURE
(
pField
,
"getPresentation: Feld nicht gefunden"
);
OSL_ENSURE
(
pField
,
"getPresentation: Feld nicht gefunden"
);
if
(
!
pField
)
if
(
!
pField
)
return
rtl
::
OUString
();
return
rtl
::
OUString
();
...
...
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