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
5a147660
Kaydet (Commit)
5a147660
authored
May 12, 2014
tarafından
Eike Rathke
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
distill copypasta
Change-Id: Ibb6e9e6f98041ddc81b3743f57c3335458be2cb0
üst
668c6dd0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
146 additions
and
274 deletions
+146
-274
inputhdl.cxx
sc/source/ui/app/inputhdl.cxx
+144
-274
inputhdl.hxx
sc/source/ui/inc/inputhdl.hxx
+2
-0
No files found.
sc/source/ui/app/inputhdl.cxx
Dosyayı görüntüle @
5a147660
...
...
@@ -792,186 +792,186 @@ void ScInputHandler::HideTipBelow()
aManualTip
=
OUString
();
}
void
ScInputHandler
::
ShowTipCursor
()
void
ScInputHandler
::
ShowArgumentsTip
(
const
OUString
&
rParagraph
,
OUString
&
rSelText
,
const
ESelection
&
rSel
,
bool
bTryFirstSel
)
{
HideTip
();
HideTipBelow
();
EditView
*
pActiveView
=
pTopView
?
pTopView
:
pTableView
;
ScDocShell
*
pDocSh
=
pActiveViewSh
->
GetViewData
()
->
GetDocShell
();
const
sal_Unicode
cSep
=
ScCompiler
::
GetNativeSymbolChar
(
ocSep
);
const
sal_Unicode
cSheetSep
=
lcl_getSheetSeparator
(
pDocSh
->
GetDocument
());
if
(
bFormulaMode
&&
pActiveView
&&
pFormulaDataPara
&&
pEngine
->
GetParagraphCount
()
==
1
)
FormulaHelper
aHelper
(
ScGlobal
::
GetStarCalcFunctionMgr
());
bool
bFound
=
false
;
while
(
!
bFound
)
{
OUString
aFormula
=
pEngine
->
GetText
(
0
);
ESelection
aSel
=
pActiveView
->
GetSelection
();
aSel
.
Adjust
();
if
(
aSel
.
nEndPos
)
rSelText
+=
")"
;
sal_Int32
nLeftParentPos
=
lcl_MatchParenthesis
(
rSelText
,
rSelText
.
getLength
()
-
1
);
if
(
nLeftParentPos
!=
-
1
)
{
if
(
aFormula
.
getLength
()
<
aSel
.
nEndPos
)
return
;
sal_Int32
nPos
=
aSel
.
nEndPos
;
OUString
aSelText
=
aFormula
.
copy
(
0
,
nPos
);
sal_Int32
nNextFStart
=
0
;
sal_Int32
nArgPos
=
0
;
sal_Int32
nNextFStart
=
aHelper
.
GetFunctionStart
(
rSelText
,
nLeftParentPos
,
true
);
const
IFunctionDescription
*
ppFDesc
;
::
std
::
vector
<
OUString
>
aArgs
;
sal_uInt16
nArgs
;
bool
bFound
=
false
;
FormulaHelper
aHelper
(
ScGlobal
::
GetStarCalcFunctionMgr
());
while
(
!
bFound
)
if
(
aHelper
.
GetNextFunc
(
rSelText
,
false
,
nNextFStart
,
NULL
,
&
ppFDesc
,
&
aArgs
)
)
{
aSelText
+=
")"
;
sal_Int32
nLeftParentPos
=
lcl_MatchParenthesis
(
aSelText
,
aSelText
.
getLength
()
-
1
);
if
(
nLeftParentPos
!=
-
1
)
if
(
!
ppFDesc
->
getFunctionName
().
isEmpty
()
)
{
sal_Unicode
c
=
(
nLeftParentPos
>
0
)
?
aSelText
[
nLeftParentPos
-
1
]
:
0
;
if
(
!
(
comphelper
::
string
::
isalphaAscii
(
c
))
)
continue
;
nNextFStart
=
aHelper
.
GetFunctionStart
(
aSelText
,
nLeftParentPos
,
true
);
if
(
aHelper
.
GetNextFunc
(
aSelText
,
false
,
nNextFStart
,
NULL
,
&
ppFDesc
,
&
aArgs
)
)
sal_Int32
nArgPos
=
aHelper
.
GetArgStart
(
rSelText
,
nNextFStart
,
0
);
sal_uInt16
nArgs
=
static_cast
<
sal_uInt16
>
(
ppFDesc
->
getParameterCount
());
OUString
aFuncName
(
ppFDesc
->
getFunctionName
()
+
"("
);
OUString
aNew
;
ScTypedCaseStrSet
::
const_iterator
it
=
findText
(
*
pFormulaDataPara
,
pFormulaDataPara
->
end
(),
aFuncName
,
aNew
,
false
);
if
(
it
!=
pFormulaDataPara
->
end
())
{
if
(
!
ppFDesc
->
getFunctionName
().
isEmpty
()
)
bool
bFlag
=
false
;
sal_uInt16
nActive
=
0
;
for
(
sal_uInt16
i
=
0
;
i
<
nArgs
;
i
++
)
{
sal_Int32
nLength
=
aArgs
[
i
].
getLength
();
if
(
nArgPos
<=
rSelText
.
getLength
()
-
1
)
{
nActive
=
i
+
1
;
bFlag
=
true
;
}
nArgPos
+=
nLength
+
1
;
}
if
(
bFlag
)
{
nArgPos
=
aHelper
.
GetArgStart
(
aSelText
,
nNextFStart
,
0
);
nArgs
=
static_cast
<
sal_uInt16
>
(
ppFDesc
->
getParameterCount
());
OUString
aFuncName
=
ppFDesc
->
getFunctionName
()
+
"("
;
OUString
aNew
;
ScTypedCaseStrSet
::
const_iterator
it
=
findText
(
*
pFormulaDataPara
,
pFormulaDataPara
->
end
(),
aFuncName
,
aNew
,
false
);
if
(
it
!=
pFormulaDataPara
->
end
())
sal_Int32
nCountSemicolon
=
comphelper
::
string
::
getTokenCount
(
aNew
,
cSep
)
-
1
;
sal_Int32
nCountDot
=
comphelper
::
string
::
getTokenCount
(
aNew
,
cSheetSep
)
-
1
;
sal_Int32
nStartPosition
=
0
;
sal_Int32
nEndPosition
=
0
;
if
(
!
nCountSemicolon
)
{
bool
bFlag
=
false
;
sal_uInt16
nActive
=
0
;
for
(
sal_uInt16
i
=
0
;
i
<
nArgs
;
i
++
)
for
(
sal_Int32
i
=
0
;
i
<
aNew
.
getLength
();
++
i
)
{
sal_
Int32
nLength
=
aArgs
[
i
].
getLength
()
;
if
(
nArgPos
<=
aSelText
.
getLength
()
-
1
)
sal_
Unicode
cNext
=
aNew
[
i
]
;
if
(
cNext
==
'('
)
{
nActive
=
i
+
1
;
bFlag
=
true
;
nStartPosition
=
i
+
1
;
}
nArgPos
+=
nLength
+
1
;
}
if
(
bFlag
)
}
else
if
(
!
nCountDot
)
{
sal_uInt16
nCount
=
0
;
for
(
sal_Int32
i
=
0
;
i
<
aNew
.
getLength
();
++
i
)
{
sal_Int32
nCountSemicolon
=
comphelper
::
string
::
getTokenCount
(
aNew
,
cSep
)
-
1
;
sal_Int32
nCountDot
=
comphelper
::
string
::
getTokenCount
(
aNew
,
cSheetSep
)
-
1
;
sal_Int32
nStartPosition
=
0
;
sal_Int32
nEndPosition
=
0
;
if
(
!
nCountSemicolon
)
sal_Unicode
cNext
=
aNew
[
i
];
if
(
cNext
==
'('
)
{
for
(
sal_Int32
i
=
0
;
i
<
aNew
.
getLength
();
++
i
)
{
sal_Unicode
cNext
=
aNew
[
i
];
if
(
cNext
==
'('
)
{
nStartPosition
=
i
+
1
;
}
}
nStartPosition
=
i
+
1
;
}
else
if
(
!
nCountDot
)
else
if
(
cNext
==
cSep
)
{
sal_uInt16
nCount
=
0
;
for
(
sal_Int32
i
=
0
;
i
<
aNew
.
getLength
();
++
i
)
nCount
++
;
nEndPosition
=
i
;
if
(
nCount
==
nActive
)
{
sal_Unicode
cNext
=
aNew
[
i
];
if
(
cNext
==
'('
)
{
nStartPosition
=
i
+
1
;
}
else
if
(
cNext
==
cSep
)
{
nCount
++
;
nEndPosition
=
i
;
if
(
nCount
==
nActive
)
{
break
;
}
nStartPosition
=
nEndPosition
+
1
;
}
break
;
}
nStartPosition
=
nEndPosition
+
1
;
}
}
}
else
{
sal_uInt16
nCount
=
0
;
for
(
sal_Int32
i
=
0
;
i
<
aNew
.
getLength
();
++
i
)
{
sal_Unicode
cNext
=
aNew
[
i
];
if
(
cNext
==
'('
)
{
nStartPosition
=
i
+
1
;
}
else
else
if
(
cNext
==
cSep
)
{
sal_uInt16
nCount
=
0
;
for
(
sal_Int32
i
=
0
;
i
<
aNew
.
getLength
();
++
i
)
nCount
++
;
nEndPosition
=
i
;
if
(
nCount
==
nActive
)
{
sal_Unicode
cNext
=
aNew
[
i
];
if
(
cNext
==
'('
)
{
nStartPosition
=
i
+
1
;
}
else
if
(
cNext
==
cSep
)
{
nCount
++
;
nEndPosition
=
i
;
if
(
nCount
==
nActive
)
{
break
;
}
nStartPosition
=
nEndPosition
+
1
;
}
else
if
(
cNext
==
cSheetSep
)
{
continue
;
}
break
;
}
nStartPosition
=
nEndPosition
+
1
;
}
if
(
nStartPosition
>
0
)
else
if
(
cNext
==
cSheetSep
)
{
OUStringBuffer
aBuf
;
aBuf
.
append
(
aNew
.
copy
(
0
,
nStartPosition
));
aBuf
.
append
(
static_cast
<
sal_Unicode
>
(
0x25BA
));
aBuf
.
append
(
aNew
.
copy
(
nStartPosition
));
aNew
=
aBuf
.
makeStringAndClear
();
ShowTipBelow
(
aNew
);
bFound
=
true
;
continue
;
}
}
else
{
ShowTipBelow
(
aNew
);
bFound
=
true
;
}
}
if
(
nStartPosition
>
0
)
{
OUStringBuffer
aBuf
;
aBuf
.
append
(
aNew
.
copy
(
0
,
nStartPosition
));
aBuf
.
append
(
static_cast
<
sal_Unicode
>
(
0x25BA
));
aBuf
.
append
(
aNew
.
copy
(
nStartPosition
));
aNew
=
aBuf
.
makeStringAndClear
();
ShowTipBelow
(
aNew
);
bFound
=
true
;
}
}
}
}
else
{
sal_Int32
nPosition
=
0
;
OUString
aText
=
pEngine
->
GetWord
(
0
,
aSel
.
nEndPos
-
1
);
/* XXX: dubious, what is this condition supposed to exactly match? */
if
(
aSel
.
nEndPos
<=
aText
.
getLength
()
&&
aText
[
aSel
.
nEndPos
-
1
]
==
'='
)
{
break
;
}
OUString
aNew
;
nPosition
=
aText
.
getLength
()
+
1
;
ScTypedCaseStrSet
::
const_iterator
it
=
findText
(
*
pFormulaDataPara
,
pFormulaDataPara
->
end
(),
aText
,
aNew
,
false
);
if
(
it
!=
pFormulaDataPara
->
end
())
{
if
(
nPosition
<
aFormula
.
getLength
()
&&
aFormula
[
nPosition
]
==
'('
)
else
{
ShowTipBelow
(
aNew
);
bFound
=
true
;
}
else
break
;
}
else
{
break
;
}
}
}
}
else
if
(
bTryFirstSel
)
{
sal_Int32
nPosition
=
0
;
OUString
aText
=
pEngine
->
GetWord
(
0
,
rSel
.
nEndPos
-
1
);
/* XXX: dubious, what is this condition supposed to exactly match? */
if
(
rSel
.
nEndPos
<=
aText
.
getLength
()
&&
aText
[
rSel
.
nEndPos
-
1
]
==
'='
)
{
break
;
}
OUString
aNew
;
nPosition
=
aText
.
getLength
()
+
1
;
ScTypedCaseStrSet
::
const_iterator
it
=
findText
(
*
pFormulaDataPara
,
pFormulaDataPara
->
end
(),
aText
,
aNew
,
false
);
if
(
it
!=
pFormulaDataPara
->
end
())
{
if
(
nPosition
<
rParagraph
.
getLength
()
&&
rParagraph
[
nPosition
]
==
'('
)
{
ShowTipBelow
(
aNew
);
bFound
=
true
;
}
else
break
;
}
else
{
break
;
}
}
}
}
void
ScInputHandler
::
ShowTipCursor
()
{
HideTip
();
HideTipBelow
();
EditView
*
pActiveView
=
pTopView
?
pTopView
:
pTableView
;
if
(
bFormulaMode
&&
pActiveView
&&
pFormulaDataPara
&&
pEngine
->
GetParagraphCount
()
==
1
)
{
OUString
aParagraph
=
pEngine
->
GetText
(
0
);
ESelection
aSel
=
pActiveView
->
GetSelection
();
aSel
.
Adjust
();
if
(
aParagraph
.
getLength
()
<
aSel
.
nEndPos
)
return
;
if
(
aSel
.
nEndPos
>
0
)
{
OUString
aSelText
(
aParagraph
.
copy
(
0
,
aSel
.
nEndPos
));
ShowArgumentsTip
(
aParagraph
,
aSelText
,
aSel
,
true
);
}
}
}
...
...
@@ -1052,38 +1052,27 @@ bool ScInputHandler::GetFuncName( OUString& aStart, OUString& aResult )
void
ScInputHandler
::
UseFormulaData
()
{
EditView
*
pActiveView
=
pTopView
?
pTopView
:
pTableView
;
ScDocShell
*
pDocSh
=
pActiveViewSh
->
GetViewData
()
->
GetDocShell
();
const
sal_Unicode
cSep
=
ScCompiler
::
GetNativeSymbolChar
(
ocSep
);
const
sal_Unicode
cSheetSep
=
lcl_getSheetSeparator
(
pDocSh
->
GetDocument
());
// Formulas may only have 1 paragraph
if
(
pActiveView
&&
pFormulaData
&&
pEngine
->
GetParagraphCount
()
==
1
)
{
OUString
a
Total
=
pEngine
->
GetText
(
0
);
OUString
a
Paragraph
=
pEngine
->
GetText
(
0
);
ESelection
aSel
=
pActiveView
->
GetSelection
();
aSel
.
Adjust
();
// Due to differences between table and input cell (e.g clipboard with line breaks),
// the selection may not be in line with the EditEngine anymore.
// Just return without any indication as to why.
if
(
aSel
.
nEndPos
>
a
Total
.
getLength
()
)
if
(
aSel
.
nEndPos
>
a
Paragraph
.
getLength
()
)
return
;
// Is the cursor at the end of a word?
if
(
aSel
.
nEndPos
>
0
)
{
sal_Int32
nPos
=
aSel
.
nEndPos
;
OUString
aFormula
=
aTotal
.
copy
(
0
,
nPos
);;
sal_Int32
nLeftParentPos
=
0
;
sal_Int32
nNextFStart
=
0
;
sal_Int32
nArgPos
=
0
;
const
IFunctionDescription
*
ppFDesc
;
::
std
::
vector
<
OUString
>
aArgs
;
sal_uInt16
nArgs
;
bool
bFound
=
false
;
OUString
aSelText
(
aParagraph
.
copy
(
0
,
aSel
.
nEndPos
));
OUString
aText
;
if
(
GetFuncName
(
a
Formula
,
aText
)
)
if
(
GetFuncName
(
a
SelText
,
aText
)
)
{
// function name is incomplete:
// show first matching function name as tip above cell
...
...
@@ -1099,129 +1088,10 @@ void ScInputHandler::UseFormulaData()
}
return
;
}
FormulaHelper
aHelper
(
ScGlobal
::
GetStarCalcFunctionMgr
());
// function name is complete:
// show tip below the cell with function name and arguments of function
while
(
!
bFound
)
{
aFormula
+=
")"
;
nLeftParentPos
=
lcl_MatchParenthesis
(
aFormula
,
aFormula
.
getLength
()
-
1
);
if
(
nLeftParentPos
==
-
1
)
break
;
nNextFStart
=
aHelper
.
GetFunctionStart
(
aFormula
,
nLeftParentPos
,
true
);
if
(
aHelper
.
GetNextFunc
(
aFormula
,
false
,
nNextFStart
,
NULL
,
&
ppFDesc
,
&
aArgs
)
)
{
if
(
!
ppFDesc
->
getFunctionName
().
isEmpty
()
)
{
nArgPos
=
aHelper
.
GetArgStart
(
aFormula
,
nNextFStart
,
0
);
nArgs
=
static_cast
<
sal_uInt16
>
(
ppFDesc
->
getParameterCount
());
OUString
aFuncName
=
ppFDesc
->
getFunctionName
()
+
"("
;
OUString
aNew
;
ScTypedCaseStrSet
::
const_iterator
it
=
findText
(
*
pFormulaDataPara
,
pFormulaDataPara
->
end
(),
aFuncName
,
aNew
,
false
);
if
(
it
!=
pFormulaDataPara
->
end
())
{
bool
bFlag
=
false
;
sal_uInt16
nActive
=
0
;
for
(
sal_uInt16
i
=
0
;
i
<
nArgs
;
i
++
)
{
sal_Int32
nLength
=
aArgs
[
i
].
getLength
();
if
(
nArgPos
<=
aFormula
.
getLength
()
-
1
)
{
nActive
=
i
+
1
;
bFlag
=
true
;
}
nArgPos
+=
nLength
+
1
;
}
if
(
bFlag
)
{
sal_Int32
nCountSemicolon
=
comphelper
::
string
::
getTokenCount
(
aNew
,
cSep
)
-
1
;
sal_Int32
nCountDot
=
comphelper
::
string
::
getTokenCount
(
aNew
,
cSheetSep
)
-
1
;
sal_Int32
nStartPosition
=
0
;
sal_Int32
nEndPosition
=
0
;
if
(
!
nCountSemicolon
)
{
for
(
sal_Int32
i
=
0
;
i
<
aNew
.
getLength
();
++
i
)
{
sal_Unicode
cNext
=
aNew
[
i
];
if
(
cNext
==
'('
)
{
nStartPosition
=
i
+
1
;
}
}
}
else
if
(
!
nCountDot
)
{
sal_uInt16
nCount
=
0
;
for
(
sal_Int32
i
=
0
;
i
<
aNew
.
getLength
();
++
i
)
{
sal_Unicode
cNext
=
aNew
[
i
];
if
(
cNext
==
'('
)
{
nStartPosition
=
i
+
1
;
}
else
if
(
cNext
==
cSep
)
{
nCount
++
;
nEndPosition
=
i
;
if
(
nCount
==
nActive
)
{
break
;
}
nStartPosition
=
nEndPosition
+
1
;
}
}
}
else
{
sal_uInt16
nCount
=
0
;
for
(
sal_Int32
i
=
0
;
i
<
aNew
.
getLength
();
++
i
)
{
sal_Unicode
cNext
=
aNew
[
i
];
if
(
cNext
==
'('
)
{
nStartPosition
=
i
+
1
;
}
else
if
(
cNext
==
cSep
)
{
nCount
++
;
nEndPosition
=
i
;
if
(
nCount
==
nActive
)
{
break
;
}
nStartPosition
=
nEndPosition
+
1
;
}
else
if
(
cNext
==
cSheetSep
)
{
continue
;
}
}
}
if
(
nStartPosition
>
0
)
{
OUStringBuffer
aBuf
;
aBuf
.
append
(
aNew
.
copy
(
0
,
nStartPosition
));
aBuf
.
append
(
static_cast
<
sal_Unicode
>
(
0x25BA
));
aBuf
.
append
(
aNew
.
copy
(
nStartPosition
));
aNew
=
aBuf
.
makeStringAndClear
();
ShowTipBelow
(
aNew
);
bFound
=
true
;
}
}
else
{
ShowTipBelow
(
aNew
);
bFound
=
true
;
}
}
}
}
}
ShowArgumentsTip
(
aParagraph
,
aSelText
,
aSel
,
false
);
}
}
}
...
...
sc/source/ui/inc/inputhdl.hxx
Dosyayı görüntüle @
5a147660
...
...
@@ -158,6 +158,8 @@ private:
bool
CursorAtClosingPar
();
void
SkipClosingPar
();
bool
GetFuncName
(
OUString
&
aStart
,
OUString
&
aResult
);
// fdo75264
void
ShowArgumentsTip
(
const
OUString
&
rParagraph
,
OUString
&
rSelText
,
const
ESelection
&
rSel
,
bool
bTryFirstSel
);
DECL_LINK
(
ModifyHdl
,
void
*
);
DECL_LINK
(
ShowHideTipVisibleParentListener
,
VclWindowEvent
*
);
DECL_LINK
(
ShowHideTipVisibleSecParentListener
,
VclWindowEvent
*
);
...
...
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