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

Generated by: LCOV version 1.10