LCOV - code coverage report
Current view: top level - sw/source/ui/frmdlg - cption.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 274 0.0 %
Date: 2014-11-03 Functions: 0 27 0.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 <view.hxx>
      21             : #include <wrtsh.hxx>
      22             : #include <cption.hxx>
      23             : #include <fldmgr.hxx>
      24             : #include <expfld.hxx>
      25             : #include <numrule.hxx>
      26             : #include <poolfmt.hxx>
      27             : #include <docsh.hxx>
      28             : #include <frmfmt.hxx>
      29             : #include <calc.hxx>
      30             : #include <uitool.hxx>
      31             : #include <doc.hxx>
      32             : #include <modcfg.hxx>
      33             : #include <swmodule.hxx>
      34             : #include <com/sun/star/frame/XStorable.hpp>
      35             : #include <com/sun/star/text/GraphicCrop.hpp>
      36             : #include <com/sun/star/text/XTextGraphicObjectsSupplier.hpp>
      37             : #include <com/sun/star/text/XTextTableCursor.hpp>
      38             : #include <com/sun/star/text/XTextTablesSupplier.hpp>
      39             : #include <com/sun/star/text/TableColumnSeparator.hpp>
      40             : #include <com/sun/star/text/XTextTable.hpp>
      41             : #include <com/sun/star/text/XTextEmbeddedObjectsSupplier.hpp>
      42             : #include <com/sun/star/text/XTextFramesSupplier.hpp>
      43             : #include <com/sun/star/text/XTextFrame.hpp>
      44             : #include <comphelper/string.hxx>
      45             : #include "initui.hxx"
      46             : #include <frmui.hrc>
      47             : #include <globals.hrc>
      48             : #include <SwStyleNameMapper.hxx>
      49             : 
      50             : using namespace ::com::sun::star;
      51             : 
      52             : class SwSequenceOptionDialog : public SvxStandardDialog
      53             : {
      54             :     ListBox*        m_pLbLevel;
      55             :     Edit*           m_pEdDelim;
      56             : 
      57             :     ListBox*        m_pLbCharStyle;
      58             :     CheckBox*       m_pApplyBorderAndShadowCB;
      59             : 
      60             :     //#i61007# order of captions
      61             :     ListBox*        m_pLbCaptionOrder;
      62             : 
      63             :     SwView&         rView;
      64             :     OUString        aFldTypeName;
      65             : 
      66             : public:
      67             :     SwSequenceOptionDialog( vcl::Window *pParent, SwView &rV,
      68             :                             const OUString& rSeqFldType );
      69             :     virtual ~SwSequenceOptionDialog();
      70             :     virtual void Apply() SAL_OVERRIDE;
      71             : 
      72           0 :     bool IsApplyBorderAndShadow( void ) { return m_pApplyBorderAndShadowCB->IsChecked(); }
      73           0 :     void SetApplyBorderAndShadow( bool bSet )  { m_pApplyBorderAndShadowCB->Check(bSet); }
      74             : 
      75             :     //#i61007# order of captions
      76           0 :     bool IsOrderNumberingFirst() const {return m_pLbCaptionOrder->GetSelectEntryPos() == 1;}
      77           0 :     void SetOrderNumberingFirst(bool bSet) { m_pLbCaptionOrder->SelectEntryPos( bSet ? 1 : 0 ); }
      78             : 
      79             :     void      SetCharacterStyle(const OUString& rStyle);
      80             :     OUString  GetCharacterStyle() const;
      81             : };
      82             : 
      83           0 : OUString SwCaptionDialog::our_aSepTextSave(": "); // Caption separator text
      84             : 
      85             : //Resolves: fdo#47427 disallow typing *or* pasting content into the category box
      86           0 : OUString TextFilterAutoConvert::filter(const OUString &rText)
      87             : {
      88           0 :     if (!SwCalc::IsValidVarName(rText))
      89           0 :         return m_sLastGoodText;
      90           0 :     m_sLastGoodText = rText;
      91           0 :     return rText;
      92             : }
      93             : 
      94           0 : SwCaptionDialog::SwCaptionDialog( vcl::Window *pParent, SwView &rV ) :
      95             :     SvxStandardDialog( pParent, "InsertCaptionDialog", "modules/swriter/ui/insertcaption.ui" ),
      96             :     m_sNone( SW_RESSTR(SW_STR_NONE) ),
      97             :     rView( rV ),
      98           0 :     pMgr( new SwFldMgr(rView.GetWrtShellPtr()) ),
      99             :     bCopyAttributes( false ),
     100           0 :     bOrderNumberingFirst( SW_MOD()->GetModuleConfig()->IsCaptionOrderNumberingFirst() )
     101             : {
     102           0 :     get(m_pTextEdit, "caption_edit");
     103           0 :     get(m_pCategoryBox, "category");
     104           0 :     m_pCategoryBox->SetTextFilter(&m_aTextFilter);
     105           0 :     get(m_pFormatText, "numbering_label");
     106           0 :     get(m_pFormatBox, "numbering");
     107           0 :     get(m_pNumberingSeparatorFT, "num_separator");
     108           0 :     get(m_pNumberingSeparatorED, "num_separator_edit");
     109           0 :     get(m_pSepText, "separator_label");
     110           0 :     get(m_pSepEdit, "separator_edit");
     111           0 :     get(m_pPosText, "position_label");
     112           0 :     get(m_pPosBox, "position");
     113           0 :     get(m_pPreview, "preview");
     114           0 :     get(m_pOKButton, "ok");
     115           0 :     get(m_pAutoCaptionButton, "auto");
     116           0 :     get(m_pOptionButton, "options");
     117             : 
     118             :     //#i61007# order of captions
     119           0 :     ApplyCaptionOrder();
     120           0 :     SwWrtShell &rSh = rView.GetWrtShell();
     121           0 :      uno::Reference< frame::XModel >  xModel = rView.GetDocShell()->GetBaseModel();
     122             : 
     123           0 :     eType = rSh.GetSelectionType();
     124           0 :     if ( eType & nsSelectionType::SEL_OLE )
     125             :     {
     126           0 :         eType = nsSelectionType::SEL_GRF;
     127           0 :          uno::Reference< text::XTextEmbeddedObjectsSupplier >  xObjs(xModel, uno::UNO_QUERY);
     128           0 :         xNameAccess = xObjs->getEmbeddedObjects();
     129             :     }
     130             : 
     131           0 :     Link aLk = LINK( this, SwCaptionDialog, ModifyHdl );
     132           0 :     m_pCategoryBox->SetModifyHdl( aLk );
     133           0 :     m_pTextEdit->SetModifyHdl( aLk );
     134           0 :     m_pNumberingSeparatorED->SetModifyHdl ( aLk );
     135           0 :     m_pSepEdit->SetModifyHdl( aLk );
     136             : 
     137           0 :     aLk = LINK(this, SwCaptionDialog, SelectHdl);
     138           0 :     m_pCategoryBox->SetSelectHdl( aLk );
     139           0 :     m_pFormatBox->SetSelectHdl( aLk );
     140           0 :     m_pOptionButton->SetClickHdl( LINK( this, SwCaptionDialog, OptionHdl ) );
     141           0 :     m_pAutoCaptionButton->SetClickHdl(LINK(this, SwCaptionDialog, CaptionHdl));
     142             : 
     143           0 :     m_pCategoryBox->InsertEntry( m_sNone );
     144           0 :     sal_uInt16 nCount = pMgr->GetFldTypeCount();
     145           0 :     for (sal_uInt16 i = 0; i < nCount; i++)
     146             :     {
     147           0 :         SwFieldType *pType = pMgr->GetFldType( USHRT_MAX, i );
     148           0 :         if( pType->Which() == RES_SETEXPFLD &&
     149           0 :             ((SwSetExpFieldType *) pType)->GetType() & nsSwGetSetExpType::GSE_SEQ )
     150           0 :             m_pCategoryBox->InsertEntry(pType->GetName());
     151             :     }
     152             : 
     153           0 :     OUString sString;
     154           0 :     sal_uInt16 nPoolId = 0;
     155           0 :     if (eType & nsSelectionType::SEL_GRF)
     156             :     {
     157           0 :         nPoolId = RES_POOLCOLL_LABEL_ABB;
     158           0 :         sString = ::GetOldGrfCat();
     159           0 :         bCopyAttributes = true;
     160           0 :         sObjectName = rSh.GetFlyName();
     161             :         //if not OLE
     162           0 :         if(!xNameAccess.is())
     163             :         {
     164           0 :          uno::Reference< text::XTextGraphicObjectsSupplier >  xGraphics(xModel, uno::UNO_QUERY);
     165           0 :             xNameAccess = xGraphics->getGraphicObjects();
     166             :         }
     167             : 
     168             :     }
     169           0 :     else if( eType & nsSelectionType::SEL_TBL )
     170             :     {
     171           0 :         nPoolId = RES_POOLCOLL_LABEL_TABLE;
     172           0 :         sString = ::GetOldTabCat();
     173           0 :         uno::Reference< text::XTextTablesSupplier >  xTables(xModel, uno::UNO_QUERY);
     174           0 :         xNameAccess = xTables->getTextTables();
     175           0 :         sObjectName = rSh.GetTableFmt()->GetName();
     176             :     }
     177           0 :     else if( eType & nsSelectionType::SEL_FRM )
     178             :     {
     179           0 :         nPoolId = RES_POOLCOLL_LABEL_FRAME;
     180           0 :         sString = ::GetOldFrmCat();
     181           0 :          uno::Reference< text::XTextFramesSupplier >  xFrms(xModel, uno::UNO_QUERY);
     182           0 :         xNameAccess = xFrms->getTextFrames();
     183           0 :         sObjectName = rSh.GetFlyName();
     184             :     }
     185           0 :     else if( eType == nsSelectionType::SEL_TXT )
     186             :     {
     187           0 :         nPoolId = RES_POOLCOLL_LABEL_FRAME;
     188           0 :         sString = ::GetOldFrmCat();
     189             :     }
     190           0 :     else if( eType & nsSelectionType::SEL_DRW )
     191             :     {
     192           0 :         nPoolId = RES_POOLCOLL_LABEL_DRAWING;
     193           0 :         sString = ::GetOldDrwCat();
     194             :     }
     195           0 :     if( nPoolId )
     196             :     {
     197           0 :         if (!sString.isEmpty())
     198           0 :             m_pCategoryBox->SetText( sString );
     199             :         else
     200             :             m_pCategoryBox->SetText(
     201           0 :                     SwStyleNameMapper::GetUIName( nPoolId, OUString() ));
     202             :     }
     203             : 
     204             :     // aFormatBox
     205           0 :     sal_uInt16 nSelFmt = SVX_NUM_ARABIC;
     206           0 :     nCount = pMgr->GetFldTypeCount();
     207             :     SwFieldType* pFldType;
     208           0 :     for ( sal_uInt16 i = nCount; i; )
     209             :     {
     210           0 :         pFldType = pMgr->GetFldType(USHRT_MAX, --i);
     211           0 :         if( pFldType->GetName().equals(m_pCategoryBox->GetText()) )
     212             :         {
     213           0 :             nSelFmt = (sal_uInt16)((SwSetExpFieldType*)pFldType)->GetSeqFormat();
     214           0 :             break;
     215             :         }
     216             :     }
     217             : 
     218           0 :     nCount = pMgr->GetFormatCount(TYP_SEQFLD, false);
     219           0 :     for ( sal_uInt16 i = 0; i < nCount; ++i )
     220             :     {
     221           0 :         m_pFormatBox->InsertEntry( pMgr->GetFormatStr(TYP_SEQFLD, i) );
     222           0 :         const sal_uInt16 nFmtId = pMgr->GetFormatId(TYP_SEQFLD, i);
     223           0 :         m_pFormatBox->SetEntryData( i, reinterpret_cast<void*>( nFmtId ) );
     224           0 :         if( nFmtId == nSelFmt )
     225           0 :             m_pFormatBox->SelectEntryPos( i );
     226             :     }
     227             : 
     228             :     // aPosBox
     229           0 :     switch (eType)
     230             :     {
     231             :         case nsSelectionType::SEL_GRF:
     232             :         case nsSelectionType::SEL_TBL:
     233             :         case nsSelectionType::SEL_TBL | nsSelectionType::SEL_NUM:
     234             :         case nsSelectionType::SEL_TBL | nsSelectionType::SEL_TXT:
     235             :         case nsSelectionType::SEL_TBL | nsSelectionType::SEL_NUM | nsSelectionType::SEL_TXT:
     236             :         case nsSelectionType::SEL_DRW:
     237             :         case nsSelectionType::SEL_DRW | nsSelectionType::SEL_BEZ:
     238           0 :             m_pPosBox->InsertEntry(SW_RESSTR(STR_CAPTION_ABOVE));
     239           0 :             m_pPosBox->InsertEntry(SW_RESSTR(STR_CAPTION_BELOW));
     240           0 :             break;
     241             :         case nsSelectionType::SEL_FRM:
     242             :         case nsSelectionType::SEL_TXT:
     243           0 :             m_pPosBox->InsertEntry(SW_RESSTR(STR_CAPTION_BEGINNING));
     244           0 :             m_pPosBox->InsertEntry(SW_RESSTR(STR_CAPTION_END     ));
     245           0 :             break;
     246             :     }
     247           0 :     m_pPosBox->SelectEntryPos(1);
     248             : 
     249           0 :     m_pCategoryBox->GetModifyHdl().Call(m_pCategoryBox);
     250             : 
     251           0 :     m_pSepEdit->SetText(our_aSepTextSave);
     252           0 :     m_pTextEdit->GrabFocus();
     253           0 :     DrawSample();
     254           0 : }
     255             : 
     256           0 : void SwCaptionDialog::Apply()
     257             : {
     258           0 :     InsCaptionOpt aOpt;
     259           0 :     aOpt.UseCaption() = true;
     260           0 :     OUString aName( m_pCategoryBox->GetText() );
     261           0 :     if ( aName == m_sNone )
     262             :     {
     263           0 :         aOpt.SetCategory( OUString() );
     264           0 :         aOpt.SetNumSeparator( OUString() );
     265             :     }
     266             :     else
     267             :     {
     268           0 :         aOpt.SetCategory(comphelper::string::strip(aName, ' '));
     269           0 :         aOpt.SetNumSeparator( m_pNumberingSeparatorED->GetText() );
     270             :     }
     271           0 :     aOpt.SetNumType( (sal_uInt16)(sal_uIntPtr)m_pFormatBox->GetEntryData( m_pFormatBox->GetSelectEntryPos() ) );
     272           0 :     aOpt.SetSeparator( m_pSepEdit->IsEnabled() ? m_pSepEdit->GetText() : OUString() );
     273           0 :     aOpt.SetCaption( m_pTextEdit->GetText() );
     274           0 :     aOpt.SetPos( m_pPosBox->GetSelectEntryPos() );
     275           0 :     aOpt.IgnoreSeqOpts() = true;
     276           0 :     aOpt.CopyAttributes() = bCopyAttributes;
     277           0 :     aOpt.SetCharacterStyle( sCharacterStyle );
     278           0 :     rView.InsertCaption( &aOpt );
     279           0 :     our_aSepTextSave = m_pSepEdit->GetText();
     280           0 : }
     281             : 
     282           0 : IMPL_LINK_INLINE_START( SwCaptionDialog, OptionHdl, Button*, pButton )
     283             : {
     284           0 :     OUString sFldTypeName = m_pCategoryBox->GetText();
     285           0 :     if(sFldTypeName == m_sNone)
     286           0 :         sFldTypeName = OUString();
     287           0 :     SwSequenceOptionDialog  aDlg( pButton, rView, sFldTypeName );
     288           0 :     aDlg.SetApplyBorderAndShadow(bCopyAttributes);
     289           0 :     aDlg.SetCharacterStyle( sCharacterStyle );
     290           0 :     aDlg.SetOrderNumberingFirst( bOrderNumberingFirst );
     291           0 :     aDlg.Execute();
     292           0 :     bCopyAttributes = aDlg.IsApplyBorderAndShadow();
     293           0 :     sCharacterStyle = aDlg.GetCharacterStyle();
     294             :     //#i61007# order of captions
     295           0 :     if( bOrderNumberingFirst != aDlg.IsOrderNumberingFirst() )
     296             :     {
     297           0 :         bOrderNumberingFirst = aDlg.IsOrderNumberingFirst();
     298           0 :         SW_MOD()->GetModuleConfig()->SetCaptionOrderNumberingFirst(bOrderNumberingFirst);
     299           0 :         ApplyCaptionOrder();
     300             :     }
     301           0 :     DrawSample();
     302           0 :     return 0;
     303             : }
     304           0 : IMPL_LINK_INLINE_END( SwCaptionDialog, OptionHdl, Button*, pButton )
     305             : 
     306           0 : IMPL_LINK_NOARG_INLINE_START(SwCaptionDialog, SelectHdl)
     307             : {
     308           0 :     DrawSample();
     309           0 :     return 0;
     310             : }
     311           0 : IMPL_LINK_NOARG_INLINE_END(SwCaptionDialog, SelectHdl)
     312             : 
     313           0 : IMPL_LINK_NOARG(SwCaptionDialog, ModifyHdl)
     314             : {
     315           0 :     SwWrtShell &rSh = rView.GetWrtShell();
     316           0 :     OUString sFldTypeName = m_pCategoryBox->GetText();
     317           0 :     bool bCorrectFldName = !sFldTypeName.isEmpty();
     318           0 :     bool bNone = sFldTypeName == m_sNone;
     319           0 :     SwFieldType* pType = (bCorrectFldName && !bNone)
     320           0 :                     ? rSh.GetFldType( RES_SETEXPFLD, sFldTypeName )
     321           0 :                     : 0;
     322           0 :     m_pOKButton->Enable( bCorrectFldName &&
     323           0 :                         (!pType ||
     324           0 :                             ((SwSetExpFieldType*)pType)->GetType() == nsSwGetSetExpType::GSE_SEQ) );
     325           0 :     m_pOptionButton->Enable( m_pOKButton->IsEnabled() && !bNone );
     326           0 :     m_pNumberingSeparatorFT->Enable( bOrderNumberingFirst && !bNone );
     327           0 :     m_pNumberingSeparatorED->Enable( bOrderNumberingFirst && !bNone );
     328           0 :     m_pFormatText->Enable( !bNone );
     329           0 :     m_pFormatBox->Enable( !bNone );
     330           0 :     m_pSepText->Enable( !bNone );
     331           0 :     m_pSepEdit->Enable( !bNone );
     332           0 :     DrawSample();
     333           0 :     return 0;
     334             : }
     335             : 
     336           0 : IMPL_LINK_NOARG(SwCaptionDialog, CaptionHdl)
     337             : {
     338           0 :     SfxItemSet  aSet( rView.GetDocShell()->GetDoc()->GetAttrPool() );
     339           0 :     SwCaptionOptDlg aDlg( this, aSet );
     340           0 :     aDlg.Execute();
     341             : 
     342           0 :     return 0;
     343             : }
     344             : 
     345           0 : void SwCaptionDialog::DrawSample()
     346             : {
     347           0 :     OUString aStr;
     348           0 :     OUString sCaption = m_pTextEdit->GetText();
     349             : 
     350             :     // number
     351           0 :     OUString sFldTypeName = m_pCategoryBox->GetText();
     352           0 :     bool bNone = sFldTypeName == m_sNone;
     353           0 :     if( !bNone )
     354             :     {
     355             :         const sal_uInt16 nNumFmt = (sal_uInt16)(sal_uIntPtr)m_pFormatBox->GetEntryData(
     356           0 :                                         m_pFormatBox->GetSelectEntryPos() );
     357           0 :         if( SVX_NUM_NUMBER_NONE != nNumFmt )
     358             :         {
     359             :             // category
     360             :             //#i61007# order of captions
     361           0 :             if( !bOrderNumberingFirst )
     362             :             {
     363           0 :                 aStr = sFldTypeName;
     364           0 :                 if ( !aStr.isEmpty() )
     365           0 :                     aStr += " ";
     366             :             }
     367             : 
     368           0 :             SwWrtShell &rSh = rView.GetWrtShell();
     369             :             SwSetExpFieldType* pFldType = (SwSetExpFieldType*)rSh.GetFldType(
     370           0 :                                             RES_SETEXPFLD, sFldTypeName );
     371           0 :             if( pFldType && pFldType->GetOutlineLvl() < MAXLEVEL )
     372             :             {
     373           0 :                 sal_Int8 nLvl = pFldType->GetOutlineLvl();
     374           0 :                 SwNumberTree::tNumberVector aNumVector;
     375           0 :                 for( sal_Int8 i = 0; i <= nLvl; ++i )
     376           0 :                     aNumVector.push_back(1);
     377             : 
     378             :                 OUString sNumber( rSh.GetOutlineNumRule()->
     379           0 :                                 MakeNumString(aNumVector, false ));
     380           0 :                 if( !sNumber.isEmpty() )
     381           0 :                     aStr += sNumber + pFldType->GetDelimiter();
     382             :             }
     383             : 
     384           0 :             switch( nNumFmt )
     385             :             {
     386           0 :             case SVX_NUM_CHARS_UPPER_LETTER:    aStr += "A"; break;
     387           0 :             case SVX_NUM_CHARS_UPPER_LETTER_N:  aStr += "A"; break;
     388           0 :             case SVX_NUM_CHARS_LOWER_LETTER:    aStr += "a"; break;
     389           0 :             case SVX_NUM_CHARS_LOWER_LETTER_N:  aStr += "a"; break;
     390           0 :             case SVX_NUM_ROMAN_UPPER:           aStr += "I"; break;
     391           0 :             case SVX_NUM_ROMAN_LOWER:           aStr += "i"; break;
     392           0 :             default:                    aStr += "1"; break;
     393             :             }
     394             :             //#i61007# order of captions
     395           0 :             if( bOrderNumberingFirst )
     396             :             {
     397           0 :                 aStr += m_pNumberingSeparatorED->GetText() + sFldTypeName;
     398             :             }
     399             : 
     400             :         }
     401           0 :         if( !sCaption.isEmpty() )
     402             :         {
     403           0 :             aStr += m_pSepEdit->GetText();
     404             :         }
     405             :     }
     406           0 :     aStr += sCaption;
     407             :     // do preview!
     408           0 :     m_pPreview->SetPreviewText( aStr );
     409           0 : }
     410             : 
     411           0 : SwCaptionDialog::~SwCaptionDialog()
     412             : {
     413           0 :     delete pMgr;
     414           0 : }
     415             : 
     416           0 : SwSequenceOptionDialog::SwSequenceOptionDialog( vcl::Window *pParent, SwView &rV,
     417             :                                             const OUString& rSeqFldType )
     418             :     : SvxStandardDialog( pParent, "CaptionOptionsDialog", "modules/swriter/ui/captionoptions.ui" ),
     419             :     rView( rV ),
     420           0 :     aFldTypeName( rSeqFldType )
     421             : {
     422           0 :     get(m_pLbLevel, "level");
     423           0 :     get(m_pEdDelim, "separator");
     424           0 :     get(m_pLbCharStyle, "style");
     425           0 :     get(m_pApplyBorderAndShadowCB, "border_and_shadow");
     426           0 :     get(m_pLbCaptionOrder, "caption_order");
     427             : 
     428           0 :     SwWrtShell &rSh = rView.GetWrtShell();
     429             : 
     430           0 :     const OUString sNone(SW_RESSTR(SW_STR_NONE));
     431             : 
     432           0 :     m_pLbLevel->InsertEntry(sNone);
     433           0 :     for( sal_uInt16 n = 0; n < MAXLEVEL; ++n )
     434           0 :         m_pLbLevel->InsertEntry( OUString::number(n+1) );
     435             : 
     436             :     SwSetExpFieldType* pFldType = (SwSetExpFieldType*)rSh.GetFldType(
     437           0 :                                         RES_SETEXPFLD, aFldTypeName );
     438             : 
     439           0 :     sal_Unicode nLvl = MAXLEVEL;
     440           0 :     OUString sDelim(": ");
     441           0 :     if( pFldType )
     442             :     {
     443           0 :         sDelim = pFldType->GetDelimiter();
     444           0 :         nLvl = pFldType->GetOutlineLvl();
     445             :     }
     446             : 
     447           0 :     m_pLbLevel->SelectEntryPos( nLvl < MAXLEVEL ? nLvl + 1 : 0 );
     448           0 :     m_pEdDelim->SetText(sDelim);
     449             : 
     450           0 :     m_pLbCharStyle->InsertEntry(sNone);
     451           0 :     ::FillCharStyleListBox( *m_pLbCharStyle, rView.GetDocShell(), true, true );
     452           0 :     m_pLbCharStyle->SelectEntryPos( 0 );
     453           0 : }
     454             : 
     455           0 : SwSequenceOptionDialog::~SwSequenceOptionDialog()
     456             : {
     457           0 : }
     458             : 
     459           0 : void SwSequenceOptionDialog::Apply()
     460             : {
     461           0 :     SwWrtShell &rSh = rView.GetWrtShell();
     462             :     SwSetExpFieldType* pFldType = (SwSetExpFieldType*)rSh.GetFldType(
     463           0 :                                         RES_SETEXPFLD, aFldTypeName );
     464             : 
     465           0 :     sal_Int8 nLvl = (sal_Int8)( m_pLbLevel->GetSelectEntryPos() - 1);
     466           0 :     sal_Unicode cDelim = m_pEdDelim->GetText()[0];
     467             : 
     468           0 :     bool bUpdate = true;
     469           0 :     if( pFldType )
     470             :     {
     471           0 :         pFldType->SetDelimiter( OUString(cDelim) );
     472           0 :         pFldType->SetOutlineLvl( nLvl );
     473             :     }
     474           0 :     else if( !aFldTypeName.isEmpty() && nLvl < MAXLEVEL )
     475             :     {
     476             :         // then we have to insert that
     477           0 :         SwSetExpFieldType aFldType( rSh.GetDoc(), aFldTypeName, nsSwGetSetExpType::GSE_SEQ );
     478           0 :         aFldType.SetDelimiter( OUString(cDelim) );
     479           0 :         aFldType.SetOutlineLvl( nLvl );
     480           0 :         rSh.InsertFldType( aFldType );
     481             :     }
     482             :     else
     483           0 :         bUpdate = false;
     484             : 
     485           0 :     if( bUpdate )
     486           0 :         rSh.UpdateExpFlds();
     487           0 : }
     488             : 
     489           0 : OUString  SwSequenceOptionDialog::GetCharacterStyle() const
     490             : {
     491           0 :     if(m_pLbCharStyle->GetSelectEntryPos())
     492           0 :         return m_pLbCharStyle->GetSelectEntry();
     493           0 :     return OUString();
     494             : }
     495             : 
     496           0 : void    SwSequenceOptionDialog::SetCharacterStyle(const OUString& rStyle)
     497             : {
     498           0 :     m_pLbCharStyle->SelectEntryPos(0);
     499           0 :     m_pLbCharStyle->SelectEntry(rStyle);
     500           0 : }
     501             : 
     502             : // #i61007# order of captions
     503           0 : void SwCaptionDialog::ApplyCaptionOrder()
     504             : {
     505           0 :     m_pNumberingSeparatorFT->Enable(bOrderNumberingFirst);
     506           0 :     m_pNumberingSeparatorED->Enable(bOrderNumberingFirst);
     507           0 : }
     508             : 
     509             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10