LCOV - code coverage report
Current view: top level - sw/source/core/uibase/config - modcfg.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 369 580 63.6 %
Date: 2014-04-11 Functions: 27 44 61.4 %
Legend: Lines: hit not hit

          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 <hintids.hxx>
      21             : #include <comphelper/classids.hxx>
      22             : #include <tools/stream.hxx>
      23             : #include <vcl/svapp.hxx>
      24             : #include <svl/mailenum.hxx>
      25             : #include <svx/svxids.hrc>
      26             : #include <editeng/svxenum.hxx>
      27             : #include <osl/diagnose.h>
      28             : 
      29             : #include <tools/globname.hxx>
      30             : #include <swtypes.hxx>
      31             : #include <itabenum.hxx>
      32             : #include <modcfg.hxx>
      33             : #include <fldupde.hxx>
      34             : #include <unotools/syslocaleoptions.hxx>
      35             : #include <caption.hxx>
      36             : #include <com/sun/star/uno/Any.hxx>
      37             : 
      38             : #include <unomid.h>
      39             : 
      40             : using namespace utl;
      41             : using namespace com::sun::star::uno;
      42             : 
      43             : #define GLOB_NAME_CALC      0
      44             : #define GLOB_NAME_IMPRESS   1
      45             : #define GLOB_NAME_DRAW      2
      46             : #define GLOB_NAME_MATH      3
      47             : #define GLOB_NAME_CHART     4
      48             : 
      49         296 : InsCaptionOpt* InsCaptionOptArr::Find(const SwCapObjType eType, const SvGlobalName *pOleId)
      50             : {
      51         296 :     for (InsCapOptArr::iterator aI = m_aInsCapOptArr.begin(); aI != m_aInsCapOptArr.end(); ++aI)
      52             :     {
      53           0 :         InsCaptionOpt &rObj = *aI;
      54           0 :         if (rObj.GetObjType() == eType && (eType != OLE_CAP || (pOleId && rObj.GetOleId() == *pOleId)))
      55           0 :             return &rObj;
      56             :     }
      57             : 
      58         296 :     return NULL;
      59             : }
      60             : 
      61         296 : void InsCaptionOptArr::Insert(InsCaptionOpt* pObj)
      62             : {
      63         296 :     m_aInsCapOptArr.push_back(pObj); //takes ownership
      64         296 : }
      65             : 
      66           0 : const InsCaptionOpt* SwModuleOptions::GetCapOption(
      67             :     sal_Bool bHTML, const SwCapObjType eType, const SvGlobalName *pOleId)
      68             : {
      69           0 :     if(bHTML)
      70             :     {
      71             :         OSL_FAIL("no caption option in sw/web!");
      72           0 :         return 0;
      73             :     }
      74             :     else
      75             :     {
      76           0 :         if(eType == OLE_CAP && pOleId)
      77             :         {
      78           0 :             bool bFound = false;
      79           0 :             for( sal_uInt16 nId = 0; nId <= GLOB_NAME_CHART && !bFound; nId++)
      80           0 :                 bFound = *pOleId == aInsertConfig.aGlobalNames[nId  ];
      81           0 :             if(!bFound)
      82           0 :                 return aInsertConfig.pOLEMiscOpt;
      83             :         }
      84           0 :         return aInsertConfig.pCapOptions->Find(eType, pOleId);
      85             :     }
      86             : }
      87             : 
      88           0 : sal_Bool SwModuleOptions::SetCapOption(sal_Bool bHTML, const InsCaptionOpt* pOpt)
      89             : {
      90           0 :     sal_Bool bRet = sal_False;
      91             : 
      92           0 :     if(bHTML)
      93             :     {
      94             :         OSL_FAIL("no caption option in sw/web!");
      95             :     }
      96           0 :     else if (pOpt)
      97             :     {
      98           0 :         if(pOpt->GetObjType() == OLE_CAP && &pOpt->GetOleId())
      99             :         {
     100           0 :             bool bFound = false;
     101           0 :             for( sal_uInt16 nId = 0; nId <= GLOB_NAME_CHART; nId++)
     102           0 :                 bFound = pOpt->GetOleId() == aInsertConfig.aGlobalNames[nId  ];
     103           0 :             if(!bFound)
     104             :             {
     105           0 :                 if(aInsertConfig.pOLEMiscOpt)
     106           0 :                     *aInsertConfig.pOLEMiscOpt = *pOpt;
     107             :                 else
     108           0 :                     aInsertConfig.pOLEMiscOpt = new InsCaptionOpt(*pOpt);
     109             :             }
     110             :         }
     111             : 
     112           0 :         InsCaptionOptArr& rArr = *aInsertConfig.pCapOptions;
     113           0 :         InsCaptionOpt *pObj = rArr.Find(pOpt->GetObjType(), &pOpt->GetOleId());
     114             : 
     115           0 :         if (pObj)
     116             :         {
     117           0 :             *pObj = *pOpt;
     118             :         }
     119             :         else
     120           0 :             rArr.Insert(new InsCaptionOpt(*pOpt));
     121             : 
     122           0 :         aInsertConfig.SetModified();
     123           0 :         bRet = sal_True;
     124             :     }
     125             : 
     126           0 :     return bRet;
     127             : }
     128             : 
     129          37 : SwModuleOptions::SwModuleOptions() :
     130             :     aInsertConfig(sal_False),
     131             :     aWebInsertConfig(sal_True),
     132             :     aTableConfig(sal_False),
     133             :     aWebTableConfig(sal_True),
     134          37 :     bHideFieldTips(sal_False)
     135             : {
     136          37 : }
     137             : 
     138          38 : OUString SwModuleOptions::ConvertWordDelimiter(const OUString& rDelim, sal_Bool bFromUI)
     139             : {
     140          38 :     OUString sReturn;
     141          38 :     const sal_Int32 nDelimLen = rDelim.getLength();
     142          38 :     if(bFromUI)
     143             :     {
     144         296 :         for (sal_Int32 i = 0; i < nDelimLen; )
     145             :         {
     146         222 :             const sal_Unicode c = rDelim[i++];
     147             : 
     148         222 :             if (c == '\\' && i < nDelimLen )
     149             :             {
     150         111 :                 switch (rDelim[i++])
     151             :                 {
     152          37 :                     case 'n':   sReturn += "\n";    break;
     153          37 :                     case 't':   sReturn += "\t";    break;
     154           0 :                     case '\\':  sReturn += "\\";    break;
     155             : 
     156             :                     case 'x':
     157             :                     {
     158          37 :                         sal_Unicode nChar = 0;
     159          37 :                         bool bValidData = true;
     160         111 :                         for( sal_Int32 n = 0; n < 2 && i < nDelimLen; ++n, ++i )
     161             :                         {
     162          74 :                             sal_Unicode nVal = rDelim[i];
     163          74 :                             if( (nVal >= '0') && ( nVal <= '9') )
     164           0 :                                 nVal -= '0';
     165          74 :                             else if( (nVal >= 'A') && (nVal <= 'F') )
     166           0 :                                 nVal -= 'A' - 10;
     167          74 :                             else if( (nVal >= 'a') && (nVal <= 'f') )
     168          74 :                                 nVal -= 'a' - 10;
     169             :                             else
     170             :                             {
     171             :                                 OSL_FAIL("wrong hex value" );
     172           0 :                                 bValidData = false;
     173           0 :                                 break;
     174             :                             }
     175             : 
     176          74 :                             nChar <<= 4;
     177          74 :                             nChar += nVal;
     178             :                         }
     179          37 :                         if( bValidData )
     180          37 :                             sReturn += OUString(nChar);
     181          37 :                         break;
     182             :                     }
     183             : 
     184             :                     default:    // Unknown, so insert backslash
     185           0 :                         sReturn += "\\";
     186           0 :                         i--;
     187           0 :                         break;
     188         111 :                 }
     189             :             }
     190             :             else
     191         111 :                 sReturn += OUString(c);
     192             :         }
     193             :     }
     194             :     else
     195             :     {
     196          22 :         for (sal_Int32 i = 0; i < nDelimLen; ++i)
     197             :         {
     198          21 :             const sal_Unicode c = rDelim[i];
     199             : 
     200          21 :             switch (c)
     201             :             {
     202           1 :                 case '\n':  sReturn += "\\n"; break;
     203           1 :                 case '\t':  sReturn += "\\t"; break;
     204           0 :                 case '\\':  sReturn += "\\\\"; break;
     205             : 
     206             :                 default:
     207          19 :                     if( c <= 0x1f || c >= 0x7f )
     208             :                     {
     209           1 :                         sReturn += "\\x" + OUString::number( c, 16 );
     210             :                     }
     211             :                     else
     212             :                     {
     213          18 :                         sReturn += OUString(c);
     214             :                     }
     215             :             }
     216             :         }
     217             :     }
     218          38 :     return sReturn;
     219             : }
     220             : 
     221          37 : const Sequence<OUString>& SwRevisionConfig::GetPropertyNames()
     222             : {
     223          37 :     static Sequence<OUString> aNames;
     224          37 :     if(!aNames.getLength())
     225             :     {
     226          37 :         const int nCount = 8;
     227          37 :         aNames.realloc(nCount);
     228             :         static const char* aPropNames[] =
     229             :         {
     230             :             "TextDisplay/Insert/Attribute",             // 0
     231             :             "TextDisplay/Insert/Color",                 // 1
     232             :             "TextDisplay/Delete/Attribute",             // 2
     233             :             "TextDisplay/Delete/Color",                 // 3
     234             :             "TextDisplay/ChangedAttribute/Attribute",   // 4
     235             :             "TextDisplay/ChangedAttribute/Color",       // 5
     236             :             "LinesChanged/Mark",                        // 6
     237             :             "LinesChanged/Color"                        // 7
     238             :         };
     239          37 :         OUString* pNames = aNames.getArray();
     240         333 :         for(int i = 0; i < nCount; i++)
     241         296 :             pNames[i] = OUString::createFromAscii(aPropNames[i]);
     242             :     }
     243          37 :     return aNames;
     244             : }
     245             : 
     246          37 : SwRevisionConfig::SwRevisionConfig() :
     247             :     ConfigItem("Office.Writer/Revision",
     248          37 :         CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE)
     249             : {
     250          37 :     aInsertAttr.nItemId = SID_ATTR_CHAR_UNDERLINE;
     251          37 :     aInsertAttr.nAttr = UNDERLINE_SINGLE;
     252          37 :     aInsertAttr.nColor = COL_TRANSPARENT;
     253          37 :     aDeletedAttr.nItemId = SID_ATTR_CHAR_STRIKEOUT;
     254          37 :     aDeletedAttr.nAttr = STRIKEOUT_SINGLE;
     255          37 :     aDeletedAttr.nColor = COL_TRANSPARENT;
     256          37 :     aFormatAttr.nItemId = SID_ATTR_CHAR_WEIGHT;
     257          37 :     aFormatAttr.nAttr = WEIGHT_BOLD;
     258          37 :     aFormatAttr.nColor = COL_BLACK;
     259             : 
     260          37 :     Load();
     261          37 : }
     262             : 
     263          18 : SwRevisionConfig::~SwRevisionConfig()
     264             : {
     265          18 : }
     266             : 
     267           0 : static sal_Int32 lcl_ConvertAttrToCfg(const AuthorCharAttr& rAttr)
     268             : {
     269           0 :     sal_Int32 nRet = 0;
     270           0 :     switch(rAttr.nItemId)
     271             :     {
     272           0 :         case  SID_ATTR_CHAR_WEIGHT: nRet = 1; break;
     273           0 :         case  SID_ATTR_CHAR_POSTURE: nRet = 2; break;
     274           0 :         case  SID_ATTR_CHAR_UNDERLINE: nRet = UNDERLINE_SINGLE == rAttr.nAttr ? 3 : 4; break;
     275           0 :         case  SID_ATTR_CHAR_STRIKEOUT: nRet = 3; break;
     276             :         case  SID_ATTR_CHAR_CASEMAP:
     277             :         {
     278           0 :             switch(rAttr.nAttr)
     279             :             {
     280           0 :                 case  SVX_CASEMAP_VERSALIEN   : nRet = 5;break;
     281           0 :                 case  SVX_CASEMAP_GEMEINE     : nRet = 6;break;
     282           0 :                 case  SVX_CASEMAP_KAPITAELCHEN: nRet = 7;break;
     283           0 :                 case  SVX_CASEMAP_TITEL       : nRet = 8;break;
     284             :             }
     285             :         }
     286           0 :         break;
     287           0 :         case SID_ATTR_BRUSH : nRet = 9; break;
     288             :     }
     289           0 :     return nRet;
     290             : }
     291             : 
     292           0 : void SwRevisionConfig::Notify( const ::com::sun::star::uno::Sequence< OUString >& ) {}
     293             : 
     294           0 : void SwRevisionConfig::Commit()
     295             : {
     296           0 :     const Sequence<OUString>& aNames = GetPropertyNames();
     297           0 :     Sequence<Any> aValues(aNames.getLength());
     298           0 :     Any* pValues = aValues.getArray();
     299             : 
     300           0 :     for(int nProp = 0; nProp < aNames.getLength(); nProp++)
     301             :     {
     302           0 :         sal_Int32 nVal = -1;
     303           0 :         switch(nProp)
     304             :         {
     305           0 :             case 0 : nVal = lcl_ConvertAttrToCfg(aInsertAttr); break;
     306           0 :             case 1 : nVal = aInsertAttr.nColor  ; break;
     307           0 :             case 2 : nVal = lcl_ConvertAttrToCfg(aDeletedAttr); break;
     308           0 :             case 3 : nVal = aDeletedAttr.nColor ; break;
     309           0 :             case 4 : nVal = lcl_ConvertAttrToCfg(aFormatAttr); break;
     310           0 :             case 5 : nVal = aFormatAttr.nColor  ; break;
     311           0 :             case 6 : nVal = nMarkAlign          ; break;
     312           0 :             case 7 : nVal = aMarkColor.GetColor(); break;
     313             :         }
     314           0 :         pValues[nProp] <<= nVal;
     315             :     }
     316           0 :     PutProperties(aNames, aValues);
     317           0 : }
     318             : 
     319         111 : static void lcl_ConvertCfgToAttr(sal_Int32 nVal, AuthorCharAttr& rAttr, bool bDelete = false)
     320             : {
     321         111 :     rAttr.nItemId = rAttr.nAttr = 0;
     322         111 :     switch(nVal)
     323             :     {
     324          37 :         case 1: rAttr.nItemId = SID_ATTR_CHAR_WEIGHT;   rAttr.nAttr = WEIGHT_BOLD              ; break;
     325           0 :         case 2: rAttr.nItemId = SID_ATTR_CHAR_POSTURE;  rAttr.nAttr = ITALIC_NORMAL            ; break;
     326          74 :         case 3: if(bDelete)
     327             :                 {
     328          37 :                     rAttr.nItemId = SID_ATTR_CHAR_STRIKEOUT;
     329          37 :                     rAttr.nAttr = STRIKEOUT_SINGLE;
     330             :                 }
     331             :                 else
     332             :                 {
     333          37 :                     rAttr.nItemId = SID_ATTR_CHAR_UNDERLINE;
     334          37 :                     rAttr.nAttr = UNDERLINE_SINGLE;
     335             :                 }
     336          74 :         break;
     337           0 :         case 4: rAttr.nItemId = SID_ATTR_CHAR_UNDERLINE;rAttr.nAttr = UNDERLINE_DOUBLE         ; break;
     338           0 :         case 5: rAttr.nItemId = SID_ATTR_CHAR_CASEMAP;  rAttr.nAttr = SVX_CASEMAP_VERSALIEN    ; break;
     339           0 :         case 6: rAttr.nItemId = SID_ATTR_CHAR_CASEMAP;  rAttr.nAttr = SVX_CASEMAP_GEMEINE      ; break;
     340           0 :         case 7: rAttr.nItemId = SID_ATTR_CHAR_CASEMAP;  rAttr.nAttr = SVX_CASEMAP_KAPITAELCHEN ; break;
     341           0 :         case 8: rAttr.nItemId = SID_ATTR_CHAR_CASEMAP;  rAttr.nAttr = SVX_CASEMAP_TITEL        ; break;
     342           0 :         case 9: rAttr.nItemId = SID_ATTR_BRUSH; break;
     343             :     }
     344         111 : }
     345          37 : void SwRevisionConfig::Load()
     346             : {
     347          37 :     const Sequence<OUString>& aNames = GetPropertyNames();
     348          37 :     Sequence<Any> aValues = GetProperties(aNames);
     349          37 :     const Any* pValues = aValues.getConstArray();
     350             :     OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
     351          37 :     if(aValues.getLength() == aNames.getLength())
     352             :     {
     353         333 :         for(int nProp = 0; nProp < aNames.getLength(); nProp++)
     354             :         {
     355         296 :             if(pValues[nProp].hasValue())
     356             :             {
     357         296 :                 sal_Int32 nVal = 0;
     358         296 :                 pValues[nProp] >>= nVal;
     359         296 :                 switch(nProp)
     360             :                 {
     361          37 :                     case 0 : lcl_ConvertCfgToAttr(nVal, aInsertAttr); break;
     362          37 :                     case 1 : aInsertAttr.nColor     = nVal; break;
     363          37 :                     case 2 : lcl_ConvertCfgToAttr(nVal, aDeletedAttr, true); break;
     364          37 :                     case 3 : aDeletedAttr.nColor    = nVal; break;
     365          37 :                     case 4 : lcl_ConvertCfgToAttr(nVal, aFormatAttr); break;
     366          37 :                     case 5 : aFormatAttr.nColor     = nVal; break;
     367          37 :                     case 6 : nMarkAlign = sal::static_int_cast< sal_uInt16, sal_Int32>(nVal); break;
     368          37 :                     case 7 : aMarkColor.SetColor(nVal); break;
     369             :                 }
     370             :             }
     371             :         }
     372          37 :     }
     373          37 : }
     374             : 
     375             : enum InsertConfigProp
     376             : {
     377             :     INS_PROP_TABLE_HEADER = 0,
     378             :     INS_PROP_TABLE_REPEATHEADER,                        // 1
     379             :     INS_PROP_TABLE_BORDER,                              // 2
     380             :     INS_PROP_TABLE_SPLIT,                               // 3 from here not in writer/web
     381             :     INS_PROP_CAP_AUTOMATIC,                             // 4
     382             :     INS_PROP_CAP_CAPTIONORDERNUMBERINGFIRST,            // 5
     383             :     INS_PROP_CAP_OBJECT_TABLE_ENABLE,                   // 6
     384             :     INS_PROP_CAP_OBJECT_TABLE_CATEGORY,                 // 7
     385             :     INS_PROP_CAP_OBJECT_TABLE_NUMBERING,                // 8
     386             :     INS_PROP_CAP_OBJECT_TABLE_NUMBERINGSEPARATOR,       // 9
     387             :     INS_PROP_CAP_OBJECT_TABLE_CAPTIONTEXT,              //10
     388             :     INS_PROP_CAP_OBJECT_TABLE_DELIMITER,                //11
     389             :     INS_PROP_CAP_OBJECT_TABLE_LEVEL,                    //12
     390             :     INS_PROP_CAP_OBJECT_TABLE_POSITION,                 //13
     391             :     INS_PROP_CAP_OBJECT_TABLE_CHARACTERSTYLE,           //14
     392             :     INS_PROP_CAP_OBJECT_FRAME_ENABLE,                   //15
     393             :     INS_PROP_CAP_OBJECT_FRAME_CATEGORY,                 //16
     394             :     INS_PROP_CAP_OBJECT_FRAME_NUMBERING,                //17
     395             :     INS_PROP_CAP_OBJECT_FRAME_NUMBERINGSEPARATOR,       //18
     396             :     INS_PROP_CAP_OBJECT_FRAME_CAPTIONTEXT,              //19
     397             :     INS_PROP_CAP_OBJECT_FRAME_DELIMITER,                //20
     398             :     INS_PROP_CAP_OBJECT_FRAME_LEVEL,                    //21
     399             :     INS_PROP_CAP_OBJECT_FRAME_POSITION,                 //22
     400             :     INS_PROP_CAP_OBJECT_FRAME_CHARACTERSTYLE,           //23
     401             :     INS_PROP_CAP_OBJECT_GRAPHIC_ENABLE,                          //24
     402             :     INS_PROP_CAP_OBJECT_GRAPHIC_CATEGORY,               //25
     403             :     INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERING,              //26
     404             :     INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERINGSEPARATOR,     //27
     405             :     INS_PROP_CAP_OBJECT_GRAPHIC_CAPTIONTEXT,            //28
     406             :     INS_PROP_CAP_OBJECT_GRAPHIC_DELIMITER,              //29
     407             :     INS_PROP_CAP_OBJECT_GRAPHIC_LEVEL,                  //30
     408             :     INS_PROP_CAP_OBJECT_GRAPHIC_POSITION,               //31
     409             :     INS_PROP_CAP_OBJECT_GRAPHIC_CHARACTERSTYLE,         //32
     410             :     INS_PROP_CAP_OBJECT_GRAPHIC_APPLYATTRIBUTES,        //33
     411             :     INS_PROP_CAP_OBJECT_CALC_ENABLE,                             //34
     412             :     INS_PROP_CAP_OBJECT_CALC_CATEGORY,                  //35
     413             :     INS_PROP_CAP_OBJECT_CALC_NUMBERING,                 //36
     414             :     INS_PROP_CAP_OBJECT_CALC_NUMBERINGSEPARATOR,        //37
     415             :     INS_PROP_CAP_OBJECT_CALC_CAPTIONTEXT,               //38
     416             :     INS_PROP_CAP_OBJECT_CALC_DELIMITER,                 //39
     417             :     INS_PROP_CAP_OBJECT_CALC_LEVEL,                     //40
     418             :     INS_PROP_CAP_OBJECT_CALC_POSITION,                  //41
     419             :     INS_PROP_CAP_OBJECT_CALC_CHARACTERSTYLE,            //42
     420             :     INS_PROP_CAP_OBJECT_CALC_APPLYATTRIBUTES,           //43
     421             :     INS_PROP_CAP_OBJECT_IMPRESS_ENABLE,                          //44
     422             :     INS_PROP_CAP_OBJECT_IMPRESS_CATEGORY,               //45
     423             :     INS_PROP_CAP_OBJECT_IMPRESS_NUMBERING,              //46
     424             :     INS_PROP_CAP_OBJECT_IMPRESS_NUMBERINGSEPARATOR,     //47
     425             :     INS_PROP_CAP_OBJECT_IMPRESS_CAPTIONTEXT,            //48
     426             :     INS_PROP_CAP_OBJECT_IMPRESS_DELIMITER,              //49
     427             :     INS_PROP_CAP_OBJECT_IMPRESS_LEVEL,                  //50
     428             :     INS_PROP_CAP_OBJECT_IMPRESS_POSITION,               //51
     429             :     INS_PROP_CAP_OBJECT_IMPRESS_CHARACTERSTYLE,         //52
     430             :     INS_PROP_CAP_OBJECT_IMPRESS_APPLYATTRIBUTES,        //53
     431             :     INS_PROP_CAP_OBJECT_CHART_ENABLE,                            //54
     432             :     INS_PROP_CAP_OBJECT_CHART_CATEGORY,                 //55
     433             :     INS_PROP_CAP_OBJECT_CHART_NUMBERING,                //56
     434             :     INS_PROP_CAP_OBJECT_CHART_NUMBERINGSEPARATOR,       //57
     435             :     INS_PROP_CAP_OBJECT_CHART_CAPTIONTEXT,              //58
     436             :     INS_PROP_CAP_OBJECT_CHART_DELIMITER,                //59
     437             :     INS_PROP_CAP_OBJECT_CHART_LEVEL,                    //60
     438             :     INS_PROP_CAP_OBJECT_CHART_POSITION,                 //61
     439             :     INS_PROP_CAP_OBJECT_CHART_CHARACTERSTYLE,           //62
     440             :     INS_PROP_CAP_OBJECT_CHART_APPLYATTRIBUTES,          //63
     441             :     INS_PROP_CAP_OBJECT_FORMULA_ENABLE,                          //64
     442             :     INS_PROP_CAP_OBJECT_FORMULA_CATEGORY,               //65
     443             :     INS_PROP_CAP_OBJECT_FORMULA_NUMBERING,              //66
     444             :     INS_PROP_CAP_OBJECT_FORMULA_NUMBERINGSEPARATOR,     //67
     445             :     INS_PROP_CAP_OBJECT_FORMULA_CAPTIONTEXT,            //68
     446             :     INS_PROP_CAP_OBJECT_FORMULA_DELIMITER,              //69
     447             :     INS_PROP_CAP_OBJECT_FORMULA_LEVEL,                  //70
     448             :     INS_PROP_CAP_OBJECT_FORMULA_POSITION,               //71
     449             :     INS_PROP_CAP_OBJECT_FORMULA_CHARACTERSTYLE,         //72
     450             :     INS_PROP_CAP_OBJECT_FORMULA_APPLYATTRIBUTES,        //73
     451             :     INS_PROP_CAP_OBJECT_DRAW_ENABLE,                             //74
     452             :     INS_PROP_CAP_OBJECT_DRAW_CATEGORY,                  //75
     453             :     INS_PROP_CAP_OBJECT_DRAW_NUMBERING,                 //76
     454             :     INS_PROP_CAP_OBJECT_DRAW_NUMBERINGSEPARATOR,        //77
     455             :     INS_PROP_CAP_OBJECT_DRAW_CAPTIONTEXT,               //78
     456             :     INS_PROP_CAP_OBJECT_DRAW_DELIMITER,                 //79
     457             :     INS_PROP_CAP_OBJECT_DRAW_LEVEL,                     //80
     458             :     INS_PROP_CAP_OBJECT_DRAW_POSITION,                  //81
     459             :     INS_PROP_CAP_OBJECT_DRAW_CHARACTERSTYLE,            //82
     460             :     INS_PROP_CAP_OBJECT_DRAW_APPLYATTRIBUTES,           //83
     461             :     INS_PROP_CAP_OBJECT_OLEMISC_ENABLE,                          //84
     462             :     INS_PROP_CAP_OBJECT_OLEMISC_CATEGORY,               //85
     463             :     INS_PROP_CAP_OBJECT_OLEMISC_NUMBERING,              //86
     464             :     INS_PROP_CAP_OBJECT_OLEMISC_NUMBERINGSEPARATOR,     //87
     465             :     INS_PROP_CAP_OBJECT_OLEMISC_CAPTIONTEXT,            //88
     466             :     INS_PROP_CAP_OBJECT_OLEMISC_DELIMITER,              //89
     467             :     INS_PROP_CAP_OBJECT_OLEMISC_LEVEL,                  //90
     468             :     INS_PROP_CAP_OBJECT_OLEMISC_POSITION,               //91
     469             :     INS_PROP_CAP_OBJECT_OLEMISC_CHARACTERSTYLE,         //92
     470             :     INS_PROP_CAP_OBJECT_OLEMISC_APPLYATTRIBUTES        //93
     471             : };
     472          74 : const Sequence<OUString>& SwInsertConfig::GetPropertyNames()
     473             : {
     474          74 :     static Sequence<OUString> aNames;
     475          74 :     static Sequence<OUString> aWebNames;
     476          74 :     if(!aNames.getLength())
     477             :     {
     478             :         static const char* aPropNames[] =
     479             :         {
     480             :             "Table/Header",                                                 // 0
     481             :             "Table/RepeatHeader",                                           // 1
     482             :             "Table/Border",                                                 // 2
     483             :             "Table/Split",                                                  // 3 from here not in writer/web
     484             :             "Caption/Automatic",                                            // 4
     485             :             "Caption/CaptionOrderNumberingFirst",                           // 5
     486             :             "Caption/WriterObject/Table/Enable",                            // 6
     487             :             "Caption/WriterObject/Table/Settings/Category",                 // 7
     488             :             "Caption/WriterObject/Table/Settings/Numbering",                // 8
     489             :             "Caption/WriterObject/Table/Settings/NumberingSeparator",       // 9
     490             :             "Caption/WriterObject/Table/Settings/CaptionText",              //10
     491             :             "Caption/WriterObject/Table/Settings/Delimiter",                //11
     492             :             "Caption/WriterObject/Table/Settings/Level",                    //12
     493             :             "Caption/WriterObject/Table/Settings/Position",                 //13
     494             :             "Caption/WriterObject/Table/Settings/CharacterStyle",           //14
     495             :             "Caption/WriterObject/Frame/Enable",                            //15
     496             :             "Caption/WriterObject/Frame/Settings/Category",                 //16
     497             :             "Caption/WriterObject/Frame/Settings/Numbering",                //17
     498             :             "Caption/WriterObject/Frame/Settings/NumberingSeparator",       //18
     499             :             "Caption/WriterObject/Frame/Settings/CaptionText",              //19
     500             :             "Caption/WriterObject/Frame/Settings/Delimiter",                //20
     501             :             "Caption/WriterObject/Frame/Settings/Level",                    //21
     502             :             "Caption/WriterObject/Frame/Settings/Position",                 //22
     503             :             "Caption/WriterObject/Frame/Settings/CharacterStyle",           //23
     504             :             "Caption/WriterObject/Graphic/Enable",                          //24
     505             :             "Caption/WriterObject/Graphic/Settings/Category",               //25
     506             :             "Caption/WriterObject/Graphic/Settings/Numbering",              //26
     507             :             "Caption/WriterObject/Graphic/Settings/NumberingSeparator",     //27
     508             :             "Caption/WriterObject/Graphic/Settings/CaptionText",            //28
     509             :             "Caption/WriterObject/Graphic/Settings/Delimiter",              //29
     510             :             "Caption/WriterObject/Graphic/Settings/Level",                  //30
     511             :             "Caption/WriterObject/Graphic/Settings/Position",               //31
     512             :             "Caption/WriterObject/Graphic/Settings/CharacterStyle",         //32
     513             :             "Caption/WriterObject/Graphic/Settings/ApplyAttributes",        //33
     514             :             "Caption/OfficeObject/Calc/Enable",                             //34
     515             :             "Caption/OfficeObject/Calc/Settings/Category",                  //35
     516             :             "Caption/OfficeObject/Calc/Settings/Numbering",                 //36
     517             :             "Caption/OfficeObject/Calc/Settings/NumberingSeparator",        //37
     518             :             "Caption/OfficeObject/Calc/Settings/CaptionText",               //38
     519             :             "Caption/OfficeObject/Calc/Settings/Delimiter",                 //39
     520             :             "Caption/OfficeObject/Calc/Settings/Level",                     //40
     521             :             "Caption/OfficeObject/Calc/Settings/Position",                  //41
     522             :             "Caption/OfficeObject/Calc/Settings/CharacterStyle",            //42
     523             :             "Caption/OfficeObject/Calc/Settings/ApplyAttributes",           //43
     524             :             "Caption/OfficeObject/Impress/Enable",                          //44
     525             :             "Caption/OfficeObject/Impress/Settings/Category",               //45
     526             :             "Caption/OfficeObject/Impress/Settings/Numbering",              //46
     527             :             "Caption/OfficeObject/Impress/Settings/NumberingSeparator",     //47
     528             :             "Caption/OfficeObject/Impress/Settings/CaptionText",            //48
     529             :             "Caption/OfficeObject/Impress/Settings/Delimiter",              //49
     530             :             "Caption/OfficeObject/Impress/Settings/Level",                  //50
     531             :             "Caption/OfficeObject/Impress/Settings/Position",               //51
     532             :             "Caption/OfficeObject/Impress/Settings/CharacterStyle",         //52
     533             :             "Caption/OfficeObject/Impress/Settings/ApplyAttributes",        //53
     534             :             "Caption/OfficeObject/Chart/Enable",                            //54
     535             :             "Caption/OfficeObject/Chart/Settings/Category",                 //55
     536             :             "Caption/OfficeObject/Chart/Settings/Numbering",                //56
     537             :             "Caption/OfficeObject/Chart/Settings/NumberingSeparator",       //57
     538             :             "Caption/OfficeObject/Chart/Settings/CaptionText",              //58
     539             :             "Caption/OfficeObject/Chart/Settings/Delimiter",                //59
     540             :             "Caption/OfficeObject/Chart/Settings/Level",                    //60
     541             :             "Caption/OfficeObject/Chart/Settings/Position",                 //61
     542             :             "Caption/OfficeObject/Chart/Settings/CharacterStyle",           //62
     543             :             "Caption/OfficeObject/Chart/Settings/ApplyAttributes",          //63
     544             :             "Caption/OfficeObject/Formula/Enable",                          //64
     545             :             "Caption/OfficeObject/Formula/Settings/Category",               //65
     546             :             "Caption/OfficeObject/Formula/Settings/Numbering",              //66
     547             :             "Caption/OfficeObject/Formula/Settings/NumberingSeparator",     //67
     548             :             "Caption/OfficeObject/Formula/Settings/CaptionText",            //68
     549             :             "Caption/OfficeObject/Formula/Settings/Delimiter",              //69
     550             :             "Caption/OfficeObject/Formula/Settings/Level",                  //70
     551             :             "Caption/OfficeObject/Formula/Settings/Position",               //71
     552             :             "Caption/OfficeObject/Formula/Settings/CharacterStyle",         //72
     553             :             "Caption/OfficeObject/Formula/Settings/ApplyAttributes",        //73
     554             :             "Caption/OfficeObject/Draw/Enable",                             //74
     555             :             "Caption/OfficeObject/Draw/Settings/Category",                  //75
     556             :             "Caption/OfficeObject/Draw/Settings/Numbering",                 //76
     557             :             "Caption/OfficeObject/Draw/Settings/NumberingSeparator",        //77
     558             :             "Caption/OfficeObject/Draw/Settings/CaptionText",               //78
     559             :             "Caption/OfficeObject/Draw/Settings/Delimiter",                 //79
     560             :             "Caption/OfficeObject/Draw/Settings/Level",                     //80
     561             :             "Caption/OfficeObject/Draw/Settings/Position",                  //81
     562             :             "Caption/OfficeObject/Draw/Settings/CharacterStyle",            //82
     563             :             "Caption/OfficeObject/Draw/Settings/ApplyAttributes",           //83
     564             :             "Caption/OfficeObject/OLEMisc/Enable",                          //84
     565             :             "Caption/OfficeObject/OLEMisc/Settings/Category",               //85
     566             :             "Caption/OfficeObject/OLEMisc/Settings/Numbering",              //86
     567             :             "Caption/OfficeObject/OLEMisc/Settings/NumberingSeparator",     //87
     568             :             "Caption/OfficeObject/OLEMisc/Settings/CaptionText",            //88
     569             :             "Caption/OfficeObject/OLEMisc/Settings/Delimiter",              //89
     570             :             "Caption/OfficeObject/OLEMisc/Settings/Level",                  //90
     571             :             "Caption/OfficeObject/OLEMisc/Settings/Position",               //91
     572             :             "Caption/OfficeObject/OLEMisc/Settings/CharacterStyle",         //92
     573             :             "Caption/OfficeObject/OLEMisc/Settings/ApplyAttributes"         //93
     574             :         };
     575          37 :         const int nCount = INS_PROP_CAP_OBJECT_OLEMISC_APPLYATTRIBUTES + 1;
     576          37 :         const int nWebCount = INS_PROP_TABLE_BORDER + 1;
     577          37 :         aNames.realloc(nCount);
     578          37 :         aWebNames.realloc(nWebCount);
     579          37 :         OUString* pNames = aNames.getArray();
     580          37 :         OUString* pWebNames = aWebNames.getArray();
     581             :         int i;
     582        3515 :         for(i = 0; i < nCount; i++)
     583        3478 :             pNames[i] = OUString::createFromAscii(aPropNames[i]);
     584         148 :         for(i = 0; i < nWebCount; i++)
     585         111 :             pWebNames[i] = OUString::createFromAscii(aPropNames[i]);
     586             :     }
     587          74 :     return bIsWeb ? aWebNames : aNames;
     588             : }
     589             : 
     590          74 : SwInsertConfig::SwInsertConfig(sal_Bool bWeb) :
     591             :     ConfigItem(bWeb ? OUString("Office.WriterWeb/Insert") : OUString("Office.Writer/Insert"),
     592             :         CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE),
     593             :     pCapOptions(0),
     594             :     pOLEMiscOpt(0),
     595             :     bInsWithCaption( sal_False ),
     596             :     bCaptionOrderNumberingFirst( sal_False ),
     597             :     aInsTblOpts(0,0),
     598          74 :     bIsWeb(bWeb)
     599             : {
     600          74 :     aGlobalNames[GLOB_NAME_CALC   ] = SvGlobalName(SO3_SC_CLASSID);
     601          74 :     aGlobalNames[GLOB_NAME_IMPRESS] = SvGlobalName(SO3_SIMPRESS_CLASSID);
     602          74 :     aGlobalNames[GLOB_NAME_DRAW   ] = SvGlobalName(SO3_SDRAW_CLASSID);
     603          74 :     aGlobalNames[GLOB_NAME_MATH   ] = SvGlobalName(SO3_SM_CLASSID);
     604          74 :     aGlobalNames[GLOB_NAME_CHART  ] = SvGlobalName(SO3_SCH_CLASSID);
     605          74 :     if(!bIsWeb)
     606          37 :         pCapOptions = new InsCaptionOptArr;
     607             : 
     608          74 :     Load();
     609          74 : }
     610             : 
     611          72 : SwInsertConfig::~SwInsertConfig()
     612             : {
     613          36 :     delete pCapOptions;
     614          36 :     delete pOLEMiscOpt;
     615          36 : }
     616             : 
     617           0 : static void lcl_WriteOpt(const InsCaptionOpt& rOpt, Any* pValues, sal_Int32 nProp, sal_Int32 nOffset)
     618             : {
     619           0 :     switch(nOffset)
     620             :     {
     621             :         case 0:
     622             :         {
     623           0 :             sal_Bool bTemp = rOpt.UseCaption();
     624           0 :             pValues[nProp].setValue(&bTemp, ::getBooleanCppuType());
     625             :         }
     626           0 :         break;//Enable
     627           0 :         case 1: pValues[nProp] <<= OUString(rOpt.GetCategory()); break;//Category
     628           0 :         case 2: pValues[nProp] <<= (sal_Int32)rOpt.GetNumType(); break;//Numbering",
     629           0 :         case 3: pValues[nProp] <<= rOpt.GetNumSeparator(); break;//NumberingSeparator",
     630           0 :         case 4: pValues[nProp] <<= OUString(rOpt.GetCaption());  break;//CaptionText",
     631           0 :         case 5: pValues[nProp] <<= OUString(rOpt.GetSeparator());break;//Delimiter",
     632           0 :         case 6: pValues[nProp] <<= (sal_Int32)rOpt.GetLevel();   break;//Level",
     633           0 :         case 7: pValues[nProp] <<= (sal_Int32)rOpt.GetPos();     break;//Position",
     634           0 :         case 8: pValues[nProp] <<= (OUString&)rOpt.GetCharacterStyle(); break; //CharacterStyle
     635           0 :         case 9: pValues[nProp] <<= rOpt.CopyAttributes(); break; //ApplyAttributes
     636             :     }
     637           0 : }
     638             : 
     639           0 : void SwInsertConfig::Notify( const ::com::sun::star::uno::Sequence< OUString >& ) {}
     640             : 
     641           0 : void SwInsertConfig::Commit()
     642             : {
     643           0 :     const Sequence<OUString>& aNames = GetPropertyNames();
     644           0 :     Sequence<Any> aValues(aNames.getLength());
     645           0 :     Any* pValues = aValues.getArray();
     646             : 
     647           0 :     const Type& rType = ::getBooleanCppuType();
     648           0 :     for(int nProp = 0; nProp < aNames.getLength(); nProp++)
     649             :     {
     650           0 :         const InsCaptionOpt* pWriterTableOpt = 0;
     651           0 :         const InsCaptionOpt* pWriterFrameOpt = 0;
     652           0 :         const InsCaptionOpt* pWriterGraphicOpt = 0;
     653           0 :         const InsCaptionOpt* pOLECalcOpt = 0;
     654           0 :         const InsCaptionOpt* pOLEImpressOpt = 0;
     655           0 :         const InsCaptionOpt* pOLEChartOpt = 0;
     656           0 :         const InsCaptionOpt* pOLEFormulaOpt = 0;
     657           0 :         const InsCaptionOpt* pOLEDrawOpt = 0;
     658           0 :         if(pCapOptions)
     659             :         {
     660           0 :             pWriterTableOpt = pCapOptions->Find(TABLE_CAP, 0);
     661           0 :             pWriterFrameOpt = pCapOptions->Find(FRAME_CAP, 0);
     662           0 :             pWriterGraphicOpt = pCapOptions->Find(GRAPHIC_CAP, 0);
     663           0 :             pOLECalcOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_CALC]);
     664           0 :             pOLEImpressOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_IMPRESS]);
     665           0 :             pOLEDrawOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_DRAW   ]);
     666           0 :             pOLEFormulaOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_MATH   ]);
     667           0 :             pOLEChartOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_CHART  ]);
     668             :         }
     669           0 :         switch(nProp)
     670             :         {
     671             :             case INS_PROP_TABLE_HEADER:
     672             :             {
     673           0 :                 sal_Bool bVal = 0 !=(aInsTblOpts.mnInsMode & tabopts::HEADLINE); pValues[nProp].setValue(&bVal, rType);
     674             :             }
     675           0 :             break;//"Table/Header",
     676             :             case INS_PROP_TABLE_REPEATHEADER:
     677             :             {
     678           0 :                 sal_Bool bVal = (aInsTblOpts.mnRowsToRepeat>0); pValues[nProp].setValue(&bVal, rType);
     679             :             }
     680           0 :             break;//"Table/RepeatHeader",
     681             :             case INS_PROP_TABLE_BORDER:
     682             :             {
     683           0 :                 sal_Bool bVal = 0 !=(aInsTblOpts.mnInsMode & tabopts::DEFAULT_BORDER ); pValues[nProp].setValue(&bVal, rType);
     684             :             }
     685           0 :             break;//"Table/Border",
     686             :             case INS_PROP_TABLE_SPLIT:
     687             :             {
     688           0 :                 sal_Bool bVal = 0 !=(aInsTblOpts.mnInsMode & tabopts::SPLIT_LAYOUT); pValues[nProp].setValue(&bVal, rType);
     689             :             }
     690           0 :             break;//"Table/Split",
     691           0 :             case INS_PROP_CAP_AUTOMATIC: pValues[nProp].setValue(&bInsWithCaption, rType);break;//"Caption/Automatic",
     692             :             case INS_PROP_CAP_CAPTIONORDERNUMBERINGFIRST:
     693           0 :                 pValues[nProp] <<= bCaptionOrderNumberingFirst;
     694           0 :             break;//"Caption/CaptionOrderNumberingFirst"
     695             : 
     696             :             case INS_PROP_CAP_OBJECT_TABLE_ENABLE:
     697             :             case INS_PROP_CAP_OBJECT_TABLE_CATEGORY:
     698             :             case INS_PROP_CAP_OBJECT_TABLE_NUMBERING:
     699             :             case INS_PROP_CAP_OBJECT_TABLE_NUMBERINGSEPARATOR:
     700             :             case INS_PROP_CAP_OBJECT_TABLE_CAPTIONTEXT:
     701             :             case INS_PROP_CAP_OBJECT_TABLE_DELIMITER:
     702             :             case INS_PROP_CAP_OBJECT_TABLE_LEVEL:
     703             :             case INS_PROP_CAP_OBJECT_TABLE_POSITION:
     704             :             case INS_PROP_CAP_OBJECT_TABLE_CHARACTERSTYLE:
     705           0 :                     if(pWriterTableOpt)
     706           0 :                         lcl_WriteOpt(*pWriterTableOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_TABLE_ENABLE);
     707           0 :             break;
     708             :             case INS_PROP_CAP_OBJECT_FRAME_ENABLE:
     709             :             case INS_PROP_CAP_OBJECT_FRAME_CATEGORY:
     710             :             case INS_PROP_CAP_OBJECT_FRAME_NUMBERING:
     711             :             case INS_PROP_CAP_OBJECT_FRAME_NUMBERINGSEPARATOR:
     712             :             case INS_PROP_CAP_OBJECT_FRAME_CAPTIONTEXT:
     713             :             case INS_PROP_CAP_OBJECT_FRAME_DELIMITER:
     714             :             case INS_PROP_CAP_OBJECT_FRAME_LEVEL:
     715             :             case INS_PROP_CAP_OBJECT_FRAME_POSITION:
     716             :             case INS_PROP_CAP_OBJECT_FRAME_CHARACTERSTYLE:
     717           0 :                     if(pWriterFrameOpt)
     718           0 :                         lcl_WriteOpt(*pWriterFrameOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_FRAME_ENABLE);
     719           0 :             break;
     720             :             case INS_PROP_CAP_OBJECT_GRAPHIC_ENABLE:
     721             :             case INS_PROP_CAP_OBJECT_GRAPHIC_CATEGORY:
     722             :             case INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERING:
     723             :             case INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERINGSEPARATOR:
     724             :             case INS_PROP_CAP_OBJECT_GRAPHIC_CAPTIONTEXT:
     725             :             case INS_PROP_CAP_OBJECT_GRAPHIC_DELIMITER:
     726             :             case INS_PROP_CAP_OBJECT_GRAPHIC_LEVEL:
     727             :             case INS_PROP_CAP_OBJECT_GRAPHIC_POSITION:
     728             :             case INS_PROP_CAP_OBJECT_GRAPHIC_CHARACTERSTYLE:
     729             :             case INS_PROP_CAP_OBJECT_GRAPHIC_APPLYATTRIBUTES:
     730           0 :                     if(pWriterGraphicOpt)
     731           0 :                         lcl_WriteOpt(*pWriterGraphicOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_GRAPHIC_ENABLE);
     732           0 :             break;
     733             :             case INS_PROP_CAP_OBJECT_CALC_ENABLE:
     734             :             case INS_PROP_CAP_OBJECT_CALC_CATEGORY:
     735             :             case INS_PROP_CAP_OBJECT_CALC_NUMBERING:
     736             :             case INS_PROP_CAP_OBJECT_CALC_NUMBERINGSEPARATOR:
     737             :             case INS_PROP_CAP_OBJECT_CALC_CAPTIONTEXT:
     738             :             case INS_PROP_CAP_OBJECT_CALC_DELIMITER:
     739             :             case INS_PROP_CAP_OBJECT_CALC_LEVEL:
     740             :             case INS_PROP_CAP_OBJECT_CALC_POSITION:
     741             :             case INS_PROP_CAP_OBJECT_CALC_CHARACTERSTYLE:
     742             :             case INS_PROP_CAP_OBJECT_CALC_APPLYATTRIBUTES:
     743           0 :                     if(pOLECalcOpt)
     744           0 :                         lcl_WriteOpt(*pOLECalcOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_CALC_ENABLE);
     745           0 :             break;
     746             :             case INS_PROP_CAP_OBJECT_IMPRESS_ENABLE:
     747             :             case INS_PROP_CAP_OBJECT_IMPRESS_CATEGORY:
     748             :             case INS_PROP_CAP_OBJECT_IMPRESS_NUMBERING:
     749             :             case INS_PROP_CAP_OBJECT_IMPRESS_NUMBERINGSEPARATOR:
     750             :             case INS_PROP_CAP_OBJECT_IMPRESS_CAPTIONTEXT:
     751             :             case INS_PROP_CAP_OBJECT_IMPRESS_DELIMITER:
     752             :             case INS_PROP_CAP_OBJECT_IMPRESS_LEVEL:
     753             :             case INS_PROP_CAP_OBJECT_IMPRESS_POSITION:
     754             :             case INS_PROP_CAP_OBJECT_IMPRESS_CHARACTERSTYLE:
     755             :             case INS_PROP_CAP_OBJECT_IMPRESS_APPLYATTRIBUTES:
     756           0 :                     if(pOLEImpressOpt)
     757           0 :                         lcl_WriteOpt(*pOLEImpressOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_IMPRESS_ENABLE);
     758           0 :             break;
     759             :             case INS_PROP_CAP_OBJECT_CHART_ENABLE:
     760             :             case INS_PROP_CAP_OBJECT_CHART_CATEGORY:
     761             :             case INS_PROP_CAP_OBJECT_CHART_NUMBERING:
     762             :             case INS_PROP_CAP_OBJECT_CHART_NUMBERINGSEPARATOR:
     763             :             case INS_PROP_CAP_OBJECT_CHART_CAPTIONTEXT:
     764             :             case INS_PROP_CAP_OBJECT_CHART_DELIMITER:
     765             :             case INS_PROP_CAP_OBJECT_CHART_LEVEL:
     766             :             case INS_PROP_CAP_OBJECT_CHART_POSITION:
     767             :             case INS_PROP_CAP_OBJECT_CHART_CHARACTERSTYLE:
     768             :             case INS_PROP_CAP_OBJECT_CHART_APPLYATTRIBUTES:
     769           0 :                     if(pOLEChartOpt)
     770           0 :                         lcl_WriteOpt(*pOLEChartOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_CHART_ENABLE);
     771           0 :             break;
     772             :             case INS_PROP_CAP_OBJECT_FORMULA_ENABLE:
     773             :             case INS_PROP_CAP_OBJECT_FORMULA_CATEGORY:
     774             :             case INS_PROP_CAP_OBJECT_FORMULA_NUMBERING:
     775             :             case INS_PROP_CAP_OBJECT_FORMULA_NUMBERINGSEPARATOR:
     776             :             case INS_PROP_CAP_OBJECT_FORMULA_CAPTIONTEXT:
     777             :             case INS_PROP_CAP_OBJECT_FORMULA_DELIMITER:
     778             :             case INS_PROP_CAP_OBJECT_FORMULA_LEVEL:
     779             :             case INS_PROP_CAP_OBJECT_FORMULA_POSITION:
     780             :             case INS_PROP_CAP_OBJECT_FORMULA_CHARACTERSTYLE:
     781             :             case INS_PROP_CAP_OBJECT_FORMULA_APPLYATTRIBUTES:
     782           0 :                     if(pOLEFormulaOpt)
     783           0 :                         lcl_WriteOpt(*pOLEFormulaOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_FORMULA_ENABLE);
     784           0 :             break;
     785             :             case INS_PROP_CAP_OBJECT_DRAW_ENABLE:
     786             :             case INS_PROP_CAP_OBJECT_DRAW_CATEGORY:
     787             :             case INS_PROP_CAP_OBJECT_DRAW_NUMBERING:
     788             :             case INS_PROP_CAP_OBJECT_DRAW_NUMBERINGSEPARATOR:
     789             :             case INS_PROP_CAP_OBJECT_DRAW_CAPTIONTEXT:
     790             :             case INS_PROP_CAP_OBJECT_DRAW_DELIMITER:
     791             :             case INS_PROP_CAP_OBJECT_DRAW_LEVEL:
     792             :             case INS_PROP_CAP_OBJECT_DRAW_POSITION:
     793             :             case INS_PROP_CAP_OBJECT_DRAW_CHARACTERSTYLE:
     794             :             case INS_PROP_CAP_OBJECT_DRAW_APPLYATTRIBUTES:
     795           0 :                     if(pOLEDrawOpt)
     796           0 :                         lcl_WriteOpt(*pOLEDrawOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_DRAW_ENABLE);
     797           0 :             break;
     798             :             case INS_PROP_CAP_OBJECT_OLEMISC_ENABLE:
     799             :             case INS_PROP_CAP_OBJECT_OLEMISC_CATEGORY:
     800             :             case INS_PROP_CAP_OBJECT_OLEMISC_NUMBERING:
     801             :             case INS_PROP_CAP_OBJECT_OLEMISC_NUMBERINGSEPARATOR:
     802             :             case INS_PROP_CAP_OBJECT_OLEMISC_CAPTIONTEXT:
     803             :             case INS_PROP_CAP_OBJECT_OLEMISC_DELIMITER:
     804             :             case INS_PROP_CAP_OBJECT_OLEMISC_LEVEL:
     805             :             case INS_PROP_CAP_OBJECT_OLEMISC_POSITION:
     806             :             case INS_PROP_CAP_OBJECT_OLEMISC_CHARACTERSTYLE:
     807             :             case INS_PROP_CAP_OBJECT_OLEMISC_APPLYATTRIBUTES:
     808           0 :                     if(pOLEMiscOpt)
     809           0 :                         lcl_WriteOpt(*pOLEMiscOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_OLEMISC_ENABLE);
     810           0 :             break;
     811             : 
     812             :         }
     813             :     }
     814           0 :     PutProperties(aNames, aValues);
     815           0 : }
     816             : 
     817        2664 : static void lcl_ReadOpt(InsCaptionOpt& rOpt, const Any* pValues, sal_Int32 nProp, sal_Int32 nOffset)
     818             : {
     819        2664 :     switch(nOffset)
     820             :     {
     821             :         case 0:
     822         333 :             rOpt.UseCaption() = *(sal_Bool*)pValues[nProp].getValue();
     823         333 :         break;//Enable
     824             :         case 1:
     825             :         {
     826         333 :             OUString sTemp; pValues[nProp] >>= sTemp;
     827         333 :             rOpt.SetCategory(sTemp);
     828             :         }
     829         333 :         break;//Category
     830             :         case 2:
     831             :         {
     832         333 :             sal_Int32 nTemp = 0;
     833         333 :             pValues[nProp] >>= nTemp;
     834         333 :             rOpt.SetNumType(sal::static_int_cast< sal_uInt16, sal_Int32>(nTemp));
     835             :         }
     836         333 :         break;//Numbering",
     837             :         case 3:
     838             :         {
     839         333 :             OUString sTemp; pValues[nProp] >>= sTemp;
     840         333 :             rOpt.SetNumSeparator(sTemp);
     841             :         }
     842         333 :         break;//NumberingSeparator",
     843             :         case 4:
     844             :         {
     845         333 :             OUString sTemp; pValues[nProp] >>= sTemp;
     846         333 :             rOpt.SetCaption(sTemp);
     847             :         }
     848         333 :         break;//CaptionText",
     849             :         case 5:
     850             :         {
     851         333 :             OUString sTemp;
     852         333 :             if(pValues[nProp] >>= sTemp)
     853         333 :                 rOpt.SetSeparator(sTemp);
     854             :         }
     855         333 :         break;//Delimiter",
     856             :         case 6:
     857             :         {
     858         333 :             sal_Int32 nTemp = 0;
     859         333 :             pValues[nProp] >>= nTemp;
     860         333 :             rOpt.SetLevel(sal::static_int_cast< sal_uInt16, sal_Int32>(nTemp));
     861             :         }
     862         333 :         break;//Level",
     863             :         case 7:
     864             :         {
     865         333 :             sal_Int32 nTemp = 0;
     866         333 :             pValues[nProp] >>= nTemp;
     867         333 :             rOpt.SetPos(sal::static_int_cast< sal_uInt16, sal_Int32>(nTemp));
     868             :         }
     869         333 :         break;//Position",
     870             :         case 8 : //CharacterStyle
     871             :         {
     872           0 :             OUString sTemp; pValues[nProp] >>= sTemp;
     873           0 :             rOpt.SetCharacterStyle( sTemp );
     874             :         }
     875           0 :         break;
     876             :         case 9 : //ApplyAttributes
     877             :         {
     878           0 :             pValues[nProp] >>= rOpt.CopyAttributes();
     879             :         }
     880           0 :         break;
     881             :     }
     882        2664 : }
     883             : 
     884          74 : void SwInsertConfig::Load()
     885             : {
     886          74 :     const Sequence<OUString>& aNames = GetPropertyNames();
     887          74 :     Sequence<Any> aValues = GetProperties(aNames);
     888          74 :     const Any* pValues = aValues.getConstArray();
     889             :     OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
     890          74 :     if(aValues.getLength() == aNames.getLength())
     891             :     {
     892          74 :         InsCaptionOpt* pWriterTableOpt = 0;
     893          74 :         InsCaptionOpt* pWriterFrameOpt = 0;
     894          74 :         InsCaptionOpt* pWriterGraphicOpt = 0;
     895          74 :         InsCaptionOpt* pOLECalcOpt = 0;
     896          74 :         InsCaptionOpt* pOLEImpressOpt = 0;
     897          74 :         InsCaptionOpt* pOLEChartOpt = 0;
     898          74 :         InsCaptionOpt* pOLEFormulaOpt = 0;
     899          74 :         InsCaptionOpt* pOLEDrawOpt = 0;
     900          74 :         if(pCapOptions)
     901             :         {
     902          37 :             pWriterTableOpt = pCapOptions->Find(TABLE_CAP, 0);
     903          37 :             pWriterFrameOpt = pCapOptions->Find(FRAME_CAP, 0);
     904          37 :             pWriterGraphicOpt = pCapOptions->Find(GRAPHIC_CAP, 0);
     905          37 :             pOLECalcOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_CALC]);
     906          37 :             pOLEImpressOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_IMPRESS]);
     907          37 :             pOLEDrawOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_DRAW   ]);
     908          37 :             pOLEFormulaOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_MATH   ]);
     909          37 :             pOLEChartOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_CHART  ]);
     910             :         }
     911          37 :         else if(!bIsWeb)
     912          74 :             return;
     913             : 
     914          74 :         sal_uInt16 nInsTblFlags = 0;
     915        3663 :         for(int nProp = 0; nProp < aNames.getLength(); nProp++)
     916             :         {
     917        3589 :             if(pValues[nProp].hasValue())
     918             :             {
     919        2960 :                 sal_Bool bBool = nProp < INS_PROP_CAP_OBJECT_TABLE_ENABLE ? *(sal_Bool*)pValues[nProp].getValue() : sal_False;
     920        2960 :                 switch(nProp)
     921             :                 {
     922             :                     case INS_PROP_TABLE_HEADER:
     923             :                     {
     924          74 :                         if(bBool)
     925           0 :                             nInsTblFlags|= tabopts::HEADLINE;
     926             :                     }
     927          74 :                     break;//"Table/Header",
     928             :                     case INS_PROP_TABLE_REPEATHEADER:
     929             :                     {
     930          74 :                         aInsTblOpts.mnRowsToRepeat = bBool? 1 : 0;
     931             : 
     932             :                     }
     933          74 :                     break;//"Table/RepeatHeader",
     934             :                     case INS_PROP_TABLE_BORDER:
     935             :                     {
     936          74 :                         if(bBool)
     937          74 :                             nInsTblFlags|= tabopts::DEFAULT_BORDER;
     938             :                     }
     939          74 :                     break;//"Table/Border",
     940             :                     case INS_PROP_TABLE_SPLIT:
     941             :                     {
     942          37 :                         if(bBool)
     943          37 :                             nInsTblFlags|= tabopts::SPLIT_LAYOUT;
     944             :                     }
     945          37 :                     break;//"Table/Split",
     946             :                     case INS_PROP_CAP_AUTOMATIC:
     947          37 :                         bInsWithCaption = bBool;
     948          37 :                     break;
     949           0 :                     case INS_PROP_CAP_CAPTIONORDERNUMBERINGFIRST: bCaptionOrderNumberingFirst = bBool; break;
     950             :                     case INS_PROP_CAP_OBJECT_TABLE_ENABLE:
     951             :                     case INS_PROP_CAP_OBJECT_TABLE_CATEGORY:
     952             :                     case INS_PROP_CAP_OBJECT_TABLE_NUMBERING:
     953             :                     case INS_PROP_CAP_OBJECT_TABLE_NUMBERINGSEPARATOR:
     954             :                     case INS_PROP_CAP_OBJECT_TABLE_CAPTIONTEXT:
     955             :                     case INS_PROP_CAP_OBJECT_TABLE_DELIMITER:
     956             :                     case INS_PROP_CAP_OBJECT_TABLE_LEVEL:
     957             :                     case INS_PROP_CAP_OBJECT_TABLE_POSITION:
     958             :                     case INS_PROP_CAP_OBJECT_TABLE_CHARACTERSTYLE:
     959         296 :                         if(!pWriterTableOpt)
     960             :                         {
     961          37 :                             pWriterTableOpt = new InsCaptionOpt(TABLE_CAP);
     962          37 :                             pCapOptions->Insert(pWriterTableOpt);
     963             :                         }
     964         296 :                         lcl_ReadOpt(*pWriterTableOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_TABLE_ENABLE);
     965         296 :                     break;
     966             :                     case INS_PROP_CAP_OBJECT_FRAME_ENABLE:
     967             :                     case INS_PROP_CAP_OBJECT_FRAME_CATEGORY:
     968             :                     case INS_PROP_CAP_OBJECT_FRAME_NUMBERING:
     969             :                     case INS_PROP_CAP_OBJECT_FRAME_NUMBERINGSEPARATOR:
     970             :                     case INS_PROP_CAP_OBJECT_FRAME_CAPTIONTEXT:
     971             :                     case INS_PROP_CAP_OBJECT_FRAME_DELIMITER:
     972             :                     case INS_PROP_CAP_OBJECT_FRAME_LEVEL:
     973             :                     case INS_PROP_CAP_OBJECT_FRAME_POSITION:
     974             :                     case INS_PROP_CAP_OBJECT_FRAME_CHARACTERSTYLE:
     975         296 :                         if(!pWriterFrameOpt)
     976             :                         {
     977          37 :                             pWriterFrameOpt = new InsCaptionOpt(FRAME_CAP);
     978          37 :                             pCapOptions->Insert(pWriterFrameOpt);
     979             :                         }
     980         296 :                         lcl_ReadOpt(*pWriterFrameOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_FRAME_ENABLE);
     981         296 :                     break;
     982             :                     case INS_PROP_CAP_OBJECT_GRAPHIC_ENABLE:
     983             :                     case INS_PROP_CAP_OBJECT_GRAPHIC_CATEGORY:
     984             :                     case INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERING:
     985             :                     case INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERINGSEPARATOR:
     986             :                     case INS_PROP_CAP_OBJECT_GRAPHIC_CAPTIONTEXT:
     987             :                     case INS_PROP_CAP_OBJECT_GRAPHIC_DELIMITER:
     988             :                     case INS_PROP_CAP_OBJECT_GRAPHIC_LEVEL:
     989             :                     case INS_PROP_CAP_OBJECT_GRAPHIC_POSITION:
     990             :                     case INS_PROP_CAP_OBJECT_GRAPHIC_CHARACTERSTYLE:
     991             :                     case INS_PROP_CAP_OBJECT_GRAPHIC_APPLYATTRIBUTES:
     992         296 :                         if(!pWriterGraphicOpt)
     993             :                         {
     994          37 :                             pWriterGraphicOpt = new InsCaptionOpt(GRAPHIC_CAP);
     995          37 :                             pCapOptions->Insert(pWriterGraphicOpt);
     996             :                         }
     997         296 :                         lcl_ReadOpt(*pWriterGraphicOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_GRAPHIC_ENABLE);
     998         296 :                     break;
     999             :                     case INS_PROP_CAP_OBJECT_CALC_ENABLE:
    1000             :                     case INS_PROP_CAP_OBJECT_CALC_CATEGORY:
    1001             :                     case INS_PROP_CAP_OBJECT_CALC_NUMBERING:
    1002             :                     case INS_PROP_CAP_OBJECT_CALC_NUMBERINGSEPARATOR:
    1003             :                     case INS_PROP_CAP_OBJECT_CALC_CAPTIONTEXT:
    1004             :                     case INS_PROP_CAP_OBJECT_CALC_DELIMITER:
    1005             :                     case INS_PROP_CAP_OBJECT_CALC_LEVEL:
    1006             :                     case INS_PROP_CAP_OBJECT_CALC_POSITION:
    1007             :                     case INS_PROP_CAP_OBJECT_CALC_CHARACTERSTYLE:
    1008             :                     case INS_PROP_CAP_OBJECT_CALC_APPLYATTRIBUTES:
    1009         296 :                         if(!pOLECalcOpt)
    1010             :                         {
    1011          37 :                             pOLECalcOpt = new InsCaptionOpt(OLE_CAP, &aGlobalNames[GLOB_NAME_CALC]);
    1012          37 :                             pCapOptions->Insert(pOLECalcOpt);
    1013             :                         }
    1014         296 :                         lcl_ReadOpt(*pOLECalcOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_CALC_ENABLE);
    1015         296 :                     break;
    1016             :                     case INS_PROP_CAP_OBJECT_IMPRESS_ENABLE:
    1017             :                     case INS_PROP_CAP_OBJECT_IMPRESS_CATEGORY:
    1018             :                     case INS_PROP_CAP_OBJECT_IMPRESS_NUMBERING:
    1019             :                     case INS_PROP_CAP_OBJECT_IMPRESS_NUMBERINGSEPARATOR:
    1020             :                     case INS_PROP_CAP_OBJECT_IMPRESS_CAPTIONTEXT:
    1021             :                     case INS_PROP_CAP_OBJECT_IMPRESS_DELIMITER:
    1022             :                     case INS_PROP_CAP_OBJECT_IMPRESS_LEVEL:
    1023             :                     case INS_PROP_CAP_OBJECT_IMPRESS_POSITION:
    1024             :                     case INS_PROP_CAP_OBJECT_IMPRESS_CHARACTERSTYLE:
    1025             :                     case INS_PROP_CAP_OBJECT_IMPRESS_APPLYATTRIBUTES:
    1026         296 :                         if(!pOLEImpressOpt)
    1027             :                         {
    1028          37 :                             pOLEImpressOpt = new InsCaptionOpt(OLE_CAP, &aGlobalNames[GLOB_NAME_IMPRESS]);
    1029          37 :                             pCapOptions->Insert(pOLEImpressOpt);
    1030             :                         }
    1031         296 :                         lcl_ReadOpt(*pOLEImpressOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_IMPRESS_ENABLE);
    1032         296 :                     break;
    1033             :                     case INS_PROP_CAP_OBJECT_CHART_ENABLE:
    1034             :                     case INS_PROP_CAP_OBJECT_CHART_CATEGORY:
    1035             :                     case INS_PROP_CAP_OBJECT_CHART_NUMBERING:
    1036             :                     case INS_PROP_CAP_OBJECT_CHART_NUMBERINGSEPARATOR:
    1037             :                     case INS_PROP_CAP_OBJECT_CHART_CAPTIONTEXT:
    1038             :                     case INS_PROP_CAP_OBJECT_CHART_DELIMITER:
    1039             :                     case INS_PROP_CAP_OBJECT_CHART_LEVEL:
    1040             :                     case INS_PROP_CAP_OBJECT_CHART_POSITION:
    1041             :                     case INS_PROP_CAP_OBJECT_CHART_CHARACTERSTYLE:
    1042             :                     case INS_PROP_CAP_OBJECT_CHART_APPLYATTRIBUTES:
    1043         296 :                         if(!pOLEChartOpt)
    1044             :                         {
    1045          37 :                             pOLEChartOpt = new InsCaptionOpt(OLE_CAP, &aGlobalNames[GLOB_NAME_CHART]);
    1046          37 :                             pCapOptions->Insert(pOLEChartOpt);
    1047             :                         }
    1048         296 :                         lcl_ReadOpt(*pOLEChartOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_CHART_ENABLE);
    1049         296 :                     break;
    1050             :                     case INS_PROP_CAP_OBJECT_FORMULA_ENABLE:
    1051             :                     case INS_PROP_CAP_OBJECT_FORMULA_CATEGORY:
    1052             :                     case INS_PROP_CAP_OBJECT_FORMULA_NUMBERING:
    1053             :                     case INS_PROP_CAP_OBJECT_FORMULA_NUMBERINGSEPARATOR:
    1054             :                     case INS_PROP_CAP_OBJECT_FORMULA_CAPTIONTEXT:
    1055             :                     case INS_PROP_CAP_OBJECT_FORMULA_DELIMITER:
    1056             :                     case INS_PROP_CAP_OBJECT_FORMULA_LEVEL:
    1057             :                     case INS_PROP_CAP_OBJECT_FORMULA_POSITION:
    1058             :                     case INS_PROP_CAP_OBJECT_FORMULA_CHARACTERSTYLE:
    1059             :                     case INS_PROP_CAP_OBJECT_FORMULA_APPLYATTRIBUTES:
    1060         296 :                         if(!pOLEFormulaOpt)
    1061             :                         {
    1062          37 :                             pOLEFormulaOpt = new InsCaptionOpt(OLE_CAP, &aGlobalNames[GLOB_NAME_MATH]);
    1063          37 :                             pCapOptions->Insert(pOLEFormulaOpt);
    1064             :                         }
    1065         296 :                         lcl_ReadOpt(*pOLEFormulaOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_FORMULA_ENABLE);
    1066         296 :                     break;
    1067             :                     case INS_PROP_CAP_OBJECT_DRAW_ENABLE:
    1068             :                     case INS_PROP_CAP_OBJECT_DRAW_CATEGORY:
    1069             :                     case INS_PROP_CAP_OBJECT_DRAW_NUMBERING:
    1070             :                     case INS_PROP_CAP_OBJECT_DRAW_NUMBERINGSEPARATOR:
    1071             :                     case INS_PROP_CAP_OBJECT_DRAW_CAPTIONTEXT:
    1072             :                     case INS_PROP_CAP_OBJECT_DRAW_DELIMITER:
    1073             :                     case INS_PROP_CAP_OBJECT_DRAW_LEVEL:
    1074             :                     case INS_PROP_CAP_OBJECT_DRAW_POSITION:
    1075             :                     case INS_PROP_CAP_OBJECT_DRAW_CHARACTERSTYLE:
    1076             :                     case INS_PROP_CAP_OBJECT_DRAW_APPLYATTRIBUTES:
    1077         296 :                         if(!pOLEDrawOpt)
    1078             :                         {
    1079          37 :                             pOLEDrawOpt = new InsCaptionOpt(OLE_CAP, &aGlobalNames[GLOB_NAME_DRAW]);
    1080          37 :                             pCapOptions->Insert(pOLEDrawOpt);
    1081             :                         }
    1082         296 :                         lcl_ReadOpt(*pOLEDrawOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_DRAW_ENABLE);
    1083         296 :                     break;
    1084             :                     case INS_PROP_CAP_OBJECT_OLEMISC_ENABLE:
    1085             :                     case INS_PROP_CAP_OBJECT_OLEMISC_CATEGORY:
    1086             :                     case INS_PROP_CAP_OBJECT_OLEMISC_NUMBERING:
    1087             :                     case INS_PROP_CAP_OBJECT_OLEMISC_NUMBERINGSEPARATOR:
    1088             :                     case INS_PROP_CAP_OBJECT_OLEMISC_CAPTIONTEXT:
    1089             :                     case INS_PROP_CAP_OBJECT_OLEMISC_DELIMITER:
    1090             :                     case INS_PROP_CAP_OBJECT_OLEMISC_LEVEL:
    1091             :                     case INS_PROP_CAP_OBJECT_OLEMISC_POSITION:
    1092             :                     case INS_PROP_CAP_OBJECT_OLEMISC_CHARACTERSTYLE:
    1093             :                     case INS_PROP_CAP_OBJECT_OLEMISC_APPLYATTRIBUTES:
    1094         296 :                         if(!pOLEMiscOpt)
    1095             :                         {
    1096          37 :                             pOLEMiscOpt = new InsCaptionOpt(OLE_CAP);
    1097             :                         }
    1098         296 :                         lcl_ReadOpt(*pOLEMiscOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_OLEMISC_ENABLE);
    1099         296 :                     break;
    1100             :                 }
    1101             :             }
    1102         629 :             else if(nProp == INS_PROP_CAP_CAPTIONORDERNUMBERINGFIRST)
    1103             :             {
    1104             :                 //#i61007#  initialize caption order, right now only HUNGARIAN seems to need a different order
    1105          37 :                 SvtSysLocaleOptions aSysLocaleOptions;
    1106          74 :                 OUString sLang = aSysLocaleOptions.GetLocaleConfigString();
    1107          74 :                 bCaptionOrderNumberingFirst = ( !sLang.isEmpty() && sLang.matchAsciiL( "hu", 2 )) ? sal_True : sal_False;
    1108             :             }
    1109             : 
    1110             :         }
    1111          74 :         aInsTblOpts.mnInsMode = nInsTblFlags;
    1112          74 :     }
    1113             : }
    1114             : 
    1115          74 : const Sequence<OUString>& SwTableConfig::GetPropertyNames()
    1116             : {
    1117          74 :     const int nCount = 8;
    1118          74 :     static Sequence<OUString> aNames(nCount);
    1119             :     static const char* aPropNames[] =
    1120             :     {
    1121             :         "Shift/Row",                    //  0
    1122             :         "Shift/Column",                 //  1
    1123             :         "Insert/Row",                   //  2
    1124             :         "Insert/Column",                //  3
    1125             :         "Change/Effect",                //  4
    1126             :         "Input/NumberRecognition",      //  5
    1127             :         "Input/NumberFormatRecognition",//  6
    1128             :         "Input/Alignment"               //  7
    1129             :     };
    1130          74 :     OUString* pNames = aNames.getArray();
    1131         666 :     for(int i = 0; i < nCount; i++)
    1132         592 :         pNames[i] = OUString::createFromAscii(aPropNames[i]);
    1133          74 :     return aNames;
    1134             : }
    1135             : 
    1136          74 : SwTableConfig::SwTableConfig(sal_Bool bWeb) :
    1137             :     ConfigItem(bWeb ? OUString("Office.WriterWeb/Table") : OUString("Office.Writer/Table"),
    1138          74 :         CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE)
    1139             : {
    1140          74 :     Load();
    1141          74 : }
    1142             : 
    1143          36 : SwTableConfig::~SwTableConfig()
    1144             : {
    1145          36 : }
    1146             : 
    1147           0 : void SwTableConfig::Notify( const ::com::sun::star::uno::Sequence< OUString >& ) {}
    1148             : 
    1149           0 : void SwTableConfig::Commit()
    1150             : {
    1151           0 :     const Sequence<OUString>& aNames = GetPropertyNames();
    1152           0 :     Sequence<Any> aValues(aNames.getLength());
    1153           0 :     Any* pValues = aValues.getArray();
    1154             : 
    1155           0 :     const Type& rType = ::getBooleanCppuType();
    1156           0 :     for(int nProp = 0; nProp < aNames.getLength(); nProp++)
    1157             :     {
    1158           0 :         switch(nProp)
    1159             :         {
    1160           0 :             case 0 : pValues[nProp] <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(nTblHMove); break;   //"Shift/Row",
    1161           0 :             case 1 : pValues[nProp] <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(nTblVMove); break;     //"Shift/Column",
    1162           0 :             case 2 : pValues[nProp] <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(nTblHInsert); break;   //"Insert/Row",
    1163           0 :             case 3 : pValues[nProp] <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(nTblVInsert); break;   //"Insert/Column",
    1164           0 :             case 4 : pValues[nProp] <<= (sal_Int32)eTblChgMode; break;   //"Change/Effect",
    1165           0 :             case 5 : pValues[nProp].setValue(&bInsTblFormatNum, rType); break;  //"Input/NumberRecognition",
    1166           0 :             case 6 : pValues[nProp].setValue(&bInsTblChangeNumFormat, rType); break;  //"Input/NumberFormatRecognition",
    1167           0 :             case 7 : pValues[nProp].setValue(&bInsTblAlignNum, rType); break;  //"Input/Alignment"
    1168             :         }
    1169             :     }
    1170           0 :     PutProperties(aNames, aValues);
    1171           0 : }
    1172             : 
    1173          74 : void SwTableConfig::Load()
    1174             : {
    1175          74 :     const Sequence<OUString>& aNames = GetPropertyNames();
    1176          74 :     Sequence<Any> aValues = GetProperties(aNames);
    1177          74 :     const Any* pValues = aValues.getConstArray();
    1178             :     OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
    1179          74 :     if(aValues.getLength() == aNames.getLength())
    1180             :     {
    1181         666 :         for(int nProp = 0; nProp < aNames.getLength(); nProp++)
    1182             :         {
    1183         592 :             if(pValues[nProp].hasValue())
    1184             :             {
    1185         592 :                 sal_Int32 nTemp = 0;
    1186         592 :                 switch(nProp)
    1187             :                 {
    1188          74 :                     case 0 : pValues[nProp] >>= nTemp; nTblHMove = (sal_uInt16)MM100_TO_TWIP(nTemp); break;  //"Shift/Row",
    1189          74 :                     case 1 : pValues[nProp] >>= nTemp; nTblVMove = (sal_uInt16)MM100_TO_TWIP(nTemp); break;     //"Shift/Column",
    1190          74 :                     case 2 : pValues[nProp] >>= nTemp; nTblHInsert = (sal_uInt16)MM100_TO_TWIP(nTemp); break;   //"Insert/Row",
    1191          74 :                     case 3 : pValues[nProp] >>= nTemp; nTblVInsert = (sal_uInt16)MM100_TO_TWIP(nTemp); break;   //"Insert/Column",
    1192          74 :                     case 4 : pValues[nProp] >>= nTemp; eTblChgMode = (TblChgMode)nTemp; break;   //"Change/Effect",
    1193          74 :                     case 5 : bInsTblFormatNum = *(sal_Bool*)pValues[nProp].getValue();  break;  //"Input/NumberRecognition",
    1194          74 :                     case 6 : bInsTblChangeNumFormat = *(sal_Bool*)pValues[nProp].getValue(); break;  //"Input/NumberFormatRecognition",
    1195          74 :                     case 7 : bInsTblAlignNum = *(sal_Bool*)pValues[nProp].getValue(); break;  //"Input/Alignment"
    1196             :                 }
    1197             :             }
    1198             :         }
    1199          74 :     }
    1200          74 : }
    1201             : 
    1202          37 : SwMiscConfig::SwMiscConfig() :
    1203             :     ConfigItem("Office.Writer",
    1204             :         CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE),
    1205             :     bDefaultFontsInCurrDocOnly(sal_False),
    1206             :     bShowIndexPreview(sal_False),
    1207             :     bGrfToGalleryAsLnk(sal_True),
    1208             :     bNumAlignSize(sal_True),
    1209             :     bSinglePrintJob(sal_False),
    1210             :     bIsNameFromColumn(sal_True),
    1211             :     bAskForMailMergeInPrint(sal_True),
    1212          37 :     nMailingFormats(0)
    1213             : {
    1214          37 :     Load();
    1215          37 : }
    1216             : 
    1217          18 : SwMiscConfig::~SwMiscConfig()
    1218             : {
    1219          18 : }
    1220             : 
    1221          38 : const Sequence<OUString>& SwMiscConfig::GetPropertyNames()
    1222             : {
    1223          38 :     static Sequence<OUString> aNames;
    1224          38 :     if(!aNames.getLength())
    1225             :     {
    1226          37 :         const int nCount = 12;
    1227          37 :         aNames.realloc(nCount);
    1228             :         static const char* aPropNames[] =
    1229             :         {
    1230             :             "Statistics/WordNumber/Delimiter",          // 0
    1231             :             "DefaultFont/Document",                     // 1
    1232             :             "Index/ShowPreview",                        // 2
    1233             :             "Misc/GraphicToGalleryAsLink",              // 3
    1234             :             "Numbering/Graphic/KeepRatio",              // 4
    1235             :             "FormLetter/PrintOutput/SinglePrintJobs",   // 5
    1236             :             "FormLetter/MailingOutput/Format",          // 6
    1237             :             "FormLetter/FileOutput/FileName/FromDatabaseField",  // 7
    1238             :             "FormLetter/FileOutput/Path",               // 8
    1239             :             "FormLetter/FileOutput/FileName/FromManualSetting",   // 9
    1240             :             "FormLetter/FileOutput/FileName/Generation",//10
    1241             :             "FormLetter/PrintOutput/AskForMerge"        //11
    1242             :         };
    1243          37 :         OUString* pNames = aNames.getArray();
    1244         481 :         for(int i = 0; i < nCount; i++)
    1245         444 :             pNames[i] = OUString::createFromAscii(aPropNames[i]);
    1246             :     }
    1247          38 :     return aNames;
    1248             : }
    1249             : 
    1250           0 : void SwMiscConfig::Notify( const ::com::sun::star::uno::Sequence< OUString >& ) {}
    1251             : 
    1252           1 : void SwMiscConfig::Commit()
    1253             : {
    1254           1 :     const Sequence<OUString>& aNames = GetPropertyNames();
    1255           1 :     Sequence<Any> aValues(aNames.getLength());
    1256           1 :     Any* pValues = aValues.getArray();
    1257             : 
    1258           1 :     const Type& rType = ::getBooleanCppuType();
    1259          13 :     for(int nProp = 0; nProp < aNames.getLength(); nProp++)
    1260             :     {
    1261          12 :         switch(nProp)
    1262             :         {
    1263             :             case 0 :
    1264           2 :                 pValues[nProp] <<=
    1265           1 :                     SwModuleOptions::ConvertWordDelimiter(sWordDelimiter, sal_False);
    1266           1 :             break;
    1267           1 :             case 1 : pValues[nProp].setValue(&bDefaultFontsInCurrDocOnly, rType); break;
    1268           1 :             case 2 : pValues[nProp].setValue(&bShowIndexPreview, rType) ;        break;
    1269           1 :             case 3 : pValues[nProp].setValue(&bGrfToGalleryAsLnk, rType);        break;
    1270           1 :             case 4 : pValues[nProp].setValue(&bNumAlignSize, rType);            break;
    1271           1 :             case 5 : pValues[nProp].setValue(&bSinglePrintJob, rType);          break;
    1272           1 :             case 6 : pValues[nProp] <<= nMailingFormats;             break;
    1273           1 :             case 7 : pValues[nProp] <<= sNameFromColumn;  break;
    1274           1 :             case 8 : pValues[nProp] <<= sMailingPath;     break;
    1275           1 :             case 9 : pValues[nProp] <<= sMailName;        break;
    1276           1 :             case 10: pValues[nProp].setValue(&bIsNameFromColumn, rType);break;
    1277           1 :             case 11: pValues[nProp] <<= bAskForMailMergeInPrint; break;
    1278             :         }
    1279             :     }
    1280           1 :     PutProperties(aNames, aValues);
    1281           1 : }
    1282             : 
    1283          37 : void SwMiscConfig::Load()
    1284             : {
    1285          37 :     const Sequence<OUString>& aNames = GetPropertyNames();
    1286          37 :     Sequence<Any> aValues = GetProperties(aNames);
    1287          37 :     const Any* pValues = aValues.getConstArray();
    1288             :     OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
    1289          37 :     if(aValues.getLength() == aNames.getLength())
    1290             :     {
    1291          37 :         OUString sTmp;
    1292         481 :         for(int nProp = 0; nProp < aNames.getLength(); nProp++)
    1293             :         {
    1294         444 :             if(pValues[nProp].hasValue())
    1295             :             {
    1296         296 :                 switch(nProp)
    1297             :                 {
    1298          37 :                     case 0 : pValues[nProp] >>= sTmp;
    1299          37 :                         sWordDelimiter = SwModuleOptions::ConvertWordDelimiter(sTmp, sal_True);
    1300          37 :                     break;
    1301          37 :                     case 1 : bDefaultFontsInCurrDocOnly = *(sal_Bool*)pValues[nProp].getValue(); break;
    1302          37 :                     case 2 : bShowIndexPreview = *(sal_Bool*)pValues[nProp].getValue(); break;
    1303          37 :                     case 3 : bGrfToGalleryAsLnk = *(sal_Bool*)pValues[nProp].getValue(); break;
    1304          37 :                     case 4 : bNumAlignSize = *(sal_Bool*)pValues[nProp].getValue(); break;
    1305          37 :                     case 5 : bSinglePrintJob = *(sal_Bool*)pValues[nProp].getValue(); break;
    1306           0 :                     case 6 : pValues[nProp] >>= nMailingFormats;              ; break;
    1307           0 :                     case 7 : pValues[nProp] >>= sTmp; sNameFromColumn = sTmp; break;
    1308          37 :                     case 8 : pValues[nProp] >>= sTmp; sMailingPath = sTmp;  break;
    1309           0 :                     case 9 : pValues[nProp] >>= sTmp; sMailName = sTmp;     break;
    1310           0 :                     case 10: bIsNameFromColumn = *(sal_Bool*)pValues[nProp].getValue(); break;
    1311          37 :                     case 11: pValues[nProp] >>= bAskForMailMergeInPrint; break;
    1312             :                 }
    1313             :             }
    1314          37 :         }
    1315          37 :     }
    1316          37 : }
    1317             : 
    1318          37 : const Sequence<OUString>& SwCompareConfig::GetPropertyNames()
    1319             : {
    1320          37 :     static Sequence<OUString> aNames;
    1321          37 :     if(!aNames.getLength())
    1322             :     {
    1323          37 :         const int nCount = 4;
    1324          37 :         aNames.realloc(nCount);
    1325             :         static const char* aPropNames[] =
    1326             :         {
    1327             :             "Mode",                                                   // 0
    1328             :             "UseRSID",                                                // 1
    1329             :             "IgnorePieces",                           // 2
    1330             :             "IgnoreLength"                                    // 3
    1331             :         };
    1332          37 :         OUString* pNames = aNames.getArray();
    1333         185 :         for(int i = 0; i < nCount; i++)
    1334         148 :             pNames[i] = OUString::createFromAscii(aPropNames[i]);
    1335             :     }
    1336          37 :     return aNames;
    1337             : }
    1338             : 
    1339          37 : SwCompareConfig::SwCompareConfig() :
    1340             :     ConfigItem("Office.Writer/Comparison",
    1341          37 :         CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE)
    1342             : {
    1343          37 :     eCmpMode = SVX_CMP_AUTO;
    1344          37 :     bUseRsid = 0;
    1345          37 :     bIgnorePieces = 0;
    1346          37 :     nPieceLen = 1;
    1347             : 
    1348          37 :     Load();
    1349          37 : }
    1350             : 
    1351          18 : SwCompareConfig::~SwCompareConfig()
    1352             : {
    1353          18 : }
    1354             : 
    1355           0 : void SwCompareConfig::Commit()
    1356             : {
    1357           0 :     const Sequence<OUString>& aNames = GetPropertyNames();
    1358           0 :     Sequence<Any> aValues(aNames.getLength());
    1359           0 :     Any* pValues = aValues.getArray();
    1360             : 
    1361           0 :    const Type& rType = ::getBooleanCppuType();
    1362             : 
    1363           0 :     pValues[0] <<= (sal_Int32) eCmpMode;
    1364           0 :     pValues[1].setValue(&bUseRsid, rType);
    1365           0 :     pValues[2].setValue(&bIgnorePieces, rType);
    1366           0 :     pValues[3] <<= (sal_Int32) nPieceLen;
    1367             : 
    1368           0 :     PutProperties(aNames, aValues);
    1369           0 : }
    1370             : 
    1371          37 : void SwCompareConfig::Load()
    1372             : {
    1373          37 :     const Sequence<OUString>& aNames = GetPropertyNames();
    1374          37 :     Sequence<Any> aValues = GetProperties(aNames);
    1375          37 :     const Any* pValues = aValues.getConstArray();
    1376             :     DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
    1377          37 :     if(aValues.getLength() == aNames.getLength())
    1378             :     {
    1379         185 :         for(int nProp = 0; nProp < aNames.getLength(); nProp++)
    1380             :         {
    1381         148 :             if(pValues[nProp].hasValue())
    1382             :             {
    1383           0 :                 sal_Int32 nVal = 0;
    1384           0 :                 pValues[nProp] >>= nVal;
    1385             : 
    1386           0 :                 switch(nProp)
    1387             :                 {
    1388           0 :                     case 0 : eCmpMode = (SvxCompareMode) nVal; break;;
    1389           0 :                     case 1 : bUseRsid = *(sal_Bool*)pValues[nProp].getValue(); break;
    1390           0 :                     case 2 : bIgnorePieces = *(sal_Bool*)pValues[nProp].getValue(); break;
    1391           0 :                     case 3 : nPieceLen = nVal; break;
    1392             :                 }
    1393             :             }
    1394             :         }
    1395          37 :     }
    1396          37 : }
    1397             : 
    1398             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10