Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
onlyoffice_core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
onlyoffice_core
Commits
7eee0755
Commit
7eee0755
authored
Feb 16, 2017
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RtfFormatReader - generate replacement text hyperlink if absent
parent
c329f29e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
28 deletions
+51
-28
ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.h
ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.h
+51
-28
No files found.
ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.h
View file @
7eee0755
...
@@ -1381,10 +1381,20 @@ private:
...
@@ -1381,10 +1381,20 @@ private:
std
::
vector
<
std
::
wstring
>
arResult
;
std
::
vector
<
std
::
wstring
>
arResult
;
boost
::
algorithm
::
split
(
arResult
,
sField
,
boost
::
algorithm
::
is_any_of
(
L"
\"
"
),
boost
::
algorithm
::
token_compress_on
);
boost
::
algorithm
::
split
(
arResult
,
sField
,
boost
::
algorithm
::
is_any_of
(
L"
\"
"
),
boost
::
algorithm
::
token_compress_on
);
if
(
arResult
.
size
()
<
1
)
while
(
!
arResult
.
empty
())
{
if
(
arResult
[
0
].
empty
())
arResult
.
erase
(
arResult
.
begin
(),
arResult
.
begin
()
+
1
);
else
break
;
}
if
(
arResult
.
empty
())
return
;
return
;
if
(
L"SYMBOL"
!=
arResult
[
0
])
if
(
L"SYMBOL"
!=
arResult
[
0
]
&&
L"HYPERLINK"
!=
arResult
[
0
])
return
;
return
;
nStartTokenize
=
arResult
[
0
].
length
();
nStartTokenize
=
arResult
[
0
].
length
();
for
(
size_t
i
=
1
;
i
<
arResult
.
size
();
i
++
)
for
(
size_t
i
=
1
;
i
<
arResult
.
size
();
i
++
)
...
@@ -1429,42 +1439,55 @@ private:
...
@@ -1429,42 +1439,55 @@ private:
nStartTokenize
+=
(
int
)
sResTokenize
.
length
();
nStartTokenize
+=
(
int
)
sResTokenize
.
length
();
}
}
if
(
L""
==
sCharCode
||
L""
==
sCharFont
)
return
;
int
nCharCode
=
Strings
::
ToInteger
(
sCharCode
);
std
::
string
sCharA
;
sCharA
+=
char
(
nCharCode
);
RtfFont
oSymbolFont
;
std
::
wstring
sResult
;
if
(
true
==
oDocument
.
m_oFontTable
.
GetFont
(
sCharFont
,
oSymbolFont
)
)
if
(
L"SYMBOL"
==
arResult
[
0
])
oReader
.
m_oState
->
m_oCharProp
.
m_nFont
=
oSymbolFont
.
m_nID
;
else
{
{
oSymbolFont
.
m_sName
=
sCharFont
;
if
(
L""
==
sCharCode
||
L""
==
sCharFont
)
return
;
oSymbolFont
.
m_nID
=
oDocument
.
m_oFontTable
.
GetCount
()
+
1
;
int
nCharCode
=
Strings
::
ToInteger
(
sCharCode
);
oSymbolFont
.
m_nCodePage
=
CP_SYMBOL
;
std
::
string
sCharA
;
sCharA
+=
char
(
nCharCode
);
oReader
.
m_oState
->
m_oCharProp
.
m_nFont
=
oSymbolFont
.
m_nID
;
oDocument
.
m_oFontTable
.
DirectAddItem
(
oSymbolFont
);
RtfFont
oSymbolFont
;
if
(
true
==
oDocument
.
m_oFontTable
.
GetFont
(
sCharFont
,
oSymbolFont
)
)
oReader
.
m_oState
->
m_oCharProp
.
m_nFont
=
oSymbolFont
.
m_nID
;
else
{
oSymbolFont
.
m_sName
=
sCharFont
;
oSymbolFont
.
m_nID
=
oDocument
.
m_oFontTable
.
GetCount
()
+
1
;
oSymbolFont
.
m_nCodePage
=
CP_SYMBOL
;
oReader
.
m_oState
->
m_oCharProp
.
m_nFont
=
oSymbolFont
.
m_nID
;
oDocument
.
m_oFontTable
.
DirectAddItem
(
oSymbolFont
);
}
int
nSkipChar
=
0
;
RtfAbstractReader
reader
;
sResult
=
reader
.
ExecuteTextInternal
(
oDocument
,
oReader
,
sCharA
,
false
,
0
,
nSkipChar
);
}
else
if
(
L"HYPERLINK"
==
arResult
[
0
])
{
sResult
=
sCharCode
;
}
}
int
nSkipChar
=
0
;
if
(
sResult
.
empty
())
return
;
RtfAbstractReader
reader
;
RtfFieldInstPtr
newResult
=
RtfFieldInstPtr
(
new
RtfFieldInst
()
);
newResult
->
SetDefault
();
std
::
wstring
sResultSymbol
=
reader
.
ExecuteTextInternal
(
oDocument
,
oReader
,
sCharA
,
false
,
0
,
nSkipChar
);
//свойства копировать ? ващето есть дубль - проверить
m_oField
.
m_pResult
=
RtfFieldInstPtr
(
new
RtfFieldInst
()
);
m_oField
.
m_pResult
->
SetDefault
();
RtfParagraphPtr
pNewPar
(
new
RtfParagraph
()
);
RtfParagraphPtr
pNewPar
(
new
RtfParagraph
()
);
RtfCharPtr
pNewChar
(
new
RtfChar
()
);
RtfCharPtr
pNewChar
(
new
RtfChar
()
);
pNewChar
->
setText
(
sResult
Symbol
);
pNewChar
->
setText
(
sResult
);
pNewChar
->
m_oProperty
=
oReader
.
m_oState
->
m_oCharProp
;
pNewChar
->
m_oProperty
=
m_oField
.
m_pResult
->
m_oCharProperty
;
pNewPar
->
AddItem
(
pNewChar
);
pNewPar
->
AddItem
(
pNewChar
);
m_oField
.
m_pResult
->
m_pTextItems
->
AddItem
(
pNewPar
);
newResult
->
m_pTextItems
->
AddItem
(
pNewPar
);
m_oField
.
m_bTextOnly
=
true
;
newResult
->
m_oCharProperty
=
m_oField
.
m_pResult
->
m_oCharProperty
;
m_oField
.
m_pResult
=
newResult
;
if
(
L"SYMBOL"
==
arResult
[
0
])
m_oField
.
m_bTextOnly
=
true
;
}
}
};
};
...
...
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