LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sw/source/ui/config - modcfg.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 368 579 63.6 %
Date: 2013-07-09 Functions: 29 46 63.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10