Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "tabprotection.hxx"
21 : #include "svl/PasswordHelper.hxx"
22 : #include <comphelper/docpasswordhelper.hxx>
23 : #include "document.hxx"
24 :
25 : #include <vector>
26 :
27 : #define DEBUG_TAB_PROTECTION 0
28 :
29 : #define URI_SHA1 "http://www.w3.org/2000/09/xmldsig#sha1"
30 : #define URI_XLS_LEGACY "http://docs.oasis-open.org/office/ns/table/legacy-hash-excel"
31 :
32 : using namespace ::com::sun::star;
33 : using ::com::sun::star::uno::Sequence;
34 : using ::std::vector;
35 :
36 0 : bool ScPassHashHelper::needsPassHashRegen(const ScDocument& rDoc, ScPasswordHash eHash1, ScPasswordHash eHash2)
37 : {
38 0 : if (rDoc.IsDocProtected())
39 : {
40 0 : const ScDocProtection* p = rDoc.GetDocProtection();
41 0 : if (!p->isPasswordEmpty() && !p->hasPasswordHash(eHash1, eHash2))
42 0 : return true;
43 : }
44 :
45 0 : SCTAB nTabCount = rDoc.GetTableCount();
46 0 : for (SCTAB i = 0; i < nTabCount; ++i)
47 : {
48 0 : const ScTableProtection* p = rDoc.GetTabProtection(i);
49 0 : if (!p || !p->isProtected())
50 : // Sheet not protected. Skip it.
51 0 : continue;
52 :
53 0 : if (!p->isPasswordEmpty() && !p->hasPasswordHash(eHash1, eHash2))
54 0 : return true;
55 : }
56 :
57 0 : return false;
58 : }
59 :
60 0 : OUString ScPassHashHelper::getHashURI(ScPasswordHash eHash)
61 : {
62 0 : switch (eHash)
63 : {
64 : case PASSHASH_SHA1:
65 0 : return OUString(URI_SHA1);
66 : case PASSHASH_XL:
67 0 : return OUString(URI_XLS_LEGACY);
68 : case PASSHASH_UNSPECIFIED:
69 : default:
70 : ;
71 : }
72 0 : return OUString();
73 : }
74 :
75 0 : ScPasswordHash ScPassHashHelper::getHashTypeFromURI(const OUString& rURI)
76 : {
77 0 : if ( rURI == URI_SHA1 )
78 0 : return PASSHASH_SHA1;
79 0 : else if ( rURI == URI_XLS_LEGACY )
80 0 : return PASSHASH_XL;
81 0 : return PASSHASH_UNSPECIFIED;
82 : }
83 :
84 0 : ScPassHashProtectable::~ScPassHashProtectable()
85 : {
86 0 : }
87 :
88 0 : class ScTableProtectionImpl
89 : {
90 : public:
91 : static Sequence<sal_Int8> hashPassword(const OUString& aPassText, ScPasswordHash eHash = PASSHASH_SHA1);
92 : static Sequence<sal_Int8> hashPassword(const Sequence<sal_Int8>& rPassHash, ScPasswordHash eHash = PASSHASH_SHA1);
93 :
94 : explicit ScTableProtectionImpl(SCSIZE nOptSize);
95 : explicit ScTableProtectionImpl(const ScTableProtectionImpl& r);
96 :
97 : bool isProtected() const;
98 : bool isProtectedWithPass() const;
99 : void setProtected(bool bProtected);
100 :
101 : bool isPasswordEmpty() const;
102 : bool hasPasswordHash(ScPasswordHash eHash, ScPasswordHash eHash2 = PASSHASH_UNSPECIFIED) const;
103 : void setPassword(const OUString& aPassText);
104 : ::com::sun::star::uno::Sequence<sal_Int8> getPasswordHash(
105 : ScPasswordHash eHash, ScPasswordHash eHash2 = PASSHASH_UNSPECIFIED) const;
106 : void setPasswordHash(
107 : const ::com::sun::star::uno::Sequence<sal_Int8>& aPassword,
108 : ScPasswordHash eHash = PASSHASH_SHA1, ScPasswordHash eHash2 = PASSHASH_UNSPECIFIED);
109 : bool verifyPassword(const OUString& aPassText) const;
110 :
111 : bool isOptionEnabled(SCSIZE nOptId) const;
112 : void setOption(SCSIZE nOptId, bool bEnabled);
113 :
114 : void setEnhancedProtection( const ::std::vector< ScEnhancedProtection > & rProt );
115 : const ::std::vector< ScEnhancedProtection > & getEnhancedProtection() const;
116 : bool updateReference( UpdateRefMode, ScDocument*, const ScRange& rWhere, SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
117 : bool isBlockEditable( const ScRange& rRange ) const;
118 : bool isSelectionEditable( const ScRangeList& rRangeList ) const;
119 :
120 : private:
121 : OUString maPassText;
122 : ::com::sun::star::uno::Sequence<sal_Int8> maPassHash;
123 : ::std::vector<bool> maOptions;
124 : bool mbEmptyPass;
125 : bool mbProtected;
126 : ScPasswordHash meHash1;
127 : ScPasswordHash meHash2;
128 : ::std::vector< ScEnhancedProtection > maEnhancedProtection;
129 : };
130 :
131 0 : Sequence<sal_Int8> ScTableProtectionImpl::hashPassword(const OUString& aPassText, ScPasswordHash eHash)
132 : {
133 0 : Sequence<sal_Int8> aHash;
134 0 : switch (eHash)
135 : {
136 : case PASSHASH_XL:
137 0 : aHash = ::comphelper::DocPasswordHelper::GetXLHashAsSequence( aPassText, RTL_TEXTENCODING_UTF8 );
138 0 : break;
139 : case PASSHASH_SHA1:
140 0 : SvPasswordHelper::GetHashPassword(aHash, aPassText);
141 0 : break;
142 : default:
143 : ;
144 : }
145 0 : return aHash;
146 : }
147 :
148 0 : Sequence<sal_Int8> ScTableProtectionImpl::hashPassword(
149 : const Sequence<sal_Int8>& rPassHash, ScPasswordHash eHash)
150 : {
151 0 : if (!rPassHash.getLength() || eHash == PASSHASH_UNSPECIFIED)
152 0 : return rPassHash;
153 :
154 : // TODO: Right now, we only support double-hash by SHA1.
155 0 : if (eHash == PASSHASH_SHA1)
156 : {
157 0 : vector<sal_Char> aChars;
158 0 : sal_Int32 n = rPassHash.getLength();
159 0 : aChars.reserve(n);
160 0 : for (sal_Int32 i = 0; i < n; ++i)
161 0 : aChars.push_back(static_cast<sal_Char>(rPassHash[i]));
162 :
163 0 : Sequence<sal_Int8> aNewHash;
164 0 : SvPasswordHelper::GetHashPassword(aNewHash, &aChars[0], aChars.size());
165 0 : return aNewHash;
166 : }
167 :
168 0 : return rPassHash;
169 : }
170 :
171 0 : ScTableProtectionImpl::ScTableProtectionImpl(SCSIZE nOptSize) :
172 : maOptions(nOptSize),
173 : mbEmptyPass(true),
174 : mbProtected(false),
175 : meHash1(PASSHASH_SHA1),
176 0 : meHash2(PASSHASH_UNSPECIFIED)
177 : {
178 0 : }
179 :
180 0 : ScTableProtectionImpl::ScTableProtectionImpl(const ScTableProtectionImpl& r) :
181 : maPassText(r.maPassText),
182 : maPassHash(r.maPassHash),
183 : maOptions(r.maOptions),
184 : mbEmptyPass(r.mbEmptyPass),
185 : mbProtected(r.mbProtected),
186 : meHash1(r.meHash1),
187 : meHash2(r.meHash2),
188 0 : maEnhancedProtection(r.maEnhancedProtection)
189 : {
190 0 : }
191 :
192 0 : bool ScTableProtectionImpl::isProtected() const
193 : {
194 0 : return mbProtected;
195 : }
196 :
197 0 : bool ScTableProtectionImpl::isProtectedWithPass() const
198 : {
199 0 : if (!mbProtected)
200 0 : return false;
201 :
202 0 : return !maPassText.isEmpty() || maPassHash.getLength();
203 : }
204 :
205 0 : void ScTableProtectionImpl::setProtected(bool bProtected)
206 : {
207 0 : mbProtected = bProtected;
208 : // We need to keep the old password even when the protection is off. So,
209 : // don't erase the password data here.
210 0 : }
211 :
212 0 : void ScTableProtectionImpl::setPassword(const OUString& aPassText)
213 : {
214 : // We can't hash it here because we don't know whether this document will
215 : // get saved to Excel or ODF, depending on which we will need to use a
216 : // different hashing algorithm. One alternative is to hash it using all
217 : // hash algorithms that we support, and store them all.
218 :
219 0 : maPassText = aPassText;
220 0 : mbEmptyPass = aPassText.isEmpty();
221 0 : if (mbEmptyPass)
222 : {
223 0 : maPassHash = Sequence<sal_Int8>();
224 : }
225 0 : }
226 :
227 0 : bool ScTableProtectionImpl::isPasswordEmpty() const
228 : {
229 0 : return mbEmptyPass;
230 : }
231 :
232 0 : bool ScTableProtectionImpl::hasPasswordHash(ScPasswordHash eHash, ScPasswordHash eHash2) const
233 : {
234 0 : if (mbEmptyPass)
235 0 : return true;
236 :
237 0 : if (!maPassText.isEmpty())
238 0 : return true;
239 :
240 0 : if (meHash1 == eHash)
241 : {
242 0 : if (meHash2 == PASSHASH_UNSPECIFIED)
243 : // single hash.
244 0 : return true;
245 :
246 0 : return meHash2 == eHash2;
247 : }
248 :
249 0 : return false;
250 : }
251 :
252 0 : Sequence<sal_Int8> ScTableProtectionImpl::getPasswordHash(
253 : ScPasswordHash eHash, ScPasswordHash eHash2) const
254 : {
255 0 : Sequence<sal_Int8> aPassHash;
256 :
257 0 : if (mbEmptyPass)
258 : // Flaged as empty.
259 0 : return aPassHash;
260 :
261 0 : if (!maPassText.isEmpty())
262 : {
263 : // Cleartext password exists. Hash it.
264 0 : aPassHash = hashPassword(maPassText, eHash);
265 0 : if (eHash2 != PASSHASH_UNSPECIFIED)
266 : // Double-hash it.
267 0 : aPassHash = hashPassword(aPassHash, eHash2);
268 :
269 0 : return aPassHash;
270 : }
271 : else
272 : {
273 : // No clear text password. Check if we have a hash value of the right hash type.
274 0 : if (meHash1 == eHash)
275 : {
276 0 : aPassHash = maPassHash;
277 :
278 0 : if (meHash2 == eHash2)
279 : // Matching double-hash requested.
280 0 : return aPassHash;
281 0 : else if (meHash2 == PASSHASH_UNSPECIFIED)
282 : // primary hashing type match. Double hash it by the requested
283 : // double-hash type.
284 0 : return hashPassword(aPassHash, eHash2);
285 : }
286 : }
287 :
288 : // failed.
289 0 : return Sequence<sal_Int8>();
290 : }
291 :
292 0 : void ScTableProtectionImpl::setPasswordHash(
293 : const uno::Sequence<sal_Int8>& aPassword, ScPasswordHash eHash, ScPasswordHash eHash2)
294 : {
295 0 : sal_Int32 nLen = aPassword.getLength();
296 0 : mbEmptyPass = nLen <= 0 ? true : false;
297 0 : meHash1 = eHash;
298 0 : meHash2 = eHash2;
299 0 : maPassHash = aPassword;
300 :
301 : #if DEBUG_TAB_PROTECTION
302 : for (sal_Int32 i = 0; i < nLen; ++i)
303 : printf("%2.2X ", static_cast<sal_uInt8>(aPassword[i]));
304 : printf("\n");
305 : #endif
306 0 : }
307 :
308 0 : bool ScTableProtectionImpl::verifyPassword(const OUString& aPassText) const
309 : {
310 : #if DEBUG_TAB_PROTECTION
311 : fprintf(stdout, "ScTableProtectionImpl::verifyPassword: input = '%s'\n",
312 : OUStringToOString(OUString(aPassText), RTL_TEXTENCODING_UTF8).getStr());
313 : #endif
314 :
315 0 : if (mbEmptyPass)
316 0 : return aPassText.isEmpty();
317 :
318 0 : if (!maPassText.isEmpty())
319 : // Clear text password exists, and this one takes precedence.
320 0 : return aPassText == maPassText;
321 :
322 0 : Sequence<sal_Int8> aHash = hashPassword(aPassText, meHash1);
323 0 : aHash = hashPassword(aHash, meHash2);
324 :
325 : #if DEBUG_TAB_PROTECTION
326 : fprintf(stdout, "ScTableProtectionImpl::verifyPassword: hash = ");
327 : for (sal_Int32 i = 0; i < aHash.getLength(); ++i)
328 : printf("%2.2X ", static_cast<sal_uInt8>(aHash[i]));
329 : printf("\n");
330 : #endif
331 :
332 0 : return aHash == maPassHash;
333 : }
334 :
335 0 : bool ScTableProtectionImpl::isOptionEnabled(SCSIZE nOptId) const
336 : {
337 0 : if ( maOptions.size() <= static_cast<size_t>(nOptId) )
338 : {
339 : OSL_FAIL("ScTableProtectionImpl::isOptionEnabled: wrong size");
340 0 : return false;
341 : }
342 :
343 0 : return maOptions[nOptId];
344 : }
345 :
346 0 : void ScTableProtectionImpl::setOption(SCSIZE nOptId, bool bEnabled)
347 : {
348 0 : if ( maOptions.size() <= static_cast<size_t>(nOptId) )
349 : {
350 : OSL_FAIL("ScTableProtectionImpl::setOption: wrong size");
351 0 : return;
352 : }
353 :
354 0 : maOptions[nOptId] = bEnabled;
355 : }
356 :
357 0 : void ScTableProtectionImpl::setEnhancedProtection( const ::std::vector< ScEnhancedProtection > & rProt )
358 : {
359 0 : maEnhancedProtection = rProt;
360 0 : }
361 :
362 0 : const ::std::vector< ScEnhancedProtection > & ScTableProtectionImpl::getEnhancedProtection() const
363 : {
364 0 : return maEnhancedProtection;
365 : }
366 :
367 0 : bool ScTableProtectionImpl::updateReference( UpdateRefMode eMode, ScDocument* pDoc,
368 : const ScRange& rWhere, SCsCOL nDx, SCsROW nDy, SCsTAB nDz )
369 : {
370 0 : bool bChanged = false;
371 0 : for (::std::vector<ScEnhancedProtection>::iterator it(maEnhancedProtection.begin());
372 0 : it != maEnhancedProtection.end(); ++it)
373 : {
374 0 : if ((*it).maRangeList.Is())
375 0 : bChanged |= (*it).maRangeList->UpdateReference( eMode, pDoc, rWhere, nDx, nDy, nDz);
376 : }
377 0 : return bChanged;
378 : }
379 :
380 0 : bool ScTableProtectionImpl::isBlockEditable( const ScRange& rRange ) const
381 : {
382 : /* TODO: ask for password (and remember) if a password was set for
383 : * a matching range and no matching range without password was encountered.
384 : * Would need another return type than boolean to reflect
385 : * "password required for a specific protection". */
386 :
387 : // No protection exception or overriding permission to edit if empty.
388 0 : if (maEnhancedProtection.empty())
389 0 : return false;
390 :
391 : // No security descriptor in an enhanced protection means the ranges of
392 : // that protection are editable. If there is any security descriptor
393 : // present we assume the permission to edit is not granted. Until we
394 : // actually can evaluate the descriptors..
395 :
396 0 : for (::std::vector<ScEnhancedProtection>::const_iterator it(maEnhancedProtection.begin()),
397 0 : itEnd(maEnhancedProtection.end()); it != itEnd; ++it)
398 : {
399 0 : if (!(*it).hasSecurityDescriptor() && (*it).maRangeList.Is())
400 : {
401 0 : if ((*it).maRangeList->In( rRange))
402 : {
403 : // Range is editable if no password is assigned.
404 0 : if (!(*it).hasPassword())
405 0 : return true;
406 : }
407 : }
408 : }
409 :
410 : // For a single address, a simple check with single ranges was sufficient.
411 0 : if (rRange.aStart == rRange.aEnd)
412 0 : return false;
413 :
414 : // Test also for cases where rRange is encompassed by a union of two or
415 : // more ranges of the list. The original ranges are not necessarily joined.
416 0 : for (::std::vector<ScEnhancedProtection>::const_iterator it(maEnhancedProtection.begin()),
417 0 : itEnd(maEnhancedProtection.end()); it != itEnd; ++it)
418 : {
419 0 : if (!(*it).hasSecurityDescriptor() && (*it).maRangeList.Is())
420 : {
421 0 : ScRangeList aList( (*it).maRangeList->GetIntersectedRange( rRange));
422 0 : if (aList.size() == 1 && *aList[0] == rRange)
423 : {
424 : // Range is editable if no password is assigned.
425 0 : if (!(*it).hasPassword())
426 0 : return true;
427 0 : }
428 : }
429 : }
430 :
431 : // Ranges may even be distributed over different protection records, for
432 : // example if they are assigned different names, and can have different
433 : // passwords. Combine the ones that can be edited.
434 : /* TODO: once we handle passwords, remember a successful unlock at
435 : * ScEnhancedProtection so we can use that here. */
436 0 : ScRangeList aRangeList;
437 0 : for (::std::vector<ScEnhancedProtection>::const_iterator it(maEnhancedProtection.begin()),
438 0 : itEnd(maEnhancedProtection.end()); it != itEnd; ++it)
439 : {
440 0 : if (!(*it).hasSecurityDescriptor() && (*it).maRangeList.Is())
441 : {
442 : // Ranges are editable if no password is assigned.
443 0 : if (!(*it).hasPassword())
444 : {
445 0 : const ScRangeList& rRanges = *(*it).maRangeList;
446 0 : size_t nRanges = rRanges.size();
447 0 : for (size_t i=0; i < nRanges; ++i)
448 : {
449 0 : aRangeList.Append( *rRanges[i]);
450 : }
451 : }
452 : }
453 : }
454 0 : ScRangeList aResultList( aRangeList.GetIntersectedRange( rRange));
455 0 : if (aResultList.size() == 1 && *aResultList[0] == rRange)
456 0 : return true;
457 :
458 0 : return false;
459 : }
460 :
461 0 : bool ScTableProtectionImpl::isSelectionEditable( const ScRangeList& rRangeList ) const
462 : {
463 0 : if (rRangeList.empty())
464 0 : return false;
465 :
466 0 : for (size_t i=0, nRanges = rRangeList.size(); i < nRanges; ++i)
467 : {
468 0 : if (!isBlockEditable( *rRangeList[i]))
469 0 : return false;
470 : }
471 0 : return true;
472 : }
473 :
474 :
475 0 : ScDocProtection::ScDocProtection() :
476 0 : mpImpl(new ScTableProtectionImpl(static_cast<SCSIZE>(ScDocProtection::NONE)))
477 : {
478 0 : }
479 :
480 0 : ScDocProtection::ScDocProtection(const ScDocProtection& r) :
481 : ScPassHashProtectable(),
482 0 : mpImpl(new ScTableProtectionImpl(*r.mpImpl))
483 : {
484 0 : }
485 :
486 0 : ScDocProtection::~ScDocProtection()
487 : {
488 0 : }
489 :
490 0 : bool ScDocProtection::isProtected() const
491 : {
492 0 : return mpImpl->isProtected();
493 : }
494 :
495 0 : bool ScDocProtection::isProtectedWithPass() const
496 : {
497 0 : return mpImpl->isProtectedWithPass();
498 : }
499 :
500 0 : void ScDocProtection::setProtected(bool bProtected)
501 : {
502 0 : mpImpl->setProtected(bProtected);
503 :
504 : // Currently Calc doesn't support document protection options. So, let's
505 : // assume that when the document is protected, its structure is protected.
506 : // We need to do this for Excel export.
507 0 : mpImpl->setOption(ScDocProtection::STRUCTURE, bProtected);
508 0 : }
509 :
510 0 : bool ScDocProtection::isPasswordEmpty() const
511 : {
512 0 : return mpImpl->isPasswordEmpty();
513 : }
514 :
515 0 : bool ScDocProtection::hasPasswordHash(ScPasswordHash eHash, ScPasswordHash eHash2) const
516 : {
517 0 : return mpImpl->hasPasswordHash(eHash, eHash2);
518 : }
519 :
520 0 : void ScDocProtection::setPassword(const OUString& aPassText)
521 : {
522 0 : mpImpl->setPassword(aPassText);
523 0 : }
524 :
525 0 : uno::Sequence<sal_Int8> ScDocProtection::getPasswordHash(ScPasswordHash eHash, ScPasswordHash eHash2) const
526 : {
527 0 : return mpImpl->getPasswordHash(eHash, eHash2);
528 : }
529 :
530 0 : void ScDocProtection::setPasswordHash(
531 : const uno::Sequence<sal_Int8>& aPassword, ScPasswordHash eHash, ScPasswordHash eHash2)
532 : {
533 0 : mpImpl->setPasswordHash(aPassword, eHash, eHash2);
534 0 : }
535 :
536 0 : bool ScDocProtection::verifyPassword(const OUString& aPassText) const
537 : {
538 0 : return mpImpl->verifyPassword(aPassText);
539 : }
540 :
541 0 : bool ScDocProtection::isOptionEnabled(Option eOption) const
542 : {
543 0 : return mpImpl->isOptionEnabled(eOption);
544 : }
545 :
546 0 : void ScDocProtection::setOption(Option eOption, bool bEnabled)
547 : {
548 0 : mpImpl->setOption(eOption, bEnabled);
549 0 : }
550 :
551 0 : ScTableProtection::ScTableProtection() :
552 0 : mpImpl(new ScTableProtectionImpl(static_cast<SCSIZE>(ScTableProtection::NONE)))
553 : {
554 : // Set default values for the options.
555 0 : mpImpl->setOption(SELECT_LOCKED_CELLS, true);
556 0 : mpImpl->setOption(SELECT_UNLOCKED_CELLS, true);
557 0 : }
558 :
559 0 : ScTableProtection::ScTableProtection(const ScTableProtection& r) :
560 : ScPassHashProtectable(),
561 0 : mpImpl(new ScTableProtectionImpl(*r.mpImpl))
562 : {
563 0 : }
564 :
565 0 : ScTableProtection::~ScTableProtection()
566 : {
567 0 : }
568 :
569 0 : bool ScTableProtection::isProtected() const
570 : {
571 0 : return mpImpl->isProtected();
572 : }
573 :
574 0 : bool ScTableProtection::isProtectedWithPass() const
575 : {
576 0 : return mpImpl->isProtectedWithPass();
577 : }
578 :
579 0 : void ScTableProtection::setProtected(bool bProtected)
580 : {
581 0 : mpImpl->setProtected(bProtected);
582 0 : }
583 :
584 0 : bool ScTableProtection::isPasswordEmpty() const
585 : {
586 0 : return mpImpl->isPasswordEmpty();
587 : }
588 :
589 0 : bool ScTableProtection::hasPasswordHash(ScPasswordHash eHash, ScPasswordHash eHash2) const
590 : {
591 0 : return mpImpl->hasPasswordHash(eHash, eHash2);
592 : }
593 :
594 0 : void ScTableProtection::setPassword(const OUString& aPassText)
595 : {
596 0 : mpImpl->setPassword(aPassText);
597 0 : }
598 :
599 0 : Sequence<sal_Int8> ScTableProtection::getPasswordHash(ScPasswordHash eHash, ScPasswordHash eHash2) const
600 : {
601 0 : return mpImpl->getPasswordHash(eHash, eHash2);
602 : }
603 :
604 0 : void ScTableProtection::setPasswordHash(
605 : const uno::Sequence<sal_Int8>& aPassword, ScPasswordHash eHash, ScPasswordHash eHash2)
606 : {
607 0 : mpImpl->setPasswordHash(aPassword, eHash, eHash2);
608 0 : }
609 :
610 0 : bool ScTableProtection::verifyPassword(const OUString& aPassText) const
611 : {
612 0 : return mpImpl->verifyPassword(aPassText);
613 : }
614 :
615 0 : bool ScTableProtection::isOptionEnabled(Option eOption) const
616 : {
617 0 : return mpImpl->isOptionEnabled(eOption);
618 : }
619 :
620 0 : void ScTableProtection::setOption(Option eOption, bool bEnabled)
621 : {
622 0 : mpImpl->setOption(eOption, bEnabled);
623 0 : }
624 :
625 0 : void ScTableProtection::setEnhancedProtection( const ::std::vector< ScEnhancedProtection > & rProt )
626 : {
627 0 : mpImpl->setEnhancedProtection(rProt);
628 0 : }
629 :
630 0 : const ::std::vector< ScEnhancedProtection > & ScTableProtection::getEnhancedProtection() const
631 : {
632 0 : return mpImpl->getEnhancedProtection();
633 : }
634 :
635 0 : bool ScTableProtection::updateReference( UpdateRefMode eMode, ScDocument* pDoc, const ScRange& rWhere,
636 : SCsCOL nDx, SCsROW nDy, SCsTAB nDz )
637 : {
638 0 : return mpImpl->updateReference( eMode, pDoc, rWhere, nDx, nDy, nDz);
639 : }
640 :
641 0 : bool ScTableProtection::isBlockEditable( const ScRange& rRange ) const
642 : {
643 0 : return mpImpl->isBlockEditable( rRange);
644 : }
645 :
646 0 : bool ScTableProtection::isSelectionEditable( const ScRangeList& rRangeList ) const
647 : {
648 0 : return mpImpl->isSelectionEditable( rRangeList);
649 : }
650 :
651 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|