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
fd28dea5
Kaydet (Commit)
fd28dea5
authored
Mar 20, 2015
tarafından
Laszlo Kis-Adam
Kaydeden (comit)
Markus Mohrhard
Mar 28, 2015
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
tdf#42897 Warn the user if string without quote is entered as condition value.
Change-Id: I5b30b608c0192b434ff237513ed7fbbf5af43f11
üst
78ad5ecd
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
89 additions
and
22 deletions
+89
-22
globstr.hrc
sc/inc/globstr.hrc
+4
-1
condformatdlgentry.cxx
sc/source/ui/condformat/condformatdlgentry.cxx
+61
-19
condformatdlg.hrc
sc/source/ui/inc/condformatdlg.hrc
+2
-0
condformatdlgentry.hxx
sc/source/ui/inc/condformatdlgentry.hxx
+8
-2
condformatdlg.src
sc/source/ui/src/condformatdlg.src
+6
-0
globstr.src
sc/source/ui/src/globstr.src
+8
-0
No files found.
sc/inc/globstr.hrc
Dosyayı görüntüle @
fd28dea5
...
@@ -695,7 +695,10 @@
...
@@ -695,7 +695,10 @@
#define STR_UNDO_CONDFORMAT 531
#define STR_UNDO_CONDFORMAT 531
#define STR_UNDO_FORMULA_TO_VALUE 532
#define STR_UNDO_FORMULA_TO_VALUE 532
#define SC_GLOBSTR_STR_COUNT 533 /**< the count of permanently resident strings */
#define STR_UNQUOTED_STRING 533
#define STR_ENTER_VALUE 534
#define SC_GLOBSTR_STR_COUNT 535 /**< the count of permanently resident strings */
#endif
#endif
...
...
sc/source/ui/condformat/condformatdlgentry.cxx
Dosyayı görüntüle @
fd28dea5
...
@@ -23,9 +23,11 @@
...
@@ -23,9 +23,11 @@
#include <svx/drawitem.hxx>
#include <svx/drawitem.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/settings.hxx>
#include <vcl/settings.hxx>
#include <formula/token.hxx>
#include "tokenarray.hxx"
#include "tokenarray.hxx"
#include "stlpool.hxx"
#include "stlpool.hxx"
#include "tabvwsh.hxx"
#include "tabvwsh.hxx"
#include "simpleformulacalc.hxx"
#include "colorformat.hxx"
#include "colorformat.hxx"
...
@@ -124,23 +126,6 @@ void ScCondFrmtEntry::Deselect()
...
@@ -124,23 +126,6 @@ void ScCondFrmtEntry::Deselect()
SetHeight
();
SetHeight
();
}
}
IMPL_LINK
(
ScCondFrmtEntry
,
EdModifyHdl
,
Edit
*
,
pEdit
)
{
OUString
aFormula
=
pEdit
->
GetText
();
ScCompiler
aComp
(
mpDoc
,
maPos
);
aComp
.
SetGrammar
(
mpDoc
->
GetGrammar
()
);
boost
::
scoped_ptr
<
ScTokenArray
>
mpCode
(
aComp
.
CompileString
(
aFormula
));
if
(
mpCode
->
GetCodeError
())
{
pEdit
->
SetControlBackground
(
COL_LIGHTRED
);
}
else
{
pEdit
->
SetControlBackground
(
GetSettings
().
GetStyleSettings
().
GetWindowColor
());
}
return
0
;
}
//condition
//condition
namespace
{
namespace
{
...
@@ -197,6 +182,7 @@ ScConditionFrmtEntry::ScConditionFrmtEntry( vcl::Window* pParent, ScDocument* pD
...
@@ -197,6 +182,7 @@ ScConditionFrmtEntry::ScConditionFrmtEntry( vcl::Window* pParent, ScDocument* pD
maLbCondType
(
this
,
ScResId
(
LB_CELLIS_TYPE
)
),
maLbCondType
(
this
,
ScResId
(
LB_CELLIS_TYPE
)
),
maEdVal1
(
this
,
NULL
,
NULL
,
ScResId
(
ED_VAL1
)
),
maEdVal1
(
this
,
NULL
,
NULL
,
ScResId
(
ED_VAL1
)
),
maEdVal2
(
this
,
NULL
,
NULL
,
ScResId
(
ED_VAL2
)
),
maEdVal2
(
this
,
NULL
,
NULL
,
ScResId
(
ED_VAL2
)
),
maFtVal
(
this
,
ScResId
(
FT_VAL
)
),
maFtStyle
(
this
,
ScResId
(
FT_STYLE
)
),
maFtStyle
(
this
,
ScResId
(
FT_STYLE
)
),
maLbStyle
(
this
,
ScResId
(
LB_STYLE
)
),
maLbStyle
(
this
,
ScResId
(
LB_STYLE
)
),
maWdPreview
(
this
,
ScResId
(
WD_PREVIEW
)
),
maWdPreview
(
this
,
ScResId
(
WD_PREVIEW
)
),
...
@@ -256,8 +242,8 @@ void ScConditionFrmtEntry::Init(ScCondFormatDlg* pDialogParent)
...
@@ -256,8 +242,8 @@ void ScConditionFrmtEntry::Init(ScCondFormatDlg* pDialogParent)
maEdVal1
.
SetStyle
(
maEdVal1
.
GetStyle
()
|
WB_FORCECTRLBACKGROUND
);
maEdVal1
.
SetStyle
(
maEdVal1
.
GetStyle
()
|
WB_FORCECTRLBACKGROUND
);
maEdVal2
.
SetStyle
(
maEdVal2
.
GetStyle
()
|
WB_FORCECTRLBACKGROUND
);
maEdVal2
.
SetStyle
(
maEdVal2
.
GetStyle
()
|
WB_FORCECTRLBACKGROUND
);
maEdVal1
.
SetModifyHdl
(
LINK
(
this
,
ScCond
FrmtEntry
,
EdModifyHdl
)
);
maEdVal1
.
SetModifyHdl
(
LINK
(
this
,
ScCond
itionFrmtEntry
,
OnEdChanged
)
);
maEdVal2
.
SetModifyHdl
(
LINK
(
this
,
ScCond
FrmtEntry
,
EdModifyHdl
)
);
maEdVal2
.
SetModifyHdl
(
LINK
(
this
,
ScCond
itionFrmtEntry
,
OnEdChanged
)
);
FillStyleListBox
(
mpDoc
,
maLbStyle
);
FillStyleListBox
(
mpDoc
,
maLbStyle
);
maLbStyle
.
SetSelectHdl
(
LINK
(
this
,
ScConditionFrmtEntry
,
StyleSelectHdl
)
);
maLbStyle
.
SetSelectHdl
(
LINK
(
this
,
ScConditionFrmtEntry
,
StyleSelectHdl
)
);
...
@@ -283,6 +269,59 @@ ScFormatEntry* ScConditionFrmtEntry::createConditionEntry() const
...
@@ -283,6 +269,59 @@ ScFormatEntry* ScConditionFrmtEntry::createConditionEntry() const
return
pEntry
;
return
pEntry
;
}
}
IMPL_LINK
(
ScConditionFrmtEntry
,
OnEdChanged
,
Edit
*
,
pEdit
)
{
OUString
aFormula
=
pEdit
->
GetText
();
if
(
aFormula
.
isEmpty
()
)
{
maFtVal
.
SetText
(
ScGlobal
::
GetRscString
(
STR_ENTER_VALUE
));
return
0
;
}
ScCompiler
aComp
(
mpDoc
,
maPos
);
aComp
.
SetGrammar
(
mpDoc
->
GetGrammar
()
);
boost
::
scoped_ptr
<
ScTokenArray
>
ta
(
aComp
.
CompileString
(
aFormula
));
// Error, warn the user
if
(
ta
->
GetCodeError
()
)
{
pEdit
->
SetControlBackground
(
COL_LIGHTRED
);
maFtVal
.
SetText
(
ScGlobal
::
GetRscString
(
STR_VALID_DEFERROR
));
return
0
;
}
// Recognized col/row name or string token, warn the user
formula
::
FormulaToken
*
token
=
ta
->
First
();
formula
::
StackVar
t
=
token
->
GetType
();
OpCode
op
=
token
->
GetOpCode
();
if
(
(
op
==
ocColRowName
)
||
(
(
op
==
ocBad
)
&&
(
t
==
formula
::
svString
)
)
)
{
pEdit
->
SetControlBackground
(
COL_LIGHTRED
);
maFtVal
.
SetText
(
ScGlobal
::
GetRscString
(
STR_UNQUOTED_STRING
));
return
0
;
}
pEdit
->
SetControlBackground
(
GetSettings
().
GetStyleSettings
().
GetWindowColor
());
maFtVal
.
SetText
(
""
);
return
0
;
}
void
ScConditionFrmtEntry
::
Select
()
{
maFtVal
.
Show
();
ScCondFrmtEntry
::
Select
();
}
void
ScConditionFrmtEntry
::
Deselect
()
{
maFtVal
.
Hide
();
ScCondFrmtEntry
::
Deselect
();
}
sal_Int32
ScConditionFrmtEntry
::
ConditionModeToEntryPos
(
ScConditionMode
eMode
)
const
sal_Int32
ScConditionFrmtEntry
::
ConditionModeToEntryPos
(
ScConditionMode
eMode
)
const
{
{
for
(
sal_Int32
i
=
0
;
i
<
NUM_COND_ENTRIES
;
++
i
)
for
(
sal_Int32
i
=
0
;
i
<
NUM_COND_ENTRIES
;
++
i
)
...
@@ -994,14 +1033,17 @@ IMPL_LINK_NOARG( ScConditionFrmtEntry, ConditionTypeSelectHdl )
...
@@ -994,14 +1033,17 @@ IMPL_LINK_NOARG( ScConditionFrmtEntry, ConditionTypeSelectHdl )
case
0
:
case
0
:
maEdVal1
.
Hide
();
maEdVal1
.
Hide
();
maEdVal2
.
Hide
();
maEdVal2
.
Hide
();
maFtVal
.
Hide
();
break
;
break
;
case
1
:
case
1
:
maEdVal1
.
Show
();
maEdVal1
.
Show
();
maEdVal2
.
Hide
();
maEdVal2
.
Hide
();
maFtVal
.
Show
();
break
;
break
;
case
2
:
case
2
:
maEdVal1
.
Show
();
maEdVal1
.
Show
();
maEdVal2
.
Show
();
maEdVal2
.
Show
();
maFtVal
.
Show
();
break
;
break
;
}
}
...
...
sc/source/ui/inc/condformatdlg.hrc
Dosyayı görüntüle @
fd28dea5
...
@@ -55,4 +55,6 @@
...
@@ -55,4 +55,6 @@
#define FT_ICON_SET_ENTRY_TEXT 49
#define FT_ICON_SET_ENTRY_TEXT 49
#define ED_ICON_SET_ENTRY_VALUE 50
#define ED_ICON_SET_ENTRY_VALUE 50
#define FT_VAL 51
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sc/source/ui/inc/condformatdlgentry.hxx
Dosyayı görüntüle @
fd28dea5
...
@@ -59,8 +59,8 @@ protected:
...
@@ -59,8 +59,8 @@ protected:
DECL_LINK
(
EdModifyHdl
,
Edit
*
);
DECL_LINK
(
EdModifyHdl
,
Edit
*
);
void
Select
();
v
irtual
v
oid
Select
();
void
Deselect
();
v
irtual
v
oid
Deselect
();
virtual
OUString
GetExpressionString
()
=
0
;
virtual
OUString
GetExpressionString
()
=
0
;
...
@@ -88,6 +88,7 @@ class ScConditionFrmtEntry : public ScCondFrmtEntry, public SfxListener
...
@@ -88,6 +88,7 @@ class ScConditionFrmtEntry : public ScCondFrmtEntry, public SfxListener
ListBox
maLbCondType
;
ListBox
maLbCondType
;
formula
::
RefEdit
maEdVal1
;
formula
::
RefEdit
maEdVal1
;
formula
::
RefEdit
maEdVal2
;
formula
::
RefEdit
maEdVal2
;
FixedText
maFtVal
;
FixedText
maFtStyle
;
FixedText
maFtStyle
;
ListBox
maLbStyle
;
ListBox
maLbStyle
;
SvxFontPrevWindow
maWdPreview
;
SvxFontPrevWindow
maWdPreview
;
...
@@ -103,6 +104,7 @@ class ScConditionFrmtEntry : public ScCondFrmtEntry, public SfxListener
...
@@ -103,6 +104,7 @@ class ScConditionFrmtEntry : public ScCondFrmtEntry, public SfxListener
void
Init
(
ScCondFormatDlg
*
pDialogParent
);
void
Init
(
ScCondFormatDlg
*
pDialogParent
);
DECL_LINK
(
StyleSelectHdl
,
void
*
);
DECL_LINK
(
StyleSelectHdl
,
void
*
);
DECL_LINK
(
ConditionTypeSelectHdl
,
void
*
);
DECL_LINK
(
ConditionTypeSelectHdl
,
void
*
);
DECL_LINK
(
OnEdChanged
,
Edit
*
);
// Searches the lookup table for the entry position, given condition mode
// Searches the lookup table for the entry position, given condition mode
sal_Int32
ConditionModeToEntryPos
(
ScConditionMode
eMode
)
const
;
sal_Int32
ConditionModeToEntryPos
(
ScConditionMode
eMode
)
const
;
...
@@ -111,6 +113,10 @@ class ScConditionFrmtEntry : public ScCondFrmtEntry, public SfxListener
...
@@ -111,6 +113,10 @@ class ScConditionFrmtEntry : public ScCondFrmtEntry, public SfxListener
// Returns the number of edit fields used for a given condition mode
// Returns the number of edit fields used for a given condition mode
sal_Int32
GetNumberEditFields
(
ScConditionMode
eMode
)
const
;
sal_Int32
GetNumberEditFields
(
ScConditionMode
eMode
)
const
;
protected
:
virtual
void
Select
()
SAL_OVERRIDE
;
virtual
void
Deselect
()
SAL_OVERRIDE
;
public
:
public
:
ScConditionFrmtEntry
(
vcl
::
Window
*
pParent
,
ScDocument
*
pDoc
,
ScCondFormatDlg
*
pDialogParent
,
ScConditionFrmtEntry
(
vcl
::
Window
*
pParent
,
ScDocument
*
pDoc
,
ScCondFormatDlg
*
pDialogParent
,
const
ScAddress
&
rPos
,
const
ScCondFormatEntry
*
pFormatEntry
=
NULL
);
const
ScAddress
&
rPos
,
const
ScCondFormatEntry
*
pFormatEntry
=
NULL
);
...
...
sc/source/ui/src/condformatdlg.src
Dosyayı görüntüle @
fd28dea5
...
@@ -190,6 +190,12 @@ Control RID_COND_ENTRY
...
@@ -190,6 +190,12 @@ Control RID_COND_ENTRY
Text [ en-US ] = "Example";
Text [ en-US ] = "Example";
Border = TRUE;
Border = TRUE;
};
};
FixedText FT_VAL
{
Pos = MAP_APPFONT( 5, 48 );
Size = MAP_APPFONT( 300, 12 );
Text[ en-US ] = "Enter a value!";
};
Edit ED_COL_SCALE_MIN
Edit ED_COL_SCALE_MIN
{
{
Pos = MAP_APPFONT( 5, 48 );
Pos = MAP_APPFONT( 5, 48 );
...
...
sc/source/ui/src/globstr.src
Dosyayı görüntüle @
fd28dea5
...
@@ -2081,6 +2081,14 @@ Resource RID_GLOBSTR
...
@@ -2081,6 +2081,14 @@ Resource RID_GLOBSTR
{
{
Text [ en-US ] = "Convert Formula To Value";
Text [ en-US ] = "Convert Formula To Value";
};
};
String STR_UNQUOTED_STRING
{
Text [ en-US ] = "Strings must be quoted, otherwise they might be interpreted as an address or col/row name!";
};
String STR_ENTER_VALUE
{
Text[ en-US ] = "Enter a value!";
};
};
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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