xref: /AOO41X/main/sc/source/filter/xml/XMLStylesImportHelper.cxx (revision b3f79822e811ac3493b185030a72c3c5a51f32d8)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sc.hxx"
26 
27 
28 
29 // INCLUDE ---------------------------------------------------------------
30 #include "XMLStylesImportHelper.hxx"
31 #include "xmlimprt.hxx"
32 #include <tools/debug.hxx>
33 #include <com/sun/star/util/NumberFormat.hpp>
34 
35 using namespace com::sun::star;
36 
AddStyleNumberFormat(const rtl::OUString & rStyleName,const sal_Int32 nNumberFormat)37 void ScMyStyleNumberFormats::AddStyleNumberFormat(const rtl::OUString& rStyleName, const sal_Int32 nNumberFormat)
38 {
39     aSet.insert(ScMyStyleNumberFormat(rStyleName, nNumberFormat));
40 }
41 
GetStyleNumberFormat(const rtl::OUString & rStyleName)42 sal_Int32 ScMyStyleNumberFormats::GetStyleNumberFormat(const rtl::OUString& rStyleName)
43 {
44     ScMyStyleNumberFormat aStyleNumberFormat(rStyleName);
45     ScMyStyleNumberFormatSet::iterator aItr(aSet.find(aStyleNumberFormat));
46     if (aItr == aSet.end())
47         return -1;
48     else
49         return aItr->nNumberFormat;
50 }
51 
ScMyStyleRanges()52 ScMyStyleRanges::ScMyStyleRanges()
53     :
54     pTextList(NULL),
55     pNumberList(NULL),
56     pTimeList(NULL),
57     pDateTimeList(NULL),
58     pPercentList(NULL),
59     pLogicalList(NULL),
60     pUndefinedList(NULL),
61     pCurrencyList(NULL)
62 {
63 }
64 
~ScMyStyleRanges()65 ScMyStyleRanges::~ScMyStyleRanges()
66 {
67     if (pTextList)
68         delete pTextList;
69     if (pNumberList)
70         delete pNumberList;
71     if (pTimeList)
72         delete pTimeList;
73     if (pDateTimeList)
74         delete pDateTimeList;
75     if (pPercentList)
76         delete pPercentList;
77     if (pLogicalList)
78         delete pLogicalList;
79     if (pUndefinedList)
80         delete pUndefinedList;
81     if (pCurrencyList)
82         delete pCurrencyList;
83 }
84 
AddRange(const ScRange & rRange,ScRangeList * pList,const rtl::OUString * pStyleName,const sal_Int16 nType,ScXMLImport & rImport,const sal_uInt32 nMaxRanges)85 void ScMyStyleRanges::AddRange(const ScRange& rRange, ScRangeList* pList,
86     const rtl::OUString* pStyleName, const sal_Int16 nType,
87     ScXMLImport& rImport, const sal_uInt32 nMaxRanges)
88 {
89     pList->Join(rRange);
90     DBG_ASSERT(nMaxRanges > 0, "MaxRanges to less");
91     if (pList->Count() > nMaxRanges)
92     {
93         sal_Int32 nCount(pList->Count());
94         ScRange* pRange(NULL);
95         for (sal_Int32 i = 0; i < nCount; ++i)
96         {
97             pRange = pList->GetObject(i);
98             if (pRange && (pRange->aEnd.Row() + 1 < rRange.aStart.Row()))
99             {
100                 rImport.SetStyleToRange(*pRange, pStyleName, nType, NULL);
101                 delete pRange;
102                 pRange = NULL;
103                 pList->Remove(i);
104             }
105         }
106     }
107 }
108 
AddCurrencyRange(const ScRange & rRange,ScRangeListRef xList,const rtl::OUString * pStyleName,const rtl::OUString * pCurrency,ScXMLImport & rImport,const sal_uInt32 nMaxRanges)109 void ScMyStyleRanges::AddCurrencyRange(const ScRange& rRange, ScRangeListRef xList,
110     const rtl::OUString* pStyleName, const rtl::OUString* pCurrency,
111     ScXMLImport& rImport, const sal_uInt32 nMaxRanges)
112 {
113     xList->Join(rRange);
114     DBG_ASSERT(nMaxRanges > 0, "MaxRanges to less");
115     if (xList->Count() > nMaxRanges)
116     {
117         sal_Int32 nCount(xList->Count());
118         ScRange* pRange(NULL);
119         for (sal_Int32 i = 0; i < nCount; ++i)
120         {
121             pRange = xList->GetObject(i);
122             if (pRange && (pRange->aEnd.Row() + 1 < rRange.aStart.Row()))
123             {
124                 rImport.SetStyleToRange(*pRange, pStyleName, util::NumberFormat::CURRENCY, pCurrency);
125                 delete pRange;
126                 pRange = NULL;
127                 xList->Remove(i);
128             }
129         }
130     }
131 }
132 
AddRange(const ScRange & rRange,const rtl::OUString * pStyleName,const sal_Int16 nType,ScXMLImport & rImport,const sal_uInt32 nMaxRanges)133 void ScMyStyleRanges::AddRange(const ScRange& rRange,
134     const rtl::OUString* pStyleName, const sal_Int16 nType,
135     ScXMLImport& rImport, const sal_uInt32 nMaxRanges)
136 {
137     switch (nType)
138     {
139         case util::NumberFormat::NUMBER:
140         {
141             if (!pNumberList)
142                 pNumberList = new ScRangeList();
143             AddRange(rRange, pNumberList, pStyleName, nType, rImport, nMaxRanges);
144         }
145         break;
146         case util::NumberFormat::TEXT:
147         {
148             if (!pTextList)
149                 pTextList = new ScRangeList();
150             AddRange(rRange, pTextList, pStyleName, nType, rImport, nMaxRanges);
151         }
152         break;
153         case util::NumberFormat::TIME:
154         {
155             if (!pTimeList)
156                 pTimeList = new ScRangeList();
157             AddRange(rRange, pTimeList, pStyleName, nType, rImport, nMaxRanges);
158         }
159         break;
160         case util::NumberFormat::DATETIME:
161         {
162             if (!pDateTimeList)
163                 pDateTimeList = new ScRangeList();
164             AddRange(rRange, pDateTimeList, pStyleName, nType, rImport, nMaxRanges);
165         }
166         break;
167         case util::NumberFormat::PERCENT:
168         {
169             if (!pPercentList)
170                 pPercentList = new ScRangeList();
171             AddRange(rRange, pPercentList, pStyleName, nType, rImport, nMaxRanges);
172         }
173         break;
174         case util::NumberFormat::LOGICAL:
175         {
176             if (!pLogicalList)
177                 pLogicalList = new ScRangeList();
178             AddRange(rRange, pLogicalList, pStyleName, nType, rImport, nMaxRanges);
179         }
180         break;
181         case util::NumberFormat::UNDEFINED:
182         {
183             if (!pUndefinedList)
184                 pUndefinedList = new ScRangeList();
185             AddRange(rRange, pUndefinedList, pStyleName, nType, rImport, nMaxRanges);
186         }
187         break;
188         default:
189         {
190             DBG_ERROR("wrong type");
191         }
192         break;
193     }
194 }
195 
AddCurrencyRange(const ScRange & rRange,const rtl::OUString * pStyleName,const rtl::OUString * pCurrency,ScXMLImport & rImport,const sal_uInt32 nMaxRanges)196 void ScMyStyleRanges::AddCurrencyRange(const ScRange& rRange,
197     const rtl::OUString* pStyleName, const rtl::OUString* pCurrency,
198     ScXMLImport& rImport, const sal_uInt32 nMaxRanges)
199 {
200     if (!pCurrencyList)
201         pCurrencyList = new ScMyCurrencyStylesSet();
202     ScMyCurrencyStyle aStyle;
203     if (pCurrency)
204         aStyle.sCurrency = *pCurrency;
205     ScMyCurrencyStylesSet::iterator aItr(pCurrencyList->find(aStyle));
206     if (aItr == pCurrencyList->end())
207     {
208         std::pair<ScMyCurrencyStylesSet::iterator, bool> aPair(pCurrencyList->insert(aStyle));
209         if (aPair.second)
210         {
211             aItr = aPair.first;
212             AddCurrencyRange(rRange, aItr->xRanges, pStyleName, pCurrency, rImport, nMaxRanges);
213         }
214     }
215     else
216         aItr->xRanges->Join(rRange);
217 }
218 
InsertColRow(const ScRange & rRange,const SCsCOL nDx,const SCsROW nDy,const SCsTAB nDz,ScDocument * pDoc)219 void ScMyStyleRanges::InsertColRow(const ScRange& rRange, const SCsCOL nDx, const SCsROW nDy,
220         const SCsTAB nDz, ScDocument* pDoc)
221 {
222     UpdateRefMode aRefMode(URM_INSDEL);
223     if (pNumberList)
224         pNumberList->UpdateReference(aRefMode, pDoc, rRange, nDx, nDy, nDz);
225     if (pTextList)
226         pTextList->UpdateReference(aRefMode, pDoc, rRange, nDx, nDy, nDz);
227     if (pTimeList)
228         pTimeList->UpdateReference(aRefMode, pDoc, rRange, nDx, nDy, nDz);
229     if (pDateTimeList)
230         pDateTimeList->UpdateReference(aRefMode, pDoc, rRange, nDx, nDy, nDz);
231     if (pPercentList)
232         pPercentList->UpdateReference(aRefMode, pDoc, rRange, nDx, nDy, nDz);
233     if (pLogicalList)
234         pLogicalList->UpdateReference(aRefMode, pDoc, rRange, nDx, nDy, nDz);
235     if (pUndefinedList)
236         pUndefinedList->UpdateReference(aRefMode, pDoc, rRange, nDx, nDy, nDz);
237     if (pCurrencyList)
238     {
239         ScMyCurrencyStylesSet::iterator aItr(pCurrencyList->begin());
240         ScMyCurrencyStylesSet::iterator aEndItr(pCurrencyList->end());
241         while (aItr != aEndItr)
242         {
243             aItr->xRanges->UpdateReference(aRefMode, pDoc, rRange, nDx, nDy, nDz);
244             ++aItr;
245         }
246     }
247 }
248 
InsertRow(const sal_Int32 nRow,const sal_Int32 nTab,ScDocument * pDoc)249 void ScMyStyleRanges::InsertRow(const sal_Int32 nRow, const sal_Int32 nTab, ScDocument* pDoc)
250 {
251     InsertColRow(ScRange(0, static_cast<SCROW>(nRow), static_cast<SCTAB>(nTab),
252         MAXCOL, MAXROW, static_cast<SCTAB>(nTab)), 0, 1, 0, pDoc);
253 }
254 
InsertCol(const sal_Int32 nCol,const sal_Int32 nTab,ScDocument * pDoc)255 void ScMyStyleRanges::InsertCol(const sal_Int32 nCol, const sal_Int32 nTab, ScDocument* pDoc)
256 {
257     InsertColRow(ScRange(static_cast<SCCOL>(nCol), 0, static_cast<SCTAB>(nTab),
258         MAXCOL, MAXROW, static_cast<SCTAB>(nTab)), 1, 0, 0, pDoc);
259 }
260 
SetStylesToRanges(ScRangeList * pList,const rtl::OUString * pStyleName,const sal_Int16 nCellType,const rtl::OUString * pCurrency,ScXMLImport & rImport)261 void ScMyStyleRanges::SetStylesToRanges(ScRangeList* pList,
262     const rtl::OUString* pStyleName, const sal_Int16 nCellType,
263     const rtl::OUString* pCurrency, ScXMLImport& rImport)
264 {
265     sal_Int32 nCount(pList->Count());
266     for (sal_Int32 i = 0; i < nCount; ++i)
267         rImport.SetStyleToRange(*pList->GetObject(i), pStyleName, nCellType, pCurrency);
268 }
269 
SetStylesToRanges(ScRangeListRef xList,const rtl::OUString * pStyleName,const sal_Int16 nCellType,const rtl::OUString * pCurrency,ScXMLImport & rImport)270 void ScMyStyleRanges::SetStylesToRanges(ScRangeListRef xList,
271     const rtl::OUString* pStyleName, const sal_Int16 nCellType,
272     const rtl::OUString* pCurrency, ScXMLImport& rImport)
273 {
274     sal_Int32 nCount(xList->Count());
275     for (sal_Int32 i = 0; i < nCount; ++i)
276         rImport.SetStyleToRange(*xList->GetObject(i), pStyleName, nCellType, pCurrency);
277 }
278 
SetStylesToRanges(const rtl::OUString * pStyleName,ScXMLImport & rImport)279 void ScMyStyleRanges::SetStylesToRanges(const rtl::OUString* pStyleName, ScXMLImport& rImport)
280 {
281     if (pNumberList)
282         SetStylesToRanges(pNumberList, pStyleName, util::NumberFormat::NUMBER, NULL, rImport);
283     if (pTextList)
284         SetStylesToRanges(pTextList, pStyleName, util::NumberFormat::TEXT, NULL, rImport);
285     if (pTimeList)
286         SetStylesToRanges(pTimeList, pStyleName, util::NumberFormat::TIME, NULL, rImport);
287     if (pDateTimeList)
288         SetStylesToRanges(pDateTimeList, pStyleName, util::NumberFormat::DATETIME, NULL, rImport);
289     if (pPercentList)
290         SetStylesToRanges(pPercentList, pStyleName, util::NumberFormat::PERCENT, NULL, rImport);
291     if (pLogicalList)
292         SetStylesToRanges(pLogicalList, pStyleName, util::NumberFormat::LOGICAL, NULL, rImport);
293     if (pUndefinedList)
294         SetStylesToRanges(pUndefinedList, pStyleName, util::NumberFormat::UNDEFINED, NULL, rImport);
295     if (pCurrencyList)
296     {
297         ScMyCurrencyStylesSet::iterator aItr(pCurrencyList->begin());
298         ScMyCurrencyStylesSet::iterator aEndItr(pCurrencyList->end());
299         while (aItr != aEndItr)
300         {
301             SetStylesToRanges(aItr->xRanges, pStyleName, util::NumberFormat::CURRENCY, &aItr->sCurrency, rImport);
302             ++aItr;
303         }
304     }
305 }
306 
307 //----------------------------------------------------------------------------
308 
ScMyStylesImportHelper(ScXMLImport & rTempImport)309 ScMyStylesImportHelper::ScMyStylesImportHelper(ScXMLImport& rTempImport)
310     :
311     aRowDefaultStyle(aCellStyles.end()),
312     rImport(rTempImport),
313     pStyleName(NULL),
314     pPrevStyleName(NULL),
315     pCurrency(NULL),
316     pPrevCurrency(NULL),
317     nMaxRanges(0),
318     bPrevRangeAdded(sal_True)
319 {
320 }
321 
~ScMyStylesImportHelper()322 ScMyStylesImportHelper::~ScMyStylesImportHelper()
323 {
324     if (pPrevStyleName)
325         delete pPrevStyleName;
326     if (pPrevCurrency)
327         delete pPrevCurrency;
328     if (pStyleName)
329         delete pStyleName;
330     if (pCurrency)
331         delete pCurrency;
332 }
333 
ResetAttributes()334 void ScMyStylesImportHelper::ResetAttributes()
335 {
336     if (pPrevStyleName)
337         delete pPrevStyleName;
338     if (pPrevCurrency)
339         delete pPrevCurrency;
340     pPrevStyleName = pStyleName;
341     pPrevCurrency = pCurrency;
342     nPrevCellType = nCellType;
343     pStyleName = NULL;
344     pCurrency = NULL;
345     nCellType = 0;
346 }
347 
GetIterator(const rtl::OUString * pStyleNameP)348 ScMyStylesSet::iterator ScMyStylesImportHelper::GetIterator(const rtl::OUString* pStyleNameP)
349 {
350     ScMyStyle aStyle;
351     if (pStyleNameP)
352         aStyle.sStyleName = *pStyleNameP;
353     else
354     {
355         DBG_ERROR("here is no stylename given");
356     }
357     ScMyStylesSet::iterator aItr(aCellStyles.find(aStyle));
358     if (aItr == aCellStyles.end())
359     {
360         std::pair<ScMyStylesSet::iterator, bool> aPair(aCellStyles.insert(aStyle));
361         if (aPair.second)
362             aItr = aPair.first;
363         else
364         {
365             DBG_ERROR("not possible to insert style");
366             return aCellStyles.end();
367         }
368     }
369     return aItr;
370 }
371 
AddDefaultRange(const ScRange & rRange)372 void ScMyStylesImportHelper::AddDefaultRange(const ScRange& rRange)
373 {
374     DBG_ASSERT(aRowDefaultStyle != aCellStyles.end(), "no row default style");
375     if (!aRowDefaultStyle->sStyleName.getLength())
376     {
377         SCCOL nStartCol(rRange.aStart.Col());
378         SCCOL nEndCol(rRange.aEnd.Col());
379         if (aColDefaultStyles.size() > sal::static_int_cast<sal_uInt32>(nStartCol))
380         {
381             ScMyStylesSet::iterator aPrevItr(aColDefaultStyles[nStartCol]);
382             DBG_ASSERT(aColDefaultStyles.size() > sal::static_int_cast<sal_uInt32>(nEndCol), "to much columns");
383             for (SCCOL i = nStartCol + 1; (i <= nEndCol) && (i < sal::static_int_cast<SCCOL>(aColDefaultStyles.size())); ++i)
384             {
385                 if (aPrevItr != aColDefaultStyles[i])
386                 {
387                     DBG_ASSERT(aPrevItr != aCellStyles.end(), "no column default style");
388                     ScRange aRange(rRange);
389                     aRange.aStart.SetCol(nStartCol);
390                     aRange.aEnd.SetCol(i - 1);
391                     if (pPrevStyleName)
392                         delete pPrevStyleName;
393                     pPrevStyleName = new rtl::OUString(aPrevItr->sStyleName);
394                     AddSingleRange(aRange);
395                     nStartCol = i;
396                     aPrevItr = aColDefaultStyles[i];
397                 }
398             }
399             if (aPrevItr != aCellStyles.end())
400             {
401                 ScRange aRange(rRange);
402                 aRange.aStart.SetCol(nStartCol);
403                 if (pPrevStyleName)
404                     delete pPrevStyleName;
405                 pPrevStyleName = new rtl::OUString(aPrevItr->sStyleName);
406                 AddSingleRange(aRange);
407             }
408             else
409             {
410                 DBG_ERRORFILE("no column default style");
411             }
412         }
413         else
414         {
415             DBG_ERRORFILE("to much columns");
416         }
417     }
418     else
419     {
420         if (pPrevStyleName)
421             delete pPrevStyleName;
422         pPrevStyleName = new rtl::OUString(aRowDefaultStyle->sStyleName);
423         AddSingleRange(rRange);
424     }
425 }
426 
AddSingleRange(const ScRange & rRange)427 void ScMyStylesImportHelper::AddSingleRange(const ScRange& rRange)
428 {
429     if (nMaxRanges == 0)
430         nMaxRanges = aColDefaultStyles.size();
431     ScMyStylesSet::iterator aItr(GetIterator(pPrevStyleName));
432     if (aItr != aCellStyles.end())
433     {
434         if (nPrevCellType != util::NumberFormat::CURRENCY)
435             aItr->xRanges->AddRange(rRange, pPrevStyleName, nPrevCellType,
436                 rImport, nMaxRanges);
437         else
438             aItr->xRanges->AddCurrencyRange(rRange, pPrevStyleName, pPrevCurrency,
439                 rImport, nMaxRanges);
440     }
441 }
442 
AddRange()443 void ScMyStylesImportHelper::AddRange()
444 {
445     if (pPrevStyleName && pPrevStyleName->getLength())
446         AddSingleRange(aPrevRange);
447     else
448         AddDefaultRange(aPrevRange);
449     ResetAttributes();
450 }
451 
AddColumnStyle(const rtl::OUString & sStyleName,const sal_Int32 nColumn,const sal_Int32 nRepeat)452 void ScMyStylesImportHelper::AddColumnStyle(const rtl::OUString& sStyleName, const sal_Int32 nColumn, const sal_Int32 nRepeat)
453 {
454     (void)nColumn;  // avoid warning in product version
455     DBG_ASSERT(static_cast<sal_uInt32>(nColumn) == aColDefaultStyles.size(), "some columns are absent");
456     ScMyStylesSet::iterator aItr(GetIterator(&sStyleName));
457     DBG_ASSERT(aItr != aCellStyles.end(), "no column default style");
458     aColDefaultStyles.reserve(aColDefaultStyles.size() + nRepeat);
459     for (sal_Int32 i = 0; i < nRepeat; ++i)
460         aColDefaultStyles.push_back(aItr);
461 }
462 
SetRowStyle(const rtl::OUString & sStyleName)463 void ScMyStylesImportHelper::SetRowStyle(const rtl::OUString& sStyleName)
464 {
465     aRowDefaultStyle = GetIterator(&sStyleName);
466 }
467 
SetAttributes(rtl::OUString * pStyleNameP,rtl::OUString * pCurrencyP,const sal_Int16 nCellTypeP)468 void ScMyStylesImportHelper::SetAttributes(rtl::OUString* pStyleNameP,
469     rtl::OUString* pCurrencyP, const sal_Int16 nCellTypeP)
470 {
471     if (this->pStyleName)
472         delete this->pStyleName;
473     if (this->pCurrency)
474         delete this->pCurrency;
475     this->pStyleName = pStyleNameP;
476     this->pCurrency = pCurrencyP;
477     this->nCellType = nCellTypeP;
478 }
479 
AddRange(const ScRange & rRange)480 void ScMyStylesImportHelper::AddRange(const ScRange& rRange)
481 {
482     if (!bPrevRangeAdded)
483     {
484         sal_Bool bAddRange(sal_False);
485         if (nCellType == nPrevCellType &&
486             IsEqual(pStyleName, pPrevStyleName) &&
487             IsEqual(pCurrency, pPrevCurrency))
488         {
489             if (rRange.aStart.Row() == aPrevRange.aStart.Row())
490             {
491                 if (rRange.aEnd.Row() == aPrevRange.aEnd.Row())
492                 {
493                     DBG_ASSERT(aPrevRange.aEnd.Col() + 1 == rRange.aStart.Col(), "something wents wrong");
494                     aPrevRange.aEnd.SetCol(rRange.aEnd.Col());
495                 }
496                 else
497                     bAddRange = sal_True;
498             }
499             else
500             {
501                 if (rRange.aStart.Col() == aPrevRange.aStart.Col() &&
502                     rRange.aEnd.Col() == aPrevRange.aEnd.Col())
503                 {
504                     DBG_ASSERT(aPrevRange.aEnd.Row() + 1 == rRange.aStart.Row(), "something wents wrong");
505                     aPrevRange.aEnd.SetRow(rRange.aEnd.Row());
506                 }
507                 else
508                     bAddRange = sal_True;
509             }
510         }
511         else
512             bAddRange = sal_True;
513         if (bAddRange)
514         {
515             AddRange();
516             aPrevRange = rRange;
517         }
518     }
519     else
520     {
521         aPrevRange = rRange;
522         ResetAttributes();
523         bPrevRangeAdded = sal_False;
524     }
525 }
526 
AddCell(const com::sun::star::table::CellAddress & rAddress)527 void ScMyStylesImportHelper::AddCell(const com::sun::star::table::CellAddress& rAddress)
528 {
529     ScAddress aScAddress( static_cast<SCCOL>(rAddress.Column), static_cast<SCROW>(rAddress.Row), rAddress.Sheet );
530     ScRange aScRange( aScAddress, aScAddress );
531     AddRange(aScRange);
532 }
533 
InsertRow(const sal_Int32 nRow,const sal_Int32 nTab,ScDocument * pDoc)534 void ScMyStylesImportHelper::InsertRow(const sal_Int32 nRow, const sal_Int32 nTab, ScDocument* pDoc)
535 {
536     rImport.LockSolarMutex();
537     ScMyStylesSet::iterator aItr(aCellStyles.begin());
538     ScMyStylesSet::iterator aEndItr(aCellStyles.end());
539     while (aItr != aEndItr)
540     {
541         aItr->xRanges->InsertRow(nRow, nTab, pDoc);
542         ++aItr;
543     }
544     rImport.UnlockSolarMutex();
545 }
546 
InsertCol(const sal_Int32 nCol,const sal_Int32 nTab,ScDocument * pDoc)547 void ScMyStylesImportHelper::InsertCol(const sal_Int32 nCol, const sal_Int32 nTab, ScDocument* pDoc)
548 {
549     rImport.LockSolarMutex();
550     ScMyStylesSet::iterator aItr(aCellStyles.begin());
551     ScMyStylesSet::iterator aEndItr(aCellStyles.end());
552     while (aItr != aEndItr)
553     {
554         aItr->xRanges->InsertCol(nCol, nTab, pDoc);
555         ++aItr;
556     }
557     rImport.UnlockSolarMutex();
558 }
559 
EndTable()560 void ScMyStylesImportHelper::EndTable()
561 {
562     if (!bPrevRangeAdded)
563     {
564         AddRange();
565         bPrevRangeAdded = sal_True;
566     }
567     nMaxRanges = 0;
568 }
569 
SetStylesToRanges()570 void ScMyStylesImportHelper::SetStylesToRanges()
571 {
572     ScMyStylesSet::iterator aItr(aCellStyles.begin());
573     ScMyStylesSet::iterator aEndItr(aCellStyles.end());
574     while (aItr != aEndItr)
575     {
576         aItr->xRanges->SetStylesToRanges(&aItr->sStyleName, rImport);
577         ++aItr;
578     }
579     aColDefaultStyles.clear();
580     aCellStyles.clear();
581     nMaxRanges = 0;
582 }
583 
584