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
35a59992
Kaydet (Commit)
35a59992
authored
Kas 06, 2013
tarafından
Kohei Yoshida
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Guard cache access with mutex & a new method just to check for range name.
Change-Id: Id24b5ba72362f9d878b4878c1e807bed3e596b20
üst
719c3fb4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
2 deletions
+64
-2
externalrefmgr.hxx
sc/inc/externalrefmgr.hxx
+9
-1
compiler.cxx
sc/source/core/tool/compiler.cxx
+1
-1
externalrefmgr.cxx
sc/source/ui/docshell/externalrefmgr.cxx
+54
-0
No files found.
sc/inc/externalrefmgr.hxx
Dosyayı görüntüle @
35a59992
...
@@ -233,6 +233,7 @@ public:
...
@@ -233,6 +233,7 @@ public:
ScExternalRefCache
::
TokenArrayRef
getRangeNameTokens
(
sal_uInt16
nFileId
,
const
OUString
&
rName
);
ScExternalRefCache
::
TokenArrayRef
getRangeNameTokens
(
sal_uInt16
nFileId
,
const
OUString
&
rName
);
void
setRangeNameTokens
(
sal_uInt16
nFileId
,
const
OUString
&
rName
,
TokenArrayRef
pArray
);
void
setRangeNameTokens
(
sal_uInt16
nFileId
,
const
OUString
&
rName
,
TokenArrayRef
pArray
);
bool
isValidRangeName
(
sal_uInt16
nFileId
,
const
OUString
&
rName
)
const
;
void
setCellData
(
sal_uInt16
nFileId
,
const
OUString
&
rTabName
,
void
setCellData
(
sal_uInt16
nFileId
,
const
OUString
&
rTabName
,
SCCOL
nCol
,
SCROW
nRow
,
TokenRef
pToken
,
sal_uLong
nFmtIndex
);
SCCOL
nCol
,
SCROW
nRow
,
TokenRef
pToken
,
sal_uLong
nFmtIndex
);
...
@@ -557,6 +558,8 @@ public:
...
@@ -557,6 +558,8 @@ public:
ScExternalRefCache
::
TokenArrayRef
getRangeNameTokens
(
ScExternalRefCache
::
TokenArrayRef
getRangeNameTokens
(
sal_uInt16
nFileId
,
const
OUString
&
rName
,
const
ScAddress
*
pCurPos
=
NULL
);
sal_uInt16
nFileId
,
const
OUString
&
rName
,
const
ScAddress
*
pCurPos
=
NULL
);
bool
isValidRangeName
(
sal_uInt16
nFileId
,
const
OUString
&
rName
);
OUString
getOwnDocumentName
()
const
;
OUString
getOwnDocumentName
()
const
;
bool
isOwnDocument
(
const
OUString
&
rFile
)
const
;
bool
isOwnDocument
(
const
OUString
&
rFile
)
const
;
...
@@ -765,6 +768,12 @@ private:
...
@@ -765,6 +768,12 @@ private:
private
:
private
:
ScDocument
*
mpDoc
;
ScDocument
*
mpDoc
;
/** Mutex for accessing cached data and/or source document shells. */
mutable
osl
::
Mutex
maMtxCacheAccess
;
/** Mutex for source document meta-data access. */
mutable
osl
::
Mutex
maMtxSrcFiles
;
/** cache of referenced ranges and names from source documents. */
/** cache of referenced ranges and names from source documents. */
ScExternalRefCache
maRefCache
;
ScExternalRefCache
maRefCache
;
...
@@ -798,7 +807,6 @@ private:
...
@@ -798,7 +807,6 @@ private:
* external document identifiers.
* external document identifiers.
*/
*/
std
::
vector
<
SrcFileData
>
maSrcFiles
;
std
::
vector
<
SrcFileData
>
maSrcFiles
;
mutable
osl
::
Mutex
maMtxSrcFiles
;
/** Status whether in reference marking state. See isInReferenceMarking(). */
/** Status whether in reference marking state. See isInReferenceMarking(). */
bool
mbInReferenceMarking
:
1
;
bool
mbInReferenceMarking
:
1
;
...
...
sc/source/core/tool/compiler.cxx
Dosyayı görüntüle @
35a59992
...
@@ -2914,7 +2914,7 @@ bool ScCompiler::IsExternalNamedRange( const OUString& rSymbol )
...
@@ -2914,7 +2914,7 @@ bool ScCompiler::IsExternalNamedRange( const OUString& rSymbol )
pRefMgr
->
convertToAbsName
(
aTmp
);
pRefMgr
->
convertToAbsName
(
aTmp
);
aFile
=
aTmp
;
aFile
=
aTmp
;
sal_uInt16
nFileId
=
pRefMgr
->
getExternalFileId
(
aFile
);
sal_uInt16
nFileId
=
pRefMgr
->
getExternalFileId
(
aFile
);
if
(
!
pRefMgr
->
getRangeNameTokens
(
nFileId
,
aName
).
get
(
))
if
(
!
pRefMgr
->
isValidRangeName
(
nFileId
,
aName
))
// range name doesn't exist in the source document.
// range name doesn't exist in the source document.
return
false
;
return
false
;
...
...
sc/source/ui/docshell/externalrefmgr.cxx
Dosyayı görüntüle @
35a59992
...
@@ -710,6 +710,18 @@ void ScExternalRefCache::setRangeNameTokens(sal_uInt16 nFileId, const OUString&
...
@@ -710,6 +710,18 @@ void ScExternalRefCache::setRangeNameTokens(sal_uInt16 nFileId, const OUString&
pDoc
->
maRealRangeNameMap
.
insert
(
NamePairMap
::
value_type
(
aUpperName
,
rName
));
pDoc
->
maRealRangeNameMap
.
insert
(
NamePairMap
::
value_type
(
aUpperName
,
rName
));
}
}
bool
ScExternalRefCache
::
isValidRangeName
(
sal_uInt16
nFileId
,
const
OUString
&
rName
)
const
{
osl
::
MutexGuard
aGuard
(
&
maMtxDocs
);
DocItem
*
pDoc
=
getDocItem
(
nFileId
);
if
(
!
pDoc
)
return
false
;
const
RangeNameMap
&
rMap
=
pDoc
->
maRangeNames
;
return
rMap
.
count
(
rName
)
>
0
;
}
void
ScExternalRefCache
::
setCellData
(
sal_uInt16
nFileId
,
const
OUString
&
rTabName
,
SCCOL
nCol
,
SCROW
nRow
,
void
ScExternalRefCache
::
setCellData
(
sal_uInt16
nFileId
,
const
OUString
&
rTabName
,
SCCOL
nCol
,
SCROW
nRow
,
TokenRef
pToken
,
sal_uLong
nFmtIndex
)
TokenRef
pToken
,
sal_uLong
nFmtIndex
)
{
{
...
@@ -1747,6 +1759,8 @@ ScExternalRefCache::TokenRef ScExternalRefManager::getSingleRefToken(
...
@@ -1747,6 +1759,8 @@ ScExternalRefCache::TokenRef ScExternalRefManager::getSingleRefToken(
sal_uInt16
nFileId
,
const
OUString
&
rTabName
,
const
ScAddress
&
rCell
,
sal_uInt16
nFileId
,
const
OUString
&
rTabName
,
const
ScAddress
&
rCell
,
const
ScAddress
*
pCurPos
,
SCTAB
*
pTab
,
ScExternalRefCache
::
CellFormat
*
pFmt
)
const
ScAddress
*
pCurPos
,
SCTAB
*
pTab
,
ScExternalRefCache
::
CellFormat
*
pFmt
)
{
{
osl
::
MutexGuard
aGuard
(
&
maMtxCacheAccess
);
if
(
pCurPos
)
if
(
pCurPos
)
insertRefCell
(
nFileId
,
*
pCurPos
);
insertRefCell
(
nFileId
,
*
pCurPos
);
...
@@ -1839,6 +1853,8 @@ ScExternalRefCache::TokenRef ScExternalRefManager::getSingleRefToken(
...
@@ -1839,6 +1853,8 @@ ScExternalRefCache::TokenRef ScExternalRefManager::getSingleRefToken(
ScExternalRefCache
::
TokenArrayRef
ScExternalRefManager
::
getDoubleRefTokens
(
ScExternalRefCache
::
TokenArrayRef
ScExternalRefManager
::
getDoubleRefTokens
(
sal_uInt16
nFileId
,
const
OUString
&
rTabName
,
const
ScRange
&
rRange
,
const
ScAddress
*
pCurPos
)
sal_uInt16
nFileId
,
const
OUString
&
rTabName
,
const
ScRange
&
rRange
,
const
ScAddress
*
pCurPos
)
{
{
osl
::
MutexGuard
aGuard
(
&
maMtxCacheAccess
);
if
(
pCurPos
)
if
(
pCurPos
)
insertRefCell
(
nFileId
,
*
pCurPos
);
insertRefCell
(
nFileId
,
*
pCurPos
);
...
@@ -1885,6 +1901,8 @@ ScExternalRefCache::TokenArrayRef ScExternalRefManager::getDoubleRefTokens(
...
@@ -1885,6 +1901,8 @@ ScExternalRefCache::TokenArrayRef ScExternalRefManager::getDoubleRefTokens(
ScExternalRefCache
::
TokenArrayRef
ScExternalRefManager
::
getRangeNameTokens
(
ScExternalRefCache
::
TokenArrayRef
ScExternalRefManager
::
getRangeNameTokens
(
sal_uInt16
nFileId
,
const
OUString
&
rName
,
const
ScAddress
*
pCurPos
)
sal_uInt16
nFileId
,
const
OUString
&
rName
,
const
ScAddress
*
pCurPos
)
{
{
osl
::
MutexGuard
aGuard
(
&
maMtxCacheAccess
);
if
(
pCurPos
)
if
(
pCurPos
)
insertRefCell
(
nFileId
,
*
pCurPos
);
insertRefCell
(
nFileId
,
*
pCurPos
);
...
@@ -1924,6 +1942,42 @@ ScExternalRefCache::TokenArrayRef ScExternalRefManager::getRangeNameTokens(
...
@@ -1924,6 +1942,42 @@ ScExternalRefCache::TokenArrayRef ScExternalRefManager::getRangeNameTokens(
return
pArray
;
return
pArray
;
}
}
namespace
{
bool
hasRangeName
(
ScDocument
&
rDoc
,
const
OUString
&
rName
)
{
ScRangeName
*
pExtNames
=
rDoc
.
GetRangeName
();
OUString
aUpperName
=
ScGlobal
::
pCharClass
->
uppercase
(
rName
);
const
ScRangeData
*
pRangeData
=
pExtNames
->
findByUpperName
(
aUpperName
);
return
pRangeData
!=
NULL
;
}
}
bool
ScExternalRefManager
::
isValidRangeName
(
sal_uInt16
nFileId
,
const
OUString
&
rName
)
{
osl
::
MutexGuard
aGuard
(
&
maMtxCacheAccess
);
maybeLinkExternalFile
(
nFileId
);
ScDocument
*
pSrcDoc
=
getInMemorySrcDocument
(
nFileId
);
if
(
pSrcDoc
)
{
// Only check the presence of the name.
return
hasRangeName
(
*
pSrcDoc
,
rName
);
}
if
(
maRefCache
.
isValidRangeName
(
nFileId
,
rName
))
// Range name is cached.
return
true
;
pSrcDoc
=
getSrcDocument
(
nFileId
);
if
(
!
pSrcDoc
)
// failed to load document from disk.
return
false
;
return
hasRangeName
(
*
pSrcDoc
,
rName
);
}
void
ScExternalRefManager
::
refreshAllRefCells
(
sal_uInt16
nFileId
)
void
ScExternalRefManager
::
refreshAllRefCells
(
sal_uInt16
nFileId
)
{
{
RefCellMap
::
iterator
itrFile
=
maRefCells
.
find
(
nFileId
);
RefCellMap
::
iterator
itrFile
=
maRefCells
.
find
(
nFileId
);
...
...
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