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
520400e8
Kaydet (Commit)
520400e8
authored
May 08, 2015
tarafından
Caolán McNamara
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
convert EXPAND constants to scoped enum
Change-Id: I98a0fecf15337db729b39b80aa9c664abcdd3daa
üst
cd3e9457
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
38 deletions
+47
-38
modeltoviewhelper.hxx
sw/inc/modeltoviewhelper.hxx
+17
-8
uwriter.cxx
sw/qa/core/uwriter.cxx
+16
-16
modeltoviewhelper.cxx
sw/source/core/txtnode/modeltoviewhelper.cxx
+11
-11
ndtxt.cxx
sw/source/core/txtnode/ndtxt.cxx
+2
-2
txtedt.cxx
sw/source/core/txtnode/txtedt.cxx
+1
-1
No files found.
sw/inc/modeltoviewhelper.hxx
Dosyayı görüntüle @
520400e8
...
...
@@ -22,6 +22,7 @@
#include <rtl/ustring.hxx>
#include <sal/types.h>
#include <o3tl/typed_flags_set.hxx>
#include <vector>
class
SwTxtNode
;
...
...
@@ -61,13 +62,21 @@ class SwTxtNode;
0111: expanding fields + hiding hiddens + hiding redlines gives: AAAABB foo CCCCC foo DDDDD
*/
#define PASSTHROUGH 0x0000
#define EXPANDFIELDS 0x0001
#define EXPANDFOOTNOTE 0x0002
#define HIDEINVISIBLE 0x0004
#define HIDEDELETIONS 0x0008
/// do not expand to content, but replace with ZWSP
#define REPLACEMODE 0x0010
enum
class
ExpandMode
{
PassThrough
=
0x0000
,
ExpandFields
=
0x0001
,
ExpandFootnote
=
0x0002
,
HideInvisible
=
0x0004
,
HideDeletions
=
0x0008
,
/// do not expand to content, but replace with zwsp
ReplaceMode
=
0x0010
,
};
namespace
o3tl
{
template
<>
struct
typed_flags
<
ExpandMode
>
:
is_typed_flags
<
ExpandMode
,
0x001f
>
{};
}
class
ModelToViewHelper
{
...
...
@@ -118,7 +127,7 @@ public:
ModelToViewHelper
(
const
SwTxtNode
&
rNode
,
// defaults are appropriate for spell/grammar checking
sal_uInt16
eMode
=
EXPANDFIELDS
|
EXPANDFOOTNOTE
|
REPLACEMODE
);
ExpandMode
eMode
=
ExpandMode
::
ExpandFields
|
ExpandMode
::
ExpandFootnote
|
ExpandMode
::
ReplaceMode
);
ModelToViewHelper
()
//pass through filter, view == model
{
}
...
...
sw/qa/core/uwriter.cxx
Dosyayı görüntüle @
520400e8
...
...
@@ -341,7 +341,7 @@ void SwDocTest::testModelToViewHelperPassthrough()
{
SwTxtNode
*
pTxtNode
=
getModelToViewTestDocument
(
m_pDoc
);
ModelToViewHelper
aModelToViewHelper
(
*
pTxtNode
,
PASSTHROUGH
);
ModelToViewHelper
aModelToViewHelper
(
*
pTxtNode
,
ExpandMode
::
PassThrough
);
OUString
sViewText
=
aModelToViewHelper
.
getViewText
();
OUString
sModelText
=
pTxtNode
->
GetTxt
();
CPPUNIT_ASSERT_EQUAL
(
sModelText
,
sViewText
);
...
...
@@ -351,7 +351,7 @@ void SwDocTest::testModelToViewHelperExpandFieldsExpandFootnote()
{
SwTxtNode
*
pTxtNode
=
getModelToViewTestDocument
(
m_pDoc
);
ModelToViewHelper
aModelToViewHelper
(
*
pTxtNode
,
E
XPANDFIELDS
|
EXPANDFOOTNOTE
);
ModelToViewHelper
aModelToViewHelper
(
*
pTxtNode
,
E
xpandMode
::
ExpandFields
|
ExpandMode
::
ExpandFootnote
);
OUString
sViewText
=
aModelToViewHelper
.
getViewText
();
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"AAAAA BBBBB foo CCCCC foo DDDDD"
),
sViewText
);
...
...
@@ -362,7 +362,7 @@ void SwDocTest::testModelToViewHelperExpandFieldsExpandFootnoteReplaceMode()
SwTxtNode
*
pTxtNode
=
getModelToViewTestDocument
(
m_pDoc
);
ModelToViewHelper
aModelToViewHelper
(
*
pTxtNode
,
E
XPANDFIELDS
|
EXPANDFOOTNOTE
|
REPLACEMODE
);
E
xpandMode
::
ExpandFields
|
ExpandMode
::
ExpandFootnote
|
ExpandMode
::
ReplaceMode
);
OUString
sViewText
=
aModelToViewHelper
.
getViewText
();
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"AAAAA BBBBB "
+
OUString
(
CHAR_ZWSP
)
+
" CCCCC "
+
OUString
(
CHAR_ZWSP
)
+
" DDDDD"
),
...
...
@@ -381,7 +381,7 @@ void SwDocTest::testModelToViewHelperExpandFields()
{
SwTxtNode
*
pTxtNode
=
getModelToViewTestDocument
(
m_pDoc
);
ModelToViewHelper
aModelToViewHelper
(
*
pTxtNode
,
E
XPANDFIELDS
);
ModelToViewHelper
aModelToViewHelper
(
*
pTxtNode
,
E
xpandMode
::
ExpandFields
);
OUString
sViewText
=
aModelToViewHelper
.
getViewText
();
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"AAAAA BBBBB CCCCC DDDDD"
),
sViewText
);
...
...
@@ -392,7 +392,7 @@ void SwDocTest::testModelToViewHelperExpandFieldsReplaceMode()
SwTxtNode
*
pTxtNode
=
getModelToViewTestDocument
(
m_pDoc
);
ModelToViewHelper
aModelToViewHelper
(
*
pTxtNode
,
E
XPANDFIELDS
|
REPLACEMODE
);
E
xpandMode
::
ExpandFields
|
ExpandMode
::
ReplaceMode
);
OUString
sViewText
=
aModelToViewHelper
.
getViewText
();
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"AAAAA BBBBB CCCCC DDDDD"
),
sViewText
);
...
...
@@ -406,7 +406,7 @@ void SwDocTest::testModelToViewHelperExpandFieldsHideInvisible()
{
SwTxtNode
*
pTxtNode
=
getModelToViewTestDocument
(
m_pDoc
);
ModelToViewHelper
aModelToViewHelper
(
*
pTxtNode
,
HIDEINVISIBLE
);
ModelToViewHelper
aModelToViewHelper
(
*
pTxtNode
,
ExpandMode
::
HideInvisible
);
OUString
sViewText
=
aModelToViewHelper
.
getViewText
();
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"AAAAA CCCCC "
+
OUStringLiteral1
<
CH_TXTATR_BREAKWORD
>
()
+
" DDDDD"
),
...
...
@@ -417,7 +417,7 @@ void SwDocTest::testModelToViewHelperExpandFieldsHideRedlined()
{
SwTxtNode
*
pTxtNode
=
getModelToViewTestDocument
(
m_pDoc
);
ModelToViewHelper
aModelToViewHelper
(
*
pTxtNode
,
HIDEDELETIONS
);
ModelToViewHelper
aModelToViewHelper
(
*
pTxtNode
,
ExpandMode
::
HideDeletions
);
OUString
sViewText
=
aModelToViewHelper
.
getViewText
();
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"AAAABB "
+
OUStringLiteral1
<
CH_TXTATR_BREAKWORD
>
()
+
" CCCCC "
+
OUStringLiteral1
<
CH_TXTATR_BREAKWORD
>
()
+
" DDDDD"
),
...
...
@@ -428,7 +428,7 @@ void SwDocTest::testModelToViewHelperExpandFieldsHideInvisibleExpandFootnote()
{
SwTxtNode
*
pTxtNode
=
getModelToViewTestDocument
(
m_pDoc
);
ModelToViewHelper
aModelToViewHelper
(
*
pTxtNode
,
E
XPANDFIELDS
|
HIDEINVISIBLE
|
EXPANDFOOTNOTE
);
ModelToViewHelper
aModelToViewHelper
(
*
pTxtNode
,
E
xpandMode
::
ExpandFields
|
ExpandMode
::
HideInvisible
|
ExpandMode
::
ExpandFootnote
);
OUString
sViewText
=
aModelToViewHelper
.
getViewText
();
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"AAAAA CCCCC foo DDDDD"
),
sViewText
);
}
...
...
@@ -438,7 +438,7 @@ void SwDocTest::testModelToViewHelperExpandFieldsHideInvisibleExpandFootnoteRepl
SwTxtNode
*
pTxtNode
=
getModelToViewTestDocument
(
m_pDoc
);
ModelToViewHelper
aModelToViewHelper
(
*
pTxtNode
,
E
XPANDFIELDS
|
HIDEINVISIBLE
|
EXPANDFOOTNOTE
|
REPLACEMODE
);
E
xpandMode
::
ExpandFields
|
ExpandMode
::
HideInvisible
|
ExpandMode
::
ExpandFootnote
|
ExpandMode
::
ReplaceMode
);
OUString
sViewText
=
aModelToViewHelper
.
getViewText
();
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"AAAAA CCCCC "
+
OUString
(
CHAR_ZWSP
)
+
" DDDDD"
),
...
...
@@ -455,7 +455,7 @@ void SwDocTest::testModelToViewHelperExpandFieldsHideHideRedlinedExpandFootnote(
{
SwTxtNode
*
pTxtNode
=
getModelToViewTestDocument
(
m_pDoc
);
ModelToViewHelper
aModelToViewHelper
(
*
pTxtNode
,
E
XPANDFIELDS
|
HIDEDELETIONS
|
EXPANDFOOTNOTE
);
ModelToViewHelper
aModelToViewHelper
(
*
pTxtNode
,
E
xpandMode
::
ExpandFields
|
ExpandMode
::
HideDeletions
|
ExpandMode
::
ExpandFootnote
);
OUString
sViewText
=
aModelToViewHelper
.
getViewText
();
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"AAAABB foo CCCCC foo DDDDD"
),
sViewText
);
...
...
@@ -466,7 +466,7 @@ void SwDocTest::testModelToViewHelperExpandFieldsHideHideRedlinedExpandFootnoteR
SwTxtNode
*
pTxtNode
=
getModelToViewTestDocument
(
m_pDoc
);
ModelToViewHelper
aModelToViewHelper
(
*
pTxtNode
,
E
XPANDFIELDS
|
HIDEDELETIONS
|
EXPANDFOOTNOTE
|
REPLACEMODE
);
E
xpandMode
::
ExpandFields
|
ExpandMode
::
HideDeletions
|
ExpandMode
::
ExpandFootnote
|
ExpandMode
::
ReplaceMode
);
OUString
sViewText
=
aModelToViewHelper
.
getViewText
();
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"AAAABB "
+
OUString
(
CHAR_ZWSP
)
+
" CCCCC "
+
OUString
(
CHAR_ZWSP
)
+
" DDDDD"
),
...
...
@@ -485,7 +485,7 @@ void SwDocTest::testModelToViewHelperHideInvisibleHideRedlined()
{
SwTxtNode
*
pTxtNode
=
getModelToViewTestDocument
(
m_pDoc
);
ModelToViewHelper
aModelToViewHelper
(
*
pTxtNode
,
HIDEINVISIBLE
|
HIDEDELETIONS
);
ModelToViewHelper
aModelToViewHelper
(
*
pTxtNode
,
ExpandMode
::
HideInvisible
|
ExpandMode
::
HideDeletions
);
OUString
sViewText
=
aModelToViewHelper
.
getViewText
();
OUStringBuffer
aBuffer
;
aBuffer
.
append
(
"AAAACCCCC "
);
...
...
@@ -498,7 +498,7 @@ void SwDocTest::testModelToViewHelperExpandFieldsHideInvisibleHideRedlinedExpand
{
SwTxtNode
*
pTxtNode
=
getModelToViewTestDocument
(
m_pDoc
);
ModelToViewHelper
aModelToViewHelper
(
*
pTxtNode
,
E
XPANDFIELDS
|
HIDEINVISIBLE
|
HIDEDELETIONS
|
EXPANDFOOTNOTE
);
ModelToViewHelper
aModelToViewHelper
(
*
pTxtNode
,
E
xpandMode
::
ExpandFields
|
ExpandMode
::
HideInvisible
|
ExpandMode
::
HideDeletions
|
ExpandMode
::
ExpandFootnote
);
OUString
sViewText
=
aModelToViewHelper
.
getViewText
();
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"AAAACCCCC foo DDDDD"
),
sViewText
);
}
...
...
@@ -508,7 +508,7 @@ void SwDocTest::testModelToViewHelperExpandFieldsHideInvisibleHideRedlinedExpand
SwTxtNode
*
pTxtNode
=
getModelToViewTestDocument
(
m_pDoc
);
ModelToViewHelper
aModelToViewHelper
(
*
pTxtNode
,
E
XPANDFIELDS
|
HIDEINVISIBLE
|
HIDEDELETIONS
|
EXPANDFOOTNOTE
|
REPLACEMODE
);
E
xpandMode
::
ExpandFields
|
ExpandMode
::
HideInvisible
|
ExpandMode
::
HideDeletions
|
ExpandMode
::
ExpandFootnote
|
ExpandMode
::
ReplaceMode
);
OUString
sViewText
=
aModelToViewHelper
.
getViewText
();
CPPUNIT_ASSERT_EQUAL
(
sViewText
,
OUString
(
"AAAACCCCC "
+
OUString
(
CHAR_ZWSP
)
+
" DDDDD"
));
...
...
@@ -524,7 +524,7 @@ void SwDocTest::testModelToViewHelperExpandFieldsExpandFootnote2()
{
SwTxtNode
*
pTxtNode
=
getModelToViewTestDocument2
(
m_pDoc
);
ModelToViewHelper
aModelToViewHelper
(
*
pTxtNode
,
E
XPANDFIELDS
|
EXPANDFOOTNOTE
);
ModelToViewHelper
aModelToViewHelper
(
*
pTxtNode
,
E
xpandMode
::
ExpandFields
|
ExpandMode
::
ExpandFootnote
);
OUString
sViewText
=
aModelToViewHelper
.
getViewText
();
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"AAAAABBBBBCCCCC"
),
sViewText
);
}
...
...
@@ -534,7 +534,7 @@ void SwDocTest::testModelToViewHelperExpandFieldsExpandFootnoteReplaceMode2()
SwTxtNode
*
pTxtNode
=
getModelToViewTestDocument2
(
m_pDoc
);
ModelToViewHelper
aModelToViewHelper
(
*
pTxtNode
,
E
XPANDFIELDS
|
EXPANDFOOTNOTE
|
REPLACEMODE
);
E
xpandMode
::
ExpandFields
|
ExpandMode
::
ExpandFootnote
|
ExpandMode
::
ReplaceMode
);
OUString
sViewText
=
aModelToViewHelper
.
getViewText
();
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"AAAAA"
+
OUString
(
CHAR_ZWSP
)
+
"CCCCC"
),
...
...
sw/source/core/txtnode/modeltoviewhelper.cxx
Dosyayı görüntüle @
520400e8
...
...
@@ -80,21 +80,21 @@ struct containsPos
}
};
ModelToViewHelper
::
ModelToViewHelper
(
const
SwTxtNode
&
rNode
,
sal_uInt16
eMode
)
ModelToViewHelper
::
ModelToViewHelper
(
const
SwTxtNode
&
rNode
,
ExpandMode
eMode
)
{
const
OUString
&
rNodeText
=
rNode
.
GetTxt
();
m_aRetText
=
rNodeText
;
if
(
eMode
==
PASSTHROUGH
)
if
(
eMode
==
ExpandMode
::
PassThrough
)
return
;
Range
aRange
(
0
,
rNodeText
.
isEmpty
()
?
0
:
rNodeText
.
getLength
()
-
1
);
MultiSelection
aHiddenMulti
(
aRange
);
if
(
eMode
&
HIDEINVISIBLE
)
if
(
eMode
&
ExpandMode
::
HideInvisible
)
SwScriptInfo
::
selectHiddenTextProperty
(
rNode
,
aHiddenMulti
);
if
(
eMode
&
HIDEDELETIONS
)
if
(
eMode
&
ExpandMode
::
HideDeletions
)
SwScriptInfo
::
selectRedLineDeleted
(
rNode
,
aHiddenMulti
);
std
::
vector
<
block
>
aBlocks
;
...
...
@@ -123,7 +123,7 @@ ModelToViewHelper::ModelToViewHelper(const SwTxtNode &rNode, sal_uInt16 eMode)
if
(
nTrailingShownLen
)
aBlocks
.
push_back
(
block
(
nShownStart
,
nTrailingShownLen
,
true
));
if
(
eMode
&
E
XPANDFIELDS
||
eMode
&
EXPANDFOOTNOTE
)
if
(
eMode
&
E
xpandMode
::
ExpandFields
||
eMode
&
ExpandMode
::
ExpandFootnote
)
{
//first the normal fields, get their position in the node and what the text they expand
//to is
...
...
@@ -145,9 +145,9 @@ ModelToViewHelper::ModelToViewHelper(const SwTxtNode &rNode, sal_uInt16 eMode)
{
case
RES_TXTATR_FIELD
:
case
RES_TXTATR_ANNOTATION
:
if
(
eMode
&
E
XPANDFIELDS
)
if
(
eMode
&
E
xpandMode
::
ExpandFields
)
{
aFieldResult
.
m_sExpand
=
(
eMode
&
REPLACEMODE
)
aFieldResult
.
m_sExpand
=
(
eMode
&
ExpandMode
::
ReplaceMode
)
?
OUString
(
CHAR_ZWSP
)
:
static_txtattr_cast
<
SwTxtFld
const
*>
(
pAttr
)
->
GetFmtFld
().
GetField
()
->
ExpandField
(
true
);
...
...
@@ -155,11 +155,11 @@ ModelToViewHelper::ModelToViewHelper(const SwTxtNode &rNode, sal_uInt16 eMode)
}
break
;
case
RES_TXTATR_FTN
:
if
(
eMode
&
E
XPANDFOOTNOTE
)
if
(
eMode
&
E
xpandMode
::
ExpandFootnote
)
{
const
SwFmtFtn
&
rFtn
=
static_cast
<
SwTxtFtn
const
*>
(
pAttr
)
->
GetFtn
();
const
SwDoc
*
pDoc
=
rNode
.
GetDoc
();
aFieldResult
.
m_sExpand
=
(
eMode
&
REPLACEMODE
)
aFieldResult
.
m_sExpand
=
(
eMode
&
ExpandMode
::
ReplaceMode
)
?
OUString
(
CHAR_ZWSP
)
:
rFtn
.
GetViewNumStr
(
*
pDoc
);
aFieldResult
.
m_eType
=
FieldResult
::
FOOTNOTE
;
...
...
@@ -173,7 +173,7 @@ ModelToViewHelper::ModelToViewHelper(const SwTxtNode &rNode, sal_uInt16 eMode)
}
}
if
(
eMode
&
E
XPANDFIELDS
)
if
(
eMode
&
E
xpandMode
::
ExpandFields
)
{
//now get the dropdown formfields, get their position in the node and what the text they expand
//to is
...
...
@@ -193,7 +193,7 @@ ModelToViewHelper::ModelToViewHelper(const SwTxtNode &rNode, sal_uInt16 eMode)
if
(
aFind
!=
aBlocks
.
end
())
{
FieldResult
aFieldResult
(
nDummyCharPos
);
aFieldResult
.
m_sExpand
=
(
eMode
&
REPLACEMODE
)
aFieldResult
.
m_sExpand
=
(
eMode
&
ExpandMode
::
ReplaceMode
)
?
OUString
(
CHAR_ZWSP
)
:
sw
::
mark
::
ExpandFieldmark
(
pMark
);
aFieldResult
.
m_eType
=
FieldResult
::
FIELD
;
...
...
sw/source/core/txtnode/ndtxt.cxx
Dosyayı görüntüle @
520400e8
...
...
@@ -3138,9 +3138,9 @@ OUString SwTxtNode::GetExpandTxt( const sal_Int32 nIdx,
const
bool
bWithFtn
)
const
{
sal_uInt16
eMode
=
EXPANDFIELDS
;
ExpandMode
eMode
=
ExpandMode
::
ExpandFields
;
if
(
bWithFtn
)
eMode
|=
E
XPANDFOOTNOTE
;
eMode
|=
E
xpandMode
::
ExpandFootnote
;
ModelToViewHelper
aConversionMap
(
*
this
,
eMode
);
OUString
aExpandText
=
aConversionMap
.
getViewText
();
...
...
sw/source/core/txtnode/txtedt.cxx
Dosyayı görüntüle @
520400e8
...
...
@@ -1985,7 +1985,7 @@ bool SwTxtNode::CountWords( SwDocStat& rStat,
}
// ConversionMap to expand fields, remove invisible and redline deleted text for scanner
const
ModelToViewHelper
aConversionMap
(
*
this
,
E
XPANDFIELDS
|
EXPANDFOOTNOTE
|
HIDEINVISIBLE
|
HIDEDELETIONS
);
const
ModelToViewHelper
aConversionMap
(
*
this
,
E
xpandMode
::
ExpandFields
|
ExpandMode
::
ExpandFootnote
|
ExpandMode
::
HideInvisible
|
ExpandMode
::
HideDeletions
);
OUString
aExpandText
=
aConversionMap
.
getViewText
();
if
(
aExpandText
.
isEmpty
()
&&
!
bCountNumbering
)
...
...
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